DELETED IDE/components/Button.ico
Index: IDE/components/Button.ico
==================================================================
--- IDE/components/Button.ico
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/components/Button.vcl
Index: IDE/components/Button.vcl
==================================================================
--- IDE/components/Button.vcl
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/components/ButtonEdit.vcl
Index: IDE/components/ButtonEdit.vcl
==================================================================
--- IDE/components/ButtonEdit.vcl
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/components/COMCTL32.vcl
Index: IDE/components/COMCTL32.vcl
==================================================================
--- IDE/components/COMCTL32.vcl
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/components/Checkbox.ico
Index: IDE/components/Checkbox.ico
==================================================================
--- IDE/components/Checkbox.ico
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/components/Combobox.ico
Index: IDE/components/Combobox.ico
==================================================================
--- IDE/components/Combobox.ico
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/components/EDIT.VCL
Index: IDE/components/EDIT.VCL
==================================================================
--- IDE/components/EDIT.VCL
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/components/Edit.ico
Index: IDE/components/Edit.ico
==================================================================
--- IDE/components/Edit.ico
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/components/FORM.ICO
Index: IDE/components/FORM.ICO
==================================================================
--- IDE/components/FORM.ICO
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/components/Form.vcl
Index: IDE/components/Form.vcl
==================================================================
--- IDE/components/Form.vcl
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/components/Groupbox.ico
Index: IDE/components/Groupbox.ico
==================================================================
--- IDE/components/Groupbox.ico
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/components/IMAGE.ICO
Index: IDE/components/IMAGE.ICO
==================================================================
--- IDE/components/IMAGE.ICO
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/components/LABEL.ICO
Index: IDE/components/LABEL.ICO
==================================================================
--- IDE/components/LABEL.ICO
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/components/LISTBOX.ICO
Index: IDE/components/LISTBOX.ICO
==================================================================
--- IDE/components/LISTBOX.ICO
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/components/LISTBOX.VCL
Index: IDE/components/LISTBOX.VCL
==================================================================
--- IDE/components/LISTBOX.VCL
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/components/LISTVIEW.ICO
Index: IDE/components/LISTVIEW.ICO
==================================================================
--- IDE/components/LISTVIEW.ICO
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/components/RADIOBTN.ICO
Index: IDE/components/RADIOBTN.ICO
==================================================================
--- IDE/components/RADIOBTN.ICO
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/components/SHAPE.ICO
Index: IDE/components/SHAPE.ICO
==================================================================
--- IDE/components/SHAPE.ICO
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/components/SIZEBOX.ICO
Index: IDE/components/SIZEBOX.ICO
==================================================================
--- IDE/components/SIZEBOX.ICO
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/components/SLIDER.ICO
Index: IDE/components/SLIDER.ICO
==================================================================
--- IDE/components/SLIDER.ICO
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/components/SOURCE/ADD.BAT
Index: IDE/components/SOURCE/ADD.BAT
==================================================================
--- IDE/components/SOURCE/ADD.BAT
+++ /dev/null
@@ -1,2 +0,0 @@
-copy *.bin ..\*.vcl
-del *.bin
DELETED IDE/components/SOURCE/BUTTON.ASM
Index: IDE/components/SOURCE/BUTTON.ASM
==================================================================
--- IDE/components/SOURCE/BUTTON.ASM
+++ /dev/null
@@ -1,136 +0,0 @@
-; This file contains design-time information for Button controls.
-;
-; One file may contains description of more than one control.
-; Look at 'DesignTimeInfo' macro definition.
-;
-; This file must be compiled with FASM compiler to get binary
-; file. It will be compiled as .COM file. This is not executable
-; file. Don't start it.
-
-include '..\..\..\source\designtime.inc'
-include 'winconst.inc'
-
-
-DesignTimeInfo \
- \ ; 1. BUTTON CONTROL
- 'BUTTON', \
- 'Button control', \
- 'Standard', \
- 'Button', \
- WS_VISIBLE or BS_PUSHBUTTON or WS_CHILD, \ ; default style
- 0, \ ; default ex style
- 64, 25, \
- < \ ; style names
- BS_ICON, "Specifies that the button displays an icon", \
- BS_BITMAP, "Specifies that the button displays a bitmap", \
- BS_LEFT, "Places text on the left of the button", \
- BS_RIGHT, "Places text on the right of the button", \
- BS_CENTER, "Places text in the center (horizontally) of the button", \
- BS_TOP, "Places text on the top of the button", \
- BS_BOTTOM, "Places text on the bottom of the button", \
- BS_VCENTER, "Places text in the center (vertically) of the button", \
- BS_MULTILINE, "Allows wrapping of the button's text if necesary", \
- BS_NOTIFY, "Enables button to send addictional notification messages", \
- BS_FLAT, "Creates flat button" \
- >, \
- NONE, \ ; style Ex names
-\
- $00000000, \ ; This is StyleMaskAnd
- WS_CHILD, \ ; This is StyleMaskOr
- $00000000, \ ; This is StyleExMaskAnd
- $00000000, \ ; This is StyleExMaskOr
- $0000000f, \ ; This is SubtypeMask
- < \
- BS_PUSHBUTTON, 'Normal push button', \
- BS_DEFPUSHBUTTON, 'Default push button' \
- >, \ ; This is SubtipeRange
- NONE, \ ; Library file NULL, because it's standard component.
- 'Button.ico', \ ; Image for icon
-\
-\ ; Checkbox control.
-\
- 'BUTTON', \
- 'Checkbox control', \
- 'Standard', \
- 'Checkbox', \
- WS_VISIBLE or BS_CHECKBOX or WS_CHILD, \ ; default style
- $0, \ ; default ex style
- 80, 21, \
- < \ ; style names
- BS_LEFTTEXT, "Places text on the left of the checkbox", \
- BS_PUSHLIKE, "Makes checkbox act like the push button", \
- BS_MULTILINE, "Allows wrapping of the checkbox's text if necesary", \
- BS_NOTIFY, "Enables checkbox to send addictional notification messages", \
- BS_FLAT, "Creates flat checkbox" \
- >, \
- NONE, \ ; style Ex names
-\
- $00000000, \ ; This is StyleMaskAnd
- WS_CHILD, \ ; This is StyleMaskOr
- $00000000, \ ; This is StyleExMaskAnd
- $00000000, \ ; This is StyleExMaskOr
- $0000000f, \ ; This is SubtypeMask
- < \
- BS_CHECKBOX, 'User controled checkbox', \
- BS_AUTOCHECKBOX, 'Auto checked checkbox', \
- BS_3STATE, '3-state checked checkbox', \
- BS_AUTO3STATE, 'Auto 3-state checkbox' \
- >, \ ; This is SubtypeRange
- NONE, \ ; Library file NULL, because it's standard component.
- 'CheckBox.ico', \ ; Image for the icon.
-\
-\ ; Radiobutton control.
-\
- 'BUTTON', \
- 'Radiobutton control', \
- 'Standard', \
- 'Radiobutton', \
- WS_VISIBLE or BS_RADIOBUTTON or WS_CHILD, \ ; default style
- $0, \ ; default ex style
- 80, 21, \
- < \ ; style names
- BS_LEFTTEXT, "Places text on the left of the radiobutton", \
- BS_PUSHLIKE, "Makes radiobutton act like the push button", \
- BS_MULTILINE, "Allows wrapping of the radiobutton's text if necesary", \
- BS_NOTIFY, "Enables radiobutton to send addictional notification messages", \
- BS_FLAT, "Crates flat radiobutton" \
- >, \
- NONE, \ ; style Ex names
-\
- $00000000, \ ; This is StyleMaskAnd
- WS_CHILD, \ ; This is StyleMaskOr
- $00000000, \ ; This is StyleExMaskAnd
- $00000000, \ ; This is StyleExMaskOr
- $0000000f, \ ; This is SubtypeMask
- < \
- BS_RADIOBUTTON, 'Standard Radiobutton', \
- BS_AUTORADIOBUTTON, 'Auto Radiobutton' \
- >, \ ; This is SubtypeRange
- NONE, \ ; Library file NULL, because it's standard component.
- 'radiobtn.ico', \ ; Image for the icon.
-\
-\ ; Groupbox control.
-\
- 'BUTTON', \
- 'Group box control', \
- 'Standard', \
- 'Group box', \
- BS_MULTILINE or WS_VISIBLE or BS_GROUPBOX or WS_CLIPSIBLINGS or WS_CHILD, \ ; default style
- $00010020, \ ; default ex style
- 128, 128, \
- < \ ; style names
- BS_LEFT, "Places text on the left of the box'es frame", \
- BS_RIGHT, "Places text on the right of the box'es frame", \
- BS_CENTER, "Places text in the center (horizontally) of the button", \
- BS_FLAT, "Creates flat groupbox" \
- >, \
- NONE, \ ; style Ex names
-\
- $00000000, \ ; This is StyleMaskAnd
- WS_CHILD, \ ; This is StyleMaskOr
- $00000000, \ ; This is StyleExMaskAnd
- $00010000, \ ; This is StyleExMaskOr
- $0000000f, \ ; This is SubtypeMask
- , \ ; This is SubtypeRange
- NONE, \ ; Library file NONE, because it's standard component.
- 'GroupBox.ico' ; Image for the icon.
DELETED IDE/components/SOURCE/ButtonEdit.asm
Index: IDE/components/SOURCE/ButtonEdit.asm
==================================================================
--- IDE/components/SOURCE/ButtonEdit.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-include '%finc%/win32/win32a.inc'
-include '..\..\..\source\designtime.inc'
-;include 'winconst.inc'
-;include '..\..\..\source\AsmEdit\AsmEdit.inc'
-
-DesignTimeInfo \
- \ ; 1. TButtonEdit control
- 'TButtonEdit', \
- 'Edit control with button inside', \
- 'Fresh', \
- 'Edit', \
- WS_VISIBLE or WS_CHILD or ES_LEFT or ES_AUTOHSCROLL, \ ; default style
- WS_EX_CLIENTEDGE, \ ; default ex style
- 121, 21, \
- < \ ; style names
- ES_LEFT , "Align left", \
- ES_CENTER , "Align center", \
- ES_RIGHT , "Align right", \
- ES_UPPERCASE , "Converts the text into uppercase characters", \
- ES_LOWERCASE , "Converts the text into lowercase characters", \
- ES_PASSWORD , "Displays all characters in the edit control as asterisks", \
- ES_NOHIDESEL , "Specifies that the selected text is not hidden when the edit control loses the keyboard focus", \
- ES_AUTOHSCROLL , "Automatically scrolls text horizontally", \
- ES_OEMCONVERT , "Ensures the proper conversion of characters", \
- ES_READONLY , "Makes the edit control read-only", \
- ES_WANTRETURN , "Inserts a carriage return when the user presses the ENTER key", \
- ES_NUMBER , "Restricts input to the edit control to digits only" \
- >, \
- NONE, \ ; style Ex names
-\
- ES_MULTILINE, \ ; This is StyleMaskAnd
- WS_CHILD, \ ; This is StyleMaskOr
- $00000000, \ ; This is StyleExMaskAnd
- $00000000, \ ; This is StyleExMaskOr
- $00000000, \ ; This is SubtypeMask
- NONE, \
- NONE, \ ; Library file NULL, because it's standard component.
- 'btnedit.ico'
DELETED IDE/components/SOURCE/COMCTL32.ASM
Index: IDE/components/SOURCE/COMCTL32.ASM
==================================================================
--- IDE/components/SOURCE/COMCTL32.ASM
+++ /dev/null
@@ -1,242 +0,0 @@
-include '%finc%\win32\win32a.inc'
-include '..\..\..\source\designtime.inc'
-
-
-DesignTimeInfo \
- \ ; 1. Control starts here
- 'SysTreeView32', \
- 'TreeView Control', \
- 'Common', \
- 'TreeView', \
- WS_VISIBLE or WS_CHILD or WS_BORDER or TVS_HASLINES, \ ; default style
- WS_EX_CLIENTEDGE, \ ; default ex style
- 128, 128, \
- < \ ; style names
- TVS_HASBUTTONS ,"Shows a button to the left side of each parent item.", \
- TVS_HASLINES ,"Enhances the graphic representation of a tree view control's hierarchy by drawing lines that link child items to their parent item.",\
- TVS_LINESATROOT ,"Draws lines between root and child nodes", \
- TVS_EDITLABELS ,"Allows the user to edit the labels of tree view items.",\
- TVS_DISABLEDRAGDROP ,"Disable drag and drop operation.", \
- TVS_SHOWSELALWAYS ,"Causes a selected item to remain selected when the tree view control loses focus.", \
- TVS_SINGLEEXPAND ,"Causes a tree view item to be expanded when it becomes selected and to be closed when it becomes unselected.",\
- TVS_CHECKBOXES ,"Enables check boxes for items in a tree view control.",\
- TVS_DISABLEDRAGDROP ,"Prevents the tree view control from sending TVN_BEGINDRAG notification messages.",\
- TVS_FULLROWSELECT ,"The entire row of the selected item is highlighted, and clicking anywhere on an item's row will cause it to be selected.",\
- TVS_INFOTIP ,"The tree view control will send the TVN_GETINFOTIP notification to obtain tooltip information.",\
- TVS_NOHSCROLL ,"Disables horizontal scrolling in the control.",\
- TVS_NONEVENHEIGHT ,"The height of the items can be set to an odd height with the TVM_SETITEMHEIGHT message.",\
- TVS_NOSCROLL ,"Disables both horizontal and vertical scrolling in the control.",\
- TVS_NOTOOLTIPS ,"The tree view control does not support tooltips.",\
- TVS_RTLREADING ,"Normal windows display text left-to-right (LTR).",\
- TVS_TRACKSELECT ,"Enables hot tracking in a tree view control." \
- >, \
- NONE, \ ; style Ex names
- \
- $00000000, \ ; This is StyleMaskAnd
- WS_CHILD , \ ; This is StyleMaskOr
- $00000000, \ ; This is StyleExMaskAnd
- $00000000, \ ; This is StyleExMaskOr
- $0 , \ ; This is SubtypeMask
- NONE, \
- NONE, \ ; Library file NULL, because it's standard component.
- 'treeview.ico', \
- \ ; 1. Control starts here
- 'SysListView32', \
- 'ListView Control', \
- 'Common', \
- 'ListView', \
- WS_CHILD or LVS_REPORT or LVS_EDITLABELS, \ ; default style
- WS_EX_CLIENTEDGE, \ ; default ex style
- 128, 128, \
- < \ ; style names
- LVS_SINGLESEL ,".",\
- LVS_SHOWSELALWAYS ,".",\
- LVS_SORTASCENDING ,".",\
- LVS_SORTDESCENDING ,".",\
- LVS_SHAREIMAGELISTS ,".",\
- LVS_NOLABELWRAP ,".",\
- LVS_AUTOARRANGE ,".",\
- LVS_EDITLABELS ,".",\
- LVS_OWNERDATA ,".",\
- LVS_NOSCROLL ,".",\
- LVS_ALIGNTOP ,"Align icons on top.",\
- LVS_ALIGNLEFT ,"Align icons on left.",\
- LVS_OWNERDRAWFIXED ,".",\
- LVS_NOCOLUMNHEADER ,".",\
- LVS_NOSORTHEADER ,"." \
- >, \
- < LVS_EX_GRIDLINES , "." ,\ ; style Ex names
- LVS_EX_SUBITEMIMAGES , "." ,\
- LVS_EX_CHECKBOXES , "." ,\
- LVS_EX_TRACKSELECT , "." ,\
- LVS_EX_HEADERDRAGDROP , "." ,\
- LVS_EX_FULLROWSELECT , "." ,\
- LVS_EX_ONECLICKACTIVATE , "." ,\
- LVS_EX_TWOCLICKACTIVATE , "." ,\
- LVS_EX_FLATSB , "." ,\
- LVS_EX_REGIONAL , "." ,\
- LVS_EX_INFOTIP , "." ,\
- LVS_EX_UNDERLINEHOT , "." ,\
- LVS_EX_UNDERLINECOLD , "." ,\
- LVS_EX_MULTIWORKAREAS , "." ,\
- LVS_EX_LABELTIP , "." ,\
- LVS_EX_BORDERSELECT , "." \
- >, \
- \
- $00000000, \ ; This is StyleMaskAnd
- WS_CHILD or WS_VISIBLE, \ ; This is StyleMaskOr
- $00000000, \ ; This is StyleExMaskAnd
- $00000000, \ ; This is StyleExMaskOr
- $3 , \ ; This is SubtypeMask
- < \
- LVS_ICON ,"Each item appears as a full-sized icon with a label below it.",\
- LVS_REPORT ,"Each item appears on its own line with information arranged in columns. The leftmost column is always left justified, and contains the small icon and label.",\
- LVS_SMALLICON ,"Each item appears as a small icon with the label to the right of it.",\
- LVS_LIST ,"Each item appears as a small icon with a label to the right of it. Items are arranged in columns and cannot be dragged to any arbitrary location by the user." \
- >, \ ; This is SubtipeRange
- NONE, \ ; Library file NULL, because it's standard component.
- 'listview.ico',\
- \ ; 1. Control starts here
- 'SysMonthCal32', \
- 'MonthView Control', \
- 'Common', \
- 'MonthView', \
- WS_VISIBLE or WS_CHILD or WS_BORDER, \ ; default style
- 0, \ ; default ex style
- 128, 128, \
- < \ ; style names
- MCS_MULTISELECT ,"Allow the user to select a range of days.",\
- MCS_WEEKNUMBERS ,"Displays week numbers at the left side of each month.",\
- MCS_NOTODAY ,"The control no longer circles the current day.",\
- MCS_DAYSTATE ,"The control highlights specific dates by displaying them in bold."\
- >, \
- NONE, \ ; style Ex names
- \
- $00000000, \ ; This is StyleMaskAnd
- WS_CHILD or WS_VISIBLE, \ ; This is StyleMaskOr
- $00000000, \ ; This is StyleExMaskAnd
- $00000000, \ ; This is StyleExMaskOr
- $0 , \ ; This is SubtypeMask
- NONE, \
- NONE, \ ; Library file NULL, because it's standard component.
- 'monthview.ico',\
- \ ; 1. Control starts here
- 'ToolbarWindow32', \
- 'Toolbar Control', \
- 'Common', \
- 'Toolbar', \
- WS_CHILD or TBSTYLE_TOOLTIPS or CCS_ADJUSTABLE, \ ; default style
- 0, \ ; default ex style
- 128, 128, \
- < \ ; style names
- TBSTYLE_TOOLTIPS, "The toolbar creates and manages a tooltip control.", \
- TBSTYLE_ALTDRAG, 'Allows the user to change the position of a toolbar button by dragging it while holding down the ALT key.', \
- TBSTYLE_WRAPABLE, 'Creates a toolbar that can have multiple lines of buttons.' \
- >, \
- NONE, \ ; style Ex names
- \
- $00000000, \ ; This is StyleMaskAnd
- WS_CHILD , \ ; This is StyleMaskOr
- $00000000, \ ; This is StyleExMaskAnd
- $00000000, \ ; This is StyleExMaskOr
- $0 , \ ; This is SubtypeMask
- NONE, \
- NONE, \ ; Library file NULL, because it's standard component.
- 'toolbar.ico',\
- \ ; 1. Control starts here
- 'msctls_statusbar32', \
- 'Status Bar Control', \
- 'Common', \
- 'Status', \
- WS_CHILD, \ ; default style
- 0, \ ; default ex style
- 128, 128, \
- NONE, \ ; style names
- NONE, \ ; style Ex names
- \
- $00000000, \ ; This is StyleMaskAnd
- WS_CHILD , \ ; This is StyleMaskOr
- $00000000, \ ; This is StyleExMaskAnd
- $00000000, \ ; This is StyleExMaskOr
- $0 , \ ; This is SubtypeMask
- NONE, \
- NONE, \ ; Library file NULL, because it's standard component.
- 'statusbar.ico', \
- \ ; 1. Control starts here
- 'SysTabControl32', \
- 'Tab Control', \
- 'Common', \
- 'Tab', \
- WS_CHILD, \ ; default style
- 0, \ ; default ex style
- 128, 128, \
- < \ ; style names
- TCS_SCROLLOPPOSITE, ".", \
- TCS_RIGHT, ".", \
- TCS_FORCEICONLEFT, ".", \
- TCS_FORCELABELLEFT, ".", \
- TCS_HOTTRACK, ".", \
- TCS_VERTICAL, '.', \
- TCS_BUTTONS, '.', \
- TCS_MULTILINE, '.', \
- TCS_FIXEDWIDTH, '.', \
- TCS_RAGGEDRIGHT, '.', \
- TCS_FOCUSONBUTTONDOWN, '.', \
- TCS_OWNERDRAWFIXED, '.', \
- TCS_TOOLTIPS, '.', \
- TCS_FOCUSNEVER, '.' \
- >, \
- NONE, \ ; style Ex names
- \
- $00000000, \ ; This is StyleMaskAnd
- WS_CHILD , \ ; This is StyleMaskOr
- $00000000, \ ; This is StyleExMaskAnd
- $00000000, \ ; This is StyleExMaskOr
- $0 , \ ; This is SubtypeMask
- NONE, \
- NONE, \ ; Library file NULL, because it's standard component.
- 'tabctl.ico', \
- \ ; 1. Control starts here
- 'msctls_trackbar32', \
- 'Slider Control', \
- 'Common', \
- 'Slider', \
- WS_CHILD, \ ; default style
- 0, \ ; default ex style
- 128, 128, \
- < \ ; style names
- 0 ,"." \
- >, \
- NONE, \ ; style Ex names
- \
- $00000000, \ ; This is StyleMaskAnd
- WS_CHILD , \ ; This is StyleMaskOr
- $00000000, \ ; This is StyleExMaskAnd
- $00000000, \ ; This is StyleExMaskOr
- $1f , \ ; This is SubtypeMask
- NONE, \
- NONE, \ ; Library file NULL, because it's standard component.
- 'slider.ico', \
-\
-\
- 'msctls_progress32', \
- 'Progressbar Control', \
- 'Common', \
- 'Progressbar', \
- WS_CHILD, \ ; default style
- 0, \ ; default ex style
- 192, 19, \
- < \ ; style names
- PBS_SMOOTH ,"PBS_SMOOTH", \
- PBS_VERTICAL, "PBS_VERTICAL" \
- >, \
- NONE, \ ; style Ex names
- \
- $00000000, \ ; This is StyleMaskAnd
- WS_CHILD , \ ; This is StyleMaskOr
- $00000000, \ ; This is StyleExMaskAnd
- $00000000, \ ; This is StyleExMaskOr
- $0 , \ ; This is SubtypeMask
- NONE, \
- NONE, \ ; Library file NULL, because it's standard component.
- 'progress.ico'
DELETED IDE/components/SOURCE/EDIT.ASM
Index: IDE/components/SOURCE/EDIT.ASM
==================================================================
--- IDE/components/SOURCE/EDIT.ASM
+++ /dev/null
@@ -1,70 +0,0 @@
-include '..\..\..\source\designtime.inc'
-include 'winconst.inc'
-
-
-DesignTimeInfo \
- \ ; 1. Edit control
- 'EDIT', \
- 'Edit control', \
- 'Standard', \
- 'Edit', \
- WS_VISIBLE or WS_CHILD or ES_LEFT or ES_AUTOHSCROLL, \ ; default style
- WS_EX_CLIENTEDGE, \ ; default ex style
- 121, 21, \
- < \ ; style names
- ES_LEFT , "Align left", \
- ES_CENTER , "Align center", \
- ES_RIGHT , "Align right", \
- ES_UPPERCASE , "Converts the text into uppercase characters", \
- ES_LOWERCASE , "Converts the text into lowercase characters", \
- ES_PASSWORD , "Displays all characters in the edit control as asterisks", \
- ES_NOHIDESEL , "Specifies that the selected text is not hidden when the edit control loses the keyboard focus", \
- ES_AUTOHSCROLL , "Automatically scrolls text horizontally", \
- ES_OEMCONVERT , "Ensures the proper conversion of characters", \
- ES_READONLY , "Makes the edit control read-only", \
- ES_WANTRETURN , "Inserts a carriage return when the user presses the ENTER key", \
- ES_NUMBER , "Restricts input to the edit control to digits only" \
- >, \
- NONE, \ ; style Ex names
-\
- ES_MULTILINE, \ ; This is StyleMaskAnd
- WS_CHILD, \ ; This is StyleMaskOr
- $00000000, \ ; This is StyleExMaskAnd
- $00000000, \ ; This is StyleExMaskOr
- $00000000, \ ; This is SubtypeMask
- NONE, \
- NONE, \ ; Library file NULL, because it's standard component.
- 'Edit.ico', \ ; Image for icon
- \ ; 2.Textbox control (edit with style es_multiline)
- 'EDIT', \
- 'Textbox control', \
- 'Standard', \
- 'Textbox', \
- WS_VISIBLE or WS_CHILD or ES_LEFT or ES_MULTILINE or ES_AUTOHSCROLL or ES_AUTOVSCROLL, \ ; default style
- WS_EX_CLIENTEDGE, \ ; default ex style
- 128, 128, \
- < \ ; style names
- ES_LEFT , "Align left", \
- ES_CENTER , "Align center", \
- ES_RIGHT , "Align right", \
- ES_UPPERCASE , "Converts the text into uppercase characters", \
- ES_LOWERCASE , "Converts the text into lowercase characters", \
- ES_PASSWORD , "Displays all characters in the textbox control as asterisks", \
- ES_NOHIDESEL , "Specifies that the selected text is not hidden when the textbox control loses the keyboard focus", \
- ES_AUTOHSCROLL , "Automatically scrolls text horizontally", \
- ES_AUTOVSCROLL , "Automatically scroll text vertically", \
- ES_OEMCONVERT , "Ensures the proper conversion of characters", \
- ES_READONLY , "Makes the textbox control read-only", \
- ES_WANTRETURN , "Inserts a carriage return when the user presses the ENTER key", \
- ES_NUMBER , "Restricts input to the textbox control to digits only" \
- >, \
- NONE, \ ; style Ex names
-\
- $00000000, \ ; This is StyleMaskAnd
- WS_CHILD or ES_MULTILINE, \ ; This is StyleMaskOr
- $00000000, \ ; This is StyleExMaskAnd
- $00000000, \ ; This is StyleExMaskOr
- $00000000, \ ; This is SubtypeMask
- NONE, \
- NONE, \ ; Library file NULL, because it's standard component.
- 'Textbox.ico'
DELETED IDE/components/SOURCE/FORM.ASM
Index: IDE/components/SOURCE/FORM.ASM
==================================================================
--- IDE/components/SOURCE/FORM.ASM
+++ /dev/null
@@ -1,30 +0,0 @@
-; This file contains design-time information for TForm control.
-;
-; This file must be compiled with FASM compiler to get binary
-; file. It will be compiled as .COM file. This is not executable
-; file. Don't start it.
-
-include '..\..\..\source\designtime.inc'
-include '..\win32\win32a.inc'
-
-
-DesignTimeInfo \
- \ ; 1. TForm control
- 'TForm', \
- 'Form control', \
- 'Standard', \
- 'Form', \
- WS_VISIBLE or WS_BORDER or WS_CHILD, \ ; default style
- $00010000, \ ; default ex style
- 128, 64, \
- NONE, \ ; style names
- NONE, \ ; style Ex names
-\
- $00000000, \ ; This is StyleMaskAnd
- $00000000, \ ; This is StyleMaskOr
- $00000000, \ ; This is StyleExMaskAnd
- $00010000, \ ; This is StyleExMaskOr
- $00000000, \ ; This is SubtypeMask
- NONE, \ ; This is SubtipeRange
- NONE, \ ; Library file NULL, because it's standard component.
- 'form.ico' ; Image for icon
DELETED IDE/components/SOURCE/LISTBOX.ASM
Index: IDE/components/SOURCE/LISTBOX.ASM
==================================================================
--- IDE/components/SOURCE/LISTBOX.ASM
+++ /dev/null
@@ -1,75 +0,0 @@
-include '..\..\..\source\designtime.inc'
-include 'winconst.inc'
-
-
-DesignTimeInfo \
- \
- 'LISTBOX', \
- 'Listbox control', \
- 'Standard', \
- 'Listbox', \
- WS_CHILD+WS_VISIBLE+WS_BORDER, \ ; default style
- WS_EX_CLIENTEDGE, \ ; default ex style
- 128, 128, \
- < \ ; style names
- LBS_DISABLENOSCROLL, 'Shows a disabled scrollbar if the listbox doesn''t contain enough items to scroll', \
- LBS_EXTENDEDSEL, 'Allows multiple items to be selected using the SHIFT key', \
- LBS_HASSTRINGS, 'Specifies that the listbox contains string items',\
- LBS_MULTICOLUMN, 'Specifies a multicolumn listbox',\
- LBS_MULTIPLESEL, 'Turns selection on and off when user clicks an item of the listbox',\
- LBS_NOINTEGRALHEIGHT, 'Specifies that height of the listbox isn''t automatically fixed',\
- LBS_NOREDRAW, 'Makes listbox''s appearance not update when changes are made',\
- LBS_NOSEL, 'Prevents user from selecting any items of the listbox',\
- LBS_NOTIFY, 'Makes the listbox send a notification when user double clicks any item',\
- LBS_OWNERDRAWFIXED, 'Specifies that the listbox''s owner is responsible for drawing items, and that they are the same height',\
- LBS_OWNERDRAWVARIABLE, 'Specifies that the listbox''s owner is responsible for drawing items, and that they are different in height', \
- LBS_SORT, 'Makes listbox sort items alphabetically',\
- LBS_USETABSTOPS, 'Makes listbox expand tabs in strings',\
- LBS_WANTKEYBOARDINPUT, 'Makes listbox send WM_VKEYTOITEM message when the key is pressed and the listbox has an input focus'\
- >, \
- NONE, \ ; style Ex names
-\
- $00000000, \ ; This is StyleMaskAnd
- WS_CHILD, \ ; This is StyleMaskOr
- $00000000, \ ; This is StyleExMaskAnd
- $00000000, \ ; This is StyleExMaskOr
- $00000000, \ ; This is SubtypeMask
- NONE, \
- NONE, \ ; Library file NULL, because it's standard component.
- 'listbox.ico', \ ; Image for icon
-\
-\ ; ComboBox class
-\
- 'COMBOBOX', \
- 'Combobox control', \
- 'Standard', \
- 'Combobox', \
- WS_CHILD+WS_VISIBLE+CBS_DROPDOWN, \ ; default style
- 0, \ ; default ex style
- 128, 25, \
- < \ ; style names
- CBS_AUTOHSCROLL, 'Automatically scrolls text in edit when user types something at the end of the line', \
- CBS_DISABLENOSCROLL, 'Displays disabled scrollbar when list doesn''t contain enough items to scroll', \
- CBS_HASSTRINGS, 'Specifies that owner-drawn combobox contains string items', \
- CBS_LOWERCASE, 'Converts to lowercase all texts in combobx', \
- CBS_UPPERCASE, 'Converts to uppercase all texts in combobx', \
- CBS_NOINTEGRALHEIGHT, 'Specifies that height of the combobox isn''t automatically fixed', \
- CBS_OEMCONVERT, 'Converts text in edit control to the OEM character set', \
- CBS_OWNERDRAWFIXED, 'Specifies that the combobox''s owner is responsible for drawing items, and that they are the same height', \
- CBS_OWNERDRAWVARIABLE, 'Specifies that the combobox''s owner is responsible for drawing items, and that they are different in height', \
- CBS_SORT, 'Makes combobox sort items alphabetically' \
- >, \
- NONE, \ ; style Ex names
-\
- $00000000, \ ; This is StyleMaskAnd
- WS_CHILD, \ ; This is StyleMaskOr
- $00000000, \ ; This is StyleExMaskAnd
- $00000000, \ ; This is StyleExMaskOr
- $00000003, \ ; This is SubtypeMask
- < \
- CBS_DROPDOWN, 'Dropdown combobox', \
- CBS_DROPDOWNLIST, 'Dropdown listbox', \
- CBS_SIMPLE, 'Simple combobox' \
- >, \ ; This is SubtipeRange
- NONE, \ ; Library file NULL, because it's standard component.
- 'combobox.ico' ; Image for icon
DELETED IDE/components/SOURCE/STATIC.ASM
Index: IDE/components/SOURCE/STATIC.ASM
==================================================================
--- IDE/components/SOURCE/STATIC.ASM
+++ /dev/null
@@ -1,104 +0,0 @@
-include '..\..\..\source\designtime.inc'
-include 'winconst.inc'
-
-
-DesignTimeInfo \
- 'STATIC', \
- 'Label control', \
- 'Standard', \
- 'Label', \
- WS_VISIBLE or WS_CHILD, \ ; default style
- 0, \ ; default ex style
- 32, 13, \
- < \ ; style names
- SS_SUNKEN , "Draws a half-sunken border around a static control", \
- SS_CENTERIMAGE , "Centers the image", \
- SS_REALSIZEIMAGE , "Prevents a static icon or bitmap control from being resized as it is loaded or drawn", \
- SS_RIGHTJUST , "Specifies that the lower right corner of a static control with the SS_BITMAP or SS_ICON style is to remain fixed when the control is resized", \
- SS_NOPREFIX , "Prevents interpretation of any ampersand (&) characters in the control's text as accelerator prefix characters",\
- SS_NOTIFY , "Sends the parent window notification messages when the user clicks or double-clicks the control" \
- >, \
- NONE, \ ; style Ex names
- \
- $00000000, \ ; This is StyleMaskAnd
- WS_CHILD , \ ; This is StyleMaskOr
- $00000000, \ ; This is StyleExMaskAnd
- $00000000, \ ; This is StyleExMaskOr
- $1f , \ ; This is SubtypeMask
- < \
- SS_LEFT , "Left aligned with wordwrap", \
- SS_CENTER , "Centered", \
- SS_RIGHT , "Right-aligned", \
- SS_SIMPLE , "Simple one line text", \
- SS_LEFTNOWORDWRAP , "Left-aligned without wordwrap" \
- >, \ ; This is SubtipeRange
- NONE, \ ; Library file NULL, because it's standard component.
- 'label.ico', \ ; Image for icon
- \ ; 2.Shape control starts here
- 'STATIC', \
- 'Shape control', \
- 'Standard', \
- 'Shape', \
- WS_VISIBLE or WS_CHILD or SS_ETCHEDFRAME, \ ; default style
- 0, \ ; default ex style
- 128, 128, \
- < \ ; style names
- SS_SUNKEN , "Draws a half-sunken border around a static control", \
- SS_CENTERIMAGE , "Centers the image", \
- SS_REALSIZEIMAGE , "Prevents a static icon or bitmap control from being resized as it is loaded or drawn", \
- SS_RIGHTJUST , "Specifies that the lower right corner of a static control with the SS_BITMAP or SS_ICON style is to remain fixed when the control is resized", \
- SS_NOPREFIX , "Prevents interpretation of any ampersand (&) characters in the control's text as accelerator prefix characters",\
- SS_NOTIFY , "Sends the parent window notification messages when the user clicks or double-clicks the control" \
- >, \
- NONE, \ ; style Ex names
- \
- $00000000, \ ; This is StyleMaskAnd
- WS_CHILD , \ ; This is StyleMaskOr
- $00000000, \ ; This is StyleExMaskAnd
- $00000000, \ ; This is StyleExMaskOr
- $1f , \ ; This is SubtypeMask
- < \
- SS_BLACKFRAME , "Specifies a box with a frame drawn in the same color as the window frames", \
- SS_GRAYFRAME , "Specifies a box with a frame drawn with the same color as the screen background (desktop)", \
- SS_WHITEFRAME , "Specifies a box with a frame drawn with the same color as the window background", \
- SS_ETCHEDHORZ , "Draws the top and bottom edges of the static control using the EDGE_ETCHED edge style", \
- SS_ETCHEDVERT , "Draws the left and right edges of the static control using the EDGE_ETCHED edge style", \
- SS_ETCHEDFRAME , "Draws the frame of the static control using the EDGE_ETCHED edge style", \
- SS_BLACKRECT , "Specifies a rectangle filled with the current window frame color", \
- SS_GRAYRECT , "Specifies a rectangle filled with the current screen background color", \
- SS_WHITERECT , "Specifies a rectangle filled with the current window background color" \
- >, \ ; This is SubtipeRange
- NONE, \ ; Library file NULL, because it's standard component.
- 'shape.ico', \ ; Image for icon
- \ ; 3.Image control starts here
- 'STATIC', \
- 'Image control', \
- 'Standard', \
- 'Image', \
- WS_VISIBLE or WS_CHILD or SS_BITMAP or SS_CENTERIMAGE,\ ; default style
- 0, \ ; default ex style
- 128, 128, \
- < \ ; style names
- SS_SUNKEN , "Draws a half-sunken border around a static control", \
- SS_CENTERIMAGE , "Centers the image", \
- SS_REALSIZEIMAGE , "Prevents a static icon or bitmap control from being resized as it is loaded or drawn", \
- SS_RIGHTJUST , "Specifies that the lower right corner of a static control with the SS_BITMAP or SS_ICON style is to remain fixed when the control is resized", \
- SS_NOPREFIX , "Prevents interpretation of any ampersand (&) characters in the control's text as accelerator prefix characters",\
- SS_NOTIFY , "Sends the parent window notification messages when the user clicks or double-clicks the control" \
- >, \
- NONE, \ ; style Ex names
- \
- $00000000, \ ; This is StyleMaskAnd
- WS_CHILD , \ ; This is StyleMaskOr
- $00000000, \ ; This is StyleExMaskAnd
- $00000000, \ ; This is StyleExMaskOr
- $1f , \ ; This is SubtypeMask
- < \
- SS_BITMAP , 'Bitmap image' , \
- SS_ICON , 'Icon image' , \
- SS_ENHMETAFILE , 'Metafile image', \
- SS_OWNERDRAW , 'Owner is responsible for drawing image.', \
- SS_USERITEM , 'User defined item' \
- >, \ ; This is SubtipeRange
- NONE, \ ; Library file NULL, because it's standard component.
- 'image.ico'
DELETED IDE/components/SOURCE/SizerClassDTL.asm
Index: IDE/components/SOURCE/SizerClassDTL.asm
==================================================================
--- IDE/components/SOURCE/SizerClassDTL.asm
+++ /dev/null
@@ -1,76 +0,0 @@
-;**********************************************************************
-; Fresh project draft file.
-; 20.09.2003 John Found
-;
-; Method for dynamic loading of source-level libraries in design-time
-;
-; This is example, how Fresh controls executable code will be loaded
-; dynamicaly in run time instead of embeding in the source file.
-; For every control will be created wrapper DLL, where the main
-; functions have standard names:
-;
-; RegisterXXXXXClass - registers the window class for the control.
-; XXXXXWinProc - Window message handler.
-;
-; Note that this wrapper includes exactly the same source file
-; as source-level library. The only problem is with global variables
-; used in source-level libs. For this example I define these in
-; .data section, but this is only to allow compilation. The data
-; for these variables is not the same as in the project.
-; This problem requre some solution, before implementation this idea
-; in Fresh.
-;**********************************************************************
-
-format PE GUI 4.0 DLL
-entry DllEntryPoint
-
-include '%finc%/win32/win32a.inc'
-include 'sourcelevel/SizerClass.inc'
-
-;------------------------------------------------------------
-; This section is illegal here. But I have no idea how to
-; remove it in common case. These variables are globals from
-; Fresh project, used in source-level libraries.
-
-section '.data' code readable writeable
-
-hInstance dd ?
-hMainWin dd ?
-xGrid dd ?
-yGrid dd ?
-fSnapToGrid dd ?
-;------------------------------------------------------------
-
-
-section '.code' code readable executable
-
-proc DllEntryPoint, hinstDLL,fdwReason,lpvReserved
- enter
- mov eax,TRUE
- return
-
-; The files from source-level library must be included without
-; any change.
-include 'sourcelevel\geometry.asm'
-include 'sourcelevel\SizerClass.asm'
-
-
-
-section '.idata' import data readable writeable
-
- library kernel32,'KERNEL32.DLL', \
- user32,'USER32.DLL', \
- gdi32, 'GDI32.DLL'
-
- include '%include%\apia\kernel32.inc'
- include '%include%\apia\user32.inc'
- include '%include%\apia\gdi32.inc'
-
-section '.edata' export data readable
-
- ; functions have to be sorted alphabetically
- export 'SizerClassDTL.DLL',\
- RegisterSizerClass,'RegisterSizerClass',\
- SizerWinProc,'SizerWinProc'
-
-section '.reloc' fixups data discardable
DELETED IDE/components/SOURCE/WINCONST.INC
Index: IDE/components/SOURCE/WINCONST.INC
==================================================================
--- IDE/components/SOURCE/WINCONST.INC
+++ /dev/null
@@ -1,323 +0,0 @@
-
-; USER32.DLL constants
-
-
-; Windows styles
-
-WS_OVERLAPPED = 000000000h
-WS_ICONICPOPUP = 0C0000000h
-WS_POPUP = 080000000h
-WS_CHILD = 040000000h
-WS_MINIMIZE = 020000000h
-WS_VISIBLE = 010000000h
-WS_DISABLED = 008000000h
-WS_CLIPSIBLINGS = 004000000h
-WS_CLIPCHILDREN = 002000000h
-WS_MAXIMIZE = 001000000h
-WS_CAPTION = 000C00000h
-WS_BORDER = 000800000h
-WS_DLGFRAME = 000400000h
-WS_VSCROLL = 000200000h
-WS_HSCROLL = 000100000h
-WS_SYSMENU = 000080000h
-WS_THICKFRAME = 000040000h
-WS_HREDRAW = 000020000h
-WS_VREDRAW = 000010000h
-WS_GROUP = 000020000h
-WS_TABSTOP = 000010000h
-WS_MINIMIZEBOX = 000020000h
-WS_MAXIMIZEBOX = 000010000h
-
-; Common Window Styles
-
-WS_OVERLAPPEDWINDOW = WS_OVERLAPPED or WS_CAPTION or WS_SYSMENU or WS_THICKFRAME or WS_MINIMIZEBOX or WS_MAXIMIZEBOX
-WS_POPUPWINDOW = WS_POPUP or WS_BORDER or WS_SYSMENU
-WS_CHILDWINDOW = WS_CHILD
-WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW
-WS_TILED = WS_OVERLAPPED
-WS_ICONIC = WS_MINIMIZE
-WS_SIZEBOX = WS_THICKFRAME
-
-; Extended Window Styles
-
-WS_EX_DLGMODALFRAME = 00001h
-WS_EX_DRAGOBJECT = 00002h
-WS_EX_NOPARENTNOTIFY = 00004h
-WS_EX_TOPMOST = 00008h
-WS_EX_ACCEPTFILES = 00010h
-WS_EX_TRANSPARENT = 00020h
-WS_EX_MDICHILD = 00040h
-WS_EX_TOOLWINDOW = 00080h
-WS_EX_WINDOWEDGE = 00100h
-WS_EX_CLIENTEDGE = 00200h
-WS_EX_CONTEXTHELP = 00400h
-WS_EX_RIGHT = 01000h
-WS_EX_LEFT = 00000h
-WS_EX_RTLREADING = 02000h
-WS_EX_LTRREADING = 00000h
-WS_EX_LEFTSCROLLBAR = 04000h
-WS_EX_RIGHTSCROLLBAR = 00000h
-WS_EX_CONTROLPARENT = 10000h
-WS_EX_STATICEDGE = 20000h
-WS_EX_APPWINDOW = 40000h
-WS_EX_LAYERED = 80000h
-WS_EX_OVERLAPPEDWINDOW = WS_EX_WINDOWEDGE or WS_EX_CLIENTEDGE
-WS_EX_PALETTEWINDOW = WS_EX_WINDOWEDGE or WS_EX_TOOLWINDOW or WS_EX_TOPMOST
-
-; System colors
-
-COLOR_SCROLLBAR = 0
-COLOR_BACKGROUND = 1
-COLOR_ACTIVECAPTION = 2
-COLOR_INACTIVECAPTION = 3
-COLOR_MENU = 4
-COLOR_WINDOW = 5
-COLOR_WINDOWFRAME = 6
-COLOR_MENUTEXT = 7
-COLOR_WINDOWTEXT = 8
-COLOR_CAPTIONTEXT = 9
-COLOR_ACTIVEBORDER = 10
-COLOR_INACTIVEBORDER = 11
-COLOR_APPWORKSPACE = 12
-COLOR_HIGHLIGHT = 13
-COLOR_HIGHLIGHTTEXT = 14
-COLOR_BTNFACE = 15
-COLOR_BTNSHADOW = 16
-COLOR_GRAYTEXT = 17
-COLOR_BTNTEXT = 18
-COLOR_INACTIVECAPTIONTEXT = 19
-COLOR_BTNHIGHLIGHT = 20
-COLOR_3DDKSHADOW = 21
-COLOR_3DLIGHT = 22
-COLOR_INFOTEXT = 23
-COLOR_INFOBK = 24
-COLOR_HOTLIGHT = 26
-COLOR_GRADIENTACTIVECAPTION = 27
-COLOR_GRADIENTINACTIVECAPTION = 28
-
-; Button styles
-
-BS_PUSHBUTTON = 0000h
-BS_DEFPUSHBUTTON = 0001h
-BS_CHECKBOX = 0002h
-BS_AUTOCHECKBOX = 0003h
-BS_RADIOBUTTON = 0004h
-BS_3STATE = 0005h
-BS_AUTO3STATE = 0006h
-BS_GROUPBOX = 0007h
-BS_USERBUTTON = 0008h
-BS_AUTORADIOBUTTON = 0009h
-BS_OWNERDRAW = 000Bh
-BS_TEXT = 0000h
-BS_LEFTTEXT = 0020h
-BS_RIGHTBUTTON = BS_LEFTTEXT
-BS_ICON = 0040h
-BS_BITMAP = 0080h
-BS_LEFT = 0100h
-BS_RIGHT = 0200h
-BS_CENTER = 0300h
-BS_TOP = 0400h
-BS_BOTTOM = 0800h
-BS_VCENTER = 0C00h
-BS_PUSHLIKE = 1000h
-BS_MULTILINE = 2000h
-BS_NOTIFY = 4000h
-BS_FLAT = 8000h
-
-; List box styles
-
-LBS_NOTIFY = 0001h
-LBS_SORT = 0002h
-LBS_NOREDRAW = 0004h
-LBS_MULTIPLESEL = 0008h
-LBS_OWNERDRAWFIXED = 0010h
-LBS_OWNERDRAWVARIABLE = 0020h
-LBS_HASSTRINGS = 0040h
-LBS_USETABSTOPS = 0080h
-LBS_NOINTEGRALHEIGHT = 0100h
-LBS_MULTICOLUMN = 0200h
-LBS_WANTKEYBOARDINPUT = 0400h
-LBS_EXTENDEDSEL = 0800h
-LBS_DISABLENOSCROLL = 1000h
-LBS_NODATA = 2000h
-LBS_NOSEL = 4000h
-LBS_STANDARD = LBS_NOTIFY or LBS_SORT or WS_VSCROLL or WS_BORDER
-
-; Combo box styles
-
-CBS_SIMPLE = 0001h
-CBS_DROPDOWN = 0002h
-CBS_DROPDOWNLIST = 0003h
-CBS_OWNERDRAWFIXED = 0010h
-CBS_OWNERDRAWVARIABLE = 0020h
-CBS_AUTOHSCROLL = 0040h
-CBS_OEMCONVERT = 0080h
-CBS_SORT = 0100h
-CBS_HASSTRINGS = 0200h
-CBS_NOINTEGRALHEIGHT = 0400h
-CBS_DISABLENOSCROLL = 0800h
-CBS_UPPERCASE = 2000h
-CBS_LOWERCASE = 4000h
-
-; Edit control styles
-
-ES_LEFT = 0000h
-ES_CENTER = 0001h
-ES_RIGHT = 0002h
-ES_MULTILINE = 0004h
-ES_UPPERCASE = 0008h
-ES_LOWERCASE = 0010h
-ES_PASSWORD = 0020h
-ES_AUTOVSCROLL = 0040h
-ES_AUTOHSCROLL = 0080h
-ES_NOHIDESEL = 0100h
-ES_OEMCONVERT = 0400h
-ES_READONLY = 0800h
-ES_WANTRETURN = 1000h
-ES_NUMBER = 2000h
-
-; Static window styles
-
-SS_LEFT = 0000h
-SS_CENTER = 0001h
-SS_RIGHT = 0002h
-SS_ICON = 0003h
-SS_BLACKRECT = 0004h
-SS_GRAYRECT = 0005h
-SS_WHITERECT = 0006h
-SS_BLACKFRAME = 0007h
-SS_GRAYFRAME = 0008h
-SS_WHITEFRAME = 0009h
-SS_USERITEM = 000Ah
-SS_SIMPLE = 000Bh
-SS_LEFTNOWORDWRAP = 000Ch
-SS_BITMAP = 000Eh
-SS_OWNERDRAW = 000Dh
-SS_ENHMETAFILE = 000Fh
-SS_ETCHEDHORZ = 0010h
-SS_ETCHEDVERT = 0011h
-SS_ETCHEDFRAME = 0012h
-SS_TYPEMASK = 001Fh
-SS_NOPREFIX = 0080h
-SS_NOTIFY = 0100h
-SS_CENTERIMAGE = 0200h
-SS_RIGHTJUST = 0400h
-SS_REALSIZEIMAGE = 0800h
-SS_SUNKEN = 1000h
-
-; Scroll bar styles
-
-SBS_HORZ = 0000h
-SBS_VERT = 0001h
-SBS_TOPALIGN = 0002h
-SBS_LEFTALIGN = 0002h
-SBS_BOTTOMALIGN = 0004h
-SBS_RIGHTALIGN = 0004h
-SBS_SIZEBOXTOPLEFTALIGN = 0002h
-SBS_SIZEBOXBOTTOMRIGHTALIGN = 0004h
-SBS_SIZEBOX = 0008h
-SBS_SIZEGRIP = 0010h
-
-; Dialog styles
-
-DS_ABSALIGN = 0001h
-DS_SYSMODAL = 0002h
-DS_3DLOOK = 0004h
-DS_FIXEDSYS = 0008h
-DS_NOFAILCREATE = 0010h
-DS_LOCALEDIT = 0020h
-DS_SETFONT = 0040h
-DS_MODALFRAME = 0080h
-DS_NOIDLEMSG = 0100h
-DS_SETFOREGROUND = 0200h
-DS_CONTROL = 0400h
-DS_CENTER = 0800h
-DS_CENTERMOUSE = 1000h
-DS_CONTEXTHELP = 2000h
-
-; Menu flags
-
-MF_INSERT = 0000h
-MF_CHANGE = 0080h
-MF_APPEND = 0100h
-MF_DELETE = 0200h
-MF_REMOVE = 1000h
-MF_BYCOMMAND = 0000h
-MF_BYPOSITION = 0400h
-MF_SEPARATOR = 0800h
-MF_UNCHECKED = 0000h
-MF_ENABLED = 0000h
-MF_GRAYED = 0001h
-MF_DISABLED = 0002h
-MF_CHECKED = 0008h
-MF_USECHECKBITMAPS = 0200h
-MF_STRING = 0000h
-MF_BITMAP = 0004h
-MF_OWNERDRAW = 0100h
-MF_POPUP = 0010h
-MF_MENUBARBREAK = 0020h
-MF_MENUBREAK = 0040h
-MF_UNHILITE = 0000h
-MF_HILITE = 0080h
-MF_DEFAULT = 1000h
-MF_SYSMENU = 2000h
-MF_HELP = 4000h
-MF_RIGHTJUSTIFY = 4000h
-MF_MOUSESELECT = 8000h
-MF_END = 0080h
-MFT_STRING = MF_STRING
-MFT_BITMAP = MF_BITMAP
-MFT_MENUBARBREAK = MF_MENUBARBREAK
-MFT_MENUBREAK = MF_MENUBREAK
-MFT_OWNERDRAW = MF_OWNERDRAW
-MFT_RADIOCHECK = 0200h
-MFT_SEPARATOR = MF_SEPARATOR
-MFT_RIGHTORDER = 2000h
-MFT_RIGHTJUSTIFY = MF_RIGHTJUSTIFY
-MFS_GRAYED = 0003h
-MFS_DISABLED = MFS_GRAYED
-MFS_CHECKED = MF_CHECKED
-MFS_HILITE = MF_HILITE
-MFS_ENABLED = MF_ENABLED
-MFS_UNCHECKED = MF_UNCHECKED
-MFS_UNHILITE = MF_UNHILITE
-MFS_DEFAULT = MF_DEFAULT
-MFR_POPUP = 0001h
-MFR_END = MF_END
-
-; Border types
-
-BDR_RAISEDOUTER = 01h
-BDR_SUNKENOUTER = 02h
-BDR_RAISEDINNER = 04h
-BDR_SUNKENINNER = 08h
-BDR_OUTER = 03h
-BDR_INNER = 0Ch
-BDR_RAISED = 05h
-BDR_SUNKEN = 0Ah
-EDGE_RAISED = BDR_RAISEDOUTER or BDR_RAISEDINNER
-EDGE_SUNKEN = BDR_SUNKENOUTER or BDR_SUNKENINNER
-EDGE_ETCHED = BDR_SUNKENOUTER or BDR_RAISEDINNER
-EDGE_BUMP = BDR_RAISEDOUTER or BDR_SUNKENINNER
-
-; Border flags
-
-BF_LEFT = 0001h
-BF_TOP = 0002h
-BF_RIGHT = 0004h
-BF_BOTTOM = 0008h
-BF_TOPLEFT = BF_TOP or BF_LEFT
-BF_TOPRIGHT = BF_TOP or BF_RIGHT
-BF_BOTTOMLEFT = BF_BOTTOM or BF_LEFT
-BF_BOTTOMRIGHT = BF_BOTTOM or BF_RIGHT
-BF_RECT = BF_LEFT or BF_TOP or BF_RIGHT or BF_BOTTOM
-BF_DIAGONAL = 0010h
-BF_DIAGONAL_ENDTOPRIGHT = BF_DIAGONAL or BF_TOP or BF_RIGHT
-BF_DIAGONAL_ENDTOPLEFT = BF_DIAGONAL or BF_TOP or BF_LEFT
-BF_DIAGONAL_ENDBOTTOMLEFT = BF_DIAGONAL or BF_BOTTOM or BF_LEFT
-BF_DIAGONAL_ENDBOTTOMRIGHT = BF_DIAGONAL or BF_BOTTOM or BF_RIGHT
-BF_MIDDLE = 0800h
-BF_SOFT = 1000h
-BF_ADJUST = 2000h
-BF_FLAT = 4000h
-BF_MONO = 8000h
DELETED IDE/components/SOURCE/asmedit.asm
Index: IDE/components/SOURCE/asmedit.asm
==================================================================
--- IDE/components/SOURCE/asmedit.asm
+++ /dev/null
@@ -1,34 +0,0 @@
-include '%finc%/win32/win32a.inc'
-include '..\..\..\source\designtime.inc'
-include 'winconst.inc'
-include '..\..\..\source\AsmEdit\AsmEdit.inc'
-
-DesignTimeInfo \
-\ ; AsmEdit control.
- 'ASMEDIT', \
- 'AsmEdit control', \
- 'Fresh', \
- 'AsmEdit', \
- WS_VISIBLE or WS_CHILD or WS_HSCROLL or WS_VSCROLL or ES_NOHIDESEL or AES_AUTOINDENT or AES_SMARTTABS or AES_CONSOLECARET, \ ; default style
- WS_EX_CLIENTEDGE, \ ; default ex style
- 128, 128, \
- < \ ; style names
- ES_NOHIDESEL, "Specifies that the selected text is not hidden when the textbox control loses the keyboard focus", \
- AES_AUTOINDENT, 'Auto indent', \
- AES_SMARTTABS, 'Smart tabs', \
- AES_OPTIMALFILL, 'Optimal fill', \
- AES_SECURESEL, 'Security selection', \
- AES_AUTOBRACKETS,'Auto brackets', \
- AES_CONSOLECARET, 'Console caret', \
- AES_INDENTSEL, 'Tab indents selection' \
- >, \
- NONE, \ ; style Ex names
-\
- $00000000, \ ; This is StyleMaskAnd
- WS_CHILD or ES_MULTILINE, \ ; This is StyleMaskOr
- $00000000, \ ; This is StyleExMaskAnd
- $00000000, \ ; This is StyleExMaskOr
- $00000000, \ ; This is SubtypeMask
- NONE, \
- NONE, \ ; Library file NULL, because it's standard component.
- 'asmedit.ico'
DELETED IDE/components/SOURCE/scrollbar.asm
Index: IDE/components/SOURCE/scrollbar.asm
==================================================================
--- IDE/components/SOURCE/scrollbar.asm
+++ /dev/null
@@ -1,66 +0,0 @@
-; One file may contains description of more than one control.
-; Look at 'DesignTimeInfo' macro definition.
-;
-; This file must be compiled with FASM compiler to get binary
-; file. It will be compiled as .BIN file. This is not executable
-; file. Don't start it.
-
-include '..\..\..\source\designtime.inc'
-include 'winconst.inc'
-
-
-DesignTimeInfo \
- \ ; 1. SCROLLBAR CONTROL
- 'SCROLLBAR', \
- 'Horizontal scrollbar control', \
- 'Standard', \
- '', \
- WS_VISIBLE+WS_CHILD, \ ; default style
- 0, \ ; default ex style
- 128, 16, \
- < \ ; style names
- SBS_BOTTOMALIGN, "Aligns scrollbar to the bottom of the client area", \
- SBS_TOPALIGN, "Aligns scrollbar to the top of the client area", \
- SBS_BOTTOMALIGN, "Aligns scrollbar to the left side of the client area", \
- SBS_TOPALIGN, "Aligns scrollbar to the right side of the client area" \
- >, \
- NONE, \ ; style Ex names
-\
- $00000000, \ ; This is StyleMaskAnd
- WS_CHILD, \ ; This is StyleMaskOr
- $00000000, \ ; This is StyleExMaskAnd
- $00000000, \ ; This is StyleExMaskOr
- $00000001, \ ; This is SubtypeMask
- < \
- SBS_HORZ, 'Horizontal scrollbar',\
- SBS_VERT, 'Vertical scrollbar'\
- >, \ ; This is SubtipeRange
- NONE, \ ; Library file NULL, because it's standard component.
- 'hscrollbar.ico', \ ; Image for icon
-\
-\ ; Vertical scrollbar control.
-\
- 'SCROLLBAR', \
- 'Sizebox control', \
- 'Standard', \
- '' , \
- WS_VISIBLE+WS_CHILD+SBS_SIZEBOX, \ ; default style
- 0, \ ; default ex style
- 16, 16, \
- < \ ; style names
- SBS_SIZEBOXBOTTOMRIGHTALIGN, "Aligns sizebox to the the lower right of the client area", \
- SBS_SIZEBOXTOPLEFTALIGN, "Aligns sizebox to the the upper left of the client area" \
- >, \
- NONE, \ ; style Ex names
-\
- $00000000, \ ; This is StyleMaskAnd
- WS_CHILD+SBS_SIZEBOX, \ ; This is StyleMaskOr
- $00000000, \ ; This is StyleExMaskAnd
- $00000000, \ ; This is StyleExMaskOr
- $00000001, \ ; This is SubtypeMask
- < \
- SBS_SIZEBOX, 'Standard sizebox', \
- SBS_SIZEGRIP, 'SizeGrip' \
- >, \ ; This is SubtipeRange
- NONE, \ ; Library file NULL, because it's standard component.
- 'sizebox.ico'
DELETED IDE/components/STATIC.vcl
Index: IDE/components/STATIC.vcl
==================================================================
--- IDE/components/STATIC.vcl
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/components/TABCTL.ICO
Index: IDE/components/TABCTL.ICO
==================================================================
--- IDE/components/TABCTL.ICO
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/components/TOOLBAR.ICO
Index: IDE/components/TOOLBAR.ICO
==================================================================
--- IDE/components/TOOLBAR.ICO
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/components/TREEVIEW.ICO
Index: IDE/components/TREEVIEW.ICO
==================================================================
--- IDE/components/TREEVIEW.ICO
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/components/Textbox.ico
Index: IDE/components/Textbox.ico
==================================================================
--- IDE/components/Textbox.ico
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/components/asmedit.ico
Index: IDE/components/asmedit.ico
==================================================================
--- IDE/components/asmedit.ico
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/components/asmedit.vcl
Index: IDE/components/asmedit.vcl
==================================================================
--- IDE/components/asmedit.vcl
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/components/btnedit.ico
Index: IDE/components/btnedit.ico
==================================================================
--- IDE/components/btnedit.ico
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/components/hscrollbar.ico
Index: IDE/components/hscrollbar.ico
==================================================================
--- IDE/components/hscrollbar.ico
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/components/monthview.ico
Index: IDE/components/monthview.ico
==================================================================
--- IDE/components/monthview.ico
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/components/progress.ico
Index: IDE/components/progress.ico
==================================================================
--- IDE/components/progress.ico
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/components/scrollbar.vcl
Index: IDE/components/scrollbar.vcl
==================================================================
--- IDE/components/scrollbar.vcl
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/components/statusbar.ico
Index: IDE/components/statusbar.ico
==================================================================
--- IDE/components/statusbar.ico
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/components/vscrollbar.ico
Index: IDE/components/vscrollbar.ico
==================================================================
--- IDE/components/vscrollbar.ico
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/templates/DOS command/DosCom.fpr
Index: IDE/templates/DOS command/DosCom.fpr
==================================================================
--- IDE/templates/DOS command/DosCom.fpr
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/templates/DOS command/MainFile.asm
Index: IDE/templates/DOS command/MainFile.asm
==================================================================
--- IDE/templates/DOS command/MainFile.asm
+++ /dev/null
@@ -1,13 +0,0 @@
-;--------------------------------------------------------------------
-; This is template for creating simple .com DOS application.
-;--------------------------------------------------------------------
- org $100
-; Put your source here.
-
-
-
-
-
-exit:
- mov ax, $4c00
- int $21
DELETED IDE/templates/DOS command/README.TXT
Index: IDE/templates/DOS command/README.TXT
==================================================================
--- IDE/templates/DOS command/README.TXT
+++ /dev/null
@@ -1,1 +0,0 @@
-Simple DOS .com application.
DELETED IDE/templates/FreshLib portable GUI application/FreshLibGUI.fpr
Index: IDE/templates/FreshLib portable GUI application/FreshLibGUI.fpr
==================================================================
--- IDE/templates/FreshLib portable GUI application/FreshLibGUI.fpr
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/templates/FreshLib portable GUI application/MainForm.asm
Index: IDE/templates/FreshLib portable GUI application/MainForm.asm
==================================================================
--- IDE/templates/FreshLib portable GUI application/MainForm.asm
+++ /dev/null
@@ -1,24 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..:: Fresh IDE ::.. template project. |
-;|_______________________________________________________________________________________|
-;
-; Description: FreshLib portable GUI application; Main form source file;
-;
-; Target OS: Any, supported by FreshLib
-;
-; Dependencies: FreshLib
-;
-; Notes:
-;_________________________________________________________________________________________
-
-iglobal
- frmMainForm:
- ObjTemplate tfEnd, Form, frmMain, \
- x, 100, \
- y, 50, \
- width, 320, \
- height, 240, \
- Visible, TRUE, \
- Caption, 'FreshLib portable application.'
-endg
DELETED IDE/templates/FreshLib portable GUI application/main.asm
Index: IDE/templates/FreshLib portable GUI application/main.asm
==================================================================
--- IDE/templates/FreshLib portable GUI application/main.asm
+++ /dev/null
@@ -1,41 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..:: Fresh IDE ::.. template project. |
-;|_______________________________________________________________________________________|
-;
-; Description: FreshLib portable GUI application.
-;
-; Target OS: Any, supported by FreshLib
-;
-; Dependencies: FreshLib
-;
-; Notes:
-;_________________________________________________________________________________________
-
-include "%lib%/freshlib.inc"
-
-@BinaryType GUI
-
-include "%lib%/freshlib.asm"
-
-; include your includes here.
-include "MainForm.asm"
-
-start:
- InitializeAll
-
- stdcall Create, CApplication
- mov [pApplication], ebx
-
- stdcall CreateFromTemplate, frmMainForm, 0
- mov ecx, [pApplication]
- mov [ecx+TApplication.MainWindow], frmMain
-
- stdcall Run
-
- FinalizeAll
- stdcall Terminate, 0
-
-
-@AllImportEmbeded ; or @AllImportSection
-@AllDataEmbeded ; or @AllDataSection
DELETED IDE/templates/FreshLib portable GUI application/readme.txt
Index: IDE/templates/FreshLib portable GUI application/readme.txt
==================================================================
--- IDE/templates/FreshLib portable GUI application/readme.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-Portable GUI application, based on FreshLib.
-Can be compiled as PE executable or as ELF executable, without source changes.
-
-In order to keep it portable, use only FreshLib functions and avoid use of OS specific API.
DELETED IDE/templates/FreshLib portable console application/FreshLibConsole.fpr
Index: IDE/templates/FreshLib portable console application/FreshLibConsole.fpr
==================================================================
--- IDE/templates/FreshLib portable console application/FreshLibConsole.fpr
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/templates/FreshLib portable console application/console.asm
Index: IDE/templates/FreshLib portable console application/console.asm
==================================================================
--- IDE/templates/FreshLib portable console application/console.asm
+++ /dev/null
@@ -1,33 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..:: Fresh IDE ::.. template project. |
-;|_______________________________________________________________________________________|
-;
-; Description: FreshLib portable console application.
-;
-; Target OS: Any, supported by FreshLib
-;
-; Dependencies: FreshLib
-;
-; Notes:
-;_________________________________________________________________________________________
-
-include "%lib%/freshlib.inc"
-
-@BinaryType console
-
-include "%lib%/freshlib.asm"
-
-; include your includes here.
-
-start:
- InitializeAll
-
-; place your code here.
-
- FinalizeAll
- stdcall Terminate, 0
-
-
-@AllImportEmbeded ; or @AllImportSection
-@AllDataEmbeded ; or @AllDataSection
DELETED IDE/templates/FreshLib portable console application/readme.txt
Index: IDE/templates/FreshLib portable console application/readme.txt
==================================================================
--- IDE/templates/FreshLib portable console application/readme.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-Portable console application, based on FreshLib.
-Can be compiled as PE executable or as ELF executable, without source changes.
-
-In order to keep it portable, use only FreshLib functions and avoid use of OS specific API.
DELETED IDE/templates/Win32 DLL library/README.TXT
Index: IDE/templates/Win32 DLL library/README.TXT
==================================================================
--- IDE/templates/Win32 DLL library/README.TXT
+++ /dev/null
@@ -1,1 +0,0 @@
-DLL (dynamic link library).
DELETED IDE/templates/Win32 DLL library/dlltpl.asm
Index: IDE/templates/Win32 DLL library/dlltpl.asm
==================================================================
--- IDE/templates/Win32 DLL library/dlltpl.asm
+++ /dev/null
@@ -1,49 +0,0 @@
-; DLL library template
-format PE GUI 4.0 DLL
-entry DllEntryPoint
-
-include '%finc%/win32/win32a.inc'
-
-
-section '.code' code readable executable
-
-;--------------- DLL entry function --------------------
-proc DllEntryPoint, .hinstDLL, .fdwReason, .lpvReserved
-begin
- mov eax,TRUE
- return
-endp
-
-
-
-;--------------- export functions ----------------------
-proc DLLExportFunc, .hWnd, .dwError
-begin
-
- ; insert your code here
-
- return
-endp
-
-
-
-section '.idata' import data readable
-
- ; Place imports here.
-
-
-section '.edata' export data readable
-
- ; Place exporting functions here.
- ;
- ; NOTE: functions need to be expoted in
- ; aplhabetical order.
-
- export 'DLLTPL.DLL',\
- DLLExportFunc,'DLLExportFunc'
-
-
-
-section '.reloc' fixups data discardable
- ; Fixup section. You don't have to
- ; put anything here manually.
DELETED IDE/templates/Win32 DLL library/dlltpl.fpr
Index: IDE/templates/Win32 DLL library/dlltpl.fpr
==================================================================
--- IDE/templates/Win32 DLL library/dlltpl.fpr
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/templates/Win32 SDI tiny application/MainForm.frm
Index: IDE/templates/Win32 SDI tiny application/MainForm.frm
==================================================================
--- IDE/templates/Win32 SDI tiny application/MainForm.frm
+++ /dev/null
@@ -1,28 +0,0 @@
-;
-
-;-----------------------------------------------------------------------
-; Window procedure for the form.
-; Arguments:
-; .hwnd - handle of the window
-; .wmsg - code of the message
-; .wparam \ Parameters of the message
-; .lparam /
-;-----------------------------------------------------------------------
-winproc MainFormWinProc
-begin
-;-----------------------------------------------------------------------
-; Write here the code that have to be executed before
-; message dispathing.
-;-----------------------------------------------------------------------
-
-
-ondefault
-;-----------------------------------------------------------------------
-; Write here the code that have to be executed if message
-; was not processed by this procedure.
-;-----------------------------------------------------------------------
- stc
- return
-endwp
DELETED IDE/templates/Win32 SDI tiny application/README.TXT
Index: IDE/templates/Win32 SDI tiny application/README.TXT
==================================================================
--- IDE/templates/Win32 SDI tiny application/README.TXT
+++ /dev/null
@@ -1,2 +0,0 @@
-Windows GUI applications of type SDI (Single document interface)that
-contains only one main window and possibly other dialog or toolbox windows, owned by the main window.
DELETED IDE/templates/Win32 SDI tiny application/TinyGUI.asm
Index: IDE/templates/Win32 SDI tiny application/TinyGUI.asm
==================================================================
--- IDE/templates/Win32 SDI tiny application/TinyGUI.asm
+++ /dev/null
@@ -1,55 +0,0 @@
-format PE GUI 4.0
-entry Start
-
-include '%finc%/win32/win32a.inc'
-
-include "%finc%/libs/msgutils.inc"
-include "%finc%/libs/tform.inc"
-include "%finc%/libs/parents.inc"
-include "%finc%/libs/templates.inc"
-
-include "%finc%/libs/msgutils.asm"
-include "%finc%/libs/tform.asm"
-include "%finc%/libs/parents.asm"
-include "%finc%/libs/templates.asm"
-
-include "MainForm.frm"
-
-uglobal
- hInstance dd ?
- hHeap dd ?
- hMainForm dd ?
-endg
-
-Start:
- invoke GetModuleHandleA,0
- mov [hInstance],eax
- invoke GetProcessHeap
- mov [hHeap], eax
-
- InitializeAll
-
- stdcall CreateForm, frmMain, NULL
- xor eax, eax
- test ebx, ebx
- jz .terminate
-
- mov [hMainForm], ebx
-
-.run:
- call ProcessMessages
- jc .terminate
-
- invoke WaitMessage
- jmp .run
-
-.terminate:
- push eax
- FinalizeAll
- invoke ExitProcess ; exit code from the stack.
-
-data import
- include '%finc%/win32/allimports.asm'
-end data
-
-IncludeAllGlobals
DELETED IDE/templates/Win32 SDI tiny application/TinyGUI.fpr
Index: IDE/templates/Win32 SDI tiny application/TinyGUI.fpr
==================================================================
--- IDE/templates/Win32 SDI tiny application/TinyGUI.fpr
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/templates/Win32 SysTray application/README.TXT
Index: IDE/templates/Win32 SysTray application/README.TXT
==================================================================
--- IDE/templates/Win32 SysTray application/README.TXT
+++ /dev/null
@@ -1,3 +0,0 @@
-Win32 System Tray application template. Includes main window
-that creates a tray icon and a popup menu that appears when
-user selects the icon.
DELETED IDE/templates/Win32 SysTray application/mainwindow.frm
Index: IDE/templates/Win32 SysTray application/mainwindow.frm
==================================================================
--- IDE/templates/Win32 SysTray application/mainwindow.frm
+++ /dev/null
@@ -1,110 +0,0 @@
-;
-PM_SHELLNOTIFY = WM_USER + 1
-
-IDI_TRAY = 0
-IDM_EXIT = 100
-IDM_SHOWHIDE = 101
-
-
-iglobal
- szShowHide db "&Show/Hide", 0
- szExit db "&Exit", 0
-endg
-
-uglobal
- nid NOTIFYICONDATA
- uVisibleFlag dd ?
- hTrayMenu dd ?
-endg
-
-
-winproc MainWindowProc
-begin
-
-ondefault
- stc
- return
-
-onmessage FM_AFTERCREATE
-
- mov [nid.cbSize],sizeof.NOTIFYICONDATA ; prepare tray icon
- push [.hwnd]
- pop [nid.hWnd]
- mov [nid.uID],IDI_TRAY
- mov [nid.uFlags],NIF_ICON+NIF_MESSAGE+NIF_TIP
- mov [nid.uCallbackMessage],PM_SHELLNOTIFY
- invoke LoadIconA, NULL,IDI_WINLOGO
- mov [nid.hIcon],eax
- mov dword[nid.szTip],"Tray"
- mov dword[nid.szTip+4], "Demo"
- invoke Shell_NotifyIconA, NIM_ADD,nid
-
- invoke CreatePopupMenu ; create tray popup menu - here you
- mov [hTrayMenu],eax ; can add your own menu items
- invoke AppendMenuA, eax,MF_STRING,IDM_SHOWHIDE,szShowHide
- invoke AppendMenuA, [hTrayMenu],MF_STRING,IDM_EXIT,szExit
- clc
- return
-
-onmessage WM_DESTROY
- invoke Shell_NotifyIconA, NIM_DELETE,nid
- invoke DestroyMenu, [hTrayMenu]
- invoke PostQuitMessage, 0
- clc
- return
-
-onmessage WM_COMMAND
- cmp [.lparam],0
- jne .ondefault
-
- mov eax,[.wparam] ; handle tray popup menu actions
- cmp eax,IDM_SHOWHIDE ;
- je .showhide
- cmp eax,IDM_EXIT
- je .idm_exit
- stc
- return
-
- .idm_exit:
- invoke DestroyWindow, [.hwnd]
- clc
- return
-
-
-onmessage WM_CLOSE
- jmp .hide
-
-onmessage PM_SHELLNOTIFY ; handle tray icons actions:
-locals ; left mouse button - show/hide window
- .pt POINT ; right mouse button - show tray popup menu
-endl
- cmp [.lparam],WM_LBUTTONDOWN
- je .showhide
- cmp [.lparam],WM_RBUTTONDOWN
- je .show_tray_popup
- jmp .finish
- .showhide:
- cmp [uVisibleFlag],0
- je .show
- .hide:
- invoke ShowWindow, [.hwnd],SW_HIDE
- mov [uVisibleFlag], 0
- jmp .finish
- .show:
- invoke ShowWindow, [.hwnd],SW_SHOW
- mov [uVisibleFlag], 1
- invoke SetActiveWindow, [.hwnd]
- jmp .finish
- .show_tray_popup:
- lea eax,[.pt]
- invoke GetCursorPos, eax
- invoke SetForegroundWindow, [.hwnd]
- invoke TrackPopupMenu, [hTrayMenu],TPM_RIGHTALIGN,[.pt.x],[.pt.y],\
- NULL,[.hwnd],NULL
- invoke PostMessageA, [.hwnd],WM_NULL,0,0
- .finish:
- clc
- return
-endwp
DELETED IDE/templates/Win32 SysTray application/tray.asm
Index: IDE/templates/Win32 SysTray application/tray.asm
==================================================================
--- IDE/templates/Win32 SysTray application/tray.asm
+++ /dev/null
@@ -1,47 +0,0 @@
-format PE GUI 4.0
-entry Start
-
-include '%finc%/win32/win32a.inc'
-include '%finc%/libs/msgutils.inc'
-include '%finc%/libs/templates.inc'
-include '%finc%/libs/TForm.inc'
-include '%finc%/libs/parents.inc'
-
-
-section '.code' code readable executable
-..ShowSizes = 1
-..ShowSkipped = 0
-
-include '%finc%/libs/msgutils.asm'
-include '%finc%/libs/templates.asm'
-include '%finc%/libs/TForm.asm'
-include '%finc%/libs/parents.asm'
-
-include 'mainwindow.frm'
-
-uglobal
- hMainForm dd ?
- hInstance dd ?
-endg
-
-Start:
- invoke GetModuleHandleA, 0
- mov [hInstance], eax
- InitializeAll
-
- stdcall CreateForm, frmMainWindow, NULL
- mov [hMainForm],ebx
-
- include '%finc%/libs/mainloop.asm'
- push eax
- FinalizeAll
- invoke ExitProcess
-
-
-section '.idata' data import readable writeable
-ImportTable:
-include '%finc%/win32/allimports.asm'
-DispSize 'ImportTable', $ - ImportTable
-
-section '.data' data readable writeable
-IncludeAllGlobals
DELETED IDE/templates/Win32 SysTray application/tray.fpr
Index: IDE/templates/Win32 SysTray application/tray.fpr
==================================================================
--- IDE/templates/Win32 SysTray application/tray.fpr
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/templates/Win32 console/Console.inc
Index: IDE/templates/Win32 console/Console.inc
==================================================================
--- IDE/templates/Win32 console/Console.inc
+++ /dev/null
@@ -1,181 +0,0 @@
-
-; Console Modes, and color atributes
-
-ENABLE_PROCESSED_INPUT = 1h
-ENABLE_LINE_INPUT = 2h
-ENABLE_ECHO_INPUT = 4h
-ENABLE_WINDOW_INPUT = 8h
-ENABLE_MOUSE_INPUT = 10h
-ENABLE_PROCESSED_OUTPUT = 1h
-ENABLE_WRAP_AT_EOL_OUTPUT = 2h
-CONSOLE_TEXTMODE_BUFFER = 1
-FOREGROUND_BLUE = 1h
-FOREGROUND_GREEN = 2h
-FOREGROUND_RED = 4h
-FOREGROUND_INTENSITY = 8h
-BACKGROUND_BLUE = 10h
-BACKGROUND_GREEN = 20h
-BACKGROUND_RED = 40h
-BACKGROUND_INTENSITY = 80h
-
-struct COORD
- .x dw ?
- .y dw ?
-ends
-
-struct SMALL_RECT
- .Left dw ?
- .Top dw ?
- .Right dw ?
- .Bottom dw ?
-ends
-
-struct CONSOLE_SCREEN_BUFFER_INFO
- .dwSize COORD
- .dwCursorPosition COORD
- .wAttributes dw ?
- .srWindow SMALL_RECT
- .dwMaximumWindowSize COORD
-ends
-
-; Console Colors
-
-macro ConsoleColor Name,[Part] {
- common
- local Color
- Color = 0
- forward
- if ~ Part eq
- Color = Color or FOREGROUND_#Part
- end if
- common
- FGColor.#Name = Color
- BGColor.#Name = (Color shl 4)
-}
-
-ConsoleColor Black
-ConsoleColor Gray,INTENSITY
-ConsoleColor Silver,RED,GREEN,BLUE
-ConsoleColor White,RED,GREEN,BLUE,INTENSITY
-ConsoleColor Maroon,RED
-ConsoleColor Red,RED,INTENSITY
-ConsoleColor Navy,BLUE
-ConsoleColor Blue,BLUE,INTENSITY
-ConsoleColor Green,GREEN
-ConsoleColor Lime,GREEN,INTENSITY
-ConsoleColor Purple,RED,BLUE
-ConsoleColor Pink,RED,BLUE,INTENSITY
-ConsoleColor Olive,RED,GREEN
-ConsoleColor Yellow,RED,GREEN,INTENSITY
-ConsoleColor Teal,BLUE,GREEN
-ConsoleColor Cyan,BLUE,GREEN,INTENSITY
-
-; Console Procedures
-
-iglobal
- CSBI CONSOLE_SCREEN_BUFFER_INFO
- coords COORD
-endg
-
-uglobal
- hStdIn dd ?
- hStdOut dd ?
- ConsoleBuffer rb 1024
-endg
-
-; FUNCTION SetColor (Color)
-; Changes the Console color.
-Console.SetColor fix [SetConsoleTextAttribute],[hStdOut]
-
-initialize PrepareConsole
-begin
- xor eax,eax
- mov dword [coords],eax
-
- invoke GetStdHandle,STD_INPUT_HANDLE
- cmp eax,INVALID_HANDLE_VALUE ;If theres an error, dont open the console
- je .end
- mov [hStdIn],eax ;else, save the input handle
- invoke GetStdHandle,STD_OUTPUT_HANDLE
- cmp eax,INVALID_HANDLE_VALUE ;If theres an error, dont open the console
- je .end
- mov [hStdOut],eax ;else save the output handle
- invoke SetConsoleMode,[hStdIn],ENABLE_PROCESSED_INPUT or ENABLE_LINE_INPUT or ENABLE_ECHO_INPUT or \
- ENABLE_MOUSE_INPUT or ENABLE_WINDOW_INPUT or ENABLE_PROCESSED_OUTPUT or \
- ENABLE_WRAP_AT_EOL_OUTPUT
- stdcall Console.SetColor,FGColor.Silver or BGColor.Black
- .end:
- return
-endp
-
-; FUNCTION Print (Text)
-; Print a text to the console.
-proc Console.Print,.strText
- .WB dd ?
-begin
- push edx
- invoke lstrlen,[.strText]
- lea edx,[.WB]
- invoke WriteConsoleA, [hStdOut], [.strText], eax, edx, 0
- pop edx
-.end:
- return
-endp
-
-
-; FUNCTION Input
-; Read one text from the console.
-; Returns pointer to buffer.
-proc Console.Input
- .RB dd ?
-begin
- invoke FlushConsoleInputBuffer,[hStdIn]
- lea eax,[.RB]
- invoke ReadConsoleA,[hStdIn],ConsoleBuffer,1024,eax,0
- mov esi,ConsoleBuffer ; starting the routine to remove the crlf chars
-.loadstrloop:
- lodsb
- cmp al,13
- jne .loadstrloop
- mov byte [esi-1],0
- mov eax,ConsoleBuffer
- return
-endp
-
-; FUNCTION Locate (X,Y)
-; Changes the cursor position.
-proc Console.Locate,.curX,.curY
-begin
- mov eax,[.curX]
- mov dword [coords.x],eax
- mov eax,[.curY]
- mov dword [coords.y],eax
- invoke SetConsoleCursorPosition,[hStdOut],[coords]
- return
-endp
-
-; FUNCTION Clear (Color)
-; Clears the console.
-proc Console.Clear,.paramColor
- .WB dd ?
-begin
- mov [coords.x],0
- mov [coords.y],0
- stdcall Console.SetColor,[.paramColor]
-.next:
- invoke GetConsoleScreenBufferInfo,[hStdOut],CSBI
- mov eax,dword [CSBI.dwSize.x]
- mul [CSBI.dwSize.y]
- ; conSize = edx
- lea eax,[.WB]
- invoke FillConsoleOutputCharacterA,[hStdOut],20h,edx,[coords],eax
- invoke GetConsoleScreenBufferInfo,[hStdOut],CSBI
- lea eax,[.WB]
- invoke FillConsoleOutputAttribute,[hStdOut],dword [CSBI.wAttributes],edx,[coords],eax
- invoke SetConsoleCursorPosition,[hStdOut],[coords]
- return
-endp
-
-; FUNCTION SetTitle (Title)
-; Changes the console title.
-Console.SetTitle equ [SetConsoleTitleA]
DELETED IDE/templates/Win32 console/MainFile.asm
Index: IDE/templates/Win32 console/MainFile.asm
==================================================================
--- IDE/templates/Win32 console/MainFile.asm
+++ /dev/null
@@ -1,49 +0,0 @@
-
-; Win32 Console Application
-
-format PE Console 4.0
-entry Start
-
-include '%finc%\win32\win32a.inc'
-include 'Console.inc'
-
-uglobal
- hInstance dd ?
- hHeap dd ?
-endg
-
-Start:
- invoke GetModuleHandleA,0
- mov [hInstance],eax
- invoke GetProcessHeap
- mov [hHeap], eax
- InitializeAll
-
- ; TODO: Insert code here
-
- ; Start of example
- iglobal
- strTest db ' Hello world! ',0
- strEnding db 'Ending application, press any key...',13,10,0
- strTitle db 'Testing Console Library',0
- endg
- stdcall Console.Locate,5,5
- stdcall Console.SetColor,FGColor.Maroon or BGColor.Pink
- stdcall Console.SetTitle, strTitle
- stdcall Console.Print, strTest
- stdcall Console.Input
- stdcall Console.Clear, FGColor.Red or BGColor.White
- stdcall Console.Print, strEnding
- stdcall Console.Input
- ; End of example
-
-Exit:
- push eax
- FinalizeAll
- invoke ExitProcess ; exit code from the stack.
-
-data import
- include "%finc%\win32\allimports.asm"
-end data
-
-IncludeAllGlobals
DELETED IDE/templates/Win32 console/README.txt
Index: IDE/templates/Win32 console/README.txt
==================================================================
--- IDE/templates/Win32 console/README.txt
+++ /dev/null
@@ -1,1 +0,0 @@
-Windows 32-bit console type applications.
DELETED IDE/templates/Win32 console/Win32Console.fpr
Index: IDE/templates/Win32 console/Win32Console.fpr
==================================================================
--- IDE/templates/Win32 console/Win32Console.fpr
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/templates/complex.asm
Index: IDE/templates/complex.asm
==================================================================
--- IDE/templates/complex.asm
+++ /dev/null
@@ -1,28 +0,0 @@
-;
-
-;-----------------------------------------------------------------------
-; Window procedure for the form.
-; Arguments:
-; .hwnd - handle of the window
-; .wmsg - code of the message
-; .wparam \ Parameters of the message
-; .lparam /
-;-----------------------------------------------------------------------
-winproc CustomWinProc
-begin
-;-----------------------------------------------------------------------
-; Write here the code that have to be executed before
-; message dispathing.
-;-----------------------------------------------------------------------
-
-
-ondefault
-;-----------------------------------------------------------------------
-; Write here the code that have to be executed if message
-; was not processed by this procedure.
-;-----------------------------------------------------------------------
- stc
- return
-endwp
DELETED IDE/themes/Black&White.theme
Index: IDE/themes/Black&White.theme
==================================================================
--- IDE/themes/Black&White.theme
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/themes/Classic.theme
Index: IDE/themes/Classic.theme
==================================================================
--- IDE/themes/Classic.theme
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/themes/Hackerz.theme
Index: IDE/themes/Hackerz.theme
==================================================================
--- IDE/themes/Hackerz.theme
+++ /dev/null
cannot compute difference between binary files
DELETED IDE/themes/Windows.theme
Index: IDE/themes/Windows.theme
==================================================================
--- IDE/themes/Windows.theme
+++ /dev/null
cannot compute difference between binary files
DELETED License.txt
Index: License.txt
==================================================================
--- License.txt
+++ /dev/null
@@ -1,117 +0,0 @@
-The Fresh Artistic License
-
-Preamble
-
-The intent of this document is to state the conditions under which a
-Package may be copied, such that the Copyright Holder maintains some
-semblance of artistic control over the development of the package,
-while giving the users of the package the right to use and distribute
-the Package in a more-or-less customary fashion, plus the right to make
-reasonable modifications.
-
-Definitions:
-
- * "Package" refers to the collection of files distributed by the
- Copyright Holder, and derivatives of that collection of files
- created through textual modification.
- * "Standard Version" refers to such a Package if it has not been
- modified, or has been modified in accordance with the wishes of
- the Copyright Holder.
- * "Copyright Holder" is whoever is named in the copyright or
- copyrights for the package.
- * "You" is you, if you're thinking about copying or distributing
- this Package.
- * "Reasonable copying fee" is whatever you can justify on the basis
- of media cost, duplication charges, time of people involved, and
- so on. (You will not be required to justify it to the Copyright
- Holder, but only to the computing community at large as a market
- that must bear the fee.)
- * "Freely Available" means that no fee is charged for the item
- itself, though there may be fees involved in handling the item.
- It also means that recipients of the item may redistribute it
- under the same conditions they received it.
-
-IMPORTANT NOTE:
- FASM compiler itself, which is integral part of this package is
- distributed under different license. All source files of FASM
- compiler are separated in "source\fasm\" directory. Please read and
- apply "source\fasm\license.txt" for FASM license.
-
-1. You may make and give away verbatim copies of the source form of the
- Standard Version of this Package without restriction, provided that
- you duplicate all of the original copyright notices and associated
- disclaimers.
-
-2. You may apply bug fixes, portability fixes and other modifications
- from the Copyright Holder or those derived from the Public Domain
- and approved by the Copyright Holder. A Package modified in such a
- way shall still be considered the Standard Version.
-
-3. You may otherwise modify your copy of this Package in any way,
- provided that you insert a prominent notice in each changed file
- stating how and when you changed that file, and provided that you do
- at least ONE of the following:
-
- a) place your modifications in the Public Domain or otherwise make
- them Freely Available, such as by posting said modifications to
- Usenet or an equivalent medium, or placing the modifications on
- a major archive site such as ftp.uu.net, or by allowing the
- Copyright Holder to include your modifications in the Standard
- Version of the Package.
-
- b) use the modified Package only within your corporation or
- organization.
-
- c) rename any non-standard executables so the names do not conflict
- with standard executables, which must also be provided, and
- provide a separate manual page for each non-standard executable
- that clearly documents how it differs from the Standard Version.
-
- d) make other distribution arrangements with the Copyright Holder.
-
-4. You may distribute the programs of this Package in object code or
- executable form, provided that you do at least ONE of the following:
-
- a) distribute a Standard Version of the executables and library
- files, together with instructions ( in the manual page or
- equivalent) on where to get the Standard Version.
-
- b) accompany the distribution with the machine-readable source of
- the Package with your modifications.
-
- c) accompany any non-standard executables with their corresponding
- Standard Version executables, giving the non-standard
- executables non-standard names, and clearly documenting the
- differences in manual pages (or equivalent), together with
- instructions on where to get the Standard Version.
-
- d) make other distribution arrangements with the Copyright Holder.
-
-5. You may charge a reasonable copying fee for any distribution of this
- Package. You may charge any fee you choose for support of this
- Package. You may not charge a fee for this Package itself. However,
- you may distribute this Package in aggregate with other (possibly
- commercial) programs as part of a larger (possibly commercial)
- software distribution provided that you do not advertise this
- Package as a product of your own.
-
-6. The executable and library files supplied as input to or produced as
- output from the programs of this Package do not automatically fall
- under the copyright of this Package, but belong to whomever
- generated them, and may be sold commercially, and may be aggregated
- with this Package.
-
-7. You may not use this package, nor files created as output from this
- package, nor products derived from this package for producing,
- distrubuting or in any way contribute to the creation or
- distribution of "unwanted advertisement" (known as SPAM).
-
-8. The name of the Copyright Holder may not be used to endorse or
- promote products derived from this software without specific prior
- written permission.
-
-9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-
-The End
DELETED ReadMe.txt
Index: ReadMe.txt
==================================================================
--- ReadMe.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-"Fresh" project
-(c)2003...2011, 2012 Fresh developement team
-
-This file is in the root directory of the Fresh RAD IDE.
-Fresh is FASM based self compilable RAD IDE.
-
-To browse and compile Fresh sources, use recent version of the
-FASMW compiler or Fresh IDE itself.
-
-For more detailed information how to write applications with Fresh,
-read "doc/FreshGuide.chm" file.
-
-For the sources look at: "source\" directory.
-
-Also the repository with the project history and latest dev versions is on:
-[http://chiselapp.com/user/johnfound/repository/FreshIDE/index]
-
-To get latest version of Fresh, visit Fresh home page: http://fresh.flatassembler.net
-
-For FASM/FASMW information and downloads: http://flatassembler.net
-
-To contact authors of Fresh and/or FASM: http://board.flatassembler.net
-
DELETED WhatsNew.txt
Index: WhatsNew.txt
==================================================================
--- WhatsNew.txt
+++ /dev/null
@@ -1,183 +0,0 @@
-This file describes the changes in every new version of Fresh IDE
-The date format: DD.MM.YYYY
-
-version 2.0.10 (??????????)
-
- [-] Fixed bug concerning working in Linux (Wine). When Fresh compiles some ELF executable
- it could not set the executable permissions. Now it is fixed.
-
- [+] New feature: When no Linux terminal is configured, Fresh runs the Linux ELF binaries
- directly, without terminal.
-
-version 2.0.9 (22.09.2012)
-
- [!] This release introduces some incompatibility with the earlier sources. Read below.
-
- [+] New FASM 1.71 compiler with address space labels.
-
- [+] Removed GlobalAPI symbol. Now, when Win32 API is used, the user must provide the
- full function name. This approach makes the syntax more simple, clear and portable.
-
- [+] Merged with FreshLibDev - new "uses" macro, more flexible dll import macros.
- New "text" macro that avoids text constants duplication. Stdcall macros now
- allows using string constants directly.
-
- [+] Examples and project templates adapted to the new style of importing functions.
-
- [-] Fixed missing syntax highlighting of the data definition directives.
-
- [-] Fixed rare bug - crash when some file is 1.in the project, 2.does not exists on disk
- and 3.the user choose to keep it in the project. Then on compilation, when the compiled
- file uses this missing file, Fresh crashes.
-
- [-] Fixed long waiting bug with editor "indent" and "comment" features, that made one more line
- to be commented/indented.
-
-version 2.0.8 (26.08.2012)
-
- [+] Merged with the latest FreshLibDev with sockets library.
- [-] Fixed buggy behaviour of the background .fas file processing.
- [-] Fixed wrong working directory of andLinux running applications.
-
-
-version 2.0.7 (22.07.2012)
-
- [+] Added new application templates - FreshLib based portable console and
- GUI applications.
- [-] Empty templates removed.
- [-] "New application" template dialog behavior fixed.
- [+] Latest version of FreshLibDev merged.
- [+] FASM 1.70.03 compiler.
- [+] New help file with FASM 1.70 manual and FreshLib reference.
- [+] New feature: "Help file Ctrl+F1" - the user can open the configured
- help files individually.
- [+] New feature: Embeded help. Fresh extracts the comment blocks from the
- source files and displays them as a hint in the editor.
- [+] Time consuming processing of the .fas file was moved to the
- background thread and does not slow the IDE.
- [+] The cross-reference window can be closed by ESCAPE key from the editor.
- [+] Autoinstalation now set FreshGuide.chm as a help file.
- [-] More FreshLib and less Win API used.
- [-] Increased default memory, allocated for the compiler.
- [-] Some obscure bugs fixed, including all tickets from the repository.
-
-version 2.0.6 alpha (27.04.2012)
-
- [+] More informative error messages when missing debug information.
- [+] Symbols cross reference functions (in the label explorer and in the source editor)
- [+] Latest version of FreshLib
- [+] Updated FASM compiler to version 1.70
- [-] Some bugs fixed
-
-version 2.0.5 alpha (13.01.2012)
-
- [+] Native support for running and debuging Linux executables. Now Fresh can run in
- Linux|Wine and to run ELF executables directly.
- [-] Fixed bug in the editor themes load/save dialog. There is still some inconsistent
- behavior, that have to be fixed later.
-
-version 2.0.4 alpha (25.12.2011)
-
- [+] Updated FASM compiler to 1.69.35
- [+] The project is managed by Fossil VCS now.
- The repository is hosted on [http://chiselapp.com/user/johnfound/repository/FreshIDE]
- Of course the full source code is still available with the release packages,
- but it is often outdated, especially in FreshLib part that is in heavy development now.
- [+] Merged with the latest development version of FreshLib.
- [-] Fixed old bug. Now in form editor ESC key works - selects the parent window in properties editor.
- [-] Fixed bug in form editor that was unable to create new forms.
-
-version 2.0.3 alpha (15.01.2011)
-
- [+] The next in a row, big restructure of the source code:
-
- FreshLib is implemented for following libraries:
- - macros (macro/allmacros.asm)
- - equates (equates/allequates.asm)
- - imports (imports/allimports.asm)
- - the structure of the program ( compiler/executable.inc )
- - memory allocations ( data/memory.asm )
- - data handling (data/arrays.asm; data/memstream.asm)
- - file operations (data/files.asm)
- - String operations (data/strlib.asm) StrLib is now portable as well.
- For details, read the header of StrLib.asm file.
- Some functions are not backward compatible with the old version.
-
- [+] Updated compiler to FASM v1.69.29
- [+] New 'text' macro introduced. The final goal is to provide automatic handling
- of the string constants in order to avoid duplications in definitions and
- waste of label names. Unfortunately, the speed of the macros is too low for
- practical use, so now only a stub is provided for future development.
- [-] Auto set for "lib" directory alias in Fresh.ini
- [-] Fixed bug in AsmEdit
- [-] Fixed bug in AddCompilationStatistics (fasm.asm)
- [-] Fixed very old bug in LabelsList.asm.
-
-version 2.0.2 alpha (23.11.2010) - silent release :)
-
- [-] Fixed bug in editorhost.asm that crashed Fresh in some cases.
- [-] Fixed bug in PAHint.asm
- [-] Fixed some include files, not properly updated after changes for this version.
- [-] Fixed example projects that refused to compile, because of the updates.
- It was because of biger memory needed and because of some not fixed include files.
- [-] some Cleanup in the XLib example to make it smaller and cleaner.
- [-] Fixed macro/exceptions.inc library to use the new FASM macro syntax.
-
-version 2.0.2 alpha (22.11.2010)
- API include files replaced with new, builded with ImportDB tool. Several bugs fixed.
-
- [+] Replaced all import files. There is no apia and apiw directories but only one "api".
- All API files are build with ImportDB utility and contains almost all API functions
- from WinXP dlls. Also, the api files now contain the argument description for almost
- all API functions.
- The type of api is set with GlobalAPI symbolic constant. It accepts following values:
-
- GlobalAPI equ ; empty value means, all functions will be imported
- ; exactly as they are exported from the libraries.
-
- GlobalAPI equ ascii ; ASCII functions will be imported without suffix.
- ; Unicode functions will be imported with suffix W.
-
- GlobalAPI equ unicode ; ASCII functions will be imported with suffix A
- ; Unicode functions will be imported without suffix.
-
- [-] Changed font of the procedure arguments hint window to "Trebuchet MS" that is
- more readable for programming needs.
- [-] buttonedit.asm and buttonedit.inc moved to '%finc%\libs\' where is the
- right place for these files.
- [-] Minor changes in some of component libraries (TForm and Action lists.)
- in order to cleanup dependencies with other libraries.
- [-] Fixed bug on counting arguments in PAHint, when there are quoted commas
- in the arguments.
- [-] Fixed bug on fake compilation that caused crash in some circumstances.
- [-] Fixed very old bug in ButtonEdit.asm, that manifested itself only in Wine.
- [-] Fixed bug in TDataGrid, that sometimes caused crash on closing Fresh.
-
-version 2.0.1 alpha (14.11.2010)
-
- One new feature and several bug fixes.
-
- [+] Procedure arguments hint - when the user type call statements, it shows arguments
- of the procedure. It can be used with imported functions too, but the argument
- descriptions for these is limited for now.
- [-] Changes in CCList.asm in order to make things more clear and to collect the code
- in one place.
- [-] Partially edited user32.inc file to insert procedure arguments.
- [-] Fixed wrong size on save of editor theme.
- [-] Bug fix in TForm window class. It concerns the proper WM_COMMAND processing when
- the form is open as modal dialog and have some parent.
- [-] Fixed missing file from the template directory.
- [-] Several other bug fixes here and there.
-
-
-version 2.0.0 alpha (09.11.2010)
-
- First version officially published after the project revival. :)
-
- [+] New project format with converter from the old projects.
- [+] New Linux execution engine, based on andLinux.
- [+] New icon set.
- [+] New help system, that allows multiply help files to be searched.
- [+] New interface to FASM compiler.
- [-] Many bugfixes here and there.
- [-] Little bug fixed in "Create new application" function.
DELETED doc/FASM.PDF
Index: doc/FASM.PDF
==================================================================
--- doc/FASM.PDF
+++ /dev/null
cannot compute difference between binary files
DELETED doc/FreshGuide.chm
Index: doc/FreshGuide.chm
==================================================================
--- doc/FreshGuide.chm
+++ /dev/null
cannot compute difference between binary files
DELETED doc/ManualRu/doc/FASM.doc
Index: doc/ManualRu/doc/FASM.doc
==================================================================
--- doc/ManualRu/doc/FASM.doc
+++ /dev/null
cannot compute difference between binary files
DELETED doc/ManualRu/doc/IA.doc
Index: doc/ManualRu/doc/IA.doc
==================================================================
--- doc/ManualRu/doc/IA.doc
+++ /dev/null
cannot compute difference between binary files
DELETED doc/ManualRu/hlp/FASM MANUAL.HLP
Index: doc/ManualRu/hlp/FASM MANUAL.HLP
==================================================================
--- doc/ManualRu/hlp/FASM MANUAL.HLP
+++ /dev/null
cannot compute difference between binary files
DELETED doc/source/0_advanced_setup.txt
Index: doc/source/0_advanced_setup.txt
==================================================================
--- doc/source/0_advanced_setup.txt
+++ /dev/null
@@ -1,231 +0,0 @@
-Setup manual
-# Chapter 4 Fresh IDE setup
-
- The upcoming version 3.0 of Fresh IDE will be fully portable, but until then,
-we have to use the Windows version of Fresh.
-
- Nevertheless, development of Windows and Linux applications in the same time is possible
- and easy with the current version of Fresh.
-
- The good news are that Fresh IDE runs like a charm in [Wine].
-
- So, now (since v2.0.5) we have a choice - whatever OS we choose we can develop applications
-for Linux and Windows, including editing, compiling, running and debugging. Of course we are
-talking about GUI applications.
-
- The installation of Fresh is easy, but if we want to use the full potential of the IDE
-some setup and adjustments are necessary. Let see how to setup Fresh IDE for work in Windows
-and Linux:
-
-[wine] http://www.winehq.org/
-
-
-## Windows setup
-
- In order to run Linux native applications inside Windows, Fresh uses special Linux
-distribution - [andlinux].
-
- *andLinux* is complete Ubuntu distribution, that uses coLinux kernel in order to allow
-running of Linux inside Windows OS.
-
-[andLinux] http://andlinux.org
-[andLinux download page] http://andlinux.org/downloads.php
-
- How to setup andLinux to work with Fresh?
-
-### Download andLinux
-
- Download andLinux package from [andLinux download page]
-
- There are two packages: "KDE version" and "minimal/XFCE version" available. For use with
-Fresh IDE, it is not important what version you will choose.
-
- KDE package is very big and very slow distribution that contains many bundled programs
-and tools, but in general you will not need them. The size of KDE package is 500MB download
-and 5GB installed.
-
- The XFCE package is relatively smaller and faster. Relatively means 200MB downloaded file
-and 2GB installed on the disk.
-
- It is obvious that the right choice is to use XFCE package.
-
-### Install andLinux
-
- Run the downloaded setup file and answer to the different questions of the
-setup wizard:
-
- * coLinux version - choose the stable version (0.7.4 in my case) instead of latest (0.8.0) -
-we shall work with andLinux, not to play.
-
- * Memory size - 256MB RAM (or maybe more - if you can afford it).
-
- * Install XMing server on your primary screen.
-
- * Sound - you can enable or disable sound in Linux option - it is harmless although
-it is one more running server.
-
- * Startup type + Panel - select *"run andLinux automatically as a NT service" + "use Windows shortcuts"*;
-It is not very important, but can save you a little manual work and troubles later.
-
- * andLinux login - just select your user name and password for Linux root.
-
- * Windows File Access - it is important! - select *"using CoFS"*, no matter it is not recommended.
-
- * File Access Using CoFS - important! - create one new directory somewhere and select it to
-be mount via CoFS. This will be the shared directory, visible from Windows and from Linux in the
-same time.
-
- All other features you can choose freely or simply leave them to default state.
-
- When you start installation, the installer will try to install network driver.
-It is possible Windows will protest and will atempt to mislead you by asking to not install
-not certified driver. You must ignore these attempts and firmly click "install".
-
- After the installation of andLinux, you have to restart Windows and probably andLinux will
-not run. :)
-
- It is because of the Windows firewall. All new network adapters are firewalled
-by default. As long as installed adapter (named TAP-Colinux) is virtual and local, you will
-not need any firewall, so, go to "Control panel/Windows firewall/Advanced" and uncheck
-"TAP-Colinux" adapter from the list of adapters.
-
- Then you can run some Linux program - in the Windows tray, there is a andLinux menu icon
-that have shortcuts to several Linux programs.
-
-
-### Additional tools
-
- Install several additional Linux tools. You will need additionally debugger and
-some decent terminal emulator. I choose xterm for terminal, because it is small and white by
-default. ;)
-
- You can choose to use the built-in terminal named in the simple Linux manner:
-"xfce4-terminal" and console debugger "gdb". In this case you can skip this step because these tools
-are already installed.
-
- Start "Synaptic" - package manager for Ubuntu from the tray menu. You have to enter root
-password you choose on install.
-
- When Synaptic is started, click "Reload" to refresh the package list from the network and
-then use search to locate needed programs. I personally recommend "xterm" as terminal and "ddd"
-as a GUI front end to "gdb".
-
- Well, I recommend "ddd" only because it is only Linux debugger that I was able to run under
-andLinux and able to show disassembled code of the program.
-
- Mark selected programs for install, click on Apply button and wait until downloading and
-installation.
-
- Here you can encounter only one problem - your computer is behind a proxy server.
-
- If the proxy is a normal proxy, you simply have to set its address and port in the
-Synaptic preferences and it should work.
-
- Completely another story is when the proxy is MS ISA server configured with NTLM user
-authorization.
-
- Most Linux programs can't work with such authorization and Synaptic is not an exception.
-
- Fortunately, there is a workaround of this situation. You need [ntlmaps] authorization
-proxy server.
-
- Setting up of this server is out of the scope of this article. On the ntlmaps home page you
-can read complete documentation and explanations.
-
- OK, we are ready with andLinux. Now you have working copy of Ubuntu inside your Windows box.
-
- It's time to configure Fresh to run Linux applications inside andLinux. Continue with:
-
-[ntlmaps] http://ntlmaps.sourceforge.net/
-
-### Fresh IDE configuration.
-
- Run Fresh and open "Options|IDE options" dialog. Select "Debuggers and Emulators" page.
- Then select following directories and commands:
-
- * "andLinux directory" - the directory where you installed andLinux.
-
- * "andLinux shared directory" - shared directory you selected during andLinux installation.
-
- * "Linux debugger" - Enter "ddd" (or whatever debugger you choose).
-
- * "Linux terminal" - Enter: `xterm -hold +mesg -e` - the options are important.
-
- *And voila! You finished the configuration!*
-
- Now you can load the source of some Linux program (for example "Fresh/examples/XLib/XLib.fpr") and run it with
-shift+F9 or load it in the debugger with shift+F8.
-
- Now Fresh IDE will detect when you compiled ELF executable and will run it in andLinux instead of
-Windows. Of course, the Windows applications will be treated as usually.
-
-
-## Linux setup
-
- Working in Linux needs Wine installation. Fresh is tested with v1.2 and 1.3 and works great.
-You can skip some steps if they are already set.
-
-### Install Wine
-
- Install Wine - use whatever package manager is good for you. Synaptic is the usual choice.
-In the "Wine configuration|Graphics" panel, uncheck the option "Allow the window manager to decorate the windows".
-
-### Install Fresh IDE
-
- Install Fresh IDE v2.0.5 or newer - you can use the installation package or ZIP
-archive. It is better (at least for v2.0.5) to install Fresh IDE in "c:\" but you can put it at
-whatever place you like.
-
-### Debuggers
-
- Install whatever debugger you will use for Linux applications and OllyDbg for
-Windows applications. (OllyDbg works in Wine).
-
- For Linux, personally I prefer [EDB] but any other is OK
-including mentioned in the previous chapter "ddd" and "gdb".
-
-[edb] http://www.codef00.com/projects#Debugger
-
-### Configure Fresh IDE
-
-Run Fresh IDE and if some paths are not set properly, set them manually in
-"Options|IDE options" menu.
-
- You will need at least following directory aliases: "Fresh", "finc" and "lib" - set
-them respectively to the Fresh main directory, Fresh "include" directory and "freshlib"
-directory, both located in Fresh main directory. (As a rule, there is an auto setup of these
-paths, so you don't to have to make it manually. But sometimes the algorithm fails)
-
- In order to work with FASM examples and programs, you can set manually "include" or any
-other alias (environment variable) you prefer.
-
-### External tools
-
- Set the paths to the external tools needed: (of course you have to install these
-tools in advance).
-
- In "Options|IDE options|Debuggers and emulators" leave "andLinux directory" and
-"andLinux shared directory" fields empty. (they are not needed when Fresh runs in Linux)
-
- Set "Linux debugger" field to binary file of the debugger you prefer. Add the needed
-options to the line as well.
-
- For example, in my settings "Linux debugger" is set to `z:/usr/bin/edb --run`
-
- Set "Linux terminal" to preferred terminal. For example `z:/usr/bin/xterm -hold +mesg`.
-
- Set "Win32 external debugger" to OllyDbg.
-In my case: `c:\Program files\OllyDebugger\Ollydbg.exe`.
-
- *All paths must be "dos style" (Note: Wine maps Linux file system to device Z: ).*
-
-### Test it
-
- Try to compile and run some test applications both for Windows and Linux.
-Ctrl+F9 should compile, Shift+F9 should run the application and Shift+F8 should load it
-in the respective debugger. The type of the application should be automatically determined.
-
- *IMPORTANT NOTE:* The only known problem (for Fresh v2.0.5) is that the first time compiled
-ELF is not set to be executable. So, you will get "access denied" message on run. The workaround
-is to set the permissions manually from the file manager, or console "chmod" command. It is one
-time procedure - the following compilations, runs and debugs should work properly.
DELETED doc/source/1_tips.txt
Index: doc/source/1_tips.txt
==================================================================
--- doc/source/1_tips.txt
+++ /dev/null
@@ -1,222 +0,0 @@
-Tips and tricks
-# Chapter 5 Fresh tips and tricks.
-
- There is still no full user guide for Fresh.
-
- I will write in this page some tips and tricks. Later, they will be used in the full user guide.
-
-
-## Linux support
-
-* How to develop Linux application from Windows?
-
-* How to develop Windows application from Linux?
-
-* What about Fresh IDE version for Linux?
-
- For now, Fresh is Windows application. The versions 2.x.x will be Windows applications.
-The upcoming v3.0.0 is planed to be portable - for Windows and Linux. Of course every port
-will be able to create applications for every OS.
-
- Despite of this situation, even the current versions can work in Linux through Wine.
-
- There is a separate [setup][setup manual] describing the setup of Fresh IDE for Linux development.
-
-[setup] 0_advanced_setup.htm
-
-## Goto address
-
- How to find the place in the source where application crashes?
-
- Press Ctrl+G in order to open "Goto address" dialog:
-
- [!goto][Goto address]
-
- Then enter the address where application crashes and press OK. Fresh will show you the
-line of the source that is compiled on the given address. The format of the number is standard
-FASM number format.
-
-
-## Code exploration and cross reference.
-
-There are several functions, aimed to provide easy exploration the source of the big project.
-
-### Labels explorer
-
-After compilation, you can browse all labels tree from the labels explorer. Open it from the
-main menu: `Project|Label explorer`.
-In the label explorer you can view the lables values, type and where in the source these labels
-was defined and used.
-
-### Editor cross reference
-
-If you position the text caret on some label and press Ctrl+R, or choose from context menu
-"Cross reference", a window with the cross reference information for this label will be open.
-
- [!cross][Cross reference]
-
-The first row of the table display the line of the source, label was defined.
-Following rows - the lines where the label is used. Besides the pointed label, all its
-children labels will be displayed.s
-
-If you double click on some of the rows, the editor will bring you to this line of source.
-
-The cross reference window can be closed by pressing *Esc* key.
-
-## Goto definition
-
-If you position the text caret on some symbol and press *Ctrl+D* or choose from the context menu
-"Goto definition", the editor will bring you to the line of the source where this symbol were
-defined.
-The project must be compiled for this function to work.
-
-## Embeded help
-
-Similar to "Goto definition" is the next function "Embeded help".
-
-If the definition of some symbol is preceded by comments block, describing this symbol, Fresh can
-show this description everywhere in the source, when you position the text caret on the symbol and
-press *Ctrl+W* shortcut.
-
-The hint window looks like on the screenshot:
-
- [!_images/EmbededHelp.png][Embeded help system]
-
-The hint window can be closed by pressing *Esc* key.
-
-## Arguments hint
-
- How to use "Procedure arguments hint"?
-
- [!procarg][Procedure argument hints]
-
- This function works with call macros: *stdcall, ccall, invoke and cinvoke*;
-
- When you type such line and the function is known (the source have to be compiled prior to
-that moment) Fresh shows a hint window that helps you to enter the arguments. This happens
-automatically when you type "," somewhere in the line.
-
- When you want to open the hint window without typing (just for check up) you can press
-Ctrl+Q when the caret is at the line. You can close the hint window, pressing *Esc* key.
-
- "Procedure argumens hint" works for the procedures defined in the compiled source and if
-the program uses import definitions from FreshLib, for imported functions as well.
-
-## Code completion
-
- How to type less and to code more?
-
- [!code][Code completion]
-
- Code completion is very powerful function, that can save you thousands of keystrokes.
-In order to use it, the source have to be compiled (at least partially - some errors are
-acceptable) because Fresh have to build the tree of labels, defined in you program.
-
- Fresh does not use fixed pre-defined lists. It uses the labels you defined in the source.
-
- This is the only possible solution, because Fresh is not committed to any particular OS or
-platform. If you write Win32 program, you need Windows API and constants in the auto completion box.
-If you write Linux program, you need all Linux constants and API functions.
-
- To open code completion, press *Ctrl+Space* shortcut. Then when you type, the content of the box
-will be refreshed in order to correspond with the word you type.
-
- You can select suitable element from the list with *Up, Down, PgUp and PgDn* keys
-and press *Enter* to insert it in the line.
-
- Auto competion list will open automatically when you type some existing in the list label
-and then press *"."* in order to select local label.
-
- You can close the auto completion window with *ESC* key.
-
-## Project categories
-
- How to move a file from one category to another in the project?
-
- Open the file in the editor. Select the category where you want it to be moved.
-Click the right mouse button on the tab of the file in order to display the context menu.
-Select "Add to project" function. It will remove the file from the old category and will
-move it to the current selected category.
-
-## Fast open files
-
- How to open the file specified in "include" or "file" directive?
-
- Place the caret on the line that contains file name and press Ctrl+Enter.
- Opening files this way, Fresh replace the directory aliases and/or environment
-variables in the filename.
-
- Files like `%lib%/%TargetOS%/MyFile.asm` will be opened correctly.
-
-## Directory aliases
-
- How to set promptly the values of the environment variables?
-
- Fresh have very flexible system of environment variables handling. Actually I prefer to call them
-"Aliase", because they are aliases of the directories or other text.
-
- You can define such aliases in three ways:
-
-* As OS environment variable.
-
-* As IDE-wide aliases in the Fresh IDE options dialog ("Options|IDE options|Aliases" menu).
-
-* As Project-wide aliases in the project options (Project|Project options" menu or Ctrl+F12 shortcut)
-
- When exists alias defined several times, then the project aliases have higher priority, then
-the IDE aliases and with lowest priority are the OS environment variables.
-
- Now on the topic: The project aliases allows rapid value change. In order to use this
-feature, you have to define the alias with several values, delimited with "|" symbol.
-The count of different values is not limited.
-
- One typical example is the alias %TargetOS% used in the FreshLib test project.
-This alias may have as values the names of the OS, the project will be compiled for.
-So, in order to switch quick from Win32 to Linux we can define TargetOS as "Win32|Linux".
-
- In this case, at the top of the project window appears popup menu, where you can select what of these
-values to be used. Additionally, the panel "Settings:" will display currently selected values.
-
- [!alias][Alias fast change]
-
-## Portable applications
-
- How to write portable assembly applications with Fresh IDE?
-
- Most people think that assembly language can't be portable. It is not the case. There are many
-examples that assembly can be portable. It is only matter of the project design, not the language.
-
- In order to allow creating of portable applications, FreshLib was created. It is work-in-progress,
-but even now it allows creating of small applications that can be compiled for Win32 and Linux platforms
-without change of the source.
-
- Read the unfinished [FreshLibRef][FreshLib reference manual]
-and check the sources of FreshLib in "Fresh/freshlib" directory of your Fresh IDE installation.
-There is a working test project called TestFreshLib.fpr that I use to test different FreshLib features.
-
-Also, you can create FreshLib projects from template engine. Choose "File|New Application" from the
-main menu or press *Shift+Ctrl+N* shortcut.
-
-In the dialog window, select the target directory and application template -
-"FreshLib portble console application" or "FreshLib portable GUI application",
-then click *"OK"* and new project will be created.
-
-Press *Shift+Ctrl+S* to save all new created files (you can change the filenames to whatever you like).
-
-Then you can compile your application to Linux or Windows executable file.
-
-The latest development version of FreshLib can be downloaded from the [rep][repository] - *FreshLibDev* branch.
-
-[FreshLibRef] 2_FreshLibDoc.htm
-
-[rep] http://chiselapp.com/user/johnfound/repository/FreshIDE/
-
-[!goto] _images/goto.png
-
-[!procarg] _images/ProcArgumentsHint.png
-
-[!code] _images/CodeCompletion.png
-
-[!alias] _images/AliasFastChange.png
-
-[!cross] _images/CrossReference.png
DELETED doc/source/2_FreshLibDoc.txt
Index: doc/source/2_FreshLibDoc.txt
==================================================================
--- doc/source/2_FreshLibDoc.txt
+++ /dev/null
@@ -1,3304 +0,0 @@
-FreshLib reference
-# Chapter 6 FreshLib reference
-
-## Overview
-
-FreshLib is an assembly library aimed to ease the development of assembly
-language applications, freely portable between different platforms,
-such as Win32 or Linux.
-
-The library is coded in [FASM][flat assembler] syntax
-and is intended to be easily used within [Fresh IDE],
-although it could be used for plain FASM development.
-
-The library consists of two layers: one, that is OS dependent and
-a second one that is OS independent. The OS dependent layer is very
-small, in order to help porting it for different OSes. This layer
-only makes interface to the core OS functions, such as memory allocations,
-file access, drawing functions, simple window management etc.
-
-The OS independent layer is responsible for the main application functionality
-allowing creation of different kind of windows and controls, processing of the
-system messages, work with dynamic strings, arrays and other data processing.
-
-FreshLib is mainly intended for developing GUI applications, as they
-are the most challenging to be ported across different platforms.
-FreshLib is also created with visual programming in mind, so it contains
-a flexible, event driven and OS independent template engine allowing
-visual creation of application user interfaces.
-
-FreshLib is in early development stage and probably will be changed
-many times in order to reach their objectives: to be small, fast and
-easy to use.
-
-The main intention is to keep the bloat off the library, but containing
-all necessary accessories for comfortable programming of a very wide
-range of applications.
-
-The architecture of FreshLib is open and it can be freely expanded
-with other libraries without increasing the size of applications.
-In other words, only those parts of the library that are effectively
-used will be compiled on the final executable.
-
-------------------------------------------------------------------------
-
-## About this manual
-
-This manual is a "work in progress". Any
-part of it can be changed at any time.
-
-Of course, some of the libraries described in this document are more
-stable and finished like the macro, system and data libraries. Therefore,
-the chapters about these libraries are less likely to be changed.
-Other libraries (like graphics and GUI), will be heavily modified
-so the manual will be changed accordingly.
-
-
-------------------------------------------------------------------------
-
-## Structure of the library.
-
-FreshLib contains many code and macros libraries, structured hierarchically
-and depending on each other. Here is shown a part of the library directory tree:
-;begin
- freshlib/
- compiler/
- Linux/
- Win32/
- data/
- Linux/
- Win32/
- dialogs/
- Linux/
- Win32/
- ...
-;end
-The library is structured to support different platforms transparently.
-You can see, that the tree consists of main sub-directories, that
-contains OS independent libraries, separated by topics.
-For example *system* subdirectory contains libraries for accessing system
-resources such as memory, files, etc. *data* contains libraries for data
-handling and so on.
-Every topic directory have also several sub-directories, that contains OS
-dependent code these directories are named after the platform they serve.
-(In this moment only Linux and Win32 OSes are supported).
-
-------------------------------------------------------------------------
-
-## Compiler setup for FreshLib use.
-
-You can use any FASM compiler to compile applications that uses FreshLib.
-In order to be compiled properly, FreshLib needs environment variables
-named `lib` and `TargetOS` to be defined.
-
-The variable `lib` contains the path to the main directory of FreshLib
-and the variable `TargetOS` contains the target platform, the application
-will be compiled for. The value of `TargerOS` is identical to the name of
-OS dependent directories in FreshLib.
-
-There are several ways these variables to be defined, depending on
-the compiler you use [FASM], [FASMW] or [Fresh IDE].
-
-1. These variable can be defined in the OS environment - see your OS documentation for details.
-this approach is more universal - it works for all kind of FASM compilers. The main drawback is
-that you have to use OS specific commands and probably will have to edit some system files.
-
-1. Definition in the section `[environment]` of *"fasm.ini"* or *"Fresh.ini"* file, depending on the
-IDE you are using. This approach works for both FASMW and Fresh IDE, but in Fresh, the same
-effect can be done from inside the IDE. Besides, defined this way, the environment variables
-becomes "global" - active for all projects compiled with FASMW or Fresh.
-
-1. From inside Fresh IDE.
-
-In Fresh IDE, the environment variables are named *alias*,
-because they serve to provide short alias for the file paths. Two types of alias (environment variables)
-lists are supported by Fresh: *global aliases* and *project aliases*. Global aliases are
-defined in the IDE options dialog: *Options|IDE options|Aliases*. Here is the screenshot
-of this dialog:
-
- [!_images/AliasesDlg.png][IDE options dialog, section "Aliases"]
-
-The global aliases are active for every project compiled with Fresh and are stored in the Fresh.ini file,
-inside the Fresh program directory.
-
-Project aliases are defined in the Project options dialog: *Project|Project
-options* or from the project manager, click on the button *Settings* at the top
-and select *Project options*. The project options dialog is shown on the following screenshot:
-
- [!_images/ProjectOptions.png][Project based aliases can be edited in the project options dialog.]
-
-The project aliases are stored inside the project file (.fpr) and they are project specific.
-
-For FreshLib it is not important what list will be used, but it is
-more convenient for `lib` variable to be defined in the global list
-and for `TargetOS` variable to be defined in the project aliases. In such way
-the common parameter (the place of the library) will be set once for all projects, and
-the particular parameter (the target OS) will be set separately for every project.
-
-Also, there is very convenient way of changing the value of project
-aliases — if several values are specified in the project alias, separated
-with `|` char (for example: `Win32|Linux`), Fresh will provide fast switching
-between these values from the project manager options menu, as shown on the picture:
-
- [!_images/fastswitch.png][The aliases with more than one value will appear in the popup menu for fast changing.]
-
-When Fresh searches for needed alias names, during the compilation, it searches first in the project
-aliase list, then the global aliases and at the end, the OS environment variables. Of course, if
-the alias is not found on these places, the compilation fails with error.
-
-
-[FASM] http://flatassembler.net
-
-[FASMW] http://flatassembler.net
-
-[Fresh] http://fresh.flatassembler.net
-
-[Fresh IDE] http://fresh.flatassembler.net
-
-------------------------------------------------------------------------
-
-## FreshLib compiling options
-
-FreshLib uses some options in order to set the behavior of the compiler and the
-different macro libraries.
-These options are defined as a local constants of the label *"options."*
-Here is a list:
-
-[#options.FastEnter] `options.FastEnter` controls the behavior of the [#proc] macro.
-
-When *options.FastEnter = 1* the procedure entry/leave code will be created with
-faster, but bigger push ebp/pop ebp instructions.
-
-When *options.FastEnter = 0* — enter/leave instructions are used.
-
-[#options.ShowSkipped] `options.ShowSkipped` controls the information displayed during compilation.
-
-When *options.ShowSkipped = 1* the compiler will display in the output window the procedures
-that are not compiled because they are not used in the program.
-
-[#options.ShowSizes] `options.ShowSizes` controls the behaviour of the DispSize macro.
-
-When *options.ShowSizes = 0* the macro [#DispSize] will be disabled.
-
-[#options.DebugMode] `options.DebugMode` controls the behaviour of the debug macros.
-
-When *options.DebugMode = 1* the macros from [#simpledebug] library will generate debug code and
-debug console will be created on running the application.
-
-When *options.DebugMode = 0* these macros will not generate code and the debug console will not be
-created.
-
-------------------------------------------------------------------------
-
-## FreshLib code conventions
-
-### Naming conventions
-
-1. The names prefixed with one or more underscores ("_") are not recomended for use by the user.
-These are internaly used labels that can be changed later. More underscores in the prefix -
-more "internal" is the given identifier.
-
-For example one underscore ( like this: `_AlmostPrivate`) means - "use it carefully".
-
-Three underscores (for example `___SomeVeryPrivateLabel`) means - don't use it at all.
-It is for internal use only and will be changed later!
-
-2. The names are considered to be used with code completion editor - i.e. there is no long equal
-prefixes of the names, but there are short "class" prefixes.
-For example most of the procedures in StrLib begin with "Str" prefix.
-
-3. In general, FreshLib uses [CamelCase] naming convention, with constants in lowerCamelCase and
-procedures in HigherCamelCase.
-
-4. All local labels and procedure arguments are prefixed with dot — ".";
-
-5. Almost all of the [#struct] and all of [#object] definitions are prefixed with "T" prefix — for
-example [#TTimer] or [#TButton]
-
-6. The file names convention. All file names with extension `.inc` doesn't contain any code or
-data definition. Only macro and constants definitions are permitted.
-
-The files with '.asm' extension can define code and data. Although, the code and data in FreshLib
-can exists in the compiled binary, only if they are used. Not used data or code, included in
-the binary should be considered a bug.
-
-[CamelCase] http://en.wikipedia.org/wiki/CamelCase
-
-
-### Register preserving convention
-
-1. The rule is - preserve all you are using. All procedures in FreshLib preserves all registers,
-except these used for returning result values.
-
-;quote
-Note: There is some small retreat from this rule - in the object handling procedures, some register
-are preserved internaly, so the user may not preserve them in its code. See [#object.asm] library
-for details.
-;end
-
-2. CF is widely used for returning error status or boolean result.
-As a rule *CF=0* means no error; *CF=1* means error.
-
-The use of CF is described always in the description of the respective procedures.
-
-3. The procedures can return result in more than one register. As a rule, EAX is the result register
-for the most procedures, but sometimes other registers are used - in order to provide better
-interface for assembly programming.
-
-For example number of procedures return X,Y values in EAX, EDX registers.
-
-* EAX — commonly used for returning 32bit values;
-
-* EDX — second choise - used together with EAX for 64 bit values, or as a second returned value.
-
-* ECX — usually some count. For example if EAX returns pointer to some memory, ECX will contains the
-data size. See [#LoadBinaryFile] for example.
-
-------------------------------------------------------------------------
-
-## Using FreshLib
-
-There are only two files, the user should include in order to use FreshLib. They are both located
-in the "freshlib" directory, usually referred by %lib% directory alias.
-
-These files are:
-
-* `%lib%/freshlib.inc` - contains all macro and OS dependent equates definitions.
-
-* `%lib%/freshlib.asm` - contains all code of FreshLib. Only the used code will actually be included
-in the result binary.
-
-The minimal application with FreshLib have following code:
-
-;begin
-include "%lib%/freshlib.inc"
-
-@BinaryType GUI
-
-include "%lib%/freshlib.asm"
-
-start:
- InitializeAll
-
- ; Place your code here
-
- FinalizeAll
- stdcall Terminate, 0
-
-@AllImportEmbeded
-@AllDataEmbeded
-;end
-
-The macros [#@BinaryType], [#@AllImportEmbeded], [#@AllDataEmbeded] will be explained later in the
-next chapter.
-
-------------------------------------------------------------------------
-## Data definitions in FreshLib program
-
-FreshLib uses advanced data definitions macros, that allows data definitions to be mixed with the
-code, but then to be grouped and inserted in the data section of the program.
-This kind of definitions greatly improves the readability of the program, because keeps the data
-near to the code that uses it. It is especially important on big projects where the code is spreaded
-among multiply files.
-There are two main types of data - uninitialized and initialized data.
-
-The initialized data definitions are enclosed inside [iglobal], [endg] macros and the uninitialized
-data in [uglobal], [endg] macros. Inside these blocks you can use all FASM data definition directives
-or any other valid FASM code. Note only, that in `uglobal` block only the size of the data matters,
-if you use some defined data, the values will be lost.
-
-;begin
-iglobal
- MyGlobalVar dd 123, 456, 789
-endg
-
-uglobal
- SomeUndefinedVar rd 1
- SomeArray rb 256
-endg
-
-;end
-
-Another useful macro is [text] (actually it is struc). It defines some string constant anywhere in
-the source code. The string constant is later defined in the data section of the program.
-
-When used data definition macros, the user should define the data section with the macro [@AllDataEmbeded] or
-[@AllDataSection] somewhere at appropriate place in the program, where all data should stay.
-
-
-------------------------------------------------------------------------
-
-
-## FreshLib directory "compiler/"
-
-This directory contains only one macro library: *"executable.inc"*
-
-### "executable.inc" library
-
-This library defines the macros that are going to be used for creating the main structure of
-the program. The implementation of these macros is OS dependent, as long as the type of the
-executable file is OS dependent: PE for Win32 and ELF for Linux. The use of the library, however
-is OS independent and is common for all supported OSes.
-Depending on the value of `TargetOS` alias, the library will create PE executable or DLL
-`(%TargetOS%='Win32')`, or ELF executable or shared library `(%TargetOS%='Linux')`
-
-*NOTE:* Every of the macros from this library must used only once in the program.
-
---------------
-
-[#@BinaryType] `macro @BinaryType type`
-
-This macro sets the type of the executable. The argument `type` can accept one of the following
-values: `GUI`, `console` or `DLL`.
-
-This macro also begins the main code section of the executable and defines the entry label of the
-program. The entry label is fixed to `start:`.
-
-For example, following code will tell the compiler to compile the program as a GUI application:
-;begin
- include '%lib%/freshlib.inc'
- @BinaryType GUI
-;end
-
---------------
-
-[#@AllDataSection] `macro @AllDataSection`
-[#@AllDataEmbeded] `macro @AllDataEmbeded`
-
-These macros defines all data definitions in the program, defined in `uglobal` and `iglobal` blocks
-and the text constants defined using `text` macro.
-
-@AllDataSection, defines the data in a separate program "section". The meaning of the "section"
-term is different, depending on TargetOS definition. In Win32 it is `section '.data' data readable writeable`.
-In Linux it is `segment readable writeable`
-
-@AllDataEmbeded defines the data, embeded in the code section of the program (created by @BinaryType macro).
-
-Only one of these macros must be used. Usually @AllDataEmbeded will create smaller executable, although
-some negative effects are possible, because embeded data and code is often considered "bad practice"
-
---------------
-
-[#@AllImportSection] `macro @AllImportSection`
-[#@AllImportEmbeded] `macro @AllImportEmbeded`
-
-These macros automatically defines the import section of the program. This section is created
-automatically depending on what functions was used in the program.
-
-Similar to the data section macros, @AllImportSection will create this data as a separate section,
-while @AllImportEmbeded will try to embed this data in the code section.
-(NOTE: In ELF executable format, the import data must be in separate segment, so
-on TargetOS=Linux @AllImportSection and @AllImportEmbeded are equal.)
-
-If embeded import section is used together with embeded data section, the import section should be
-defined before the data section, because of undefined data definitions, that must reside at the end
-of the section (code section in the case of embeded data).
-
-------------------------------------------------------------------------
-
-## FreshLib directory "equates/"
-
-[#allequates.inc] *"allequates.inc"* library. This library defines all
-constants and structures needed for OS dependent parts of FreshLib.
-
-Actually, the user should never use these constants and structures in the portable program.
-
-The constants and structures that the user should use are defined in the respective libraries,
-not in *"allequates.inc"*.
-
-This library will be included automatically by "%lib%/freshlib.inc" file, so the user should not care
-about this library at all.
-
-------------------------------------------------------------------------
-
-## FreshLib directory "imports/"
-
-[#allimports.asm]Another directory that contains only OS dependent definitions is *"imports/"* with a library
-file to be included in the project: *"allimports.asm"*
-
-This file is automatically included in the [#@AllImportSection] and [#@AllImportEmbeded] macros.
-Then it will generate the proper import section, depending on the target platform and functions used
-by the OS dependent parts of FreshLib.
-
-FreshLib contains very big catalog of shared libraries for Windows and decent set of Linux
-shared libraries. The import macros used by FreshLib includes in the import section of the
-program, only the functions used by the program, so it will never define redundant import items.
-
-The user must never call directly imported functions from inside a portable application, except if
-the imported dynamic library is portable as well. (as sqlite3.dll, for example)
-
-------------------------------------------------------------------------
-
-## FreshLib directory "macros/"
-
-This directory contains several libraries that provides common convenience functions to be
-used with big assembly projects.
-
-All these libraries will be included automatically in "%lib%/freshlib.inc" file.
-
-There is no overhead including all these libraries, because there is no code to be generated,
-just macro definitions.
-There is a little delay in compile time but thanks to fasm's speed, it is barely noticeable.
-
-Lets examine each one of these libraries.
-
-### "_stdcall.inc" library
-
-In general this library provides ways of definition and invoking of the procedures with
-argument passing through the stack. It supports STDCALL and CCALL calling conventions.
-
--------------------
-
-[#proc] `macro proc name, [arg]`
-[#begin] `macro begin`
-[#endp] `macro endp`
-[#return] `macro return`
-[#cret] `macro cret`
-[#locals] `macro locals`
-[#endl] `macro endl`
-
-These macros define a procedure, create a stack frame for the local variables and define
-symbolic names for the arguments. The macro "proc" defines the global label "name" as a name
-for the procedure. All arguments and local variables are defined as a local labels with regard
-to the name of the procedure. That is why all arguments and local variables must have names
-beginning with dot.
-
-Between the line with *proc* and *begin*, any number of local variables can be defined.
-The macro *begin* marks the begining of the procedural code.
-
-The macro *endp* marks the end of the procedural code.
-
-The return from procedure instruction is provided by macros *return* or *cret* depending on
-the calling convention we want to use: *return* clears the arguments from the stack and *cret*
-does not.
-
-Inside the procedure, a secondary stack frame can be allocated with the pair *locals* and *endl*.
-All data definitions, enclosed between these macros will define a secondary stack frame that
-is a continuation of the stack frame defined between *proc* and *begin*.
-
-Any number of *locals* and *endl* pairs can be used, but all of these secondary stack frames
-will overlap between each other. This feature is specially intended to provide savings of stack
-space and at the same time, to provide talking variable names for the different parts of more
-complex procedures.
-
-For example (in Win32) let we have complex window procedure that have to process
-multiple messages.
-
-One of the message handlers may need one variable `.rect`.
-
-Another message handler may need two variables called `.point1` and `.point2`.
-
-But the procedure as a whole is never going to need all those variables at the
-same time, because it process only one message at a time. On the other hand it
-may need the variable `.ctrldata` for every message processed. The optimal solution
-is to define the variables as shown in the following example:
-
-;begin
- proc CtrlWinProc, .hwnd, .wmsg, .wparam, .lparam
- .ctrldata dd ?
- begin
- invoke GetWindowLong, [.hwnd], GWL_USERDATA
- mov [.ctrldata], eax
-
- cmp [.wmsg], WM_MESSAGE1
- je .message1
- cmp [.wmsg], WM_MESSAGE2
- je .message2
- return
-
- .message1:
- locals
- .rect RECT
- endl
- ; do something.
- return
-
- .message2:
- locals
- .point1 POINT
- .point2 POINT
- endl
- ; do something.
- return
- endp
-;end
-
-The assignment of the stack memory for the above example is shown in the table:
-;table
-(1, 2) Address
-
-(3, 1) Stack frames
-;-----------------------
-Common
-
-Locals 1
-
-Locals 2
-;-----------------------
-EBP-20
-
---
-
-.rect.left
-
-.point1.x
-;-----------------------
-EBP-16
-
---
-
-.rect.top
-
-.point1.y
-;-----------------------
-EBP-12
-
---
-
-.rect.right
-
-.point2.x
-;-----------------------
-EBP-8
-
---
-
-.rect.bottom
-
-.point2.y
-;-----------------------
-EBP-4
-
-.ctrldata
-
---
-
---
-
-;end
-
-;;begin
-;;+---------+---------+--------------+-------------+
-;;| | Stack frames |
-;;+ address +---------+--------------+-------------+
-;;| | common | locals 1 | locals2 |
-;;|:-------:|:-------:|:------------:|:-----------:|
-;;| EBP-20 | | .rect.left | .point1.x |
-;;| EBP-16 | | .rect.top | .point1.y |
-;;| EBP-12 | | .rect.right | .point2.x |
-;;| EBP-08 | | .rect.bottom | .point2.y |
-;;| EBP-04 |.ctrldata| | |
-;;+---------+---------+--------------+-------------+
-;; Procedure local labels memory map.
-;;end
-
-As you can see, *.rect* occupies the same memory as *.point1* and *.point2*,
-but *.ctrldata* is never overlapped and exists independently.
-
-As a general rule, you have to use the definitions between "proc" and "begin" for local
-variables that are used in every call of the procedure and separate locals/endl definitions
-for variables needed for the particular branches inside the procedure.
-This approach will always provide the optimal size for the locals stack frame.
-
---------------------
-
-[#initialize] `macro initialize`
-[#finalize] `macro finalize`
-
-The macros "initialize" and "finalize" defines one special type of procedures that, during
-compilation are registered in a two separate lists - one for "initialize" and one for
-"finalize" procedures. Procedures defined with "initialize" and "finalize" must have no any
-arguments.
-
-After that, using the macros "InitializeAll" and "FinalizeAll", all these procedures can be
-call at once. "initialize" procedures are call in the order of their definition and "finalize"
-procedures in reverse order.
-
-These macros provides standard and consistent way for initialization and the
-finalization of the libraries and modules of the application.
-
-FreshLib uses this mechanism and the user is free to use it also.
-
-
--------------------------
-
-
-[#stdcall] `macro stdcall proc, [arg]`
-[#ccall] `macro ccall proc, [arg]`
-[#invoke] `macro invoke proc, [arg]`
-[#cinvoke] `macro cinvoke proc, [arg]`
-
-These macros call the procedures with STDCALL and CCALL calling convention.
-
-`stdcall` macro pushes the arguments to the stack in reverse order and then call
-the procedure with label *proc*. As long as the macro "stdcall" does not provide
-any stack cleanup (this duty is assigned to the procedure) the arguments can be
-pushed in free manner using, for example, separate push instructions for part of
-the arguments and arguments in the stdcall line for the remaining arguments.
-This can be very convenient in some cases. For example see the following source:
-;begin
- stdcall CreateSomeObject
- push eax
- stdcall DoSomething
- stdcall DeleteSomeObject
-;end
-Here, the procedure DoSomething changes the value of eax, so the handle is saved
-in the stack. The procedure DeleteSomeObject needs one argument — a handle of
-the object. But as long as the proper value is already in the stack, it is
-mindless to pop the value and then to push it again. So the source calls
-DeleteSomeObject without any arguments. The procedure knows the proper number
-of arguments (one in this example) and clean the stack properly.
-
-The standard (and wrong) approach is to pop the argument from the stack and then
-to pass it to the procedure explicitly is the stdcall statement:
-;begin
- stdcall CreateSomeObject
- push eax ; save the handle.
- stdcall DoSomething
- pop eax ; ??? Why ???
- stdcall DeleteSomeObject, eax
-;end
-This source will generate the meaningless instructions sequence:
-;begin
- pop eax
- push eax
-;end
-*invoke* macro is the same as "stdcall" with the only difference - it calls the procedure
-indirectly ( `call [proc]` instead of `call proc` ). This mechanism usualy is used to call
-the functions imported from external dynamic linked libraries.
-Of course, the imported functions can be call with `stdcall [someproc]` but the *invoke*
-macro helps to better distinguish what procedures are imported and what are internal for the
-program.
-
-*NOTE:* The user should never use *invoke* in the portable programs, because such programs
-never use directly OS dependent import functions.
-
-
-*ccall* macro calls a procedure with CCALL convention. This means that the procedure returns
-with simple "retn", without cleaning the parameters from the stack. Then "ccall" macro provides
-instructions that remove the arguments from the stack.
-
-Because ccall have to know the exact count of passed arguments, all arguments have to be passed
-explicitly as a values in the ccall statement.
-Tricks as described above will not work properly and leads to stack not properly cleaned after
-the call.
-
-"cinvoke" is the same as ccall, but using indirect call. The reason for existing of "cinvoke"
-macro is the same as with "invoke" macro — better legibility of the source.
-
-*About the calling conventions:* While all Win32 dynamic linked libraries uses STDCALL
-convention, most (if not all) of Linux libraries uses CCALL convention.
-
-*All code libraries of Fresh use STDCALL calling convention and it is platform independient.*
-
--------------------------------------------------------------------------------------
-
-### "_globals.inc" library
-
-This library defines several macros intended to deal with data definitions.
-
-Usually all data definitions have to be placed in special section of the
-executable file. ([#_DataSection] in FreshLib). This is not very convenient, because the code
-that process this data and the data definitions must reside in separate places of the source
-code, and in most cases even in different files.
-
-The idea of *"globals.inc"* macro library is to allow the data definition to be
-described anywhere in the source code, but these definitions to be defined at
-once, at the place the programmer wants - usually in the data section of the
-program.
-
---------------------
-
-[#uglobal] `macro uglobal`
-[#iglobal] `macro iglobal`
-[#endg] `macro endg`
-[#IncludeAllGlobals] `macro IncludeAllGlobals`
-
-*uglobal* begins block for undefined data definition. The block ends with *endg*
-macro. Between "uglobal" and "endg" macro any count of data definitions can be
-inserted.
-
-Note that because uglobal block defines undefined data, it is only the labels
-and the size of data that have meaning inside this block. Any data, defined with
-data definition directive will not increase the size of the executable file, but will
-be allocated when the executable is loaded in the memory.
-
-The undefined data will be defined later at the place where "IncludeAllGlobals"
-macro resides. In order to not increase the size of the executable file,
-the undefined data is always placed at the end of all data definitions.
-
-"iglobal" macro, again combined with "endg" defines initialized data. The data
-defined in the block will be created at "IncludeAllGlobals" statement.
-
-This block increases the size of the executable file, because it contains
-sensible data, that have to be included in the file.
-
-Actually, neither *uglobal*, nor *iglobal* blocks defines any data immediately.
-Instead, the data definitions are stored in a list. The real definition occurs
-later, when *IncludeAllGlobals* macro is invoked.
-For this reason, *IncludeAllGlobals* must be placed in the source after all used
-global data blocks.
-
-The programmer should never use explicitely IncludeAllGlobals. This macro will be invoked
-on [#@AllDataSection] or [#@AllDataEmbeded] macros use.
-
----------------------
-
-[#text] `struc text [val]`
-
-The macro *"text"* is actually a structure. It needs to be preceded by some label name.
-
-This macro accepts string or number arguments. When it is invoked with string arguments,
-it defines a zero terminated string constant, and also a local constant *.length*
-equal to the length of the string without terminating zero. When invoked with number as argument,
-*"text"* defines label at the address *val* and does not defines .length constant.
-
-The *"text"* macro, the same way as *iglobal* and *uglobal*, simply stores string data for
-defer definition. This definition, occurs in IncludeAllGlobals invocation.
-Note that the real definition will be made only if the string is used in the program.
-Not used strings will not be defined.
-
-Look at the following example:
-;begin
- myName text 'John',$20,'Smith'
-;end
-This code will define the data and constant labels following way:
-;begin
- if used myName
- myName db 'John Smith'
- .length = $-myName
- db 0
- end if
-;end
-
-Why to define separate macro for the strings and not to use the normal iglobal
-block? At first, *text* macro defines a real data only if this data is used
-somewhere in the source. This way is prevented bloating of the code with
-unneeded data definitions.
-
-;quote
-Also, the macro "text" was planned to check the strings
-content and to not define any string more than once. In the case of repetitive strings,
-this macro should return the pointer to the already defined string constant.
-
-In that case, it would be very convenient and harmless to use unnamed string constants
-in the function calling macros - stdcall, ccall etc.
-
-Unfortunately, regardless of the power of fasm macro language, this functionality
-cannot be implemented. Or, more precisely, it can be implemented, but the
-implementation is too slow for any real project use.
-
-This ineffective implementation is still leaved inside the file *"_globals.inc"* -
-commented block that defines macro with name "*InitStringList*". If someone have
-ideas about fixing this problem, please send it to me!
-;end
-
-------------------
-
-[#var] `macro var expr`
-
-The macro *var* defines dword variable with a given value. The use is following:
-;begin
- var MyVar = 1234
-;end
-The only differens from the usual use of *dd* directive is that the variable will be
-defined only if used in the source.
-
-Note that the variable is created at the place where *var* is used, so you need to place it
-inside a *iglobal* block if you want it to be defined in the global data place.
-
----------------------
-
-### "_struct.inc" library
-
-This library contains only two simple macros:
-
-[#struct] `macro struct name`
-[#ends] `ends`
-
-*struct* macro is aimed to provide easy creation of data structures. The "struc"
-directive in FASM is known to not create actual labels, but only the template
-for the label definitions. So, we need to create an instance of the data
-structure in order to have addresses and offsets of its fields.
-
-But very often we don't have static data structure of the given type, but data
-structure, pointed by some of the registers. In this case in order to use
-offsets to the fields of the data structure, we need to define at least one
-virtual instance of the structure at address 0. Then we can use the values of
-the fields as an offsets in the instructions - for example:
-;begin
- mov eax, [esi+RECT.right].
-;end
-So, this is exactly what "struct" macro does. Besides it defines the "struc"
-structure with the given fields, it creates a single virtual instance of this
-structure, in order to be used later for register addressing.
-Also, the macro defines local constant of *sizeof.* global label equal to the
-byte size of the structure.
-In all remaining functionality it behaves exactly as the struc directive.
-
-The syntax of struct macro is the following:
-;begin
- struct StructureName
- .field1 dd ?
- .field2 RECT
- .fieldN:
- ends
-;end
-The definition begins with "struct" followed by the structure name.
-The definition ends with "ends" directive. Between both, any local label
-definition becomes a member of the structure.
-The above definition, results in following code:
-;begin
- struc StructureName {
- .field1 dd ?
- .field2 RECT
- .fieldN:
- }
- virtual at 0
- StructureName StructureName
- sizeof.StructureName = $
- end virtual
-;end
-
---------------------------------------------------------------
-
-### "_display.inc" library
-
-This library contains macros that enhance the functionality of standard FASM
-"display" directive.
-
-
-[#disp] `macro disp [arg]`
-
-The macro "disp" displays the strings given in the arguments, just as "display"
-FASM directive does. Additionally it can display numbers in any given radix:
-;begin
- disp
-;end
-
----------------
-
-[#DispSize] `macro DispSize Text, Sz`
-
-"DispSize" is very specialized macro, that displays the text and number in
-the following form:
-;begin
-Size of [Text] is: Sz bytes
-;end
-The size number is automatically scaled to bytes or kbytes, depending on the
-value of Sz.
-
-This macro allows easy display and control of the sizes of particular areas of
-the program - data structures, subroutines etc.
-
-DispSize macro behavior is controlled by [#options.ShowSizes] option.
-
------------------
-
-[#display] How Fresh implements "display" directive
-
-There are some specifics in Fresh, concerning message displaying. The "display"
-directive in Fresh works in a slightly different way than the original FASM directive.
-
-It outputs text in Fresh message window. Each message can have one of six icons,
-or it can have no icon at all. And because message window is implemented as a
-TreeView control, you can organize your messages into groups (directories).
-
-Implementation is a bit "tricky" - when you display a character whose code is
-less than 16, it is interpreted in a special way. Characters from 1 to 6 set an
-icon of current message. It sounds complicated, but it is quite simple. Try:
-;begin
- display 2, "some message"
-;end
-It will display "some message" with an error icon. Another codes are used for
-controlling directory structure. Try to type following lines and see what would
-happen:
-;begin
- display 3, "message at root", 0x09
- display 3, "child message1", 0x0a
- display 3, "child message2", 0x0d
- display 3, "again at root", 0x0a
-;end
-Of course you don't have to put each message in separate display directive, you
-can, with the same result write:
-
-display 3, "at root",$09,3,"child1",$0a,3,"child2", $0d,3,"again at root",$0a
-
-Here is the complete list of all special characters and their meanings:
-;table
-char
-
-meaning
-
-note
-;-------------
-$01
-
-set current icon to "warning"
-
- [?_images/warning.gif]
-;------------------
-$02
-
-set current icon to "error"
-
- [?_images/error.gif]
-;-----------------
-$03
-
-set current icon to "info"
-
- [?_images/information.gif]
-;----------------
-$04
-
-set current icon to "find"
-
- [?_images/find.gif]
-;----------------
-$05
-
-set current icon to "none"
-
---
-;----------------
-$06
-
-set current icon to "debug"
-
- [?_images/debug.gif]
-;----------------
-$08
-
-end current row and set one level back.
-
---
-;----------------
-$09
-
-end current row and set it as new directory.
-
---
-;----------------
-$0a
-
-end current row and keep current level.
-
---
-;----------------
-$0d
-
-end current row and set current level to root level.
-
---
-;end
-
-
-;;begin
-;;+------+--------------------------------------------------------+
-;;| char | meaning |
-;;|:----:|:-------------------------------------------------------|
-;;| $01 | set current icon to "warning" |
-;;| $02 | set current icon to "error" |
-;;| $03 | set current icon to "info" |
-;;| $04 | set current icon to "find" |
-;;| $05 | set current icon to "none" |
-;;| $06 | set current icon to "debug" |
-;;| $08 | end current row and set one level back. |
-;;| $09 | end current row and set it as new directory. |
-;;| $0a | end current row and keep current level |
-;;| $0d | end current row and set current level to root level |
-;;+------+--------------------------------------------------------+
-;; display directive special characters
-;;end
-
-
--------------------
-
-
-## FreshLib directory "system/"
-
-
------------------
-
-
-### "memory.asm" library
-
-This library provides OS independent way of allocating, reallocating and freeing
-dynamic memory blocks.
-All other libraries in FreshLib that needs dynamic memory, use this library.
-
-The user who needs such memory blocks should use it as well.
-
---------------
-
-[#GetMem] `proc GetMem, .size`
-
-Allocates `[.size]` byte of dynamic memory.
-
-Returns:
-
- `CF=0`; EAX = pointer to the allocated memory;
-
- `CF=1`; EAX=0 if the memory can not be allocated.
-
-The memory is filled with NULL.
-
-------------------
-
-[#FreeMem] `proc FreeMem, .ptr`
-
-Frees the specified in `[.ptr]` dynamically allocated memory.
-Returns nothing.
-
--------------------
-
-[#ResizeMem] `proc ResizeMem, .ptr, .newsize`
-
-Reallocates memory on address `[.ptr]` to the new size in `[.newsize]`
-
-Returns:
-
-CF=0; EAX = pointer to the allocated memory;
-
-CF=1; EAX=`[.ptr]` if the memory can not be reallocated.
-In this case, the memory block is not changed
-
-The increased part of the memory block is not zeroed.
-
------------------
-
-
-### "files.asm" library
-
-
-[#FileOpen] `proc FileOpen, .filename`
-
-The procedure opens the file with filename in `[.filename]` for reading.
-
-Returns:
-
-`CF=0`; EAX = Handle to the file.
-
-`CF=1`; EAX = Error code.
-
--------------------
-
-[#FileCreate] `proc FileCreate, .filename`
-
-Creates a file or opens the existing one and truncates its size to 0. The file is opened for writing.
-
-Returns:
-
-`CF=0`; EAX = Handle to the file.
-
-`CF=1`; EAX = Error code.
-
-
-----------------------
-
-[#FileClose] `proc FileClose, .handle`
-
-Closes the previously opened file.
-
-Returns:
-
-`CF=0`; EAX = Handle to the file.
-`CF=1`; EAX = Error code.
-
-----------------------
-
-[#FileRead] `proc FileRead, .handle, .buffer, .count`
-
-Reads `[.count]` bytes from the file `[.handle]` in the buffer at `[.buffer]`.
-
-Returns:
-
-`CF=0`; EAX = The count of actually read bytes.
-`CF=1`; EAX = Error code.
-
----------------------
-
-[#FileWrite] `proc FileWrite, .handle, .buffer, .count`
-
-Writes `[.count]` bytes from the buffer `[.buffer]` to the file with handle `[.handle]`.
-
-Returns:
-
-`CF=0`; EAX = The count of actually written bytes.
-
-`CF=1`; EAX = Error code.
-
-------------------------
-
-[#FileSeek] `proc FileSeek, .handle, .dist, .direction`
-
-Moves the file pointer of the file `[.handle]` on `[.dist]` distance (in bytes) relative to `[.direction]`.
-
-Direction is one of the following values:
-
-`fsFromBegin` — relative to the file begin.
-
-`fsFromEnd` — relative to the file end (then `[.dist]` should be negative).
-
-`fsFromCurrent` — relative to the current position.
-
-[#FileDelete] `proc FileDelete, .filename`
-
-Deletes the file with filename in `[.filename]`
-
-Returns:
-
-`CF=0`; The file was deleted.
-`CF=1`; EAX = Error code.
-
---------------------------
-
-[#GetErrorString] `proc GetErrorString, .code`
-
-Returns in EAX, pointer to the human readable error message, corresponding to the error code
-passed in `[.code]`
-
-The message string have to be passed to FreeErrorString, when not needed.
-
----------------------------
-
-[#FreeErrorString] `proc FreeErrorString, .ptrString`
-
-Frees the error string `[.ptrString]`, previously returned by GetErrorString. As long as the
-error strings are allocated by the OS, they have to be free by OS as well.
-Returns nothing.
-
---------------------------
-
-[#LoadBinaryFile] `proc LoadBinaryFile, .ptrFileName`
-
-Loads the whole file `[.ptrFileName]` to the dynamically allocated memory block.
-
-Returns:
-
-`CF=0`; EAX = pointer to the allocated memory; ECX = the size of the loaded file.
-
-`CF=1`; EAX = Error code. ECX = 0; The memory is not allocated.
-
-The allocated memory have to be free after use with [#FreeMem].
-
----------------------------
-
-[#SaveBinaryFile] `proc SaveBinaryFile, .ptrFileName, .aptr, .size`
-
-Creates or overwrites the file `[.ptrFileName]` with the `[.size]` bytes from the buffer `[.aptr]`;
-
-Returns:
-
-`CF=0`; EAX = count of the bytes actually write;
-`CF=1`; EAX = error code;
-
---------------------------
-
-[#FileExists] `proc FileExists, .ptrFileName`
-
-Check the existence of the file with name in `[.ptrFileName]`.
-
-Returnds:
-
-`CF=1` — the file *does not* exists.
-`CF=0` — the file exists.
-
-The existence of the file is checked using [#FileOpen] procedure.
-If the file can be opened, it is considered existing.
-
------------------
-
-### "process.asm" library
-
-
-[#Terminate] `proc Terminate, .exit_code`
-
-Terminates the application and all of its threads.
-Returns `[.exit_code]` to the OS.
-
-This procedure simply does not returns, because the application stops.
-
-----------------------
-
-[#ThreadCreate] `proc ThreadCreate, .ptr_to_function, .ptr_to_args`
-
-Creates new thread. `[.ptr_to_function]` points to the thread procedure.
-The thread procedure should have one argument.
-When the thread starts, `[.ptr_to_args]` is passed as a thread argument.
-
-Returns:
-
-`CF=0`; EAX = is a handle to the new thread. In the different OSes this value can have different meaning.
-But it identifies the thread anyway.
-
-`CF=1`; EAX = error code;
-
-------------------------
-
-[#MutexCreate] `proc MutexCreate, .ptrName, .ptrMutex`
-
-Creates new mutex with name `[.ptrName]` and save its handle to `[.ptrMutex]` variable.
-
-The calling thread takes the owneship of the mutex.
-
-If `[.ptrName]` = 0, unnamed mutex will be created.
-
-------------------------
-
-[#WaitForMutex] `proc WaitForMutex, .ptrMutex, .timeout`
-
-Waits until the mutex is released and takes the ownership.
-
-Returns:
-
-`CF=0` — the mutex ownership is successfuly obtained.
-`CF=1` — the timeout was expired.
-
-
-[#MutexRelease] `proc MutexRelease, .ptrMutex`
-
-Releases the ownership of the specified mutex.
-
------------------------
-
-[#MutexDestroy] proc MutexDestroy, .ptrMutex
-
-Destroys the mutex `[.ptrMutex]`
-
------------------
-
-### "clipboard.asm" library
-
-[#clipboard.asm] clipboard.asm library contains very simple clipboard functions that
-works only on text data.
-
-------------------
-
-[#ClipboardRead] `proc ClipboardRead`
-
-Returns in EAX handle to the string with the current clipboard content.
-If the clipboard is empty or contains not textual information, EAX=0;
-The user should delete the string when not needed by passing it to [#StrDel].
-
---------------------
-
-[#ClipboardWrite] `proc ClipboardWrite, .hstring`
-
-Writes the string `[.hstring]` to the clipboard.
-Returns nothing.
-
------------------
-
-## FreshLib directory "timers/"
-
-
-### "timers.asm" library
-
-[#timers.asm] library deals with user created timers and also contains some
-procedures for work with the system time and date.
-
-------------------------------------
-
-[#TTimer] `TTimer` structure.
-
-The timers in FreshLib are represented with the following memory structure:
-;begin
- struct TTimer
- .next dd ?
-
- .interval dd ?
- .value dd ?
-
-
- .flags dd ?
- .Callback dd ?
- .Expired dd ?
- .tag dd ?
- ends
-;end
-The fields are:
-
- * `.next` — Don't change this. It is a pointer to the next timer in the timers chain. It is for internal use only.
-
- * `.interval` — the interval of the time in ms
-
- * `.value` — The current value of the timer in ms. When this value becomes higher than `[.interval]` an event is
-fired and the value becomes 0. This value is incremented by the system dependent time step - probably something like 1..100ms
-
- * `.flags` — contains a set of tmfXXXX flag values. Determines the behavior of the timer. See below for description of the flags.
-
- * `.Callback` — pointer to the callback procedure of the timer.
- The callback procedure should accept one argument with the pointer to the timer that fired the event: `proc OnTimer, .ptrTimer`
-
- * `.Expired` — count of the timer expirations, if the callback procedure was not called.
-
- * `.tag` — user defined value associated with the timer.
-
-
-The `.flags` field can have one or more of the following values:
-
- * `tmfDoNothing` — when the timer expires no action should be performed. .Expired field of the timer will be incremented.
-
- * `tmfCallProc` — `[TTimer.Callback]` contains pointer to the procedure that to be executed once per timer expiration.
-
- * `tmfSyncDestroy` — If this flag is set, the timer will be destroyed on the next timer expiration.
- In this case, the configured event is fired and then the timer is destroyed.
- The flag is checked after the event returns, so the event handler can reset this flag and thus to prevent destruction.
-
- * `tmfRunning` — If this flag is set, the timer runs. If the event handler resets this flag, the timer will fire only once and will be suspended.
-
------------------------
-
-[#TimerCreate] `proc TimerCreate`
-
-Creates a new timer.
-
-Returns:
-
- * CF=0; EAX= pointer to the TTimer structure. The timer is created suspended.
- The user can set or reset tmfRunning in `[.flags]` in order to start or stop the timer.
- Also, the user have to enter proper values in the remaining fields.
-
- * CF=1; Error allocating memory.
-
-----------------------
-
-[#TimerDestroy] `proc TimerDestroy, .ptrTimer`
-
-Destroys the timer `[.ptrTimer]`
-
-------------------
-
-
-## FreshLib directory "simpledebug/"
-
-### "debug.asm" library
-
-[#simpledebug] This library includes number or macros and procedures aimed to assist the debugging
-process of the application. These macros display different data values on the debugging
-console.
-
-The library contains its own output procedures, so it does not depend on the other used libraries.
-
-All the macros from this library generate code only when [#options.DebugMode] = 1, so the
-programmer can include as many debug statements as needed and leave them in the source.
-They will not be included in the final binary.
-The debug macros will always preserve all registers, except the EFLAGS register.
-
--------------
-
-[#DebugMsg] `macro DebugMsg msg`
-
-Displays the text message `msg` to the debug console.
-Example:
-;begin
- DebugMsg 'The program executes here!'
-;end
-
-----------------
-
-[#OutputRegister] `macro OutputRegister reg, radix`
-
-Outputs the content of some register in the given radix. Example:
-;begin
- OutputRegister regEAX, 10
-;end
-The possible register values are: `regEDI`, `regESI`, `regEBP`, `regESP`, `regEBX`, `regEDX`, `regECX`, `regEAX`
-
-----------------
-
-[#OutputMemory] `macro OutputMemory pointer, size`
-
-OutputMemory will dump `[size]` bytes of memory at address `[pointer]`; Example:
-;begin
- OutputMemory esi, 128
-;end
-
----------------
-
-[#OutputNumber] `macro OutputNumber number, radix, digits`
-
-Outputs *digits* digits of the *number* in *radix* radix. Example:
-;begin
- OutputNumber 12345, 16, 8
-;end
-
-------------------
-
-[#GetTimestamp] `proc GetTimestamp`
-
-Returns in eax timestamp measured in milliseconds (ms).
-
------------------
-
-
-## FreshLib directory "data/"
-
-This directory contains several libraries that handles different data structures.
-The libraries are mostly OS independent.
-Actually the only OS dependent part is one small routine in Win32 section, that
-converts strings from UTF-8 to UTF-16 because Windows can't handle UTF-8 strings
-directly.
-
-------------------
-
-### "arrays.asm" library
-
-This library handles dynamic arrays, containing elements of arbitrary size.
-All elements of the array have the same size.
-
-[#TArray] TArray structure have following definition:
-;begin
- struct TArray
- .count dd ?
- .capacity dd ?
- .itemsize dd ?
- .lparam dd ?
- label .array dword
- ends
-;end
-The above structure represents the header of the array. The actual array will
-have arbitrary size, depending on the element count and size.
-
-The first element of the array begins on offset *TArray.array* from the begining
-of the memory block.
-
-The field *TArray.count* contains the current element count of the array.
-
-The field *TArray.capacity* contains the current capacity of the array.
-It is because the library usually allocates more memory than is needed for the array
-element count.
-This approach reduces memory allocations and reallocations and
-thus increases the speed of inserting and deleting elements in the array.
-How many memory will be allocated depends on the user setting of the variable
-ResizeIt (defined in memory.asm). This variable contains a pointer to the
-procedure that simply increases the value of ECX to the next suitable value.
-
-The field *TArray.itemsize* contains the size in bytes of one array element.
-Changing of this value is not recommended.
-
-The field *TArray.lparam* is for user defined parameter, associated with the array.
-
------------------------------
-
-[#CreateArray] `proc CreateArray, .itemSize`
-
-This procedure creates new array with item size `[.ItemSize]`
-
-The procedure returns CF=0 if the array is properly created and pointer to the
-array is placed in EAX.
-
-In case the memory cannot be allocated, the procedure returns CF=1.
-To free the allocated array, use [#FreeMem] procedure.
-
-------------------------------
-
-[#AddArrayItems] `proc AddArrayItems, .ptrArray, .count`
-
-This procedure adds new array items at the end of the array pointed by `[.ptrArray]`
-
-The procedure returns two values:
-
-EAX contains pointer to the first of the new appended elements.
-
-EDX contains pointer to the array (in the process of appending of the new
-element, it is possible the whole array to be moved to the new address in
-memory, so the programmer should store the value of EDX for the future
-reference to the array.
-
-In case, the new memory can not be allocated, the procedure returns CF=1 and
-EDX contains the proper pointer to the original array.
-
-----------------------------------
-
-[#InsertArrayItems] `proc InsertArrayItems, .ptrArray, .iElement, .count`
-
-This procedure inserts `[.count]` new elements at the `[.iElement]` position of the
-array pointed by `[.ptrArray]`
-
-If `[.iElement]` is larger or equal to `[TArray.count]` the elements are appended
-at the end of the array. (Just like AddArrayItems) Otherwise, all elements are
-moved to make room for the new elements.
-
-The procedure returns exactly the same results as AddArrayItems procedure — EDX
-points to the array and EAX points to the first of the new inserted elements.
-
-CF is an error flag.
-
----------------------------------
-
-[#GetArrayItem] `proc GetArrayItem, .array, .item`
-
-CF=0; Returns in EAX pointer to the array item with index `[.item]`.
-
-CF=1; The requested item does not exists ( `[.item]` >= `[.array.count]` ). In this case,
-EAX contains pointer to the end of the array the byte next after the last array element.
-
----------------------------------
-
-[#DeleteArrayItems] `proc DeleteArrayItems, .ptrArray, .iElement, .count`
-
-This procedure deletes `[.count]` items with begin index `[.iElement]` the `[.ptrArray]`
-dynamic array. If the capacity of the array is bigger than the recommended for
-the new count, then the array is resized. The recommended size is calculated
-using ResizeIt procedure from memory library.
-
-Returns EDX - pointer to the TArray. In the most cases this pointer will not be
-changed, but this also depends on the current OS memory allocation API, so it
-is safer to store the pointer for future use, instead of one passed to the
-procedure.
-
-This procedure can not fail, because deleting element is always possible. In
-some rare cases it can fail to reallocate smaller memory block, but this is
-not a problem for the array consistency.
-
----------------------------
-
-[#VacuumArray] `proc VacuumArray, .ptrArray`
-
-This procedure removes the reserved memory from the array in order to make it
-as small as possible.
-Note, that the first insert/append operation after the vacuum operation will be very slow.
-The memory economized this way depends on reallocation strategy and can be from 25 to 100% in some cases.
-
---------------------------
-
-[#ListIndexOf] `proc ListIndexOf, .ptrList, .Item`
-
-The list is a special case of array with item size equal to 4 bytes (dword).
-This procedure searches the list `[.ptrList]` for item equal to `[.Item]` and
-returns the index of the element in EAX. In case of error CF=1.
-
----------------------------
-
-[#ListFree] `proc ListFree, .ptrList, .FreeProc`
-
-Frees all elements of the list `[.ptrList]`, calling `[.FreeProc]` for every
-element of the list.
-
-FreeProc callback procedure have one argument of type dword that is the value
-of the current list element. The definition of the callback procedure is similar
-to following:
-
-;begin
- proc FreeMyListItem, .ptrItem
- begin
- ;do something with the item being freed
- return
- endp
-;end
-
-
------------------
-
-
-### "strlib.asm" library
-
-[#StrLib]
-
-Using strings in assembler was often problematic for programmers - static
-strings can't be resized, so they had to reserve as many bytes as they thought
-user could need, and it still could be not enough. For that reason we created
-Dynamic String Library - a library that operates on dynamic strings, that are
-automatically resized when needed. Also, StrLib contains many functions that
-perform different string operations — comparison, inserting one string into
-another, etc.
-In StrLib, the strings are represented by handles, not by pointers. This way,
-the string can be freely resized and moved in memory.
-StrLib can distinguish the handle values from pointer and will process properly
-both of them. When the processing is possible, the procedures will operate
-on static strings in memory.
-
-[#StrLib string format]
-
-The strings in the StrLib are stored in specific format. The format is defined
-following way:
-;begin
- struc string {
- .capacity dd ?
- .len dd ?
- label .data byte
- }
-
- virtual at -(sizeof.string)
- string string
- sizeof.string = $-string
- end virtual
-;end
-The structure string have variable length and is dynamically allocated.
-
-The field *string.capacity* on offset `-8` contains the allocated memory size in bytes.
-
-The field *string.len* on offset `-4` contains the current length of the string in bytes.
-
-The string content begins on offset 0. The content of the string always ends with at least one
-zero byte, so the string format is compatible with ASCIIZ format used in the most OS API.
-
-All procedures in StrLib will set `[string.len]` to the proper value and will use it in the
-string processing.
-
-If the programmer manipulates the string data directly, he should set `[string.len]` himself, or
-call [#StrFixLen] in order to let StrLib to scan the string and to fix the length field.
-
-
-[#StrLib procedures]
-
-StrLib procedure reference:
-
-[#StrNew]
-;begin
- proc StrNew
-;end
-Creates new dynamic string and returns its handle.
-
-[#StrDel]
-;begin
- proc StrDel, .hstring
-;end
-Frees the memory occupied by given string. If the .hstring is pointer to memory, StrDel
-will try to find it in the table of created strings and if found, will free it as well.
-If the string passed by pointer is not found in the list - StrDel exits without error.
-Note, that passing pointer can degrade the performance of the procedure.
-
-[#StrPtr]
-;begin
- proc StrPtr, .hstring
-;end
-Returns in EAX the pointer of the string with handle `[.hstring]`
-If .hstring is pointer EAX will be equal to `[.hstring]`
-If the handle is invalid, StrPtr returns CF=1 and EAX=0.
-
-
-[#StrLen]
-;begin
- proc StrLen, .hstring
-;end
-Returns the length of the string in bytes, excluding the terminating zero.
-If `[.hstring]` is handle, the procedure returns directly the stored length of the string.
-If `[.hstring]` is pointer, the functions scans the string and computes the length.
-Thus, passing handle is much faster, especially for long strings.
-
-
-[#StrDup]
-;begin
- proc StrDup, .hstring
-;end
-Creates new string and copy the content of `[.hstring]` to it.
-Returns in EAX — handle of the new string.
-`[.hstring]` can be memory pointer or string handle.
-
-
-
-[#StrFixLen]
-;begin
- proc StrFixLen, .hstring
-;end
-StrFixLen scans the string in order to compute its actual length and then writes this length
-in the field `[string.len]`.
-StrFixLen should be call only with handle of the string as argument. It will process pointer as
-well, but will assume there is a field `[string.len]` at offset `-4`.
-The user should call StrFixLen only if the `[string.len]` field does not contains the proper value,
-because of some reason - for example the user made some string processing that changes the length
-of the string or the string data is returned by some OS function that does not care about string
-length.
-
-
-[#StrSetCapacity]
-;begin
- proc StrSetCapacity, .hString, .capacity
-;end
-This function ensures that the allocated for the string memory is enough to hold at least
-`[.capacity]` bytes. If needed the string memory is reallocated.
-Returns pointer to the string data in EAX.
-If the reallocation is impossible, returns CF=1;
-
-
-[#StrCopy]
-;begin
- proc StrCopy, .dest, .source
-;end
-
-Copies the content of `[.source]` string to `[.dest]` string.
-`[.dest]` must be a handle.
-`[.source]` can be handle or pointer.
-Returns nothing.
-
-
-
-[#StrCompCase]
-[#StrCompNoCase]
-;begin
- proc StrCompCase, .str1, .str2
- proc StrCompNoCase, .str1, .str2
-;end
-Compares two strings - case sensitive (StrCompCase) or string not sensitive (StrCompNoCase).
-
-Returns CF = 1 if the strings are equal.
-
-Returns CF = 0 if the strings are different.
-
-The speed of this procedure varies depending on passed strings and its content.
-The worst case is when the strings are passed as pointers and have equal lengths.
-The best case is when the strings are passed as handles and have different lengths.
-
-
-[#StrCat]
-;begin
- proc StrCat, .dest, .source
-;end
-Concatenates the string `[.source]` to the end of the string `[.dest]`.
-
-[#StrCharPos]
-;begin
- proc StrCharPos, .hString, .char
-;end
-StrCharPos returns a pointer to the first occurence of a given char in specified string.
-
-[#StrPos]
-;begin
- proc StrPos, .hstring, .hpattern
-;end
-StrPos returns in EAX a pointer to the first occurence of a `[.hpattern]` string in
-`[.hstring]` or NULL if the pattern was not found.
-
-
-[#StrCopyPart]
-;begin
- proc StrCopyPart, .dest, .source, .pos, .len
-;end
-Extracts `[.len]` bytes on position `[.pos]` from the string `[.source]` and copies them
-to the string `[.dest]`.
-Returns CF=1 if the needed memory can not be allocated.
-
-
-[#StrExtract]
-;begin
- proc StrExtract, .string, .pos, .len
-;end
-Extracts `[.len]` bytes on position `[.pos]` from the string `[.source]` and copies them
-to the new created string.
-Returns the created string in EAX or CF=1 if the needed memory can not be allocated.
-
-
-[#StrSplit]
-;begin
- proc StrSplit, .hString, .pos
-;end
-Splits the string `[.hstring]` into two parts on byte possition `[.pos]`.
-The left part remains in `[.hstring]`; The right part is returned as new created string in EAX.
-Note that the memory of the `[.hstring]` will not be reallocated, only the length of the string
-will be set accordingly.
-
-
-[#StrInsert]
-;begin
- proc StrInsert, .dest, .source, .pos
-;end
-Inserts the `[.source]` string on possition `[.pos]` into the `[.dest]` string.
-Returns nothing.
-
-
-[#NumToStr]
-;begin
- proc NumToStr, .num, .flags
-;end
-Converts number `[.num]` in any radix to string.
-Returns the new created string in EAX.
-
-`[.flags]` controls the way number have to be converted.
-.flags is dword value that contains following values:
-
-byte0 - number of digits if ntsFixedWidth is specified.
-
-byte1 - radix for the convertion. Some radixes have predefined constants:
-;begin
- ntsBin = $0200
- ntsQuad = $0400
- ntsOct = $0800
- ntsDec = $0a00
- ntsHex = $1000
-;end
-
-byte2, byte3 - flags:
-;begin
- ntsSigned = $00000
- ntsUnsigned = $10000
- ntsFixedWidth = $20000
-;end
-
-[#StrToNumEx]
-;begin
- proc StrToNumEx, .hstring
-;end
-Converts `[.hstring]` to number.
-Returns CF=0 and value in EAX if the conversion was successful, or
-CF=1 and EAX = 0 if not.
-
-The procedure supports the FASM numbers format:
-
-`0x1111`, `$1111` or `1111h` will be converted as HEX;
-
-`1111` as decimal;
-
-`1111b` as binary;
-
-`1111o` as octal.
-
-
-[#StrCharCat]
-;begin
- proc StrCharCat, .hString, .char
-;end
-Appends up to 4 bytes fro `[.char]` at the end of `[.hString]`
-
-
-[#StrCharInsert]
-;begin
- proc StrCharInsert, .hString, .char, .pos
-;end
-Inserts up to 4 characters from `[.char]` into the `[.pos]` position of the `[.hString]`
-
-
-[#StrClipSpacesR]
-[#StrClipSpacesL]
-
-;begin
- proc StrClipSpacesR, .hString
- proc StrClipSpacesL, .hString
-;end
-
-Removes the spaces from the start (StrClipSpacesL) or from the end (StrClipSpacesR)
-of the string `[.hString]`.
-
-
-[#StrCleanDupSpaces]
-;begin
- proc StrCleanDupSpaces, .hString
-;end
-Removes duplicating spaces from the string `[.hStrin]` and leaves only single spaces.
-For example the string ("." represents the space char) "123.....456" will be processed to "123.456".
-
-[#StrHash]
-;begin
- proc StrHash, .hString
-;end
-Computes the hash value from the string `[.hString]`.
-This procedure implements FNV-1b algorithm.
-
-Returns 32 bit hash value in EAX.
-
-
-[#DataHash]
-;begin
- proc DataHash, .ptrData, .len
-;end
-Computes the hash value from the memory array at address `[.ptrData]` with byte length `[.len]`.
-This procedure also uses FNV-1b algorithm.
-
-Returns 32 bit hash value in EAX.
-
-
-[#StrLenUtf8]
-;begin
- proc StrLenUtf8, .hString, .len
-;end
-Computes the length in chars of the first `[.len]` bytes of the UTF-8 encoded string `[.hString]`
-The scan of the string ends on one of the two conditions — terminating zero byte
-is reached or `[.len]` bytes are processed. So, if `[.len] == -1` the scan will always end on the
-end of the string.
-
-
-[#StrOffsUtf8]
-;begin
- proc StrOffsUtf8, .hString, .pos
-;end
-Returns in EAX the address of the `[.pos]` character of the UTF-8 encoded string `[.hString]`
-If the length of the string is less than `[.pos]` — returns NULL.
-
-
-[#DecodeUtf8]
-;begin
- proc DecodeUtf8, .chars
-;end
-Decodes 4 bytes in `[.chars]` to UNICODE dword value.
-
-Returns:
-`CF=0` — no error; eax — unicode value; edx — byte count of the char. `[1..4]`
-
-`CF=1` — invalid utf-8 char; if eax = edx = 0; the character can not be decoded;
-if edx <> 0 — eax = the overlong encoded character. edx = byte count of the char.
-
-*Note:* When CF=1 and `[.chars]` is overlong encoded char, eax contains the proper
-value and edx contains the proper length. But it is still invalid character, according
-to the standards.
-
-[#ExpandTabs]
-;begin
- proc ExpandTabs, .hstring, .tabstop
-;end
-
-Converts the tab characters in `[.hstring]` into space characters, according to `[.tabstop]` length.
-Returns in EAX a value, that indicates by how many chars the length of the string increased.
-
-
------------------
-
-
-### "uConfig.asm" library
-
-uCongig library is implementation of small [hierarchical] database engine, intended to keep program settings and
-preferences in OS independent manner.
-The data in the uConfig database have tree structure similar to the file system directory structure
-or to Windows registry structure.
-Every record or directory in the database has its own key — dword value.
-Usually it is convenient to use as a key 4 char ASCII string in order to be human readable, but
-it is not mandatory.
-;quote
-The uConfig format is not "human readable", "universal", "super-puper", etc.
-It was designed with only two aims:
-
-1. Small and simple engine, suitable to be used from assembly.
-
-2. Relatively robust database format.
-
-So, if someone wants some new advanced features - these features should make the engine
-smaller or at least to keep its current size.
-;end
-
-[hierarchical] http://en.wikipedia.org/wiki/Hierarchical_database_model
-
-The database have two representations — packed "file representation" and
-expanded "memory representation".
-Database operations can be provided only on expanded form.
-
-The base of the database is TConfigRecord structure. The database itself is an array of
-TConfigRecords.
-
-[#TConfigRecord]
-;begin
- struct TConfigRecord
- .KeyName dd ?
- .DataSize dd ?
- .Type dd ?
- .Data dd ?
- ends
-;end
-The fields have following meaning:
-
-* .KeyName — contains the key of the record.
-
-* .DataSize — the size of the data in bytes if .Data field contains pointer to the data.
-
-* .Type is one of the following values:
-;quote
-* cdtNULL = 0
-* cdtInteger = 1 — .Data contains the number.
-* cdtString = 2 — .Data contains string handle (see [#StrLib])
-* cdtBlob = 3 — .Data contains pointer to the blob data. .DataSize — its size
-* cdtConfig = 4 — .Data contains pointer to the [#TArray] of TConfigRecords — i.e. uConfig database.
-;end
-* .Data — data value if fits in dword or pointer to the data for the bigger formats.
-
-There are number of procedures intended to provide manipulation of uConfig database:
-
-[#LoadCongigDB]
-;begin
- proc LoadConfigDB, .ptrSource, .signature
-;end
-Loads the "file representation" of database and expands it to "memory representation".
-".signature" is DWORD value, that identifies the database. The signature is actually 8 bytes long —
-the first dword identify the file as a uConfig database and the second dword are user defined.
-
-The procedure returns:
-
-CF=0; EAX = pointer to the root level of the expanded database
-
-CF=1; Database error:
-;quote
-EAX = `-1` : Bad signature
-
-EAX = `-2` : Damaged database. Some control sum is wrong.
-;end
-
-
-[#SaveConfigFile]
-;begin
- proc SaveConfigFile, .ptrRoot, .signature
-;end
-Creates "file representation" of the database as a memory TArray of dword. The user have to save
-this image to the file if needed.
-
-* .ptrRoot is pointer to TArray ot TConfigRecord.
-
-* .signature if the desired signature for the database file.
-
-The procedure returns pointer to TArray. The user should free it later.
-
-
-[#FreeConfigDB]
-;begin
- proc FreeConfigDB, .ptrRoot
-;end
-Frees the uConfig database and all its records.
-
-[#GetConfigParam]
-;begin
- proc GetConfigParam, .ptrConfig, .pDirectory, .name
-;end
-Search the database `[.ptrConfig]` for the record with keyname `[.name]`
-
-Returns EAX = poiner to the TConfigRecord or NULL if the record is missing.
-
-`[.pDirectory]` should point to the zero terminated array of dwords with the path to the directory
-of the needed record. `[.pDirectory]` can be NULL.
-
-[#GetConfigParam.AsString]
-;begin
- proc GetConfigParam.AsString, .ptrConfig, .pDirectory, .name
-;end
-Returns handle to string with textual representation of the value of the database record.
-The user have to free this string later with [#StrDel].
-This procedure is intended to be use for screen display of the values of the database.
-Depending on the type of the field it returns:
-
- * cdtNULL — "NULL"
-
- * cdtInteger — The number converted to decimal string.
-
- * cdtString — A copy of the string.
-
- * cdtBlob — "BLOB"
-
- * cdtConfig — "SDIR"
-
-
-[#DelConfigParam]
-;begin
- proc DelConfigParam, .ptrVarConfig, .pDirectory, .name
-;end
-Deletes the specified config record. Returns nothing.
-
-
-
-[#SetConfigParam]
-;begin
- proc SetConfigParam, .ptrVarConfig, .pDirectory, .name, .type, .value, .size
-;end
-Set the value of the given config record. If the record exists, the value will be changed.
-If the record with the given name does not exists, it will be created.
-Returns error in CF. If CF=1 the specified directory does not exists.
-
-
-
------------------
-
-
-### "memstream.asm" library
-
-
------------------
-
-
-## FreshLib directory "graphics/"
-
-The graphics library provides procedures that draw graphics images and text on
-the screen. The library is OS dependent and is placed in the directory
-"graphics" in the root directory of FreshLib.
-
-The main conception of this library is ".raster" - represented by handle
-object, where the drawing happens.
-
-The exact meaning for this object is
-different for the different OSes — in Win32 it is named "device context", in
-Linux it is "drawable" - window or pixmap.
-
---------------------
-
-### "context.asm" library
-
-
---------------------
-
-### "draw.asm" library
-
---------------------
-
-### "fonts.asm" library
-
---------------------
-
-### "text.asm" library
-
---------------------
-
-### "images.asm" library
-
---------------------
-
-### "giflib.asm" library
-
---------------------
-
-### "backbuffer.asm" library
-
---------------------
-
-## FreshLib directory "mouse/"
-
--------------------
-
-### "mouse.asm" library
-
-------------------
-
-## FreshLib directory "GUI/"
-
-
-This directory contains the libraries providing portable GUI for assembly
-programming.
-
-Note that these libraries are in very early stage of development, so the
-description in this chapter is preliminary and probably will be changed in
-one or another way in the near future.
-
-The main idea behind the GUI library is to make one small OS dependent layer of
-functions, that to serve as an interface between the OS and the OS independent
-layer of the library.
-
-The first will translate OS events, such as mouse, keyboard, timers etc to one
-common standard of OS independent event handlers of the user interface
-objects — windows, buttons and other widgets.
-
-The biggest advantage of this approach is that the porting of the library
-is very easy — most of the code is OS independent and only little part of it
-have to be rewriten in order to port the whole library to a new OS.
-
-The biggest drawback of this approach is the bigger size of the library,
-because, with this architecture, all controls in the library have to be created
-from scratch. It is impossible to use graphic controls that the OS provides —
-particularly Win32 controls - buttons, simple text editors, labels, combo boxes
-list and tree view controls etc.
-
-This library is not aimed to use all complex GUI system of the target OS.
-At first time, the goal of Fresh GUI library is to provide minimal, but decent
-functionality that will do the job — writing portable GUI applications in
-assembly language.
-
-The GUI library is actually set of libraries.
-These libraries defines many data structures and procedures that together, form
-something that conditionally can be called "Object oriented" environment.
-It is object oriented, as long as it deals with GUI "objects" - forms,
-controls, menus etc.
-
-On the other hand, the library does not limit the programmer in the way HLL OOP
-limits him. The user have full access to all data structures of the program.
-The "encapsulation" principle is fairly impossible in the assembly programming.
-
-All objects in Fresh GUI library, are in fact structures of data.
-For every created object, the library allocates some memory and fills this memory
-with object parameters data.
-
-There are two types of data structures that describe GUI objects - classes and
-instances.
-
-The *class* is a structure that contains data commonly used by all objects of
-given type — for example all buttons use one class structure `CButton`.
-
-*Instance* is a data structure that describes the properties and behavior of
-particular GUI object — for example button with icon "open file" that opens
-a file when the user click on it.
-
-### Classes
-
-[#class]
-
-*"Class"* in FreshLib is a data structure, that have the following definition:
-;begin
- struct TObjectClass
- .ptrParent dd 0
- .dataSize dd 0
- .procCreate dd 0
- .procDestroy dd 0
- .procGetParam dd 0
- .procSetParam dd 0
- .procExecCmd dd 0
- .procSysEventHandler dd 0
- ends
-;end
-`.ptrParent` is a pointer to other TObjectClass structure, that appears as a
-parent class for the given class.
-
-`.dataSize` contains the size in bytes of the object instance structure.
-
-The following fields are pointers to procedures that provides the "engine"
-of the object. All of these pointers as a rule can be NULL, if there is no need
-for such processing.
-
-[#.procCreate]
-
-`.procCreate` is a pointer to procedure that creates instance object of the given class.
-This field can be NULL. It has the following definition:
-;begin
- proc Create, .obj
-;end
-This procedure sets needed values in the object instance data structure.
-
-*Note:* This procedure does not allocate any memory. The needed memory block is allocated by
-the [#objects] library and the pointer to this allocated block is passed to this procedure in the
-argument `.obj`.
-
-[#.procDestroy]
-
-`.procDestroy` is a procedure that destroys an instance of the given class.
-;begin
- proc Destroy, .obj
-;end
-Frees the memory, images, fonts and other resources, allocated for the object `.obj` during
-its existence. Must not free the object itself.
-
-
-[#.procGetParam]
-
-.procGetParam is a pointer to the procedure that retrieves and returns the properties of the object.
-;begin
- proc GetParam, .obj, .paramID
-;end
-Returns the value of the object `[.obj]` parameter with ID=`[.paramID]`
-
-[#.procSetParam]
-
-.procSetParam is a pointer to the procedure that set the properties of the object.
-;begin
- proc Set, .obj, .paramID, .value
-;end
-For object `[.obj]`, set the value of the parameter with ID=`[.paramID]`
-
-
-[#.procExecCmd]
-
-.procExecCmd is a pointer to the procedure that executes object method.
-;begin
- proc ExecCmd, .obj, .method
-;end
-For the object `[.obj]` this procedure executes the method with ID in `[.method]`.
-
-The methods can have arbitrary number of arguments, that are defined in the
- [#object] definition (see below). When the method is executed, the procedure
-`[.procExecCmd]` accepts pointer to the arguments array in the register EBX.
-
-The user is supposed to call methods of the object with the macro "execute"
-The macro is defined following way:
-
-[#execute]
-;begin
- macro execute obj*, meth*, [arg]
-;end
-
-[#.procSysEventHandler]
-
-.procSysEventHandler is a pointer to the procedure that process the system
-events that are send to the object, i.e. mouse events, keyboard events etc.
-;begin
- proc SysEventHandler, .obj, .pEvent
-;end
-Process one system event for object `[.obj]`. `[.pEvent]` contains pointer to the
-system event.
-
-All of the above callback procedures are called internally and should not be
-used by the user of the library. How these procedure are called will be described later.
-
-TObjectClass structure is defined statically in memory, in compile time, only
-once for every object class. Its definition is located in the library for the
-respective GUI element. For example CButton class structure is defined in the
-file TButton.asm that contains the code and data of the object class Button.
-
-In order to make construction of such structures easy, macro with name
-ObjectClass is defined in objects.asm
-
-[#ObjectClass]
-;begin
- macro ObjectClass name*, parent*, \
- procCreate*, \
- procDestroy*, \
- procGetParam*, \
- procSetParam*, \
- procExecCmd*, \
- procSysEvents*
-;end
-Every defined ObjectClass have a label that points to the begin of the structure.
-The name of this label is the name of the class, prefixed with "C".
-
-One example of ObjectClass definition is the definition of Window object class:
-;begin
- ObjectClass Window, Object, \
- TWindow.Create, \
- TWindow.Destroy, \
- TWindow.Get, \
- TWindow.Set, \
- TWindow.ExecCmd, \
- TWindow.SysEventHandler
-;end
-
-This definition creates following data structure in the memory:
-;begin
- CWindow: dd CObject
- dd sizeof.TWindow
- dd TWindow.Create
- dd TWindow.Destroy
- dd TWindow.Get
- dd TWindow.Set,
- dd TWindow.ExecCmd
- dd TWindow.SysEventHandler
-;end
-
-### Object instance structure
-
-[#object]
-[#endobj]
-[#instance]
-
-Object instance is data structure that contains different fields. By that it is
-very similar to the normal FASM structures. As structures, the object is only
-description of the data but not the data itself.
-
-Objects can inherit field definitions by its parent objects. The memory instance
-of the object is allocated dynamically in runtime, when the object is created
-by call to the respective FreshLib procedures.
-
-The definition of the object looks like following:
-;begin
- object TObject
- .ptrClass dd ?
-
- .mxAccess dd ?
- .ptrVar dd ?
-
- .OnCreate dd ?
- .OnDestroy dd ?
-
- method .AddChild, .objchild
- endobj
-
- object TWindow, TObject
- .handle dd ?
- .Fcaption dd ?
- .Fcursor dd ?
-
- param .x
- param .y
- param .width
- param .height
- param .visible
- param .caption
- param .parent
- param .cursor
-
- method .Refresh
- endobj
-
-
- object TButton, TWindow
- .state dd ?
- .Ficon dd ?
- .FiconAlign dd ?
- .Ftextalign dd ?
-
- .OnClick dd ?
-
- param .TextAlign
- param .Icon
- param .IconPosition
- endobj
-;end
-
-By convention the names of the objects are composed by the name of the class,
-prefixed with "T".
-
-You can see that the object TWindow contains data fields, parameters and methods.
-The parameters defined by "param" macro are compile time constants which values
-are assigned automatically. These constants are local labels for the object
-structure.
-They are also inherited from the parent structure.
-
-The methods are very similar to parameters, in that they are constants, defined
-in compile time. But besides the value, the method also have list of
-arguments, passed to the method, when executed.
-
-In the above example, TButton.width parameter is inherited from TWindow and
-have the same value as TWindow.width parameter.
-
-Also, TWindow have all fields of TObject defined as well.
-
-If we have to translate TWindow definition in plain FASM syntax it will looks
-similar to this:
-;begin
- struc TWindow {
- .ptrClass dd ?
-
- .mxAccess dd ?
- .ptrVar dd ?
-
- .OnCreate dd ?
- .OnDestroy dd ?
-
- .handle dd ?
- .Fcaption dd ?
- .Fcursor dd ?
-
- .AddChild = $80000000
- .x = $80000001
- .y = $80000002
- .width = $80000003
- .height = $80000004
- .visible = $80000005
- .caption = $80000006
- .parent = $80000007
- .cursor = $80000008
- .Refresh = $80000009
- }
- virtual at 0
- TWindow TWindow
- sizeof.TWindow = $
- end virtual
-;end
-
-------------------
-
-### "objects.asm" library.
-
-[#object]
-
-------------------
-
-
-### "sysevents.asm" library
-
-[#sysevents.asm]
-
-This library contains event codes and data structures for FreshGUI OS independent
-events. For now only several events are defined:
-;begin
- ; mouse events
- seMouseMove
- seMouseEnter
- seMouseLeave
- seMouseBtnPress
- seMouseBtnRelease
- seMouseBtnClick
- seMouseBtnDblClick
-
- ; keyboard events
- seKbdKeyPress
- seKbdKeyRelease
- seKbdStatusChanged
- seKbdChar
-
- ; Window handling events
- sePaint
- seScroll
- seFocusIn
- seFocusOut
- seMoveResize
-;end
-These events cover mouse, keyboard and window appearance and behavior events.
-
-Every event have some arguments that have to be sent to the recipient event handler.
-The event code and the event arguments are contained in data structure, defined for
-every kind of events.
-
-The first dword of the event structure is the field .event that contains the
-event code.
-
-Here are the structures defined in sysevents.asm
-
-
-[#TSysEvent]
-;begin
- struct TSysEvent
- .event dd ?
- ends
-;end
-The base event structure. The field `.event` contains the code of the event, as described above.
-
-
-[#TMouseMoveEvent]
-;begin
- struct TMouseMoveEvent
- . TSysEvent
- .x dd ?
- .y dd ?
- ends
-;end
-The event is generated when the mouse cursor moves over some window.
-The fields `.x` and `.y` contains the coordinates of the mouse cursor relative to
-the upper-left cornet of the window, this message is sent to.
-
-
-[#TMouseButtonEvent]
-;begin
- struct TMouseButtonEvent
- . TSysEvent
- .Button dd ?
- .kbdStatus dd ?
- ends
-;end
-This event is generated when some of the mouse buttons changes its state.
-The button that changes its state is specified in the field `.Button`.
-
-This field can accept following values:
-;begin
- mbLeft = 0
- mbMiddle = 1
- mbRight = 2
-;end
-The field `.kbdStatus` contains the status of remaining mouse buttons and
-keyboard modifying buttons. These buttons are represented by bits in the field:
-;begin
- maskBtnLeft = $0100
- maskBtnMiddle = $0200
- maskBtnRight = $0400
- maskCtrl = $0800
- maskShift = $1
- maskCapsLock = $2
- maskCtrl = $4
- maskAlt = $8
- maskScrLk = $10
-;end
-
-[#TMouseEnterEvent]
-;begin
- struct TMouseEnterEvent
- . TSysEvent
- ends
-;end
-This event is generated when the mouse cursor enters or leaves some control.
-There is no additional parameters besides the event code.
-
-
-[#TKeyboardEvent]
-;begin
- struct TKeyboardEvent
- . TSysEvent
- .key dd ?
- .kbdStatus dd ?
- ends
-;end
-
-This event is generated on keyboard button press/release. The field `.key` contains
-the code of the pressed button. `.kbdStatus` have the same meaning and the same
-values as in TMouseButtonEvent.
-
-
-[#TPaintEvent]
-;begin
- struct TPaintEvent
- . TSysEvent
- .context dd ?
- .rect RECT
- ends
-;end
-TPaintEvent is generated when given control have to be repainted. The field `.context`
-contains a pointer to [#TContext] structure where the program have to draw.
-
-The field `.rect` is the rectangle of the control that needs to be repainted.
-
-
-[#TScrollEvent]
-;begin
- struct TScrollEvent
- . TSysEvent
- .ScrollBar dd ? ; 0
- .ScrollCmd dd ? ;
- .Value dd ? ; Distance for scUp and scDown and position for scTrack
- ends
-;end
-This event is sent to the window when it needs to be scrolled.
-The field `.ScrollBar` have value 0 for the horizontal scrolling and 1 for vertival.
-There are defined constants for these values:
-;begin
- scrollX = 0
- scrollY = 1
-;end
-The field `.ScrollCmd` can have following values:
-;begin
- scTrack = 1
- scUp = 2
- scDown = 3
- scWheelUp = 4
- scWheelDn = 5
-;end
-The field `.Value` contains the absolute position where to scroll the window, for the
-command scTrack, and relative distance of the scroll for all remaining commands.
-
-
-[#TCloseEvent]
-;begin
- struct TCloseEvent
- . TSysEvent
- .reason dd ? ; how the close was requested?
- ends
-;end
-
-This event is sent to the window, when the window have to be closed.
-`.reason` field defines the reason for the operation. It can have following values:
-;begin
- cerFromUser = 0 ;The user pressed X button on the window header, pressed alt+F4
- from the keyboard, or choose "Close" from the title menu.
-
- cerFromProgram = 1 ; Method Close was executed from the program.
-;end
-
-[#TFocusEvent]
-;begin
- struct TFocusInEvent
- . TSysEvent
- ends
-;end
-This event is sent when the window receives or lose the focus.
-
-
-[#TMoveResizeEvent]
-;begin
- struct TMoveResizeEvent
- . TSysEvent
- .newX dd ?
- .newY dd ?
- .newWidth dd ?
- .newHeight dd ?
- ends
-;end
-This event is generated when the user resizes the window or moves it to another place.
-The fields specify the new coordinates and sizes.
-
-
--------------------
-
-### "main.asm" library.
-
-[#main.asm]
-
-This library implements the procedures for the main program loop of the GUI application.
-The modal dialogs procedure is also here.
-
-
-[#Run]
-;begin
- proc Run
-;end
-This procedure is the main program loop of the GUI application.
-The procedure Run process all pending system events, then calls once the OnIdle
-event handler of the [#TApplication] object and then sleeps until new events are
-sent by the OS.
-
-When the OS terminates the application — the procedure returns an exit code.
-
-The programmer uses this procedure following way:
-;begin
- stdcall Run
- push eax ; eax contains the exit code.
-
- FinalizeAll ; free all resources.
-
- stdcall Terminate ; the exit code is already in the stack.
-;end
-
-[#ShowModal]
-;begin
- proc ShowModal, .pForm, .pParent
-;end
-Shows the form `[.pForm]` as a modal dialog window with parent window `[.pParent]` —
-i.e. the parent window is disabled until the modal windows is visible.
-
-The procedure returns the modal result in EAX. The modal result is also stored in
-`TForm.ModalResult` field of the modal form.
-
-
-[#ProcessSystemEvents]
-;begin
- proc ProcessSystemEvents
-;end
-This procedure process the events generated by the OS. If there are waiting
-events in the queue, the procedure reads them, translates them to FreshGUI
-event data structures and calls the event handlers of the respective windows.
-
-If there is no pending events in the queue, ProcessSystemEvents ends with CF=0
-
-The second task this procedure serves is to detect the end of the application.
-In this case it ends with CF=1.
-
-This procedure is call from the main event loop of the application. ([#Run] procedure).
-Also, the user can periodically call this procedure in order to not allow
-hanging of the user interface during long processing of some data.
-
-
-[#WaitForSystemEvent]
-;begin
- proc WaitForSystemEvent
-;end
-This procedure waits until some system message is posted to the application
-event queue. Then it exits. During the wait, very low CPU power is consumed
-by the application.
-
-
--------------------
-
-
-### "ObjTemplates.asm" library
-
-[#templates]
-
-This library contains the template engine of FreshGUI.
-The template engine provides creation of complex window structures with tree
-layout from memory data structure, called template. The templates makes
-creation of dialog windows containing children windows and non visual objects.
-
-Templates can be visually created and edited. The template format used by
-FreshLib is flexible and allows all parameters and fields of the objects to
-be set to needed values during creation of the window.
-
-
-The template is consisted from one or more data structures of type TObjTemplate,
-defined following way:
-;begin
- struct TObjTemplate
- .flags dd ?
- .class dd ?
- .ptrVar dd ?
- .paramsize dd ?
- .params:
- ends
-;end
-`.flags` — controls what is the place of the object in the whole tree structure.
-Can accept one or more of the following values, combined with OR:
-
-`tfChild` — means the object is a child of the last object with tfParent set.
-
-`tfParent` — means the given object is parent and there will be at least one next
-TObjTemplate structure that will be a child object.
-
-`tfEnd` — means the given object is the last child of its parent.
-Note, that one object can be parent and child in the same time.
-If the current template element is at the root level — the processing of
-template stops, after creating the current element and all its children.
-
-.class - pointer to TObjectClass data structure for the created object.
-
-.ptrVar - pointer to dword variable that to accept the pointer to the created object.
-
-.paramsize — the size of the additional data to the end of the template.
-Note, that TObjTemplate is variable length structure, not fixed. sizeof.TObjTemplate
-contains the size of the header part of the structure.
-
-.params — after the header fields there can be arbitrary count of dword pairs:
-(paramID, Value) that to be set to the object during creation. This sequence
-ends with dword $FFFFFF (-1) value for paramID.
-
-Easy creation of templates is provided with macro ObjTemplate:
-
-[#ObjTemplate]
-;begin
- macro ObjTemplate flags, class, name, [id, param]
-;end
-This macro allows use of string values for params and computes automatically
-the values for TObjTemplate.paramsize;
-The macro have following arguments:
-
-* flags — set of (tfChild, tfParent, tfEnd) constants.
-
-* class — the base name of the object class (without prefix C) — i.e. Form,
- Window, Button, etc.
-
-* name — label of the variable to receive the pointer to the created object.
-
-* id — parameter ID or offset in the object structure.
-
-* param — value of the parameter. Can be dword number or string constant. In the
-case the parameter value is string, it will be automatically created in
-the memory and the pointer to this string will be placed as a param value.
-
-One example of template structure:
-;begin
- ObjTemplate tfParent or tfEnd, Form, frmMain, \
- visible, TRUE, \
- x, 100, \
- y, 50, \
- width, 640, \
- height, 480, \
- caption, 'Fresh portable Win32/Linux application test.'
-
- ObjTemplate tfChild, Button, btnChild1, \
- visible, TRUE, \
- x, 64, \
- y, 48, \
- width, 64, \
- height, 24, \
- caption, 'Button1', \
- OnClick, Button1Click
-
- ObjTemplate tfChild or tfEnd, Button, btnChild2, \
- x, 136, \
- y, 48, \
- width, 64, \
- height, 24, \
- caption, 'Button2' , \
- visible, TRUE
-;end
-
-The template engine provides one single procedure:
-
-[#CreateFromTemplate]
-;begin
- proc CreateFromTemplate, .ptrTemplate, .parent
-;end
-This procedure creates all objects from the template, pointed by `[.ptrTemplate]`
-as a parent of `[.parent]` argument.
-
-`.ptrTemplate` points to TObjTemplate structure.
-
-`.parent` points to TObject descendant structure. In most cases it will be
-actually descendant of TWindow or NULL if the created object is not a child
-of any window.
-
-Returns: *EBX* contains a pointer to the topmost of the created object
-(it is first of the created objects)
-
-All pointers of the objects are stored in the specified in the template
-variables ( i.e. `[TObjTemplate.ptrVar]`)
-
-
-------------------
-
-### "TObject.asm" library
-
-[#TObject]
-
-This library implements TObject object class. This is the root class for all object clases in
-FreshLib. It is defined following way:
-;begin
- object TObject
- .ptrClass dd ?
-
- .mxAccess dd ?
- .ptrVar dd ?
-
- .OnCreate dd ?
- .OnDestroy dd ?
-
- method .AddChild, .objchild
- endobj
-;end
-
-------------------
-
-### "TApplication.asm" library
-
-[#TApplication]
-;begin
- object TApplication, TObject
- .MainWindow dd ?
- .Accelerators dd ?
- .OnIdle dd ?
- endobj
-;end
-This object class represents the whole GUI application and handles some properties that are
-application-wide. For example it keeps the main windows of the application, the list of
-keyboard accelerators, etc.
-Only one instance of this object must be created during the initialization of the application,
-before the call of [#Run] procedure.
-
-`.MainWindow` field is a pointer to the main window of the application. When this window is
-closed, the whole application terminates as well.
-
-`.Accelerators` fields is a pointer to a list with application-wide keyboard accelerators.
-
-`.OnIdle` is an application callback that will be call once everytime the events queue is empty.
-The user can process here some tasks that have to be processed with low priority. The usual
-use of this callback is to detect what toolbar buttons and menu items have to be enabled or
-disabled, depending to the current state of the program.
-
-
-------------------
-
-### "TWindows.asm" library
-
-[#TWindow]
-;begin
- object TWindow, TObject
-
- .handle dd ?
-
- ._x dd ?
- ._y dd ?
- ._width dd ?
- ._height dd ?
-
- ._visible dd ?
-
- ._bounds_changed dd ?
-
- ._border dd ?
-
- ._align dd ?
-
- ._FreeArea TBounds
-
- ._caption dd ?
- ._cursor dd ?
-
- .OnKeyPress dd ?
-
- ; parameters
-
- param .x
- param .y
- param .width
- param .height
-
- param .Align
-
- param .FreeArea
-
- param .borderKind
- param .Zorder
-
- param .Visible
- param .Caption
- param .Parent
- param .Cursor
- param .Children
-
- method .Refresh
- method .Focus
- method .AlignChildren
- method .ToBack
- method .ToFront
-
- method ._ComputeFreeArea
- endobj
-;end
-
-------------------
-
-
-### "TScrollWindow.asm" library
-
-[#TScrollWindow]
-
-;begin
- object TScrollWindow, TWindow
- ._HScroller TScrollbar
- ._VScroller TScrollbar
-
- method HScrollSet, .Pos, .Max, .Page
- method VScrollSet, .Pos, .Max, .Page
- endobj
-;end
-
-
-------------------
-
-### "TForm.asm" library
-
-[#TForm]
-;begin
- object TForm, TWindow
-
- .ModalResult dd ?
-
- .OnClose dd ?
-
- param .type
- endobj
-;end
-
-------------------
-
-### "TButton.asm" library
-
-[#TButton]
-;begin
- object TButton, TWindow
- .state dd ?
- .Ficon dd ?
- .FiconAlign dd ?
- .Ftextalign dd ?
-
- .ModalResult dd ?
- .OnClick dd ?
-
- param .TextAlign
- param .Icon
- param .IconPosition
- endobj
-;end
-
-
-------------------
-
-### "TLabel.asm" library
-
-[#TLabel]
-;begin
- object TLabel, TWindow
- .Ftextalign dd ?
-
- param .TextAlign ; text align flags.
- param .Control ; control that to be activated
- endobj
-;end
-
-------------------
-
-### "TImagelabel.asm" library
-
-[#TImageLabel]
-;begin
- object TImageLabel, TWindow
- .FImageAlign dd ?
- .FImage dd ?
- .FMask dd ?
- .FBackground dd ?
-
- param .ImageAlign
- param .Image
- param .Mask
- endobj
-;end
-
-
-------------------
-
-### "TEdit.asm" library
-
-[#TEdit]
-;begin
- object TEdit, TWindow
- ._Text dd ?
- ._Len dd ? ; the length of the string in characters. (UTF-8)
- ._Start dd ? ; Where the string begins to be displayed in the edit window.
- ._Pos dd ? ; Position of the caret in the string.
- ._Sel dd ? ; Position of the selction in the string.
-
- ._MarginLeft dd ?
- ._MarginRight dd ?
-
- ._Focused dd ? ; flag
-
- param .Text
- endobj
-;end
-
-
-------------------
-
-### "TProgressbar.asm" library
-
-[#TProgress]
-;begin
- object TProgress, TWindow
- ._Pos dd ?
- ._Max dd ?
- ._Color dd ?
-
- param .Pos
- param .Max
- param .Color
-
- method .Step
- endobj
-;end
-
-------------------
-
-### "TTreeView.asm" library
-
-[#TTreeView]
-;begin
- object TTreeView, TScrollWindow
- ._items dd ?
- ._first dd ?
- ._pShadow dd ?
-
- .OnItemDelete dd ?
-
- param .Focused
-
- method .AddItem, .iParent
- method .DelItem, .iItem
- method .GetItem, .index
- endobj
-;end
-
-------------------
-
-## FreshLib directory "FreshEdit/"
-
-This directory contains one additional control class — TFreshEdit.
-It is complex and powerful text editor control, intended to be used
-in the advanced programmer's text editors - such as Fresh IDE.
-
-------------------
-
-### "TFreshEdit.asm" library
-
-
-[#TFreshEdit]
-
-;begin
- object TFreshEdit, TScrollWindow
- ._Font dd ? ; font of the editor.
-
- ; main editor font sizes
- ._fontheight dd ? ; in pixels.
- ._fontwidth dd ? ; in pixels.
- ._fontdescent dd ? ; in pixels.
-
- ; system font sizes (used for additional texts and line numbers)
- ._fontheight2 dd ? ; in pixels.
- ._fontwidth2 dd ? ; in pixels.
- ._fontdescent2 dd ? ; in pixels.
-
- .__LeftMargin dd ? ; width of the left margin field. Auto computed.
- .__NumberMargin dd ? ; width of the field for the line number. Auto computed.
-
- ._cols dd ? ; width of the window in text columns.
- ._rows dd ? ; height of the window in text rows.
- ; must to be update on resize and on font change.
-
- ._pLines dd ? ; pointer to TArray of TEditorLine items.
- ._pLengths dd ? ; pointer to TArray with counts of the lines with given length.
-
- ._pUndoList dd ? ; pointer to TArray of TUndoInfo
- ._pRedoList dd ? ; pointer to TArray of TUndoInfo
-
- ._pShadow dd ? ; pointer to TBackBuffer object.
- ._fShadowValid dd ? ;
-
- ; view change fields
-
- ._TopLine dd ? ; number of the line that is at the topmost line of the window.
- ._TopOffset dd ? ; how many rows the top line is off the screen (for word wrapped lines)
- ._LeftColumn dd ? ; the column of the text at the leftmost side of the window.
-
- ._CaretChar dd ? ; the number of the char the caret resides.
- ._CaretLine dd ? ; the index of the line the caret resides.
-
- ._SelChar dd ?
- ._SelLine dd ?
-
- ._fReadOnly dd ?
- ._SelMode dd ? ; NOTE: on selmBlock, the word wrap should be OFF
- ._InsMode dd ?
- ._TabStop dd ?
-
- ; end change fields
-
- ._prevTopLine dd ?
- ._prevTopOffset dd ?
- ._prevLeftColumn dd ?
-
- ._prevCaretChar dd ?
- ._prevCaretLine dd ?
-
- ._prevxDelta dd ?
- ._prevyDelta dd ?
-
- ._prevSelMode dd ?
- ._prevInsMode dd ?
-
- ; end backup fields
-
- ._DragButton dd ?
-
- ._procSyntax dd ? ; syntax highlighter procedure.
-
- ; icons and masks for the left margin
- ._iconBreakpointA dd ? ; active breakpoint icon.
- ._iconBreakpointI dd ? ; inactive breakpoint icon.
- ._iconDebugInfo dd ?
- ._maskBreakpointA dd ?
- ._maskBreakpointI dd ?
- ._maskDebugInfo dd ?
- ._iconUnfold dd ?
- ._iconFold dd ?
- ._maskUnfold dd ?
-
- ; Event handlers
-
- .OnControlKey dd ?
-
- ; Parameters
- param .Selection ; selected text read/write
-
- param .CurrentLine ; TEditorLine where caret resides. read only
- param .Text ; whole text; read/write
- param .MaxLineLen
-
- ; Methods
-
- method .Clear ; clears the text in the editor.
-
- ; navigation methods
-
- method .Move, .direction, .count, .force ; moves the caret
-
- method .LineBegin
- method .LineEnd
- method .ScreenBegin
- method .ScreenEnd
- method .FileBegin
- method .FileEnd
-
- ; editing methods
-
- method .DeleteSel
- method .InsertLine, .index ; index = -1 inserts at current position of the caret.
- ; index = -2 appends the line at the end of the text.
- method .DeleteLine, .index ; index = -1 deletes the line on the current position of the caret.
-
- ; block processing methods.
- method .DeleteText, .lineFrom, .charFrom, .lineTo, .charTo, .BlockKind
- method .GetText, .lineFrom, .charFrom, .lineTo, .charTo, .BlockKind
-
- ; Undo/Redo functions.
-
- method .RegisterForUndo, .operation, .data
-
- method .Undo
- method .Redo
-
- method .ClearUndo
-
- ; these two methods are flexible, but very slow.
- ; .Text parameter seting is fastest way to change whole text of the editor.
-
- method .InsertChar, .char
- method .InsertString, .hstring ; inserts a string at the caret position.
- ; If the string contains formating chars they are
- ; processed properly.
- method .DelChar ; deletes the char under the caret.
-
- ; format and appearance methods
- method .FormatLine, .index
-
- ; themes methods
-
- method LoadTheme, .configdb, .directory
-
- endobj
-;end
-
-------------------
-
-### "fasm_syntax.asm" library
-
-
-[#SyntaxFASM]
-;begin
- proc SyntaxFASM, .hString, .pAttr, .SynContext
-;end
-
-
-------------------
DELETED doc/source/FASM.TEX
Index: doc/source/FASM.TEX
==================================================================
--- doc/source/FASM.TEX
+++ /dev/null
@@ -1,6837 +0,0 @@
-\documentclass[a4paper,12pt]{book}
-
-\usepackage[pdftex,bookmarks=true,hidelinks,pdfstartview=FitH]{hyperref}
-
-\usepackage{longtable}
-
-\usepackage{anysize}
-\makeindex
-
-\begin{document}
-\author{Tomasz Grysztar}
-\title{flat assembler 1.70\\\small{Programmer's Manual}}
-\date{}
-\maketitle
-
-
-\chapter{Introduction}
-This chapter contains all the most important information you need to begin
-using the flat assembler. If you are experienced assembly language programmer,
-you should read at least this chapter before using this compiler.
-
-\section{Compiler overview}
-Flat assembler is a fast assembly language compiler for the x86
-architecture processors, which does multiple passes to optimize
-the size of generated machine code. It is self--compilable and
-versions for different operating systems are provided. They are
-designed to be used from the system command line and they should
-not differ in behavior.
-
-This document describes also the IDE version designed for the
-Windows system, which uses the graphical interface instead of
-console and has the integrated editor. But from the compilation point of view
-it has exactly the same functionality as all the
-console versions, and so later parts (beginning from
-\ref{sec:syntax}) of this document are common with other releases.
-The executable of the IDE version is called \verb"fasmw.exe",
-while \verb"fasm.exe" is the command line version.
-
-\subsection{System requirements}
-All versions require the x86 architecture 32--bit processor (at
-least 80386), although they can produce programs for the x86
-architecture 16--bit processors, too. Windows console version
-requires any Win32 operating system, while Windows GUI version
-requires the Win32 GUI system version 4.0 or higher, so it should
-run on all systems compatible with Windows 95.
-
-The example source provided with this version require you have
-environment variable \verb"INCLUDE" set to the path of the
-\verb"include" directory, which is the part of flat assembler
-package. If such variable already exists in your system and
-contains paths used by some other program, it's enough to add the
-new path to it (the different paths should be separated with
-semicolons). If you don't want to define such variable in the
-system, or don't know how to do it, you can set it for the flat
-assembler IDE only by editing the \verb"fasmw.ini" file in its
-directory (this file is created by \verb"fasmw.exe" when it's
-executed, but you can also create it by yourself). In this case
-you should add the \verb"Include" value into the
-\verb"Environment" section. For example, when you have unpacked
-the flat assembler files into the \verb"c:\fasmw" directory, you
-should put the following two lines into your
-\verb"c:\fasmw\fasmw.ini" file:
-\begin{verbatim}
-[Environment]
-Include = c:\fasmw\include
-\end{verbatim}
-If you don't define the \verb"INCLUDE" environment variable
-properly, you will have to manually provide the full path to the
-Win32 includes in every program you want to compile.
-
-\subsection{Compiler usage}
-To start working with flat assembler, simply double click on the icon of \verb"fasmw.exe" file,
-or drag the icon of your source file onto it. You can also later open new source files with
-the \emph{Open} command from the \emph{File} menu, or by dragging the files into the editor window.
-You can have multiple source files opened at one time, each one is represented by one tab button
-at the bottom of the editor window. To select file for editing, click on the corresponding tab
-with left mouse button. Compiler by default operates on the file you are currently editing, but you
-can force it to always operate on some particular file by clicking the appropriate tab with right mouse
-button and selecting the \emph{Assign} command. Only single file can be assigned to compiler at one time.
-
-When your source file is ready, you can execute the compiler with \emph{Compile} command from the
-\emph{Run} menu. When the compilation is successful, compiler will display the summary of compilation
-process; otherwise it will display the information about error that occurred. Compilation summary
-includes the information of how many passes was done, how much time it took, and how many bytes were
-written into destination file. It also contains a text field called \emph{Display}, in which will
-appear any messages from the \verb"display" directives in source (see \ref{sec:other}). Error
-summary consists at least of the error message and a text field \emph{Display}, which has the same
-purpose as above. If error is related to some specific line of source code, the summary contains also
-a text field \emph{Instruction}, which contains the preprocessed form of instruction that caused an
-error if the error occured after the preprocessor stage (otherwise it's empty) and the \emph{Source}
-list, which shows location of all the source lines related to this error, when you select a line from
-this list, it will be at the same time selected in the editor window (if file which contains that line
-is not loaded, it will be automatically added).
-
-The \emph{Run} command also executes the compiler, and in case of successful compilation it runs the
-compiled program if only it is one of the formats that can be run in Windows environment, otherwise
-you'll get a message that such type of file cannot be executed. If an error occurs, compiler displays
-information about it in the same form as if the \emph{Compile} command was used.
-
-If the compiler runs out of memory, you can increase the memory allocation in the \emph{Compiler setup}
-dialog, which you can start from the \emph{Options} menu. You can specify there the amount of kilobytes
-that the compiler should use, and also the priority of the compiler's thread.
-
-If you want only one instance of program to be running, add
-the \verb"OneInstanceOnly=1" setting to the \verb"Options" section
-of the \verb"fasmw.ini" file.
-
-\subsection{Keyboard commands in editor}
-This section lists the all keyboard commands available when working with
-editor. Except for the keys listed as specific ones, they are common with the
-DOS IDE for flat assembler.
-
-\subsubsection{Movement:}
-\begin{longtable}[l]{p{4cm}l}
- Left arrow & move one character left \\
- Right arrow & move one character right \\
- Up arrow & move one line up \\
- Down arrow & move one line down \\
- Ctrl+Left arrow & move one word left \\
- Ctrl+Right arrow & move one word right \\
- Home & move to the beginning of line \\
- End & move to the end of line \\
- PageUp & move one page up \\
- PageDown & move one page down \\
- Ctrl+Home & move to the first line of page \\
- Ctrl+End & move to the last line of page \\
- Ctrl+PageUp & move to the first line of text \\
- Ctrl+PageDown & move to the last line of text \\
-\\
-\multicolumn{2}{l}{Each of the movement keys pressed with Shift selects text.}
-\end{longtable}
-
-\subsubsection{Editing:}
-\begin{longtable}[l]{p{4cm}l}
- Insert & switch insert/overwrite mode \\
- Alt+Insert & switch horizontal/vertical blocks \\
- Delete & delete current character \\
- Backspace & delete previous character \\
- Ctrl+Backspace & delete previous word \\
- Alt+Backspace & undo previous operation (also Ctrl+Z) \\
- Ctrl+Y & delete current line \\
- F6 & duplicate current line \\
-\end{longtable}
-
-\subsubsection{Block operations:}
-\begin{longtable}[l]{p{4cm}l}
- Ctrl+Insert & copy block into clipboard (also Ctrl+C) \\
- Shift+Insert & paste block from the clipboard (also Ctrl+V) \\
- Ctrl+Delete & delete block \\
- Shift+Delete & cut block into clipboard (also Ctrl+X) \\
- Ctrl+A & select all text \\
-\end{longtable}
-
-\subsubsection{Search:}
-\begin{longtable}[l]{p{4cm}l}
- F5 & go to specified position (also Ctrl+G) \\
- F7 & find (also Ctrl+F) \\
- Shift+F7 & find next (also F3) \\
- Ctrl+F7 & replace (also Ctrl+H) \\
-\end{longtable}
-
-\subsubsection{Compile:}
-\begin{longtable}[l]{p{4cm}l}
- F9 & compile and run \\
- Ctrl+F9 & compile only \\
- Shift+F9 & assign current file as main file to compile \\
- Ctrl+F8 & compile and build symbols information \\
-\end{longtable}
-
-\subsubsection{Other keys:}
-\begin{longtable}[l]{p{4cm}l}
- F2 & save current file \\
- Shift+F2 & save file under a new name \\
- F4 & load file \\
- Ctrl+N & create new file \\
- Ctrl+Tab & switch to next file \\
- Ctrl+Shift+Tab & switch to previous file \\
- Alt+[1-9] & switch to file of given number \\
- Esc & close current file \\
- Alt+X & close all files and exit \\
- Ctrl+F6 & calculator \\
- Alt+Left arrow & scroll left \\
- Alt+Right arrow & scroll right \\
- Alt+Up arrow & scroll up \\
- Alt+Down arrow & scroll down \\
- Alt+Delete & discard undo information \\
-\end{longtable}
-
-\subsubsection{Specific keys:}
-\begin{longtable}[l]{p{4cm}l}
- F1 & search for keyword in selected help file \\
- Alt+F1 & contents of selected help file \\
-\end{longtable}
-
-\subsection{Editor options}
-In the \emph{Options} menu resides also a list of editor options, which may be turned on or off and
-affect the behavior of editor. This section describes these options.
-
-\emph{Secure selection} -- when you turn this option on, the selected block never
-gets deleted when you start typing. When you do any text--changing operation,
-the selection is cancelled, not affecting in any way the text that was
-selected, and then the command is performed. When this option is off and you
-start typing, the current selection is discarded, also Del key simply deletes
-the selected block (when secure selection is on you have to use Ctrl+Del).
-
-\emph{Automatic brackets} -- when you type any of the opening brackets, the closing
-one is automatically put just after caret.
-
-\emph{Automatic indents} -- when you press Enter to start a new line, the caret is
-moved into the new line at the same position, where in the previous line the
-first non-blank character is placed. If you are breaking the line, and there
-were some non-blank characters after the caret when you pressed Enter, they
-are moved into the new line at the position of indent, any blank characters
-that were between the caret and them are ignored.
-
-\emph{Smart tabulation} -- when you press Tab, it moves you to the position just
-below the next sequence of non-blank characters in the line above starting
-from the position just above where you were. If no such sequence is found in
-line above, the standard tabulation size of 8 characters is used.
-
-\emph{Optimal fill on saving} -- with this option enabled, when the file is saved,
-all blank areas are filled with the optimal combination of tabs and spaces to
-get the smaller file size. If this option is off, the blank areas are saved as
-filled with spaces (but the spaces at the ends of lines are not saved).
-
-\emph{Revive dead keys} -- when this option is turned on, it disables inside the
-editor the so--called
-dead keys (keys that don't immediately generate the character, but wait for a next key
-to decide what character to put -- usually you enter the character of a dead key by
-pressing a space key after it). It may be useful if key for entering some of the characters that
-you need to enter often into assembly source is a dead key and you don't need this
-functionality for writing programs.
-
-\subsection{Executing compiler from command line}
-To perform compilation from the command line you need to execute
-the \verb"fasm.exe" executable, providing two parameters -- first
-should be name of source file, second should be name of
-destination file. If no second parameter is given, the name for
-output file will be guessed automatically. After displaying short
-information about the program name and version, compiler will read
-the data from source file and compile it. When the compilation is
-successful, compiler will write the generated code to the
-destination file and display the summary of compilation process;
-otherwise it will display the information about error that
-occurred.
-
-The source file should be a text file, and can be created in any
-text editor. Line breaks are accepted in both DOS and Unix
-standards, tabulators are treated as spaces.
-
-In the command line you can also include \verb"-m" option followed
-by a number, which specifies how many kilobytes of memory flat
-assembler should maximally use. In case of DOS version this
-options limits only the usage of extended memory. The \verb"-p"
-option followed by a number can be used to specify the limit for
-number of passes the assembler performs. If code cannot be
-generated within specified amount of passes, the assembly will be
-terminated with an error message. The maximum value of this
-setting is 65536, while the default limit, used when no such
-option is included in command line, is 100. It is also possible to
-limit the number of passes the assembler performs, with the
-\verb"-p" option followed by a number specifying the maximum
-number of passes.
-
-There are no command line options that would affect the output of
-compiler, flat assembler requires only the source code to include
-the information it really needs. For example, to specify output
-format you specify it by using the \verb"format" directive at the
-beginning of source.
-
-\subsection{Command line compiler messages}
-As it is stated above, after the successful compilation, the
-compiler displays the compilation summary. It includes the
-information of how many passes was done, how much time it took,
-and how many bytes were written into the destination file. The
-following is an example of the compilation summary:
-\begin{verbatim}
-flat assembler version 1.70 (16384 kilobytes memory)
-38 passes, 5.3 seconds, 77824 bytes.
-\end{verbatim}
-In case of error during the compilation process, the program will
-display an error message. For example, when compiler can't find
-the input file, it will display the following message:
-\begin{verbatim}
-flat assembler version 1.70 (16384 kilobytes memory)
-error: source file not found.
-\end{verbatim}
-If the error is connected with a specific part of source code, the
-source line that caused the error will be also displayed. Also
-placement of this line in the source is given to help you finding
-this error, for example:
-\begin{verbatim}
-flat assembler version 1.70 (16384 kilobytes memory)
-example.asm [3]:
- mob ax,1
-error: illegal instruction.
-\end{verbatim}
-It means that in the third line of the \verb"example.asm" file
-compiler has encountered an unrecognized instruction. When the
-line that caused error contains a macroinstruction, also the line
-in macroinstruction definition that generated the erroneous
-instruction is displayed:
-\begin{verbatim}
-flat assembler version 1.70 (16384 kilobytes memory)
-example.asm [6]:
- stoschar 7
-example.asm [3] stoschar [1]:
- mob al,char
-error: illegal instruction.
-\end{verbatim}
-It means that the macroinstruction in the sixth line of the
-\verb"example.asm" file generated an unrecognized instruction with
-the first line of its definition.
-
-\subsection{Output formats}
-By default, when there is no \verb"format" directive in source file, flat
-assembler simply puts generated instruction codes into output, creating this
-way flat binary file. By default it generates 16--bit code, but you can
-always turn it into the 16--bit or 32--bit mode by using \verb"use16" or
-\verb"use32" directive. Some of the output formats switch into 32--bit mode,
-when selected -- more information about formats which you can choose can be
-found in \ref{sec:formatter}.
-
-The extension of destination file is chosen automatically by compiler, depending
-on the selected output format.
-
-All output code is always in the order in which it was entered into the
-source file.
-
-\section{Assembly syntax}
-\label{sec:syntax}
-The information provided below is intended mainly for the assembler
-programmers that have been using some other assembly compilers before.
-If you are beginner, you should look for the assembly programming tutorials.
-
-Flat assembler by default uses the Intel syntax for the assembly
-instructions, although you can customize it using the preprocessor
-capabilities (macroinstructions and symbolic constants). It also has its own
-set of the directives -- the instructions for compiler.
-
-All symbols defined inside the sources are case--sensitive.
-
-\begin{table}[h]
-\begin{center}\begin{tabular}{|c|c|c|}
-\hline
-Operator & Bits & Bytes \\
-\hline \hline
-\verb"byte" & 8 & 1 \\
-\verb"word" & 16 & 2 \\
-\verb"dword" & 32 & 4 \\
-\verb"fword" & 48 & 6 \\
-\verb"pword" & 48 & 6 \\
-\verb"qword" & 64 & 8 \\
-\verb"tbyte" & 80 & 10 \\
-\verb"tword" & 80 & 10 \\
-\verb"dqword" & 128 & 16 \\
-\verb"xword" & 128 & 16 \\
-\verb"qqword" & 256 & 32 \\
-\verb"yword" & 256 & 32 \\
-\hline
-\end{tabular}\end{center}
-\caption{Size operators.}\label{tab:size_operators}
-\end{table}
-
-\begin{table}[bt]
-\begin{center}\begin{tabular}{|c|c||cccccccc|}
-\hline
-Type & Bits & & & & & & & & \\
-\hline\hline
- & 8 & \verb"al" & \verb"cl" & \verb"dl" & \verb"bl" & \verb"ah" & \verb"ch" & \verb"dh" & \verb"bh" \\
-General & 16 & \verb"ax" & \verb"cx" & \verb"dx" & \verb"bx" & \verb"sp" & \verb"bp" & \verb"si" & \verb"di" \\
- & 32 & \verb"eax" & \verb"ecx" & \verb"edx" & \verb"ebx" & \verb"esp" & \verb"ebp" & \verb"esi" & \verb"edi" \\
-\hline
-Segment & 16 & \verb"es" & \verb"cs" & \verb"ss" & \verb"ds" & \verb"fs" & \verb"gs" & & \\
-\hline
-Control & 32 & \verb"cr0" & & \verb"cr2" & \verb"cr3" & \verb"cr4" & & & \\
-\hline
-Debug & 32 & \verb"dr0" & \verb"dr1" & \verb"dr2" & \verb"dr3" & & & \verb"dr6" & \verb"dr7" \\
-\hline
-FPU & 80 & \verb"st0" & \verb"st1" & \verb"st2" & \verb"st3" & \verb"st4" & \verb"st5" & \verb"st6" & \verb"st7" \\
-\hline
-MMX & 64 & \verb"mm0" & \verb"mm1" & \verb"mm2" & \verb"mm3" & \verb"mm4" & \verb"mm5" & \verb"mm6" & \verb"mm7" \\
-\hline
-SSE & 128 & \verb"xmm0" & \verb"xmm1" & \verb"xmm2" & \verb"xmm3" & \verb"xmm4" & \verb"xmm5" & \verb"xmm6" & \verb"xmm7" \\
-\hline
-AVX & 256 & \verb"ymm0" & \verb"ymm1" & \verb"ymm2" & \verb"ymm3" & \verb"ymm4" & \verb"ymm5" & \verb"ymm6" & \verb"ymm7" \\
-\hline
-\end{tabular}\end{center}
-\caption{Registers.}
-\label{tab:registers}
-\end{table}
-
-\subsection{Instruction syntax}
-Instructions in assembly language are separated by line breaks, and one
-instruction is expected to fill the one line of text. If a line contains
-a semicolon, except for the semicolons inside the quoted strings, the rest of
-this line is the comment and compiler ignores it. If a line ends with \verb"\"
-character (eventually the semicolon and comment may follow it), the next line
-is attached at this point.
-
-Each line in source is the sequence of items, which may be one of the three
-types. One type are the symbol characters, which are the special characters
-that are individual items even when are not spaced from the other ones.
-Any of the \verb"+-*/=<>()[]{}:,|&~#`" is the symbol character. The sequence of
-other characters, separated from other items with either blank spaces or
-symbol characters, is a symbol. If the first character of symbol is either a
-single or double quote, it integrates any sequence of characters following
-it, even the special ones, into a quoted string, which should end with the same
-character, with which it began (the single or double quote) -- however if there
-are two such characters in a row (without any other character between them),
-they are integrated into quoted string as just one of them and the quoted
-string continues then. The symbols other than symbol characters and quoted
-strings can be used as names, so are also called the name symbols.
-
-Every instruction consists of the mnemonic and the various number of
-operands, separated with commas. The operand can be register, immediate
-value or a data addressed in memory, it can also be preceded by size operator
-to define or override its size (table \ref{tab:size_operators}). Names of
-available registers you can find in table \ref{tab:registers}, their sizes
-cannot be overridden. Immediate value can be specified by any numerical
-expression.
-
-When operand is a data in memory, the address of that data (also any
-numerical expression, but it may contain registers) should be enclosed in
-square brackets or preceded by \verb"ptr" operator. For example instruction
-\verb"mov eax,3" will put the immediate value 3 into the \verb"eax" register,
-instruction \verb"mov eax,[7]" will put the 32--bit value from the address 7
-into \verb"eax" and the instruction \verb"mov byte [7],3" will put the
-immediate value 3 into the byte at address 7, it can also be written as
-\verb"mov byte ptr 7,3". To specify which segment register should be used for
-addressing, segment register name followed with a colon should be put just
-before the address value (inside the square brackets or after the \verb"ptr"
-operator).
-
-\subsection{Data definitions}
-\index{DB}\index{RB}\index{DW}\index{DU}\index{RW}\index{DP}\index{RP}\index{DF}\index{RF}
-\index{DD}\index{RD}\index{DQ}\index{RQ}\index{DT}\index{RT}
-To define data or reserve a space for it, use one of the directives listed
-in table \ref{tab:data_directives}. The data definition directive should be
-followed by one or more of numerical expressions, separated with commas.
-These expressions define the values for data cells of size depending on which
-directive is used. For example \verb"db 1,2,3" will define the three bytes of
-values 1, 2 and 3 respectively.
-
-The \verb"db" and \verb"du" directives also accept the quoted string values
-of any length, which will be converted into chain of bytes when \verb"db"
-is used and into chain of words with zeroed high byte when \verb"du" is used.
-For example \verb"db 'abc'" will define the three bytes of values 61, 62 and
-63.
-
-The \verb"dp" directive and its synonym \verb"df" accept the values
-consisting of two numerical expressions separated with colon, the first value
-will become the high word and the second value will become the low double
-word of the far pointer value. Also \verb"dd" accepts such pointers consisting
-of two word values separated with colon, and \verb"dt" accepts the word and quad word value separated
-with colon, the quad word is stored first. The \verb"dt" directive with single
-expression as parameter accepts only floating point values and creates data in
-FPU double extended precision format.
-
-Any of the above directive allows the usage of special \verb"dup" operator to
-make multiple copies of given values. The count of duplicates should precede
-this operator and the value to duplicate should follow -- it can even be the
-chain of values separated with commas, but such set of values needs to be
-enclosed with parenthesis, like \verb"db 5 dup (1,2)", which defines five copies
-of the given two byte sequence.
-
-\index{FILE}
-The \verb"file" is a special directive and its syntax is different. This
-directive includes a chain of bytes from file and it should be followed by
-the quoted file name, then optionally numerical expression specifying offset
-in file preceded by the colon, then -- also optionally -- comma and numerical
-expression specifying count of bytes to include (if no count is specified,
-all data up to the end of file is included). For example \verb"file 'data.bin'" will
-include the whole file as binary data and \verb"file 'data.bin':10h,4" will include
-only four bytes starting at offset 10h.
-
-\begin{table}[hbt]
-\begin{center}\begin{tabular}{|c||c|c|}
-\hline
-Size & Define & Reserve \\
-(bytes) & data & data \\
-\hline \hline
-1 & \verb"db" & \verb"rb" \\
-& \verb"file" & \\
-\hline
-2 & \verb"dw" & \verb"rw" \\
-& \verb"du" & \\
-\hline
-4 & \verb"dd" & \verb"rd" \\
-\hline
-6 & \verb"dp" & \verb"rp" \\
-& \verb"df" & \verb"rf" \\
-\hline
-8 & \verb"dq" & \verb"rq" \\
-\hline
-10 & \verb"dt" & \verb"rt" \\
-\hline
-\end{tabular}\end{center}
-\caption{Data directives.}
-\label{tab:data_directives}
-\end{table}
-
-The data reservation directive should be followed by only one numerical
-expression, and this value defines how many cells of the specified size
-should be reserved. All data definition directives also accept the \verb"?"
-value, which means that this cell should not be initialized to any value and
-the effect is the same as by using the data reservation directive. The
-uninitialized data may not be included in the output file, so its values
-should be always considered unknown.
-
-\subsection{Constants and labels}
-\label{sec:labels}
-In the numerical expressions you can also use constants or labels instead of
-numbers. To define the constant or label you should use the specific
-directives. Each label can be defined only once and it is accessible from the
-any place of source (even before it was defined). Constant can be redefined
-many times, but in this case it is accessible only after it was defined, and
-is always equal to the value from last definition before the place where it's
-used. When a constant is defined only once in source, it is -- like the label --
-accessible from anywhere.
-
-\index{=}
-The definition of constant consists of name of the constant followed by the
-\verb"=" character and numerical expression, which after calculation will
-become the value of constant. This value is always calculated at the time the
-constant is defined. For example you can define \verb"count" constant by
-using the directive \verb"count = 17", and then use it in the assembly
-instructions, like \verb"mov cx,count" -- which will become \verb"mov cx,17"
-during the compilation process.
-
-There are different ways to define labels. The simplest is to follow the name
-of label by the colon, this directive can even be followed by the other
-instruction in the same line. It defines the label whose value is equal to
-offset of the point where it's defined. This method is usually used to label
-the places in code. The other way is to follow the name of label (without a
-colon) by some data directive. It defines the label with value equal to
-offset of the beginning of defined data, and remembered as a label for data
-with cell size as specified for that data directive in table
-\ref{tab:data_directives}.
-
-The label can be treated as constant of value equal to offset of labeled
-code or data. For example when you define data using the labeled directive
-\verb"char db 224", to put the offset of this data into
-\verb"bx" register you should use \verb"mov bx,char" instruction, and to put
-the value of byte addressed by \verb"char" label to \verb"dl" register,
-you should use \verb"mov dl,[char]" (or \verb"mov dl,ptr char"). But when you
-try to assemble \verb"mov ax,[char]", it will cause an error, because fasm
-compares the sizes of operands, which should be equal. You can force
-assembling that instruction by using size override:
-\verb"mov ax,word [char]", but remember that this instruction will read the
-two bytes beginning at \verb"char" address, while it was defined as a one
-byte.
-
-\index{LABEL}
-The last and the most flexible way to define labels is to use \verb"label"
-directive. This directive should be followed by the name of label, then
-optionally size operator and then -- also optionally \verb"at" operator and
-the numerical expression defining the address at which this label should be
-defined. For example \verb"label wchar word at char" will define a new label
-for the 16--bit data at the address of \verb"char". Now the instruction
-\verb"mov ax,[wchar]" will be after compilation the same as
-\verb"mov ax,word [char]". If no address is specified, \verb"label" directive
-defines the label at current offset. Thus \verb"mov [wchar],57568" will copy
-two bytes while \verb"mov [char],224" will copy one byte to the same address.
-
-The label whose name begins with dot is treated as local label, and its name
-is attached to the name of last global label (with name beginning with
-anything but dot) to make the full name of this label. So you can use the
-short name (beginning with dot) of this label anywhere before the next global
-label is defined, and in the other places you have to use the full name.
-Label beginning with two dots are the exception -- they are like global, but
-they don't become the new prefix for local labels.
-
-The \verb"@@" name means anonymous label, you can have defined many of them
-in the source. Symbol \verb"@b" (or equivalent \verb"@r") references the
-nearest preceding anonymous label, symbol \verb"@f" references the nearest
-following anonymous label. These special symbol are case--insensitive.
-
-\subsection{Numerical expressions}
-In the above examples all the numerical expressions were the simple numbers,
-constants or labels. But they can be more complex, by using the arithmetical
-or logical operators for calculations at compile time. All these operators
-with their priority values are listed in table \ref{tab:operators_priority}.
-The operations with higher priority value will be calculated first, you can
-of course change this behavior by putting some parts of expression into
-parenthesis. The \verb"+", \verb"-", \verb"*" and \verb"/" are standard
-arithmetical operations, \verb"mod" calculates the remainder from division.
-The \verb"and", \verb"or", \verb"xor", \verb"shl", \verb"shr" and \verb"not"
-perform the same logical operations as assembly instructions of those names.
-The \verb"rva" and \verb"plt" are special unary operators that perform
-conversions between different kinds of addresses, they can be used only with
-few of the output formats and their meaning may vary (see \ref{sec:formatter}).
-
-The arithmetical and logical calculations are usually processed as if they
-operated on infinite precision 2-adic numbers, and assembler signalizes an
-overflow error if because of its limitations it is not table to perform the
-required calculation, or if the result is too large number to fit in either
-signed or unsigned range for the destination unit size. However \verb"not", \verb"xor"
-and \verb"shr" operators are exceptions from this rule -- if the value specified
-by numerical expression has to fit in a unit of specified size, and the
-arguments for operation fit into that size, the operation will be performed
-with precision limited to that size.
-
-\begin{table}[hbt]
-\begin{center}\begin{tabular}{|c|c|}
-\hline
-Priority & Operators \\
-\hline \hline
-0 & \verb"+" \\
- & \verb"-" \\
-\hline
-1 & \verb"*" \\
- & \verb"/" \\
-\hline
-2 & \verb"mod" \\
-\hline
-3 & \verb"and" \\
- & \verb"or" \\
- & \verb"xor" \\
-\hline
-4 & \verb"shl" \\
- & \verb"shr" \\
-\hline
-5 & \verb"not" \\
-\hline
-6 & \verb"rva" \\
- & \verb"plt" \\
-\hline
-\end{tabular}\end{center}
-\caption{Arithmetical and logical operators by priority.}
-\label{tab:operators_priority}
-\end{table}
-
-The numbers in the expression are by default treated as a decimal, binary
-numbers should have the \verb"b" letter attached at the end, octal number
-should end with \verb"o" letter, hexadecimal numbers should begin with \verb"0x" characters
-(like in C language) or with the \verb"$" character (like in Pascal language)
-or they should end with \verb"h" letter. Also quoted string, when encountered
-in expression, will be converted into number -- the first character will become
-the least significant byte of number.
-
-The numerical expression used as an address value can also contain
-any of general registers used for addressing, they can be added
-and multiplied by appropriate values, as it is allowed for x86
-architecture instructions.
-
-There are also some special symbols that can be used inside the numerical
-expression. First is \verb"$", which is always equal to the value of current
-offset, while \verb"$$" is equal to base address of current addressing space.
-The other one is \verb"%", which is the number of current repeat in parts of
-code that are repeated using some special directives (see \ref{sec:control}).
-There's also \verb"%t" symbol, which is always equal to the current time stamp.
-
-Any numerical expression can also consist of single floating point value
-(flat assembler does not allow any floating point operations at compilation
-time) in the scientific notation, they can end with the \verb"f" letter
-to be recognized, otherwise they should contain at least one of the \verb"."
-or \verb"E" characters. So \verb"1.0", \verb"1E0" and \verb"1f" define the
-same floating point value, while simple \verb"1" defines an integer value.
-
-\subsection{Jumps and calls}
-\label{sec:jumps}
-The operand of any jump or call instruction can be preceded not only by the
-size operator, but also by one of the operators specifying type of the jump:
-\verb"short", \verb"near" of \verb"far". For example, when assembler is in 16--bit mode,
-instruction \verb"jmp dword [0]" will become the far jump and when assembler is
-in 32--bit mode, it will become the near jump. To force this instruction to be
-treated differently, use the \verb"jmp near dword [0]" or \verb"jmp far dword [0]" form.
-
-When operand of near jump is the immediate value, assembler will generate
-the shortest variant of this jump instruction if possible (but will not create
-32--bit instruction in 16--bit mode nor 16--bit instruction in 32--bit mode,
-unless there is a size operator stating it). By specifying the jump type
-you can force it to always generate long variant (for example \verb"jmp near 0")
-or to always generate short variant and terminate with an error when it's
-impossible (for example \verb"jmp short 0").
-
-
-\subsection{Size settings}
-When instruction uses some memory addressing, by default the smallest form of
-instruction is generated by using the short displacement if only address
-value fits in the range. This can be overridden using the \verb"word" or \verb"dword"
-operator before the address inside the square brackets (or after the \verb"ptr"
-operator), which forces the long displacement of appropriate size to be made.
-In case when address is not relative to any registers, those operators allow
-also to choose the appropriate mode of absolute addressing.
-
-Instructions \verb"adc", \verb"add", \verb"and", \verb"cmp",
-\verb"or", \verb"sbb", \verb"sub" and \verb"xor" with first
-operand being 16--bit or 32--bit are by default generated in
-shortened 8--bit form when the second operand is immediate value
-fitting in the range for signed 8-bit values. It also can be
-overridden by putting the \verb"word" or \verb"dword" operator
-before the immediate value. The similar rules applies to the
-\verb"imul" instruction with the last operand being immediate
-value.
-
-Immediate value as an operand for \verb"push" instruction without a size
-operator is by default treated as a word value if assembler is in 16--bit
-mode and as a double word value if assembler is in 32--bit mode, shorter
-8--bit form of this instruction is used if possible, \verb"word" or
-\verb"dword" size operator forces the \verb"push" instruction to be generated
-in longer form for specified size. \verb"pushw" and \verb"pushd" mnemonics
-force assembler to generate 16-bit or 32--bit code without forcing it to use
-the longer form of instruction.
-
-\chapter{Instruction set}
-This chapter provides the detailed information about the instructions and
-directives supported by flat assembler. Directives for defining labels were
-already discussed in \ref{sec:labels}, all other directives will be described later in this chapter.
-
-\section{The x86 architecture instructions}
-In this section you can find both the information about the syntax and
-purpose the assembly language instructions. If you need more technical
-information, look for the Intel Architecture Software Developer's Manual.
-
-Assembly instructions consist of the mnemonic (instruction's name) and from
-zero to three operands. If there are two or more operands, usually first is
-the destination operand and second is the source operand. Each operand can be
-register, memory or immediate value (see \ref{sec:syntax} for details about
-syntax of operands). After the description of each instruction there are
-examples of different combinations of operands, if the instruction has any.
-
-Some instructions act as prefixes and can be followed by other instruction
-in the same line, and there can be more than one prefix in a line. Each name
-of the segment register is also a mnemonic of instruction prefix, altough it
-is recommended to use segment overrides inside the square brackets instead of
-these prefixes.
-
-\subsection{Data movement instructions}
-\index{mov}
-\verb"mov" transfers a byte, word or double word from the source operand to
-the destination operand. It can transfer data between general registers, from
-the general register to memory, or from memory to general register, but it
-cannot move from memory to memory. It can also transfer an immediate value to
-general register or memory, segment register to general register or memory,
-general register or memory to segment register, control or debug register to
-general register and general register to control or debug register. The
-\verb"mov" can be assembled only if the size of source operand and size of
-destination operand are the same. Below are the examples for each of the
-allowed combinations:
-\begin{verbatim}
- mov bx,ax ; general register to general register
- mov [char],al ; general register to memory
- mov bl,[char] ; memory to general register
- mov dl,32 ; immediate value to general register
- mov [char],32 ; immediate value to memory
- mov ax,ds ; segment register to general register
- mov [bx],ds ; segment register to memory
- mov ds,ax ; general register to segment register
- mov ds,[bx] ; memory to segment register
- mov eax,cr0 ; control register to general register
- mov cr3,ebx ; general register to control register
-\end{verbatim}
-
-\index{xchg}
-\verb"xchg" swaps the contents of two operands. It can swap two byte
-operands, two word operands or two double word operands. Order of operands is
-not important. The operands may be two general registers, or general register
-with memory. For example:
-\begin{verbatim}
- xchg ax,bx ; swap two general registers
- xchg al,[char] ; swap register with memory
-\end{verbatim}
-
-\index{push}\index{pushw}\index{pushd}
-\verb"push" decrements the stack frame pointer (\verb"esp" register), then
-transfers the operand to the top of stack indicated by \verb"esp". The
-operand can be memory, general register, segment register or immediate value
-of word or double word size. If operand is an immediate value and no size is
-specified, it is by default treated as a word value if assembler is in
-16--bit mode and as a double word value if assembler is in 32--bit mode.
-\verb"pushw" and \verb"pushd" mnemonics are variants of this instruction that
-store the values of word or double word size respectively. If more operands
-follow in the same line (separated only with spaces, not commas), compiler
-will assemble chain of the \verb"push" instructions with these operands.
-The examples are with single operands:
-\begin{verbatim}
- push ax ; store general register
- push es ; store segment register
- pushw [bx] ; store memory
- push 1000h ; store immediate value
-\end{verbatim}
-
-\index{pusha}\index{pushaw}\index{pushad}
-\verb"pusha" saves the contents of the eight general register on the stack.
-This instruction has no operands. There are two version of this instruction,
-one 16--bit and one 32--bit, assembler automatically generates the right
-version for current mode, but it can be overridden by using \verb"pushaw"
-or \verb"pushad" mnemonic to always get the 16--bit or 32--bit version.
-The 16--bit version of this instruction pushes general registers on the stack
-in the following order: \verb"ax", \verb"cx", \verb"dx", \verb"bx", the
-initial value of \verb"sp" before \verb"ax" was pushed, \verb"bp", \verb"si"
-and \verb"di". The 32--bit version pushes equivalent 32--bit general
-registers in the same order.
-
-\index{pop}\index{popw}\index{popd}
-\verb"pop" transfers the word or double word at the current top of stack to
-the destination operand, and then increments \verb"esp" to point to the new
-top of stack. The operand can be memory, general register or segment
-register. \verb"popw" and \verb"popd" mnemonics are variants of this
-instruction for restoring the values of word or double word size respectively.
-If more operands separated with spaces follow in the same line, compiler will
-assemble chain of the \verb"pop" instructions with these operands.
-\begin{verbatim}
- pop bx ; restore general register
- pop ds ; restore segment register
- popw [si] ; restore memory
-\end{verbatim}
-
-\index{popa}\index{popaw}\index{popad}
-\verb"popa" restores the registers saved on the stack by \verb"pusha"
-instruction, except for the saved value of \verb"sp" (or \verb"esp"),
-which is ignored. This instruction has no operands. To force assembling
-16--bit or 32--bit version of this instruction use \verb"popaw" or
-\verb"popad" mnemonic.
-
-\subsection{Type conversion instructions}
-The type conversion instructions convert bytes into words, words into double
-words, and double words into quad words. These conversions can be done using
-the sign extension or zero extension. The sign extension fills the extra bits
-of the larger item with the value of the sign bit of the smaller item,
-the zero extension simply fills them with zeros.
-
-\index{cwd}\index{cdq}
-\verb"cwd" and \verb"cdq" double the size of value \verb"ax" or \verb"eax"
-register respectively and store the extra bits into the \verb"dx" or
-\verb"edx" register. The conversion is done using the sign extension.
-These instructions have no operands.
-
-\index{cbw}\index{cwde}
-\verb"cbw" extends the sign of the byte in \verb"al" throughout \verb"ax",
-and \verb"cwde" extends the sign of the word in \verb"ax" throughout
-\verb"eax". These instructions also have no operands.
-
-\index{movsx}\index{movzx}
-\verb"movsx" converts a byte to word or double word and a word to double word
-using the sign extension. \verb"movzx" does the same, but it uses the zero
-extension. The source operand can be general register or memory, while the
-destination operand must be a general register. For example:
-\begin{verbatim}
- movsx ax,al ; byte register to word register
- movsx edx,dl ; byte register to double word register
- movsx eax,ax ; word register to double word register
- movsx ax,byte [bx] ; byte memory to word register
- movsx edx,byte [bx] ; byte memory to double word register
- movsx eax,word [bx] ; word memory to double word register
-\end{verbatim}
-
-\subsection{Binary arithmetic instructions}
-\index{add}
-\verb"add" replaces the destination operand with the sum of the source and
-destination operands and sets CF if overflow has occurred. The operands may
-be bytes, words or double words. The destination operand can be general
-register or memory, the source operand can be general register or immediate
-value, it can also be memory if the destination operand is register.
-\begin{verbatim}
- add ax,bx ; add register to register
- add ax,[si] ; add memory to register
- add [di],al ; add register to memory
- add al,48 ; add immediate value to register
- add [char],48 ; add immediate value to memory
-\end{verbatim}
-
-\index{adc}
-\verb"adc" sums the operands, adds one if CF is set, and replaces the
-destination operand with the result. Rules for the operands are the same as
-for the \verb"add" instruction. An \verb"add" followed by multiple \verb"adc"
-instructions can be used to add numbers longer than 32 bits.
-
-\index{inc}
-\verb"inc" adds one to the operand, it does not affect CF. The operand can be
-a general register or memory, and the size of the operand can be byte, word or double word.
-\begin{verbatim}
- inc ax ; increment register by one
- inc byte [bx] ; increment memory by one
-\end{verbatim}
-
-\index{sub}
-\verb"sub" subtracts the source operand from the destination operand and
-replaces the destination operand with the result. If a borrow is required,
-the CF is set. Rules for the operands are the same as for the \verb"add"
-instruction.
-
-\index{sbb}
-\verb"sbb" subtracts the source operand from the destination operand,
-subtracts one if CF is set, and stores the result to the destination operand.
-Rules for the operands are the same as for the \verb"add" instruction.
-A \verb"sub" followed by multiple \verb"sbb" instructions may be used to
-subtract numbers longer than 32 bits.
-
-\index{dec}
-\verb"dec" subtracts one from the operand, it does not affect CF. Rules for
-the operand are the same as for the \verb"inc" instruction.
-
-\index{cmp}
-\verb"cmp" subtracts the source operand from the destination operand. It
-updates the flags as the \verb"sub" instruction, but does not alter the
-source and destination operands. Rules for the operands are the same as for
-the \verb"sub" instruction.
-
-\index{neg}
-\verb"neg" subtracts a signed integer operand from zero. The effect of this
-instructon is to reverse the sign of the operand from positive to negative or
-from negative to positive. Rules for the operand are the same as for the
-\verb"inc" instruction.
-
-\index{xadd}
-\verb"xadd" exchanges the destination operand with the source operand,
-then loads the sum of the two values into the destination operand. Rules for
-the operands are the same as for the \verb"add" instruction.
-
-All the above binary arithmetic instructions update SF, ZF, PF and OF flags.
-SF is always set to the same value as the result's sign bit, ZF is set
-when all the bits of result are zero, PF is set when low order eight bits of
-result contain an even number of set bits, OF is set if result is too large for a
-positive number or too small for a negative number (excluding sign bit) to fit in
-destination operand.
-
-\index{mul}
-\verb"mul" performs an unsigned multiplication of the operand and the
-accumulator. If the operand is a byte, the processor multiplies it by the
-contents of \verb"al" and returns the 16--bit result to \verb"ah" and
-\verb"al". If the operand is a word, the processor multiplies it by the
-contents of \verb"ax" and returns the 32--bit result to \verb"dx" and
-\verb"ax". If the operand is a double word, the processor multiplies it by
-the contents of \verb"eax" and returns the 64--bit result in \verb"edx" and
-\verb"eax". \verb"mul" sets CF and OF when the upper half of the result is
-nonzero, otherwise they are cleared. Rules for the operand are the same as
-for the \verb"inc" instruction.
-
-\index{imul}
-\verb"imul" performs a signed multiplication operation. This
-instruction has three variations. First has one operand and
-behaves in the same way as the \verb"mul" instruction. Second has
-two operands, in this case destination operand is multiplied by
-the source operand and the result replaces the destination
-operand. Destination operand must be a general register, it can be
-word or double word, source operand can be general register,
-memory or immediate value. Third form has three operands, the
-destination operand must be a general register, word or double
-word in size, source operand can be general register or memory,
-and third operand must be an immediate value. The source operand
-is multiplied by the immediate value and the result is stored in
-the destination register. All the three forms calculate the
-product to twice the size of operands and set CF and OF when the
-upper half of the result is nonzero, but second and third form
-truncate the product to the size of operands. So second and third
-forms can be also used for unsigned operands because, whether the
-operands are signed or unsigned, the lower half of the product is
-the same. Below are the examples for all three forms:
-\begin{verbatim}
- imul bl ; accumulator by register
- imul word [si] ; accumulator by memory
- imul bx,cx ; register by register
- imul bx,[si] ; register by memory
- imul bx,10 ; register by immediate value
- imul ax,bx,10 ; register by immediate value to register
- imul ax,[si],10 ; memory by immediate value to register
-\end{verbatim}
-
-\index{div}
-\verb"div" performs an unsigned division of the accumulator by the operand.
-The dividend (the accumulator) is twice the size of the divisor (the
-operand), the quotient and remainder have the same size as the divisor.
-If divisor is byte, the dividend is taken from \verb"ax" register, the
-quotient is stored in \verb"al" and the remainder is stored in \verb"ah".
-If divisor is word, the upper half of dividend is taken from \verb"dx",
-the lower half of dividend is taken from \verb"ax", the quotient is stored
-in \verb"ax" and the remainder is stored in \verb"dx". If divisor is double
-word, the upper half of dividend is taken from \verb"edx", the lower half of
-dividend is taken from \verb"eax", the quotient is stored in \verb"eax" and
-the remainder is stored in \verb"edx". Rules for the operand are the same as
-for the \verb"mul" instruction.
-
-\index{idiv}
-\verb"idiv" performs a signed division of the accumulator by the operand.
-It uses the same registers as the \verb"div" instruction, and the rules for
-the operand are the same.
-
-\subsection{Decimal arithmetic instructions}
-Decimal arithmetic is performed by combining the binary arithmetic
-instructions (already described in the prior section) with the decimal
-arithmetic instructions. The decimal arithmetic instructions are used to
-adjust the results of a previous binary arithmetic operation to produce a
-valid packed or unpacked decimal result, or to adjust the inputs to a
-subsequent binary arithmetic operation so the operation will produce a valid
-packed or unpacked decimal result.
-
-\index{daa}
-\verb"daa" adjusts the result of adding two valid packed decimal operands in
-\verb"al". \verb"daa" must always follow the addition of two pairs of packed
-decimal numbers (one digit in each half--byte) to obtain a pair of valid
-packed decimal digits as results. The carry flag is set if carry was needed.
-This instruction has no operands.
-
-\index{das}
-\verb"das" adjusts the result of subtracting two valid packed decimal
-operands in \verb"al". \verb"das" must always follow the subtraction of one
-pair of packed decimal numbers (one digit in each half--byte) from another
-to obtain a pair of valid packed decimal digits as results. The carry flag is
-set if a borrow was needed. This instruction has no operands.
-
-\index{aaa}
-\verb"aaa" changes the contents of register \verb"al" to a valid unpacked
-decimal number, and zeroes the top four bits. \verb"aaa" must always follow
-the addition of two unpacked decimal operands in \verb"al". The carry flag is
-set and \verb"ah" is incremented if a carry is necessary. This instruction
-has no operands.
-
-\index{aas}
-\verb"aas" changes the contents of register \verb"al" to a valid unpacked
-decimal number, and zeroes the top four bits. \verb"aas" must always follow
-the subtraction of one unpacked decimal operand from another in \verb"al".
-The carry flag is set and \verb"ah" decremented if a borrow is necessary.
-This instruction has no operands.
-
-\index{aam}
-\verb"aam" corrects the result of a multiplication of two valid unpacked
-decimal numbers. \verb"aam" must always follow the multiplication of two
-decimal numbers to produce a valid decimal result. The high order digit is
-left in \verb"ah", the low order digit in \verb"al". The generalized version
-of this instruction allows adjustment of the contents of the \verb"ax" to
-create two unpacked digits of any number base. The standard version of this
-instruction has no operands, the generalized version has one operand -- an
-immediate value specifying the number base for the created digits.
-
-\index{aad}
-\verb"aad" modifies the numerator in \verb"ah" and \verb"ah" to prepare for
-the division of two valid unpacked decimal operands so that the quotient
-produced by the division will be a valid unpacked decimal number. \verb"ah"
-should contain the high order digit and \verb"al" the low order digit.
-This instruction adjusts the value and places the result in \verb"al", while
-\verb"ah" will contain zero. The generalized version of this instruction
-allows adjustment of two unpacked digits of any number base. Rules for the
-operand are the same as for the \verb"aam" instruction.
-
-\subsection{Logical instructions}
-\index{not}
-\verb"not" inverts the bits in the specified operand to form a one's
-complement of the operand. It has no effect on the flags. Rules for the
-operand are the same as for the \verb"inc" instruction.
-
-\index{and}\index{or}\index{xor}
-\verb"and", \verb"or" and \verb"xor" instructions perform the standard
-logical operations. They update the SF, ZF and PF flags. Rules for the
-operands are the same as for the \verb"add" instruction.
-
-\index{bt}\index{bts}\index{btr}\index{btc}
-\verb"bt", \verb"bts", \verb"btr" and \verb"btc" instructions operate on a
-single bit which can be in memory or in a general register. The location of
-the bit is specified as an offset from the low order end of the operand.
-The value of the offset is the taken from the second operand, it either may
-be an immediate byte or a general register. These instructions first assign
-the value of the selected bit to CF. \verb"bt" instruction does nothing more,
-\verb"bts" sets the selected bit to 1, \verb"btr" resets the selected bit to
-0, \verb"btc" changes the bit to its complement. The first operand can be
-word or double word.
-\begin{verbatim}
- bt ax,15 ; test bit in register
- bts word [bx],15 ; test and set bit in memory
- btr ax,cx ; test and reset bit in register
- btc word [bx],cx ; test and complement bit in memory
-\end{verbatim}
-
-\index{bsf}\index{bsr}
-\verb"bsf" and \verb"bsr" instructions scan a word or double word for first
-set bit and store the index of this bit into destination operand, which must
-be general register. The bit string being scanned is specified by source
-operand, it may be either general register or memory. The ZF flag is set if
-the entire string is zero (no set bits are found); otherwise it is cleared.
-If no set bit is found, the value of the destination register is undefined.
-\verb"bsf" from low order to high order (starting from bit index zero).
-\verb"bsr" scans from high order to low order (starting from bit index 15 of
-a word or index 31 of a double word).
-\begin{verbatim}
- bsf ax,bx ; scan register forward
- bsr ax,[si] ; scan memory reverse
-\end{verbatim}
-
-\index{shl}
-\verb"shl" shifts the destination operand left by the number of bits
-specified in the second operand. The destination operand can be byte, word,
-or double word general register or memory. The second operand can be an
-immediate value or the \verb"cl" register. The processor shifts zeros in from
-the right (low order) side of the operand as bits exit from the left side.
-The last bit that exited is stored in CF. \verb"sal" is a synonym for
-\verb"shl".
-\begin{verbatim}
- shl al,1 ; shift register left by one bit
- shl byte [bx],1 ; shift memory left by one bit
- shl ax,cl ; shift register left by count from cl
- shl word [bx],cl ; shift memory left by count from cl
-\end{verbatim}
-
-\index{shr}\index{sar}
-\verb"shr" and \verb"sar" shift the destination operand right by the number
-of bits specified in the second operand. Rules for operands are the same as
-for the \verb"shl" instruction. \verb"shr" shifts zeros in from the left side
-of the operand as bits exit from the right side. The last bit that exited is
-stored in CF. \verb"sar" preserves the sign of the operand by shifting in
-zeros on the left side if the value is positive or by shifting in ones if the
-value is negative.
-
-\index{shld}
-\verb"shld" shifts bits of the destination operand to the left by the number
-of bits specified in third operand, while shifting high order bits from the
-source operand into the destination operand on the right. The source operand
-remains unmodified. The destination operand can be a word or double word
-general register or memory, the source operand must be a general register,
-third operand can be an immediate value or the \verb"cl" register.
-\begin{verbatim}
- shld ax,bx,1 ; shift register left by one bit
- shld [di],bx,1 ; shift memory left by one bit
- shld ax,bx,cl ; shift register left by count from cl
- shld [di],bx,cl ; shift memory left by count from cl
-\end{verbatim}
-
-\index{shrd}
-\verb"shrd" shifts bits of the destination operand to the right, while
-shifting low order bits from the source operand into the destination operand
-on the left. The source operand remains unmodified. Rules for operands are
-the same as for the \verb"shld" instruction.
-
-\index{rol}\index{rcl}
-\verb"rol" and \verb"rcl" rotate the byte, word or double word destination
-operand left by the number of bits specified in the second operand. For each
-rotation specified, the high order bit that exits from the left of the
-operand returns at the right to become the new low order bit. \verb"rcl"
-additionally puts in CF each high order bit that exits from the left side
-of the operand before it returns to the operand as the low order bit on the
-next rotation cycle. Rules for operands are the same as for the \verb"shl"
-instruction.
-
-\index{ror}\index{rcr}
-\verb"ror" and \verb"rcr" rotate the byte, word or double word destination
-operand right by the number of bits specified in the second operand. For each
-rotation specified, the low order bit that exits from the right of the
-operand returns at the left to become the new high order bit. \verb"rcr"
-additionally puts in CF each low order bit that exits from the right side of
-the operand before it returns to the operand as the high order bit on the
-next rotation cycle. Rules for operands are the same as for the \verb"shl"
-instruction.
-
-\index{test}
-\verb"test" performs the same action as the \verb"and" instruction, but it
-does not alter the destination operand, only updates flags. Rules for the
-operands are the same as for the \verb"and" instruction.
-
-\index{bswap}
-\verb"bswap" reverses the byte order of a 32--bit general register:
-bits 0 through 7 are swapped with bits 24 through 31, and bits 8 through 15
-are swapped with bits 16 through 23. This instruction is provided for
-converting little--endian values to big--endian format and vice versa.
-\begin{verbatim}
- bswap edx ; swap bytes in register
-\end{verbatim}
-
-\subsection{Control transfer instructions}
-
-\index{jmp}
-\verb"jmp" unconditionally transfers control to the target location. The
-destination address can be specified directly within the instruction or
-indirectly through a register or memory, the acceptable size of this address
-depends on whether the jump is near or far (it can be specified by preceding
-the operand with \verb"near" or \verb"far" operator) and whether the instruction is
-16--bit or 32--bit. Operand for near jump should be \verb"word" size for 16--bit
-instruction or the \verb"dword" size for 32--bit instruction. Operand for far jump
-should be \verb"dword" size for 16--bit instruction or \verb"pword" size for 32--bit
-instruction. A direct \verb"jmp" instruction includes the destination address as
-part of the instruction (and can be preceded by \verb"short", \verb"near" or \verb"far"
-operator), the operand specifying address should be the numerical expression
-for near or short jump, or two numerical expressions separated with colon for
-far jump, the first specifies selector of segment, the second is the offset
-within segment. The \verb"pword" operator can be used to force the 32--bit far call,
-and \verb"dword" to force the 16-bit far call. An indirect \verb"jmp" instruction
-obtains the destination address indirectly through a register or a pointer
-variable, the operand should be general register or memory. See also \ref{sec:jumps} for
-some more details.
-\begin{verbatim}
- jmp 100h ; direct near jump
- jmp 0FFFFh:0 ; direct far jump
- jmp ax ; indirect near jump
- jmp pword [ebx] ; indirect far jump
-\end{verbatim}
-
-\index{call}
-\verb"call" transfers control to the procedure, saving on the stack the
-address of the instruction following the \verb"call" for later use by a
-\verb"ret" (return) instruction. Rules for the operands are the same as for
-the \verb"jmp" instruction, but the \verb"call" has no short variant of
-direct instruction and thus it not optimized.
-
-\index{ret}\index{retn}\index{retf}
-\index{retw}\index{retnw}\index{retfw}
-\index{retd}\index{retnd}\index{retfd}
-\verb"ret", \verb"retn" and \verb"retf" instructions terminate the execution
-of a procedure and transfers control back to the program that originally
-invoked the procedure using the address that was stored on the stack by the
-\verb"call" instruction. \verb"ret" is the equivalent for \verb"retn", which
-returns from the procedure that was executed using the near call, while
-\verb"retf" returns from the procedure that was executed using the far call.
-These instructions default to the size of address appropriate for the current
-code setting, but the size of address can be forced to 16--bit by using the
-\verb"retw", \verb"retnw" and \verb"retfw" mnemonics, and to 32--bit by using
-the \verb"retd", \verb"retnd" and \verb"retfd" mnemonics. All these
-instructions may optionally specify an immediate operand, by adding this
-constant to the stack pointer, they effectively remove any arguments that the
-calling program pushed on the stack before the execution of the \verb"call"
-instruction.
-
-\index{iret}\index{iretw}\index{iretd}
-\verb"iret" returns control to an interrupted procedure. It differs from
-\verb"ret" in that it also pops the flags from the stack into the flags
-register. The flags are stored on the stack by the interrupt mechanism. It
-defaults to the size of return address appropriate for the current code
-setting, but it can be forced to use 16--bit or 32--bit address by using the
-\verb"iretw" or \verb"iretd" mnemonic.
-
-\index{jo}\index{jno}\index{jc}\index{jb}\index{jnae}\index{jnc}\index{jae}
-\index{jnb}\index{je}\index{jz}\index{jne}\index{jnz}\index{jbe}\index{jna}
-\index{ja}\index{jnbe}\index{js}\index{jns}\index{jp}\index{jpe}\index{jnp}
-\index{jpo}\index{jl}\index{jnge}\index{jge}\index{jnl}\index{jle}\index{jng}
-\index{jg}\index{jnle}
-The conditional transfer instructions are jumps that may or may not transfer
-control, depending on the state of the CPU flags when the instruction
-executes. The mnemonics for conditional jumps may be obtained by attaching
-the condition mnemonic (see table \ref{tab:conditions}) to the \verb"j"
-mnemonic, for example \verb"jc" instruction will transfer the control when
-the CF flag is set. The conditional jumps can be short or near, and direct only, and
-can be optimized (see \ref{sec:jumps}), the operand should be an immediate
-value specifying target address.
-
-\begin{table}[p]
-\begin{center}\begin{tabular}{|c|c|c|}
-\hline
-Mnemonic & Condition tested & Description \\
-\hline \hline
-\verb"o" & OF = 1 & overflow\\
-\hline
-\verb"no" & OF = 0 & not overflow\\
-\hline
-\verb"c" & & carry\\
-\verb"b" & CF = 1 & below\\
-\verb"nae" & & not above nor equal\\
-\hline
-\verb"nc" & & not carry\\
-\verb"ae" & CF = 0 & above or equal\\
-\verb"nb" & & not below\\
-\hline
-\verb"e" & ZF = 1 & equal\\
-\verb"z" & & zero\\
-\hline
-\verb"ne" & ZF = 0 & not equal\\
-\verb"nz" & & not zero\\
-\hline
-\verb"be" & CF \verb"or" ZF = 1 & below or equal\\
-\verb"na" & & not above\\
-\hline
-\verb"a" & CF \verb"or" ZF = 0 & above\\
-\verb"nbe" & & not below nor equal\\
-\hline
-\verb"s" & SF = 1 & sign\\
-\hline
-\verb"ns" & SF = 0 & not sign\\
-\hline
-\verb"p" & PF = 1 & parity\\
-\verb"pe" & & parity even\\
-\hline
-\verb"np" & PF = 0 & not parity\\
-\verb"po" & & parity odd\\
-\hline
-\verb"l" & SF \verb"xor" OF = 1 & less\\
-\verb"nge" & & not greater nor equal\\
-\hline
-\verb"ge" & SF \verb"xor" OF = 0 & greater or equal\\
-\verb"nl" & & not less\\
-\hline
-\verb"le" & (SF \verb"xor" OF) \verb"or" ZF = 1 & less or equal\\
-\verb"ng" & & not greater\\
-\hline
-\verb"g" & (SF \verb"xor" OF) \verb"or" ZF = 0 & greater\\
-\verb"nle" & & not less nor equal\\
-\hline
-\end{tabular}\end{center}
-\caption{Conditions.}
-\label{tab:conditions}
-\end{table}
-
-\index{loop}\index{loopw}\index{loopd}
-\index{loope}\index{loopz}\index{loopew}\index{loopzw}\index{looped}\index{loopzd}
-\index{loopne}\index{loopnz}\index{loopnew}\index{loopnzw}\index{loopned}\index{loopnzd}
-The \verb"loop" instructions are conditional jumps that use a value placed in
-\verb"cx" (or \verb"ecx") to specify the number of repetitions of a software
-loop. All \verb"loop" instructions automatically decrement \verb"cx" (or
-\verb"ecx") and terminate the loop (don't transfer the control) when
-\verb"cx" (or \verb"ecx") is zero. It uses \verb"cx" or \verb"ecx" whether
-the current code setting is 16--bit or 32--bit, but it can be forced to use
-\verb"cx" with the \verb"loopw" mnemonic or to use \verb"ecx" with the
-\verb"loopd" mnemonic. \verb"loope" and \verb"loopz" are the synonyms for the
-same instruction, which acts as the standard \verb"loop", but also terminates
-the loop when ZF flag is set. \verb"loopew" and \verb"loopzw" mnemonics force
-them to use \verb"cx" register while \verb"looped" and \verb"loopzd" force
-them to use \verb"ecx" register. \verb"loopne" and \verb"loopnz" are the
-synonyms for the same instructions, which acts as the standard \verb"loop",
-but also terminate the loop when ZF flag is not set. \verb"loopnew" and
-\verb"loopnzw" mnemonics force them to use \verb"cx" register while
-\verb"loopned" and \verb"loopnzd" force them to use \verb"ecx" register.
-Every \verb"loop" instruction needs an operand being an immediate value
-specifying target address, it can be only short jump (in the range of 128
-bytes back and 127 bytes forward from the address of instruction following
-the \verb"loop" instruction).
-
-\index{jcxz}\index{jecxz}
-\verb"jcxz" branches to the label specified in the instruction if it finds a
-value of zero in \verb"cx", \verb"jecxz" does the same, but checks the value
-of \verb"ecx" instead of \verb"cx". Rules for the operands are the same as
-for the \verb"loop" instruction.
-
-\index{int}\index{int3}\index{into}
-\verb"int" activates the interrupt service routine that corresponds to the
-number specified as an operand to the instruction, the number should be in
-range from 0 to 255. The interrupt service routine terminates with an
-\verb"iret" instruction that returns control to the instruction that follows
-\verb"int". \verb"int3" mnemonic codes the short (one byte) trap that invokes
-the interrupt 3. \verb"into" instruction invokes the interrupt 4 if the OF
-flag is set.
-
-\index{bound}
-\verb"bound" verifies that the signed value contained in the specified
-register lies within specified limits. An interrupt 5 occurs if the value
-contained in the register is less than the lower bound or greater than the
-upper bound. It needs two operands, the first operand specifies the register
-being tested, the second operand should be memory address for the two signed
-limit values. The operands can be \verb"word" or \verb"dword" in size.
-\begin{verbatim}
- bound ax,[bx] ; check word for bounds
- bound eax,[esi] ; check double word for bounds
-\end{verbatim}
-
-\subsection{I/O instructions}
-
-\index{in}
-\verb"in" transfers a byte, word, or double word from an input port to
-\verb"al", \verb"ax", or \verb"eax". I/O ports can be addressed either
-directly, with the immediate byte value coded in instruction, or indirectly
-via the \verb"dx" register. The destination operand should be \verb"al",
-\verb"ax", or \verb"eax" register. The source operand should be an immediate
-value in range from 0 to 255, or \verb"dx" register.
-\begin{verbatim}
- in al,20h ; input byte from port 20h
- in ax,dx ; input word from port addressed by dx
-\end{verbatim}
-
-\index{out}
-\verb"out" transfers a byte, word, or double word to an output port from
-\verb"al", \verb"ax", or \verb"eax". The program can specify the number of
-the port using the same methods as the \verb"in" instruction. The destination
-operand should be an immediate value in range from 0 to 255, or \verb"dx"
-register. The source operand should be \verb"al", \verb"ax", or \verb"eax"
-register.
-\begin{verbatim}
- out 20h,ax ; output word to port 20h
- out dx,al ; output byte to port addressed by dx
-\end{verbatim}
-
-\subsection{Strings operations}
-
-The string operations operate on one element of a string. A string element
-may be a byte, a word, or a double word. The string elements are addressed by
-\verb"si" and \verb"di" (or \verb"esi" and \verb"edi") registers. After every
-string operation \verb"si" and/or \verb"di" (or \verb"esi" and/or \verb"edi")
-are automatically updated to point to the next element of the string. If DF
-(direction flag) is zero, the index registers are incremented, if DF is one,
-they are decremented. The amount of the increment or decrement is 1, 2, or 4
-depending on the size of the string element. Every string operation
-instruction has short forms which have no operands and use \verb"si" and/or
-\verb"di" when the code type is 16--bit, and \verb"esi" and/or \verb"edi"
-when the code type is 32--bit. \verb"si" and \verb"esi" by default address
-data in the segment selected by \verb"ds", \verb"di" and \verb"edi" always
-address data in the segment selected by \verb"es". Short form is obtained
-by attaching to the mnemonic of string operation letter specifying the size
-of string element, it should be \verb"b" for byte element, \verb"w" for word
-element, and \verb"d" for double word element. Full form of string operation
-needs operands providing the size operator and the memory addresses, which
-can be \verb"si" or \verb"esi" with any segment prefix, \verb"di" or
-\verb"edi" always with \verb"es" segment prefix.
-
-\index{movs}\index{movsb}\index{movsw}\index{movsd}
-\verb"movs" transfers the string element pointed to by \verb"si" (or
-\verb"esi") to the location pointed to by \verb"di" (or \verb"edi"). Size of
-operands can be \verb"byte", \verb"word" or \verb"dword". The destination
-operand should be memory addressed by \verb"di" or \verb"edi", the source
-operand should be memory addressed by \verb"si" or \verb"esi" with any
-segment prefix.
-\begin{verbatim}
- movs byte [di],[si] ; transfer byte
- movs word [es:di],[ss:si] ; transfer word
- movsd ; transfer double word
-\end{verbatim}
-
-\index{cmps}\index{cmpsb}\index{cmpsw}\index{cmpsd}
-\verb"cmps" subtracts the destination string element from the source string
-element and updates the flags AF, SF, PF, CF and OF, but it does not change
-any of the compared elements. If the string elements are equal, ZF is set,
-otherwise it is cleared. The first operand for this instruction should be the
-source string element addressed by \verb"si" or \verb"esi" with any segment
-prefix, the second operand should be the destination string element addressed
-by \verb"di" or \verb"edi".
-\begin{verbatim}
- cmpsb ; compare bytes
- cmps word [ds:si],[es:di] ; compare words
- cmps dword [fs:esi],[edi] ; compare double words
-\end{verbatim}
-
-\index{scas}\index{scasb}\index{scasw}\index{scasd}
-\verb"scas" subtracts the destination string element from \verb"al",
-\verb"ax", or \verb"eax" (depending on the size of string element) and
-updates the flags AF, SF, ZF, PF, CF and OF. If the values are equal, ZF is
-set, otherwise it is cleared. The operand should be the destination string
-element addressed by \verb"di" or \verb"edi".
-\begin{verbatim}
- scas byte [es:di] ; scan byte
- scasw ; scan word
- scas dword [es:edi] ; scan double word
-\end{verbatim}
-
-\index{lods}\index{lodsb}\index{lodsw}\index{lodsd}
-\verb"lods" places the source string element into \verb"al", \verb"ax", or
-\verb"eax". The operand should be the source string element addressed by
-\verb"si" or \verb"esi" with any segment prefix.
-\begin{verbatim}
- lods byte [ds:si] ; load byte
- lods word [cs:si] ; load word
- lodsd ; load double word
-\end{verbatim}
-
-\index{stos}\index{stosb}\index{stosw}\index{stosd}
-\verb"stos" places the value of \verb"al", \verb"ax", or \verb"eax" into the
-destination string element. Rules for the operand are the same as for the
-\verb"scas" instruction.
-
-\index{ins}\index{insb}\index{insw}\index{insd}
-\verb"ins" transfers a byte, word, or double word from an input port
-addressed by \verb"dx" register to the destination string element. The
-destination operand should be memory addressed by \verb"di" or \verb"edi",
-the source operand should be the \verb"dx" register.
-\begin{verbatim}
- insb ; input byte
- ins word [es:di],dx ; input word
- ins dword [edi],dx ; input double word
-\end{verbatim}
-
-\index{outs}\index{outsb}\index{outsw}\index{outsd}
-\verb"outs" transfers the source string element to an output port addressed
-by \verb"dx" register. The destination operand should be the \verb"dx"
-register and the source operand should be memory addressed by \verb"si" or
-\verb"esi" with any segment prefix.
-\begin{verbatim}
- outs dx,byte [si] ; output byte
- outsw ; output word
- outs dx,dword [gs:esi] ; output double word
-\end{verbatim}
-
-\index{rep}\index{repe}\index{repz}\index{repne}\index{repnz}
-The repeat prefixes \verb"rep", \verb"repe"/\verb"repz", and
-\verb"repne"/\verb"repnz" specify repeated string operation. When a string
-operation instruction has a repeat prefix, the operation is executed
-repeatedly, each time using a different element of the string. The repetition
-terminates when one of the conditions specified by the prefix is satisfied.
-All three prefixes automatically decrease \verb"cx" or \verb"ecx" register
-(depending whether string operation instruction uses the 16--bit or 32--bit
-addressing) after each operation and repeat the associated operation until
-\verb"cx" or \verb"ecx" is zero. \verb"repe"/\verb"repz" and
-\verb"repne"/\verb"repnz" are used exclusively with the \verb"scas" and
-\verb"cmps" instructions (described below). When these prefixes are used,
-repetition of the next instruction depends on the zero flag (ZF) also,
-\verb"repe" and \verb"repz" terminate the execution when the ZF is zero,
-\verb"repne" and \verb"repnz" terminate the execution when the ZF is set.
-\begin{verbatim}
- rep movsd ; transfer multiple double words
- repe cmpsb ; compare bytes until not equal
-\end{verbatim}
-
-\subsection{Flag control instructions}
-
-The flag control instructions provide a method for directly changing the
-state of bits in the flag register. All instructions described in this
-section have no operands.
-
-\index{stc}\index{clc}\index{cmc}\index{std}\index{cld}\index{sti}\index{cli}
-\verb"stc" sets the CF (carry flag) to 1, \verb"clc" zeroes the CF,
-\verb"cmc" changes the CF to its complement. \verb"std" sets the DF
-(direction flag) to 1, \verb"cld" zeroes the DF, \verb"sti" sets the IF
-(interrupt flag) to 1 and therefore enables the interrupts, \verb"cli" zeroes
-the IF and therefore disables the interrupts.
-
-\index{lahf}
-\verb"lahf" copies SF, ZF, AF, PF, and CF to bits 7, 6, 4, 2, and 0 of the
-\verb"ah" register. The contents of the remaining bits are undefined.
-The flags remain unaffected.
-
-\index{sahf}
-\verb"sahf" transfers bits 7, 6, 4, 2, and 0 from the \verb"ah" register
-into SF, ZF, AF, PF, and CF.
-
-\index{pushf}\index{pushfw}\index{pushfd}
-\verb"pushf" decrements \verb"esp" by two or four and stores the low word or
-double word of flags register at the top of stack, size of stored data
-depends on the current code setting. \verb"pushfw" variant forces storing the
-word and \verb"pushfd" forces storing the double word.
-
-\index{popf}\index{popfw}\index{popfd}
-\verb"popf" transfers specific bits from the word or double word at the top
-of stack, then increments \verb"esp" by two or four, this value depends on
-the current code setting. \verb"popfw" variant forces restoring from the word
-and \verb"popfd" forces restoring from the double word.
-
-\subsection{Conditional operations}
-
-\index{seto}\index{setno}\index{setc}\index{setb}\index{setnae}\index{setnc}\index{setae}
-\index{setnb}\index{sete}\index{setz}\index{setne}\index{setnz}\index{setbe}\index{setna}
-\index{seta}\index{setnbe}\index{sets}\index{setns}\index{setp}\index{setpe}\index{setnp}
-\index{setpo}\index{setl}\index{setnge}\index{setge}\index{setnl}\index{setle}\index{setng}
-\index{setg}\index{setnle}
-The instructions obtained by attaching the condition mnemonic (see table
-\ref{tab:conditions}) to the \verb"set" mnemonic set a byte to one if the
-condition is true and set the byte to zero otherwise. The operand should be
-an 8--bit be general register or the byte in memory.
-\begin{verbatim}
- setne al ; set al if zero flag cleared
- seto byte [bx] ; set byte if overflow
-\end{verbatim}
-
-\index{salc}
-\verb"salc" instruction sets the all bits of \verb"al" register when the
-carry flag is set and zeroes the \verb"al" register otherwise. This
-instruction has no arguments.
-
-\index{cmovo}\index{cmovno}\index{cmovc}\index{cmovb}\index{cmovnae}\index{cmovnc}\index{cmovae}
-\index{cmovnb}\index{cmove}\index{cmovz}\index{cmovne}\index{cmovnz}\index{cmovbe}\index{cmovna}
-\index{cmova}\index{cmovnbe}\index{cmovs}\index{cmovns}\index{cmovp}\index{cmovpe}\index{cmovnp}
-\index{cmovpo}\index{cmovl}\index{cmovnge}\index{cmovge}\index{cmovnl}\index{cmovle}\index{cmovng}
-\index{cmovg}\index{cmovnle}
-The instructions obtained by attaching the condition mnemonic to
-\verb"cmov" mnemonic transfer the word or double word from the general
-register or memory to the general register only when the condition is true.
-The destination operand should be general register, the source operand can be
-general register or memory.
-\begin{verbatim}
- cmove ax,bx ; move when zero flag set
- cmovnc eax,[ebx] ; move when carry flag cleared
-\end{verbatim}
-
-\index{cmpxchg}
-\verb"cmpxchg" compares the value in the \verb"al", \verb"ax", or \verb"eax"
-register with the destination operand. If the two values are equal,
-the source operand is loaded into the destination operand. Otherwise,
-the destination operand is loaded into the \verb"al", \verb"ax", or \verb"eax"
-register. The destination operand may be a general register or memory, the
-source operand must be a general register.
-\begin{verbatim}
- cmpxchg dl,bl ; compare and exchange with register
- cmpxchg [bx],dx ; compare and exchange with memory
-\end{verbatim}
-
-\index{cmpxchg8b}
-\verb"cmpxchg8b" compares the 64--bit value in \verb"edx" and \verb"eax"
-registers with the destination operand. If the values are equal, the 64--bit
-value in \verb"ecx" and \verb"ebx" registers is stored in the destination
-operand. Otherwise, the value in the destination operand is loaded into
-\verb"edx" and \verb"eax" registers. The destination operand should be a
-quad word in memory.
-\begin{verbatim}
- cmpxchg8b [bx] ; compare and exchange 8 bytes
-\end{verbatim}
-
-\subsection{Miscellaneous instructions}
-
-\index{nop}
-\verb"nop" instruction occupies one byte but affects nothing but the
-instruction pointer. This instruction has no operands and doesn't perform any
-operation.
-
-\index{ud2}
-\verb"ud2" instruction generates an invalid opcode exception. This
-instruction is provided for software testing to explicitly generate an
-invalid opcode. This is instruction has no operands.
-
-\index{xlat}
-\verb"xlat" replaces a byte in the \verb"al" register with a byte indexed by
-its value in a translation table addressed by \verb"bx" or \verb"ebx". The
-operand should be a byte memory addressed by \verb"bx" or \verb"ebx" with any
-segment prefix. This instruction has also a short form \verb"xlatb" which has
-no operands and uses the \verb"bx" or \verb"ebx" address in the segment
-selected by \verb"ds" depending on the current code setting.
-
-\index{lds}\index{les}\index{lfs}\index{lgs}\index{lss}
-\verb"lds" transfers a pointer variable from the source operand to \verb"ds"
-and the destination register. The source operand must be a memory operand,
-and the destination operand must be a general register. The \verb"ds"
-register receives the segment selector of the pointer while the destination
-register receives the offset part of the pointer. \verb"les", \verb"lfs",
-\verb"lgs" and \verb"lss" operate identically to \verb"lds" except that
-rather than \verb"ds" register the \verb"es", \verb"fs", \verb"gs" and
-\verb"ss" is used respectively.
-\begin{verbatim}
- lds bx,[si] ; load pointer to ds:bx
-\end{verbatim}
-
-\index{lea}
-\verb"lea" transfers the offset of the source operand (rather than its value)
-to the destination operand. The source operand must be a memory operand, and
-the destination operand must be a general register.
-\begin{verbatim}
- lea dx,[bx+si+1] ; load effective address to dx
-\end{verbatim}
-
-\index{cpuid}
-\verb"cpuid" returns processor identification and feature information in the
-\verb"eax", \verb"ebx", \verb"ecx", and \verb"edx" registers. The information
-returned is selected by entering a value in the \verb"eax" register before
-the instruction is executed. This instruction has no operands.
-
-\index{pause}
-\verb"pause" instruction delays the execution of the next instruction an
-implementation specific amount of time. It can be used to improve the
-performance of spin wait loops. This instruction has no operands.
-
-\index{enter}\index{leave}
-\verb"enter" creates a stack frame that may be used to implement the scope
-rules of block--structured high--level languages. A \verb"leave" instruction
-at the end of a procedure complements an \verb"enter" at the beginning of the
-procedure to simplify stack management and to control access to variables for
-nested procedures. The \verb"enter" instruction includes two parameters. The
-first parameter specifies the number of bytes of dynamic storage to be
-allocated on the stack for the routine being entered. The second parameter
-corresponds to the lexical nesting level of the routine, it can be in range
-from 0 to 31. The specified lexical level determines how many sets of stack
-frame pointers the CPU copies into the new stack frame from the preceding
-frame. This list of stack frame pointers is sometimes called the display.
-The first word (or double word when code is 32--bit) of the display is a
-pointer to the last stack frame. This pointer enables a \verb"leave"
-instruction to reverse the action of the previous \verb"enter" instruction by
-effectively discarding the last stack frame. After \verb"enter" creates the
-new display for a procedure, it allocates the dynamic storage space for that
-procedure by decrementing \verb"esp" by the number of bytes specified in the
-first parameter. To enable a procedure to address its display, \verb"enter"
-leaves \verb"bp" (or \verb"ebp") pointing to the beginning of the new stack
-frame. If the lexical level is zero, \verb"enter" pushes \verb"bp" (or
-\verb"ebp"), copies \verb"sp" to \verb"bp" (or \verb"esp" to \verb"ebp") and
-then subtracts the first operand from \verb"esp". For nesting levels greater
-than zero, the processor pushes additional frame pointers on the stack before
-adjusting the stack pointer.
-\begin{verbatim}
- enter 2048,0 ; enter and allocate 2048 bytes on stack
-\end{verbatim}
-
-\subsection{System instructions}
-
-\index{lmsw}\index{smsw}
-\verb"lmsw" loads the operand into the machine status word (bits 0 through 15
-of \verb"cr0" register), while \verb"smsw" stores the machine status word
-into the destination operand. The operand for both those instructions can be 16--bit
-general register or memory, for \verb"smsw" it can also be 32--bit general
-register.
-\begin{verbatim}
- lmsw ax ; load machine status from register
- smsw [bx] ; store machine status to memory
-\end{verbatim}
-
-\index{lgdt}\index{lidt}\index{sgdt}\index{sidt}
-\verb"lgdt" and \verb"lidt" instructions load the values in operand into the
-global descriptor table register or the interrupt descriptor table register
-respectively. \verb"sgdt" and \verb"sidt" store the contents of the global
-descriptor table register or the interrupt descriptor table register
-in the destination operand. The operand should be a 6 bytes in memory.
-\begin{verbatim}
- lgdt [ebx] ; load global descriptor table
-\end{verbatim}
-
-\index{lldt}\index{sldt}\index{ltr}\index{str}
-\verb"lldt" loads the operand into the segment selector field of
-the local descriptor table register and \verb"sldt" stores the
-segment selector from the local descriptor table register in the
-operand. \verb"ltr" loads the operand into the segment selector
-field of the task register and \verb"str" stores the segment
-selector from the task register in the operand. Rules for operand
-are the same as for the \verb"lmsw" and \verb"smsw" instructions.
-
-\index{lar}
-\verb"lar" loads the access rights from the segment descriptor
-specified by the selector in source operand into the destination
-operand and sets the ZF flag. The destination operand can be a
-16-bit or 32--bit general register. The source operand should be a
-16-bit general register or memory.
-\begin{verbatim}
- lar ax,[bx] ; load access rights into word
- lar eax,dx ; load access rights into double word
-\end{verbatim}
-
-\index{lsl}
-\verb"lsl" loads the segment limit from the segment descriptor specified by
-the selector in source operand into the destination operand and sets the ZF
-flag. Rules for operand are the same as for the \verb"lar" instruction.
-
-\index{verr}\index{verw}
-\verb"verr" and \verb"verw" verify whether the code or data segment specified
-with the operand is readable or writable from the current privilege level.
-The operand should be a word, it can be general register or memory.
-If the segment is accessible and readable (for \verb"verr") or writable (for
-\verb"verw") the ZF flag is set, otherwise it's cleared. Rules for operand
-are the same as for the \verb"lldt" instruction.
-
-\index{arpl}
-\verb"arpl" compares the RPL (requestor's privilege level) fields of two
-segment selectors. The first operand contains one segment selector and the
-second operand contains the other. If the RPL field of the destination
-operand is less than the RPL field of the source operand, the ZF flag is set
-and the RPL field of the destination operand is increased to match that of
-the source operand. Otherwise, the ZF flag is cleared and no change is made
-to the destination operand. The destination operand can be a word general
-register or memory, the source operand must be a general register.
-\begin{verbatim}
- arpl bx,ax ; adjust RPL of selector in register
- arpl [bx],ax ; adjust RPL of selector in memory
-\end{verbatim}
-
-\index{clts}
-\verb"clts" clears the TS (task switched) flag in the \verb"cr0" register.
-This instruction has no operands.
-
-\index{lock}
-\verb"lock" prefix causes the processor's bus--lock signal to be asserted during
-execution of the accompanying instruction. In a multiprocessor environment,
-the bus--lock signal insures that the processor has exclusive use of any shared
-memory while the signal is asserted. The \verb"lock" prefix can be prepended
-only to the following instructions and only to those forms of the
-instructions where the destination operand is a memory operand: \verb"add",
-\verb"adc", \verb"and", \verb"btc", \verb"btr", \verb"bts", \verb"cmpxchg",
-\verb"cmpxchg8b", \verb"dec", \verb"inc", \verb"neg", \verb"not", \verb"or",
-\verb"sbb", \verb"sub", \verb"xor", \verb"xadd" and \verb"xchg". If the
-\verb"lock" prefix is used with one of these instructions and the source
-operand is a memory operand, an undefined opcode exception may be generated.
-An undefined opcode exception will also be generated if the \verb"lock"
-prefix is used with any instruction not in the above list. The \verb"xchg"
-instruction always asserts the bus--lock signal regardless of the presence or
-absence of the \verb"lock" prefix.
-
-\index{hlt}
-\verb"hlt" stops instruction execution and places the processor in a halted
-state. An enabled interrupt, a debug exception, the BINIT, INIT or the RESET
-signal will resume execution. This instruction has no operands.
-
-\index{invlpg}
-\verb"invlpg" invalidates (flushes) the TLB (translation lookaside buffer)
-entry specified with the operand, which should be a memory. The processor
-determines the page that contains that address and flushes the TLB entry for
-that page.
-
-\index{rdmsr}\index{wrmsr}
-\verb"rdmsr" loads the contents of a 64--bit MSR (model specific register)
-of the address specified in the \verb"ecx" register into registers \verb"edx"
-and \verb"eax". \verb"wrmsr" writes the contents of registers \verb"edx" and
-\verb"eax" into the 64--bit MSR of the address specified in the \verb"ecx"
-register. \verb"rdtsc" loads the current value of the processor's time stamp
-counter from the 64--bit MSR into the \verb"edx" and \verb"eax" registers.
-The processor increments the time stamp counter MSR every clock cycle and
-resets it to 0 whenever the processor is reset.
-
-\index{rdpmc}
-\verb"rdpmc" loads the contents of the 40--bit performance monitoring counter
-specified in the \verb"ecx" register into registers \verb"edx" and
-\verb"eax". These instructions have no operands.
-
-\index{wbinvd}
-\verb"wbinvd" writes back all modified cache lines in the processor's
-internal cache to main memory and invalidates (flushes) the internal caches.
-The instruction then issues a special function bus cycle that directs
-external caches to also write back modified data and another bus cycle to
-indicate that the external caches should be invalidated. This instruction has
-no operands.
-
-\index{rsm}
-\verb"rsm" return program control from the system management mode to the
-program that was interrupted when the processor received an SMM interrupt.
-This instruction has no operands.
-
-\index{sysenter}\index{sysexit}
-\verb"sysenter" executes a fast call to a level 0 system procedure, \verb"sysexit"
-executes a fast return to level 3 user code. The addresses used by these instructions
-are stored in MSRs. These instructions have no operands.
-
-\subsection{FPU instructions}
-
-The FPU (Floating-Point Unit) instructions operate on the floating--point
-values in three formats: single precision (32--bit), double precision
-(64--bit) and double extended precision (80--bit). The FPU registers form
-the stack and each of them holds the double extended precision floating--point
-value. When some values are pushed onto the stack or are removed from the top,
-the FPU registers are shifted, so \verb"st0" is always the value on
-the top of FPU stack, \verb"st1" is the first value below the top, etc.
-The \verb"st0" name has also the synonym \verb"st".
-
-\index{fld}
-\verb"fld" pushes the floating--point value onto the FPU register stack.
-The operand can be 32--bit, 64--bit or 80--bit memory location or the
-FPU register, its value is then loaded onto the top of FPU register stack
-(the \verb"st0" register) and is automatically converted into the
-double extended precision format.
-\begin{verbatim}
- fld dword [bx] ; load single prevision value from memory
- fld st2 ; push value of st2 onto register stack
-\end{verbatim}
-
-\index{fld1}\index{lfdz}\index{ldl2t}\index{lfdl2e}\index{fldpi}
-\index{fldlg2}\index{fldln2}
-\verb"fld1", \verb"fldz", \verb"fldl2t", \verb"fldl2e", \verb"fldpi",
-\verb"fldlg2" and \verb"fldln2" load the commonly used contants onto the
-FPU register stack. The loaded constants are $+1.0$, $+0.0$, $\log_{2}10$,
-$\log_{2}e$, $\pi$, $\log_{10}2$ and $\ln{2}$ respectively. These instructions
-have no operands.
-
-\index{fild}
-\verb"fild" converts the signed integer source operand into double extended
-precision floating-point format and pushes the result onto the FPU register
-stack. The source operand can be a 16--bit, 32--bit or 64--bit memory location.
-\begin{verbatim}
- fild qword [bx] ; load 64-bit integer from memory
-\end{verbatim}
-
-\index{fst}\index{fstp}
-\verb"fst" copies the value of \verb"st0" register to the destination operand,
-which can be 32--bit or 64--bit memory location or another FPU register.
-\verb"fstp" performs the same operation as \verb"fst" and then pops the register
-stack, getting rid of \verb"st0". \verb"fstp" accepts the same operands as
-the \verb"fst" instruction and can also store value in the 80--bit memory.
-\begin{verbatim}
- fst st3 ; copy value of st0 into st3 register
- fstp tword [bx] ; store value in memory and pop stack
-\end{verbatim}
-
-\index{fist}
-\verb"fist" converts the value in \verb"st0" to a signed integer and stores
-the result in the destination operand. The operand can be 16--bit or
-32--bit memory location. \verb"fistp" performs the same operation and then
-pops the register stack, it accepts the same operands as the \verb"fist"
-instruction and can also store integer value in the 64--bit memory, so it
-has the same rules for operands as \verb"fild" instruction.
-
-\index{fbld}
-\verb"fbld" converts the packed BCD integer into double extended precision
-floating--point format and pushes this value onto the FPU stack. \verb"fbstp"
-converts the value in \verb"st0" to an 18--digit packed BCD integer, stores the
-result in the destination operand, and pops the register stack. The operand
-should be an 80--bit memory location.
-
-\index{fadd}
-\verb"fadd" adds the destination and source operand and stores the sum in the
-destination location. The destination operand is always an FPU register, if the
-source is a memory location, the destination is \verb"st0" register and only
-source operand should be specified. If both operands are FPU registers, at
-least one of them should be \verb"st0" register. An operand in memory can be
-a 32--bit or 64--bit value.
-\begin{verbatim}
- fadd qword [bx] ; add double precision value to st0
- fadd st2,st0 ; add st0 to st2
-\end{verbatim}
-
-\index{faddp}
-\verb"faddp" adds the destination and source operand, stores the sum in the
-destination location and then pops the register stack. The destination operand
-must be an FPU register and the source operand must be the \verb"st0". When
-no operands are specified, \verb"st1" is used as a destination operand.
-\begin{verbatim}
- faddp ; add st0 to st1 and pop the stack
- faddp st2,st0 ; add st0 to st2 and pop the stack
-\end{verbatim}
-
-\index{fiadd}
-\verb"fiadd" instruction converts an integer source operand into double
-extended precision floating--point value and adds it to the destination
-operand. The operand should be a 16--bit or 32--bit memory location.
-\begin{verbatim}
- fiadd word [bx] ; add word integer to st0
-\end{verbatim}
-
-\index{fsub}\index{fsubr}\index{fmul}\index{fdiv}\index{fdivr}
-\verb"fsub", \verb"fsubr", \verb"fmul", \verb"fdiv", \verb"fdivr" instruction
-are similar to \verb"fadd", have the same rules for operands and differ only in
-the perfomed computation. \verb"fsub" substracts the source operand from the
-destination operand, \verb"fsubr" substract the destination operand from the
-source operand, \verb"fmul" multiplies the destination and source operands,
-\verb"fdiv" divides the destination operand by the source operand and \verb"fdivr"
-divides the source operand by the destination operand. \verb"fsubp", \verb"fsubrp",
-\verb"fmulp", \verb"fdivp", \verb"fdivrp" perform the same operations and pop the
-register stack, the rules for operand are the same as for the \verb"faddp"
-instruction. \verb"fisub", \verb"fisubr", \verb"fimul", \verb"fidiv", \verb"fidivr"
-perform these operations after converting the integer source operand into
-floating--point value, they have the same rules for operands as \verb"fiadd"
-instruction.
-
-\index{fsqrt}\index{fsin}\index{fcos}\index{fchs}\index{fabs}\index{frndint}
-\index{f2xm1}
-\verb"fsqrt" computes the square root of the value in \verb"st0" register,
-\verb"fsin" computes the sine of that value, \verb"fcos" computes the cosine
-of that value, \verb"fchs" complements its sign bit, \verb"fabs" clears its sign to
-create the absolute value, \verb"frndint" rounds it to the nearest integral value,
-depending on the current rounding mode. \verb"f2xm1" computes the exponential value
-of 2 to the power of \verb"st0" and substracts the $1.0$ from it, the value of
-\verb"st0" must lie in the range $-1.0$ to $+1.0$.
-All these instruction store the result in \verb"st0" and have no operands.
-
-\index{fsincos}\index{fptan}\index{fpatan}\index{fyl2x}\index{fyl2xp1}
-\index{fprem}\index{fprem1}\index{fscale}\index{fxtract}\index{fnop}
-\verb"fsincos" computes both the sine and the cosine of the value in
-\verb"st0" register, stores the sine in \verb"st0" and pushes the cosine on the
-top of FPU register stack. \verb"fptan" computes the tangent of the value in
-\verb"st0", stores the result in \verb"st0" and pushes a $1.0$ onto the FPU register
-stack. \verb"fpatan" computes the arctangent of the value in \verb"st1" divided by
-the value in \verb"st0", stores the result in \verb"st1" and pops the FPU register
-stack. \verb"fyl2x" computes the binary logarithm of \verb"st0", multiplies it by
-\verb"st1", stores the result in \verb"st1" and pops the FPU register stack;
-\verb"fyl2xp1" performs the same operation but it adds $1.0$ to \verb"st0" before
-computing the logarithm. \verb"fprem" computes the remainder obtained from
-dividing the value in \verb"st0" by the value in \verb"st1", and stores the result
-in \verb"st0". \verb"fprem1" performs the same operation as \verb"fprem", but it
-computes the remainder in the way specified by IEEE Standard 754. \verb"fscale"
-truncates the value in \verb"st1" and increases the exponent of \verb"st0" by this value.
-\verb"fxtract" separates the value in \verb"st0" into its exponent and significand,
-stores the exponent in \verb"st0" and pushes the significand onto the register
-stack. \verb"fnop" performs no operation. These instruction have no operands.
-
-\index{fxch}
-\verb"fxch" exchanges the contents of \verb"st0" an another FPU register. The
-operand should be an FPU register, if no operand is specified, the contents of
-\verb"st0" and \verb"st1" are exchanged.
-
-\index{fcom}\index{fcomp}
-\verb"fcom" and \verb"fcomp" compare the contents of \verb"st0" and the source
-operand and set flags in the FPU status word according to the results.
-\verb"fcomp" additionally pops the register stack after performing the comparison.
-The operand can be a single or double precision value in memory or the FPU register.
-When no operand is specified, \verb"st1" is used as a source operand.
-\begin{verbatim}
- fcom ; compare st0 with st1
- fcomp st2 ; compare st0 with st2 and pop stack
-\end{verbatim}
-
-\index{fcompp}
-\verb"fcompp" compares the contents of \verb"st0" and \verb"st1", sets flags in the
-FPU status word according to the results and pops the register stack twice.
-This instruction has no operands.
-
-\index{fucom}\index{fucomp}\index{fucompp}
-\verb"fucom", \verb"fucomp" and \verb"fucompp" performs an unordered comparison of
-two FPU registers. Rules for operands are the same as for the \verb"fcom",
-\verb"fcomp" and \verb"fcompp", but the source operand must be an FPU register.
-
-\index{ficom}\index{ficomp}
-\verb"ficom" and \verb"ficomp" compare the value in \verb"st0" with an integer
-source operand and set the flags in the FPU status word according to the results.
-\verb"ficomp" additionally pops the register stack after performing the comparison.
-The integer value is converted to double extended precision floating--point format
-before the comparison is made. The operand should be a 16--bit or 32--bit memory
-location.
-\begin{verbatim}
- ficom word [bx] ; compare st0 with 16-bit integer
-\end{verbatim}
-
-\index{fcomi}\index{fcomip}\index{fucomi}\index{fucomip}
-\verb"fcomi", \verb"fcomip", \verb"fucomi", \verb"fucomip" perform the comparison
-of \verb"st0" with another FPU register and set the ZF, PF and CF flags according to
-the results. \verb"fcomip" and \verb"fucomip" additionaly pop the register stack
-after performing the comparison.
-
-\index{fcmovb}\index{fcmove}\index{fcmovbe}\index{fcmovu}
-\index{fcmovnb}\index{fcmovne}\index{fcmovnbe}\index{fcmovnu}
-The instructions obtained by attaching the FPU
-condition mnemonic (see table \ref{tab:FPU_conditions}) to the \verb"fcmov" mnemonic
-transfer the specified FPU register into \verb"st0" register if the given test
-condition is true. These instruction allow two different syntaxes, one with single
-operand specifying the source FPU register, and one with two operands, in that case
-destination operand should be \verb"st0" register and the second operand specifies
-the source FPU register.
-\begin{verbatim}
- fcomi st2 ; compare st0 with st2 and set flags
- fcmovb st0,st2 ; transfer st2 to st0 if below
-\end{verbatim}
-
-\label{tab:FPU_conditions}
-\begin{table}[hbt]
-\caption{FPU conditions.}
-\begin{center}\begin{tabular}{|c|c|c|}
-\hline
-Mnemonic & Condition tested & Description \\
-\hline \hline
-\verb"b" & CF = 1 & below\\
-\hline
-\verb"e" & ZF = 1 & equal\\
-\hline
-\verb"be" & CF \verb"or" ZF = 1 & below or equal\\
-\hline
-\verb"u" & PF = 1 & unordered\\
-\hline
-\verb"nb" & CF = 0 & not below\\
-\hline
-\verb"ne" & ZF = 0 & not equal\\
-\hline
-\verb"nbe" & CF \verb"and" ZF = 0 & not below nor equal\\
-\hline
-\verb"nu" & PF = 0 & not unordered\\
-\hline
-\end{tabular}\end{center}
-\end{table}
-
-\index{ftst}\index{fxam}
-\verb"ftst" compares the value in \verb"st0" with $0.0$ and sets the flags in the
-FPU status word according to the results. \verb"fxam" examines the contents of the
-\verb"st0" and sets the flags in FPU status word to indicate the class of value in
-the register. These instructions have no operands.
-
-\index{fstsw}\index{fnstsw}
-\verb"fstsw" and \verb"fnstsw" store the current value of the FPU status word in the
-destination location. The destination operand can be either a 16--bit memory or the
-\verb"ax" register. \verb"fstsw" checks for pending umasked FPU exceptions before
-storing the status word, \verb"fnstsw" does not.
-
-\index{fstcw}\index{fnstcw}
-\verb"fstcw" and \verb"fnstcw" store the current value of the FPU control word
-at the specified destination in memory. \verb"fstcw" checks for pending unmasked FPU
-exceptions before storing the control word, \verb"fnstcw" does not. \verb"fldcw" loads
-the operand into the FPU control word. The operand should be a 16--bit memory
-location.
-
-\index{fstenv}\index{fnstenv}\index{fldenv}\index{fsave}\index{fnsave}\index{frstor}
-\index{fstenvw}\index{fnstenvw}\index{fldenvw}\index{fsavew}\index{fnsavew}\index{frstorw}
-\index{fstenvd}\index{fnstenvd}\index{fldenvd}\index{fsaved}\index{fnsaved}\index{frstord}
-\verb"fstenv" and \verb"fnstenv" store the current FPU operating environment at
-the memory location specified with the destination operand, and then mask all
-FPU exceptions. \verb"fstenv" checks for pending umasked FPU exceptions before
-proceeding, \verb"fnstenv" does not. \verb"fldenv" loads the complete operating
-environment from memory into the FPU. \verb"fsave" and \verb"fnsave"
-store the current FPU state (operating environment and register stack) at the
-specified destination in memory and reinitializes the FPU. \verb"fsave" check
-for pending unmasked FPU exceptions before proceeding, \verb"fnsave" does not.
-\verb"frstor" loads the FPU state from the specified memory location.
-All these instructions need an operand being a memory location.
-For each of these instruction
-exist two additional mnemonics that allow to precisely select the type of the
-operation. The \verb"fstenvw", \verb"fnstenvw", \verb"fldenvw", \verb"fsavew", \verb"fnsavew" and
-\verb"frstorw" mnemonics force the instruction to perform operation as in the 16--bit
-mode, while \verb"fstenvd", \verb"fnstenvd", \verb"fldenvd", \verb"fsaved", \verb"fnsaved" and \verb"frstord"
-force the operation as in 32--bit mode.
-
-\index{finit}\index{fninit}\index{fclex}\index{fnclex}\index{wait}\index{fwait}
-\verb"finit" and \verb"fninit" set the FPU operating environment into its default
-state. \verb"finit" checks for pending unmasked FPU exception before proceeding,
-\verb"fninit" does not. \verb"fclex" and \verb"fnclex" clear the FPU exception flags in the FPU
-status word. \verb"fclex" checks for pending unmasked FPU exception before proceeding,
-\verb"fnclex" does not. \verb"wait" and \verb"fwait" are synonyms for the same
-instruction, which causes the processor to check for pending unmasked FPU exceptions
-and handle them before proceeding. These instruction have no operands.
-
-\index{ffree}
-\verb"ffree" sets the tag associated with specified FPU register to empty. The
-operand should be an FPU register.
-
-\index{fincstp}\index{fdecstp}
-\verb"fincstp" and \verb"fdecstp" rotate the FPU stack by one by adding or
-substracting one to the pointer of the top of stack. These instruction have no
-operands.
-
-\subsection{MMX instructions}
-\label{sec:MMX_instructions}
-
-The MMX instructions operate on the packed integer types and use the MMX registers,
-which are the low 64--bit parts of the 80--bit FPU registers. Because of this MMX
-instructions cannot be used at the same time as FPU instructions. They can operate
-on packed bytes (eight 8--bit integers), packed words (four 16--bit integers) or
-packed double words (two 32--bit integers), use of packed formats allows to perform
-operations on multiple data at one time.
-
-\index{movq}
-\verb"movq" copies a quad word from the source operand to the destination operand.
-At least one of the operands must be a MMX register, the second one can be also
-a MMX register or 64--bit memory location.
-\begin{verbatim}
- movq mm0,mm1 ; move quad word from register to register
- movq mm2,[ebx] ; move quad word from memory to register
-\end{verbatim}
-
-\index{movd}
-\verb"movd" copies a double word from the source operand to the destination operand.
-One of the operands must be a MMX register, the second one can be a general register
-or 32--bit memory location. Only low double word of MMX register is used.
-
-All general MMX operations have two operands, the destination operand should be
-a MMX register, the source operand can be a MMX register or 64--bit memory location.
-Operation is performed on the corresponding data elements of the source and destination
-operand and stored in the data elements of the destination operand.
-
-\index{paddb}\index{paddw}\index{paddd}
-\verb"paddb", \verb"paddw" and \verb"paddd" perform the addition of packed bytes,
-packed words, or packed double words.
-
-\index{psubb}\index{psubw}\index{psubd}
-\verb"psubb", \verb"psubw" and \verb"psubd" perform the substraction of appropriate types.
-
-\index{paddsb}\index{paddsw}\index{psubsb}\index{psubsw}
-\verb"paddsb", \verb"paddsw", \verb"psubsb" and \verb"psubsw" perform the addition or
-substraction of packed bytes or packed words with the signed saturation.
-
-\index{paddusb}\index{paddusw}\index{psubusb}\index{psubusw}
-\verb"paddusb", \verb"paddusw", \verb"psubusb", \verb"psubusw" are analoguous, but with
-unsigned saturation.
-
-\index{pmulhw}\index{pmullw}\
-\verb"pmulhw" and \verb"pmullw" performs a signed multiplication of the packed words
-and store the high or low words of the results in the destination operand.
-
-\index{pmaddwd}
-\verb"pmaddwd" performs a multiply of the packed words and adds the four intermediate
-double word products in pairs to produce result as a packed double words.
-
-\index{pand}\index{por}\index{pxor}\index{pandn}
-\verb"pand", \verb"por" and \verb"pxor" perform the logical operations on the quad words,
-\verb"pandn" peforms also a logical negation of the destination operand before the
-operation.
-
-\index{pcmpeqb}\index{pcmpeqw}\index{pcmpeqd}
-\verb"pcmpeqb", \verb"pcmpeqw" and \verb"pcmpeqd" compare for equality of packed
-bytes, packed words or packed double words. If a pair of data elements is equal,
-the corresponding data element in the destination operand is filled with bits of
-value 1, otherwise it's set to 0.
-
-\index{pcmpgtb}\index{pcmpgtw}\index{pcmpgtd}
-\verb"pcmpgtb", \verb"pcmpgtw" and \verb"pcmpgtd"
-perform the similar operation, but they check whether the data elements in
-the destination operand are greater than the correspoding data elements in the
-source operand.
-
-\index{packsswb}\index{packssdw}\index{packuswb}
-\verb"packsswb" converts packed signed words into packed signed bytes, \verb"packssdw"
-converts packed signed double words into packed signed words, using saturation to
-handle overflow conditions. \verb"packuswb" converts packed signed words into
-packed unsigned bytes. Converted data elements from the source operand are stored
-in the low part of the destination operand, while converted data elements from
-the destination operand are stored in the high part.
-
-\index{punpckhbw}\index{punpckhwd}\index{punpckhdq}
-\verb"punpckhbw", \verb"punpckhwd" and \verb"punpckhdq" interleaves the
-data elements from the high parts of the source and destination operands and stores
-the result into the destination operand.
-
-\index{punpcklbw}\index{punpcklwd}\index{punpckldq}
-\verb"punpcklbw", \verb"punpcklwd" and
-\verb"punpckldq" perform the same operation, but the low parts of the source and destination
-operand are used.
-\begin{verbatim}
- paddsb mm0,[esi] ; add packed bytes with signed saturation
- pcmpeqw mm3,mm7 ; compare packed words for equality
-\end{verbatim}
-
-\index{psllw}\index{pslld}\index{psllq}
-\verb"psllw", \verb"pslld" and \verb"psllq" perform logical shift left of the packed
-words, packed double words or a single quad word in the destination operand by the
-amount specified in the source operand.
-
-\index{psrlw}\index{psrld}\index{psrlq}
-\verb"psrlw", \verb"psrld" and \verb"psrlq" perform logical shift right of the packed words,
-packed double words or a single quad word.
-
-\index{psraw}\index{psrad}
-\verb"psraw" and \verb"psrad" perform arithmetic shift of the packed words or
-double words. The destination operand should be a MMX register, while source operand
-can be a MMX register, 64--bit memory location, or 8--bit immediate value.
-\begin{verbatim}
- psllw mm2,mm4 ; shift words left logically
- psrad mm4,[ebx] ; shift double words right arithmetically
-\end{verbatim}
-
-\index{emms}
-\verb"emms" makes the FPU registers usable for the FPU instructions, it must be used
-before using the FPU instructions if any MMX instructions were used.
-
-\subsection{SSE instructions}
-The SSE extension adds more MMX instructions and also introduces the
-operations on packed single precision floating point values. The 128--bit
-packed single precision format consists of four single precision floating
-point values. The 128--bit SSE registers are designed for the purpose of
-operations on this data type.
-
-\index{movaps}\index{movups}
-\verb"movaps" and \verb"movups" transfer a double quad word operand containing packed
-single precision values from source operand to destination operand. At least
-one of the operands have to be a SSE register, the second one can be also a
-SSE register or 128--bit memory location. Memory operands for \verb"movaps"
-instruction must be aligned on boundary of 16 bytes, operands for \verb"movups"
-instruction don't have to be aligned.
-\begin{verbatim}
- movups xmm0,[ebx] ; move unaligned double quad word
-\end{verbatim}
-
-\index{movlps}\index{movhps}
-\verb"movlps" moves packed two single precision values between the memory and the
-low quad word of SSE register. \verb"movhps" moved packed two single precision
-values between the memory and the high quad word of SSE register. One of the
-operands must be a SSE register, and the other operand must be a 64--bit memory
-location.
-\begin{verbatim}
- movlps xmm0,[ebx] ; move memory to low quad word of xmm0
- movhps [esi],xmm7 ; move high quad word of xmm7 to memory
-\end{verbatim}
-
-\index{movlhps}\index{movhlps}
-\verb"movlhps" moves packed two single precision values from the low quad word
-of source register to the high quad word of destination register. \verb"movhlps"
-moves two packed single precision values from the high quad word of source
-register to the low quad word of destination register. Both operands have to
-be a SSE registers.
-
-\index{movmskps}
-\verb"movmskps" transfers the most significant bit of each of the four single
-precision values in the SSE register into low four bits of a general register.
-The source operand must be a SSE register, the destination operand must be a
-general register.
-
-\index{movss}
-\verb"movss" transfers a single precision value between source and destination
-operand (only the low double word is trasferred). At least one of the operands
-have to be a SSE register, the second one can be also a SSE register or 32--bit
-memory location.
-\begin{verbatim}
- movss [edi],xmm3 ; move low double word of xmm3 to memory
-\end{verbatim}
-
-Each of the SSE arithmetic operations has two variants. When the mnemonic
-ends with \verb"ps", the source operand can be a 128--bit memory location or a SSE
-register, the destination operand must be a SSE register and the operation is
-performed on packed four single precision values, for each pair of the
-corresponding data elements separately, the result is stored in the
-destination register. When the mnemonic ends with \verb"ss", the source operand
-can be a 32--bit memory location or a SSE register, the destination operand
-must be a SSE register and the operation is performed on single precision
-values, only low double words of SSE registers are used in this case, the
-result is stored in the low double word of destination register.
-
-\index{addps}\index{addss}\index{subps}\index{subss}\index{mulps}\index{mulss}
-\index{divps}\index{divss}\index{rcpps}\index{rcpss}\index{sqrtps}\index{sqrtss}
-\index{rsqrtps}\index{rsqrtss}\index{maxps}\index{maxss}\index{minps}\index{minss}
-\verb"addps" and \verb"addss" add the values, \verb"subps" and \verb"subss" substract the
-source value from destination value, \verb"mulps" and \verb"mulss" multiply the values,
-\verb"divps" and \verb"divss" divide the destination value by the source value,
-\verb"rcpps" and \verb"rcpss" compute the approximate reciprocal of the source value,
-\verb"sqrtps" and \verb"sqrtss" compute the square root of the source value,
-\verb"rsqrtps" and \verb"rsqrtss" compute the approximate reciprocal of square root
-of the source value, \verb"maxps" and \verb"maxss" compare the source and destination
-values and return the greater one, \verb"minps" and \verb"minss" compare the source and
-destination values and return the lesser one.
-\begin{verbatim}
- mulss xmm0,[ebx] ; multiply single precision values
- addps xmm3,xmm7 ; add packed single precision values
-\end{verbatim}
-
-\index{andps}\index{andnps}\index{orps}\index{xorps}
-\verb"andps", \verb"andnps", \verb"orps" and \verb"xorps" perform the logical operations on
-packed single precision values. The source operand can be a 128--bit memory
-location or a SSE register, the destination operand must be a SSE register.
-
-\index{cmpps}\index{cmpss}\index{cmpeqps}\index{cmpeqss}\index{cmpltps}\index{cmpltss}
-\index{cmpleps}\index{cmpless}\index{cmpunordps}\index{cmpunordss}\index{cmpneqps}\index{cmpneqss}
-\index{cmpnltps}\index{cmpnltss}\index{cmpnleps}\index{cmpnless}\index{cmpordps}\index{cmpordss}
-\verb"cmpps" compares packed single precision values and returns a mask result
-into the destination operand, which must be a SSE register. The source operand
-can be a 128--bit memory location or SSE register, the third operand must be an
-immediate operand selecting code of one of the eight compare conditions
-(table \ref{tab:SSE_conditions}). \verb"cmpss" performs the same operation on single precision values,
-only low double word of destination register is affected, in this case source
-operand can be a 32--bit memory location or SSE register. These two
-instructions have also variants with only two operands and the condition
-encoded within mnemonic. Their mnemonics are obtained by attaching the
-mnemonic from table \ref{tab:SSE_conditions} to the \verb"cmp" mnemonic and then attaching the \verb"ps" or
-\verb"ss" at the end.
-\begin{verbatim}
- cmpps xmm2,xmm4,0 ; compare packed single precision values
- cmpltss xmm0,[ebx] ; compare single precision values
-\end{verbatim}
-
-\begin{table}[hbt]
-\begin{center}\begin{tabular}{|c|c|c|}
-\hline
-Code & Mnemonic & Description \\
-\hline \hline
-0 & \verb"eq" & equal \\
-\hline
-1 & \verb"lt" & less than \\
-\hline
-2 & \verb"le" & less than or equal \\
-\hline
-3 & \verb"unord" & unordered \\
-\hline
-4 & \verb"neq" & not equal \\
-\hline
-5 & \verb"nlt" & not less than \\
-\hline
-6 & \verb"nle" & not less than nor equal \\
-\hline
-7 & \verb"ord" & ordered \\
-\hline
-\end{tabular}\end{center}
-\caption{SSE conditions.}
-\label{tab:SSE_conditions}
-\end{table}
-
-\index{comiss}\index{ucomiss}
-\verb"comiss" and \verb"ucomiss" compare the single precision values and set the ZF,
-PF and CF flags to show the result. The destination operand must be a SSE
-register, the source operand can be a 32--bit memory location or SSE register.
-
-\index{shufps}
-\verb"shufps" moves any two of the four single precision values from the
-destination operand into the low quad word of the destination operand, and any
-two of the four values from the source operand into the high quad word of the
-destination operand. The destination operand must be a SSE register, the
-source operand can be a 128--bit memory location or SSE register, the third
-operand must be an 8--bit immediate value selecting which values will be moved
-into the destination operand. Bits 0 and 1 select the value to be moved from
-destination operand to the low double word of the result, bits 2 and 3 select
-the value to be moved from the destination operand to the second double word,
-bits 4 and 5 select the value to be moved from the source operand to the third
-double word, and bits 6 and 7 select the value to be moved from the source
-operand to the high double word of the result.
-\begin{verbatim}
- shufps xmm0,xmm0,10010011b ; shuffle double words
-\end{verbatim}
-
-\index{unpckhps}\index{unpcklps}
-\verb"unpckhps" performs an interleaved unpack of the values from the high parts
-of the source and destination operands and stores the result in the
-destination operand, which must be a SSE register. The source operand can be
-a 128--bit memory location or a SSE register. \verb"unpcklps" performs an
-interleaved unpack of the values from the low parts of the source and
-destination operand and stores the result in the destination operand,
-the rules for operands are the same.
-
-\index{cvtpi2ps}
-\verb"cvtpi2ps" converts packed two double word integers into the the packed two
-single precision floating point values and stores the result in the low quad
-word of the destination operand, which should be a SSE register. The source
-operand can be a 64--bit memory location or MMX register.
-\begin{verbatim}
- cvtpi2ps xmm0,mm0 ; integers to single precision values
-\end{verbatim}
-
-\index{cvtsi2ss}
-\verb"cvtsi2ss" converts a double word integer into a single precision floating
-point value and stores the result in the low double word of the destination
-operand, which should be a SSE register. The source operand can be a 32--bit
-memory location or 32--bit general register.
-\begin{verbatim}
- cvtsi2ss xmm0,eax ; integer to single precision value
-\end{verbatim}
-
-\index{cvtps2pi}\index{cvttps2pi}
-\verb"cvtps2pi" converts packed two single precision floating point values into
-packed two double word integers and stores the result in the destination
-operand, which should be a MMX register. The source operand can be a 64--bit
-memory location or SSE register, only low quad word of SSE register is used.
-\verb"cvttps2pi" performs the similar operation, except that truncation is used to
-round a source values to integers, rules for the operands are the same.
-\begin{verbatim}
- cvtps2pi mm0,xmm0 ; single precision values to integers
-\end{verbatim}
-
-\index{cvtss2si}\index{cvttss2si}
-\verb"cvtss2si" convert a single precision floating point value into a double
-word integer and stores the result in the destination operand, which should be
-a 32--bit general register. The source operand can be a 32--bit memory location
-or SSE register, only low double word of SSE register is used. \verb"cvttss2si"
-performs the similar operation, except that truncation is used to round a
-source value to integer, rules for the operands are the same.
-\begin{verbatim}
- cvtss2si eax,xmm0 ; single precision value to integer
-\end{verbatim}
-
-\index{pextrw}
-\verb"pextrw" copies the word in the source operand specified by the third
-operand to the destination operand. The source operand must be a MMX register,
-the destination operand must be a 32--bit general register (the high word of
-the destination is cleared), the third operand must an 8--bit immediate value.
-\begin{verbatim}
- pextrw eax,mm0,1 ; extract word into eax
-\end{verbatim}
-
-\index{pinsrw}
-\verb"pinsrw" inserts a word from the source operand in the destination operand
-at the location specified with the third operand, which must be an 8--bit
-immediate value. The destination operand must be a MMX register, the source
-operand can be a 16--bit memory location or 32--bit general register (only low
-word of the register is used).
-\begin{verbatim}
- pinsrw mm1,ebx,2 ; insert word from ebx
-\end{verbatim}
-
-\index{pavgb}\index{pavgw}\index{pmaxub}\index{pminub}\index{pmaxsw}\index{pminsw}
-\index{pmulhuw}\index{psadbw}
-\verb"pavgb" and \verb"pavgw" compute average of packed bytes or words. \verb"pmaxub"
-return the maximum values of packed unsigned bytes, \verb"pminub" returns the
-minimum values of packed unsigned bytes, \verb"pmaxsw" returns the maximum values
-of packed signed words, \verb"pminsw" returns the minimum values of packed signed
-words. \verb"pmulhuw" performs a unsigned multiplication of the packed words and stores
-the high words of the results in the destination operand. \verb"psadbw" computes
-the absolute differences of packed unsigned bytes, sums the differences, and
-stores the sum in the low word of destination operand. All these instructions
-follow the same rules for operands as the general MMX operations described in
-previous section.
-
-\index{pmovmskb}
-\verb"pmovmskb" creates a mask made of the most significant bit of each byte in
-the source operand and stores the result in the low byte of destination
-operand. The source operand must be a MMX register, the destination operand
-must a 32--bit general register.
-
-\index{pshufw}
-\verb"pshufw" inserts words from the source operand in the destination operand
-from the locations specified with the third operand. The destination operand
-must be a MMX register, the source operand can be a 64--bit memory location or
-MMX register, third operand must an 8--bit immediate value selecting which
-values will be moved into destination operand, in the similar way as the third
-operand of the \verb"shufps" instruction.
-
-\index{movntq}\index{movntps}\index{maskmovq}
-\verb"movntq" moves the quad word from the source operand to memory using a
-non--temporal hint to minimize cache pollution. The source operand should be a
-MMX register, the destination operand should be a 64--bit memory location.
-\verb"movntps" stores packed single precision values from the SSE register to
-memory using a non--temporal hint. The source operand should be a SSE register,
-the destination operand should be a 128--bit memory location. \verb"maskmovq" stores
-selected bytes from the first operand into a 64--bit memory location using a
-non--temporal hint. Both operands should be a MMX registers, the second operand
-selects wich bytes from the source operand are written to memory. The
-memory location is pointed by DI (or EDI) register in the segment selected
-by DS.
-
-\index{prefetch0}\index{prefetch1}\index{prefetch2}\index{prefetchnta}
-\verb"prefetcht0", \verb"prefetcht1", \verb"prefetcht2" and \verb"prefetchnta" fetch the line
-of data from memory that contains byte specified with the operand to a
-specified location in hierarchy. The operand should be an 8--bit memory
-location.
-
-\index{sfence}
-\verb"sfence" performs a serializing operation on all instruction storing to
-memory that were issued prior to it. This instruction has no operands.
-
-\index{ldmxcsr}\index{stmxcsr}
-\verb"ldmxcsr" loads the 32--bit memory operand into the MXCSR register. \verb"stmxcsr"
-stores the contents of MXCSR into a 32--bit memory operand.
-
-\index{fxsave}\index{fxrstor}\index{fxsave}
-\verb"fxsave" saves the current state of the FPU, MXCSR register, and all the FPU
-and SSE registers to a 512--byte memory location specified in the destination
-operand. \verb"fxrstor" reloads data previously stored with \verb"fxsave" instruction
-from the specified 512--byte memory location. The memory operand for both those
-instructions must be aligned on 16 byte boundary, it should declare operand
-of no specified size.
-
-\subsection{SSE2 instructions}
-The SSE2 extension introduces the operations on packed double precision
-floating point values, extends the syntax of MMX instructions, and adds also
-some new instructions.
-
-\index{movapd}\index{movupd}
-\verb"movapd" and \verb"movupd" transfer a double quad word operand containing packed
-double precision values from source operand to destination operand. These
-instructions are analogous to \verb"movaps" and \verb"movups" and have the same rules
-for operands.
-
-\index{movlpd}\index{movhpd}
-\verb"movlpd" moves double precision value between the memory and the low quad
-word of SSE register. \verb"movhpd" moved double precision value between the memory
-and the high quad word of SSE register. These instructions are analogous to
-\verb"movlps" and \verb"movhps" and have the same rules for operands.
-
-\index{movmskpd}
-\verb"movmskpd" transfers the most significant bit of each of the two double
-precision values in the SSE register into low two bits of a general register.
-This instruction is analogous to \verb"movmskps" and has the same rules for
-operands.
-
-\index{movsd}
-\verb"movsd" transfers a double precision value between source and destination
-operand (only the low quad word is trasferred). At least one of the operands
-have to be a SSE register, the second one can be also a SSE register or 64--bit
-memory location.
-
-\index{addpd}\index{addsd}\index{subpd}\index{subsd}\index{mulpd}\index{mulsd}
-\index{divpd}\index{divsd}\index{sqrtpd}\index{sqrtsd}\index{maxpd}\index{maxsd}
-\index{minpd}\index{minsd}
-Arithmetic operations on double precision values are: \verb"addpd", \verb"addsd",
-\verb"subpd", \verb"subsd", \verb"mulpd", \verb"mulsd", \verb"divpd", \verb"divsd", \verb"sqrtpd", \verb"sqrtsd",
-\verb"maxpd", \verb"maxsd", \verb"minpd", \verb"minsd", and they are analoguous to arithmetic
-operations on single precision values described in previous section. When the
-mnemonic ends with \verb"pd" instead of \verb"ps", the operation is performed on packed
-two double precision values, but rules for operands are the same. When the
-mnemonic ends with \verb"sd" instead of \verb"ss", the source operand can be a 64--bit
-memory location or a SSE register, the destination operand must be a SSE
-register and the operation is performed on double precision values, only low
-quad words of SSE registers are used in this case.
-
-\index{andpd}\index{andnpd}\index{orpd}\index{xorpd}
-\verb"andpd", \verb"andnpd", \verb"orpd" and \verb"xorpd" perform the logical operations on
-packed double precision values. They are analoguous to SSE logical operations
-on single prevision values and have the same rules for operands.
-
-\index{cmppd}\index{cmpsd}\index{cmpeqpd}\index{cmpeqsd}\index{cmpltpd}\index{cmpltsd}
-\index{cmplepd}\index{cmplesd}\index{cmpunordpd}\index{cmpunordsd}\index{cmpneqpd}\index{cmpneqsd}
-\index{cmpnltpd}\index{cmpnltsd}\index{cmpnlepd}\index{cmpnlesd}\index{cmpordpd}\index{cmpordsd}
-\verb"cmppd" compares packed double precision values and returns and returns a
-mask result into the destination operand. This instruction is analoguous to
-\verb"cmpps" and has the same rules for operands. \verb"cmpsd" performs the same
-operation on double precision values, only low quad word of destination
-register is affected, in this case source operand can be a 64--bit memory or
-SSE register. Variant with only two operands are obtained by attaching the
-condition mnemonic from table \ref{tab:SSE_conditions} to the \verb"cmp" mnemonic and then attaching
-the \verb"pd" or \verb"sd" at the end.
-
-\index{comisd}\index{ucomisd}
-\verb"comisd" and \verb"ucomisd" compare the double precision values and set the ZF,
-PF and CF flags to show the result. The destination operand must be a SSE
-register, the source operand can be a 128--bit memory location or SSE register.
-
-\index{shufpd}\index{shufps}
-\verb"shufpd" moves any of the two double precision values from the destination
-operand into the low quad word of the destination operand, and any of the two
-values from the source operand into the high quad word of the destination
-operand. This instruction is analoguous to \verb"shufps" and has the same rules for
-operand. Bit 0 of the third operand selects the value to be moved from the
-destination operand, bit 1 selects the value to be moved from the source
-operand, the rest of bits are reserved and must be zeroed.
-
-\index{unpckhpd}\index{unpcklpd}
-\verb"unpckhpd" performs an unpack of the high quad words from the source and
-destination operands, \verb"unpcklpd" performs an unpack of the low quad words from
-the source and destination operands. They are analoguous to \verb"unpckhps" and
-\verb"unpcklps", and have the same rules for operands.
-
-\index{cvtps2pd}\index{cvtpd2ps}\index{cvtss2sd}\index{cvtsd2ss}
-\verb"cvtps2pd" converts the packed two single precision floating point values to
-two packed double precision floating point values, the destination operand
-must be a SSE register, the source operand can be a 64--bit memory location or
-SSE register. \verb"cvtpd2ps" converts the packed two double precision floating
-point values to packed two single precision floating point values, the
-destination operand must be a SSE register, the source operand can be a
-128--bit memory location or SSE register. \verb"cvtss2sd" converts the single
-precision floating point value to double precision floating point value, the
-destination operand must be a SSE register, the source operand can be a 32--bit
-memory location or SSE register. \verb"cvtsd2ss" converts the double precision
-floating point value to single precision floating point value, the destination
-operand must be a SSE register, the source operand can be 64--bit memory
-location or SSE register.
-
-\index{cvtpi2pd}\index{cvtsi2sd}\index{cvtpd2pi}
-\index{cvttpd2pi}\index{cvtsd2si}\index{cvttsd2si}
-\verb"cvtpi2pd" converts packed two double word integers into the the packed
-double precision floating point values, the destination operand must be a SSE
-register, the source operand can be a 64--bit memory location or MMX register.
-\verb"cvtsi2sd" converts a double word integer into a double precision floating
-point value, the destination operand must be a SSE register, the source
-operand can be a 32--bit memory location or 32--bit general register. \verb"cvtpd2pi"
-converts packed double precision floating point values into packed two double
-word integers, the destination operand should be a MMX register, the source
-operand can be a 128--bit memory location or SSE register. \verb"cvttpd2pi" performs
-the similar operation, except that truncation is used to round a source values
-to integers, rules for operands are the same. \verb"cvtsd2si" converts a double
-precision floating point value into a double word integer, the destination
-operand should be a 32--bit general register, the source operand can be a
-64--bit memory location or SSE register. \verb"cvttsd2si" performs the similar
-operation, except that truncation is used to round a source value to integer,
-rules for operands are the same.
-
-\index{cvtps2dq}\index{cvttps2dq}
-\index{cvtpd2dq}\index{cvttpd2dq}\index{cvtdq2ps}
-\verb"cvtps2dq" and \verb"cvttps2dq" convert packed single precision floating point
-values to packed four double word integers, storing them in the destination
-operand. \verb"cvtpd2dq" and \verb"cvttpd2dq" convert packed double precision floating
-point values to packed two double word integers, storing the result in the low
-quad word of the destination operand. \verb"cvtdq2ps" converts packed four double
-word integers to packed single precision floating point values.
-
-For all these instruction destination operand must be a SSE register, the
-source operand can be a 128--bit memory location or SSE register.
-
-\index{cvtdq2pd}
-\verb"cvtdq2pd" converts packed two double word integers from the low quad word
-of the source operand to packed double precision floating point values, the source can be a 64-bit
-memory location or SSE register, destination has to be SSE register.
-
-\index{movdqa}\index{movdqu}
-\verb"movdqa" and \verb"movdqu" transfer a double quad word operand containing packed
-integers from source operand to destination operand. At least one of the
-operands have to be a SSE register, the second one can be also a SSE register
-or 128--bit memory location. Memory operands for \verb"movdqa" instruction must be
-aligned on boundary of 16 bytes, operands for \verb"movdqu" instruction don't have
-to be aligned.
-
-\index{movq2dq}\index{movdq2q}
-\verb"movq2dq" moves the contents of the MMX source register to the low quad word
-of destination SSE register. \verb"movdq2q" moves the low quad word from the source
-SSE register to the destination MMX register.
-\begin{verbatim}
- movq2dq xmm0,mm1 ; move from MMX register to SSE register
- movdq2q mm0,xmm1 ; move from SSE register to MMX register
-\end{verbatim}
-
-\index{pshufhw}\index{pshuflw}\index{pshufd}
-All MMX instructions operating on the 64--bit packed integers (those with
-mnemonics starting with \verb"p") are extended to operate on 128--bit packed
-integers located in SSE registers. Additional syntax for these instructions
-needs an SSE register where MMX register was needed, and the 128--bit memory
-location or SSE register where 64--bit memory location or MMX register were
-needed. The exception is \verb"pshufw" instruction, which doesn't allow extended
-syntax, but has two new variants: \verb"pshufhw" and \verb"pshuflw", which allow only
-the extended syntax, and perform the same operation as \verb"pshufw" on the high
-or low quad words of operands respectively. Also the new instruction \verb"pshufd"
-is introduced, which performs the same operation as \verb"pshufw", but on the
-double words instead of words, it allows only the extended syntax.
-\begin{verbatim}
- psubb xmm0,[esi] ; substract 16 packed bytes
- pextrw eax,xmm0,7 ; extract highest word into eax
-\end{verbatim}
-
-\index{paddq}\index{psubq}\index{pmuludq}
-\verb"paddq" performs the addition of packed quad words, \verb"psubq" performs the
-substraction of packed quad words, \verb"pmuludq" performs an unsigned multiplication
-of low double words from each corresponding quad words and returns the results
-in packed quad words. These instructions follow the same rules for operands as
-the general MMX operations described in \ref{sec:MMX_instructions}.
-
-\index{pslldq}\index{psrldq}
-\verb"pslldq" and \verb"psrldq" perform logical shift left or right of the double
-quad word in the destination operand by the amount of bytes specified in the source
-operand. The destination operand should be a SSE register, source operand
-should be an 8--bit immediate value.
-
-\index{punpckhqdq}\index{punpcklqdq}
-\verb"punpckhqdq" interleaves the high quad word of the source operand and the
-high quad word of the destination operand and writes them to the destination
-SSE register. \verb"punpcklqdq" interleaves the low quad word of the source operand
-and the low quad word of the destination operand and writes them to the
-destination SSE register. The source operand can be a 128--bit memory location
-or SSE register.
-
-\index{movntdq}\index{movntpd}\index{movnti}\index{maskmovdqu}
-\verb"movntdq" stores packed integer data from the SSE register to memory using
-non--temporal hint. The source operand should be a SSE register, the
-destination operand should be a 128--bit memory location. \verb"movntpd" stores
-packed double precision values from the SSE register to memory using a
-non--temporal hint. Rules for operand are the same. \verb"movnti" stores integer
-from a general register to memory using a non--temporal hint. The source
-operand should be a 32--bit general register, the destination operand should
-be a 32--bit memory location. \verb"maskmovdqu" stores selected bytes from the first
-operand into a 128--bit memory location using a non--temporal hint. Both
-operands should be a SSE registers, the second operand selects wich bytes from
-the source operand are written to memory. The memory location is pointed by DI
-(or EDI) register in the segment selected by DS and does not need to be
-aligned.
-
-\index{clflush}
-\verb"clflush" writes and invalidates the cache line associated with the address
-of byte specified with the operand, which should be a 8--bit memory location.
-
-\index{lfence}\index{mfence}\index{sfence}\index{lfence}
-\verb"lfence" performs a serializing operation on all instruction loading from
-memory that were issued prior to it. \verb"mfence" performs a serializing operation
-on all instruction accesing memory that were issued prior to it, and so it
-combines the functions of \verb"sfence" (described in previous section) and
-\verb"lfence" instructions. These instructions have no operands.
-
-\subsection{SSE3 instructions}
-Prescott technology introduced some new instructions to improve
-the performance of SSE and SSE2 -- this extension is called SSE3.
-
-\index{fisttp}
-\verb"fisttp" behaves like the \verb"fistp" instruction and accepts the same operands,
-the only difference is that it always used truncation, irrespective of the
-rounding mode.
-
-\index{movshdup}
-\verb"movshdup" loads into destination operand the 128--bit value obtained from
-the source value of the same size by filling the each quad word with the two
-duplicates of the value in its high double word.
-
-\index{movsldup}
-\verb"movsldup" performs the same action, except it duplicates the values of low double words.
-The destination operand should be SSE register, the source operand can be SSE register or
-128--bit memory location.
-
-\index{movddup}
-\verb"movddup" loads the 64--bit source value and duplicates it into high and low
-quad word of the destination operand. The destination operand should be SSE
-register, the source operand can be SSE register or 64--bit memory location.
-
-\index{lddqu}
-\verb"lddqu" is functionally equivalent to \verb"movdqu" with memory as
-source operand, but it may improve performance when the source operand crosses
-a cacheline boundary. The destination operand has to be SSE register, the source
-operand must be 128--bit memory location.
-
-\index{adddubps}
-\verb"addsubps" performs single precision addition of second and fourth pairs and
-single precision substracion of the first and third pairs of floating point
-values in the operands.
-
-\index{addsubpd}
-\verb"addsubpd" performs double precision addition of the
-second pair and double precision substraction of the first pair of floating
-point values in the operand.
-
-\index{haddps}
-\verb"haddps" performs the addition of two single
-precision values within the each quad word of source and destination operands,
-and stores the results of such horizontal addition of values from destination
-operand into low quad word of destination operand, and the results from the
-source operand into high quad word of destination operand.
-
-\index{haddpd}
-\verb"haddpd" performs
-the addition of two double precision values within each operand, and stores
-the result from destination operand into low quad word of destination operand,
-and the result from source operand into high quad word of destination operand.
-All these instruction need the destination operand to be SSE register, source
-operand can be SSE register or 128--bit memory location.
-
-\index{monitor}
-\verb"monitor" sets up an address range for monitoring of write--back stores. It
-need its three operands to be EAX, ECX and EDX register in that order.
-
-\index{mwait}
-\verb"mwait" waits for a write--back store to the address range set up by the
-\verb"monitor" instruction.
-It uses two operands with additional parameters, first being the EAX and second
-the ECX register.
-
-The functionality of SSE3 is further extended by the set of Supplemental
-SSE3 instructions (SSSE3). They generally follow the same rules for operands
-as all the MMX operations extended by SSE.
-
-\index{phaddw}\index{phaddd}\index{phaddsw}
-\index{phsubw}\index{phsubd}\index{phsubsw}
-\verb"phaddw" and \verb"phaddd" perform the horizontal additional of the pairs of
-adjacent values from both the source and destination operand, and stores the
-sums into the destination (sums from the source operand go into lower part of
-destination register). They operate on 16--bit or 32--bit chunks, respectively.
-\verb"phaddsw" performs the same operation on signed 16--bit packed values, but the
-result of each addition is saturated. \verb"phsubw" and \verb"phsubd" analogously
-perform the horizontal substraction of 16--bit or 32--bit packed value, and
-\verb"phsubsw" performs the horizontal substraction of signed 16--bit packed values
-with saturation.
-
-\index{pabsb}\index{pabsw}\index{pabsd}
-\verb"pabsb", \verb"pabsw" and \verb"pabsd" calculate the absolute value of each signed
-packed signed value in source operand and stores them into the destination
-register. They operator on 8--bit, 16--bit and 32--bit elements respectively.
-
-\index{pmaddubsw}
-\verb"pmaddubsw" multiplies signed 8--bit values from the source operand with the
-corresponding unsigned 8--bit values from the destination operand to produce
-intermediate 16--bit values, and every adjacent pair of those intermediate
-values is then added horizontally and those 16--bit sums are stored into the
-destination operand.
-
-\index{pmulhrsw}
-\verb"pmulhrsw" multiplies corresponding 16--bit integers from the source and
-destination operand to produce intermediate 32--bit values, and the 16 bits
-next to the highest bit of each of those values are then rounded and packed
-into the destination operand.
-
-\index{pshufb}
-\verb"pshufb" shuffles the bytes in the destination operand according to the
-mask provided by source operand - each of the bytes in source operand is
-an index of the target position for the corresponding byte in the destination.
-
-\index{psignb}\index{psignw}\index{psignd}
-\verb"psignb", \verb"psignw" and \verb"psignd" perform the operation on 8--bit, 16--bit or
-32--bit integers in destination operand, depending on the signs of the values
-in the source. If the value in source is negative, the corresponding value in
-the destination register is negated, if the value in source is positive, no
-operation is performed on the corresponding value is performed, and if the
-value in source is zero, the value in destination is zeroed, too.
-
-\index{palifnr}
-\verb"palignr" appends the source operand to the destination operand to form the
-intermediate value of twice the size, and then extracts into the destination
-register the 64 or 128 bits that are right-aligned to the byte offset
-specified by the third operand, which should be an 8--bit immediate value. This
-is the only SSSE3 instruction that takes three arguments.
-
-
-\subsection{AMD 3DNow! instructions}
-The 3DNow! extension adds a new MMX instructions to those described in \ref{sec:MMX_instructions},
-and introduces operation on the 64--bit packed floating point values, each
-consisting of two single precision floating point values.
-
-These instructions follow the same rules as the general MMX operations, the
-destination operand should be a MMX register, the source operand can be a MMX
-register or 64--bit memory location.
-
-\index{pavgusb}\index{pmulhrw}\index{pi2fd}\index{pf2id}\index{pi2fw}\index{pf2iw}
-\index{pfadd}\index{pfsub}\index{pfsubr}\index{pfmul}
-\index{pfacc}\index{pfnacc}\index{pfpnacc}
-\index{pfmax}\index{pfmin}\index{pswapd}\index{pfrcp}\index{pfrsqrt}
-\index{pfrcpit1}\index{pfrsqit1}\index{pfrcpit2}
-\index{pfcmpeq}\index{pfcmpge}\index{pfcmpgt}
-\verb"pavgusb" computes the rounded averages
-of packed unsigned bytes. \verb"pmulhrw" performs a signed multiplication of the packed
-words, round the high word of each double word results and stores them in the
-destination operand. \verb"pi2fd" converts packed double word integers into
-packed floating point values. \verb"pf2id" converts packed floating point values
-into packed double word integers using truncation. \verb"pi2fw" converts packed
-word integers into packed floating point values, only low words of each
-double word in source operand are used. \verb"pf2iw" converts packed floating
-point values to packed word integers, results are extended to double words
-using the sign extension. \verb"pfadd" adds packed floating point values. \verb"pfsub"
-and \verb"pfsubr" substracts packed floating point values, the first one substracts
-source values from destination values, the second one substracts destination
-values from the source values. \verb"pfmul" multiplies packed floating point
-values. \verb"pfacc" adds the low and high floating point values of the destination
-operand, storing the result in the low double word of destination, and adds
-the low and high floating point values of the source operand, storing the
-result in the high double word of destination. \verb"pfnacc" substracts the high
-floating point value of the destination operand from the low, storing the
-result in the low double word of destination, and substracts the high floating
-point value of the source operand from the low, storing the result in the high
-double word of destination. \verb"pfpnacc" substracts the high floating point value
-of the destination operand from the low, storing the result in the low double
-word of destination, and adds the low and high floating point values of the
-source operand, storing the result in the high double word of destination.
-\verb"pfmax" and \verb"pfmin" compute the maximum and minimum of floating point values.
-\verb"pswapd" reverses the high and low double word of the source operand. \verb"pfrcp"
-returns an estimates of the reciprocals of floating point values from the
-source operand, \verb"pfrsqrt" returns an estimates of the reciprocal square
-roots of floating point values from the source operand, \verb"pfrcpit1" performs
-the first step in the Newton--Raphson iteration to refine the reciprocal
-approximation produced by \verb"pfrcp" instruction, \verb"pfrsqit1" performs the first
-step in the Newton--Raphson iteration to refine the reciprocal square root
-approximation produced by \verb"pfrsqrt" instruction, \verb"pfrcpit2" performs the
-second final step in the Newton--Raphson iteration to refine the reciprocal
-approximation or the reciprocal square root approximation. \verb"pfcmpeq",
-\verb"pfcmpge" and \verb"pfcmpgt" compare the packed floating point values and sets
-all bits or zeroes all bits of the correspoding data element in the
-destination operand according to the result of comparison, first checks
-whether values are equal, second checks whether destination value is greater
-or equal to source value, third checks whether destination value is greater
-than source value.
-
-\index{prefetch}\index{prefetchw}
-\verb"prefetch" and \verb"prefetchw" load the line of data from memory that contains
-byte specified with the operand into the data cache, \verb"prefetchw" instruction
-should be used when the data in the cache line is expected to be modified,
-otherwise the \verb"prefetch" instruction should be used. The operand should be an
-8--bit memory location.
-
-\index{femms}
-\verb"femms" performs a fast clear of MMX state. It has no operands.
-
-\subsection{The x86-64 long mode instructions}
-
-The AMD64 and EM64T architectures (we will use the common name x86--64 for them
-both) extend the x86 instruction set for the 64--bit processing. While legacy
-and compatibility modes use the same set of registers and instructions, the
-new long mode extends the x86 operations to 64 bits and introduces several new
-registers. You can turn on generating the code for this mode with the \verb"use64"
-directive.
-
-Each of the general purpose registers is extended to 64 bits and the eight
-whole new general purpose registers and also eight new SSE registers are added.
-See table \ref{tab:x86_64_registers} for the summary of new registers (only the ones that was not
-listed in table \ref{tab:registers}). The general purpose registers of smallers sizes are the
-low order portions of the larger ones. You can still access the \verb"ah", \verb"bh",
-\verb"ch" and \verb"dh" registers in long mode, but you cannot use them in the same
-instruction with any of the new registers.
-
-\begin{table}[htb]
-\begin{center}\begin{tabular}{|c||c|c|c|c|c|c|}
-\hline
-Type & \multicolumn{4}{c|}{General} & SSE & AVX \\
-\hline
-Bits & 8 & 16 & 32 & 64 & 128 & 256 \\
-\hline \hline
-& & & & \verb"rax" & & \\
-& & & & \verb"rcx" & & \\
-& & & & \verb"rdx" & & \\
-& & & & \verb"rbx" & & \\
-& \verb"spl" & & & \verb"rsp" & & \\
-& \verb"bpl" & & & \verb"rbp" & & \\
-& \verb"sil" & & & \verb"rsi" & & \\
-& \verb"dil" & & & \verb"rdi" & & \\
-& \verb"r8b" & \verb"r8w" & \verb"r8d" & \verb"r8" & \verb"xmm8" & \verb"ymm8" \\
-& \verb"r9b" & \verb"r9w" & \verb"r9d" & \verb"r9" & \verb"xmm9" & \verb"ymm9" \\
-& \verb"r10b" & \verb"r10w" & \verb"r10d" & \verb"r10" & \verb"xmm10" & \verb"ymm10" \\
-& \verb"r11b" & \verb"r11w" & \verb"r11d" & \verb"r11" & \verb"xmm11" & \verb"ymm11" \\
-& \verb"r12b" & \verb"r12w" & \verb"r12d" & \verb"r12" & \verb"xmm12" & \verb"ymm12" \\
-& \verb"r13b" & \verb"r13w" & \verb"r13d" & \verb"r13" & \verb"xmm13" & \verb"ymm13" \\
-& \verb"r14b" & \verb"r14w" & \verb"r14d" & \verb"r14" & \verb"xmm14" & \verb"ymm14" \\
-& \verb"r15b" & \verb"r15w" & \verb"r15d" & \verb"r15" & \verb"xmm15" & \verb"ymm15" \\
-\hline
-\end{tabular}\end{center}
-\caption{New registers in long mode.} \label{tab:x86_64_registers}
-\end{table}
-
-In general any instruction from x86 architecture, which allowed 16--bit or
-32--bit operand sizes, in long mode allows also the 64--bit operands. The 64--bit
-registers should be used for addressing in long mode, the 32--bit addressing
-is also allowed, but it's not possible to use the addresses based on 16--bit
-registers. Below are the samples of new operations possible in long mode on the
-example of \verb"mov" instruction:
-\begin{verbatim}
- mov rax,r8 ; transfer 64-bit general register
- mov al,[rbx] ; transfer memory addressed by 64-bit register
-\end{verbatim}
-The long mode uses also the instruction pointer based addresses, you can
-specify it manually with the special RIP register symbol, but such addressing
-is also automatically generated by flat assembler, since there is no 64--bit
-absolute addressing in long mode. You can still force the assembler to use the
-32--bit absolute addressing by putting the \verb"dword" size override for address
-inside the square brackets. There is also one exception, where the 64--bit
-absolute addressing is possible, it's the \verb"mov" instruction with one of the
-operand being accumulator register, and second being the memory operand.
-To force the assembler to use the 64--bit absolute addressing there, use the
-\verb"qword" size operator for address inside the square brackets. When no size
-operator is applied to address, assembler generates the optimal form
-automatically.
-\begin{verbatim}
- mov [qword 0],rax ; absolute 64-bit addressing
- mov [dword 0],r15d ; absolute 32-bit addressing
- mov [0],rsi ; automatic RIP-relative addressing
- mov [rip+3],sil ; manual RIP-relative addressing
-\end{verbatim}
-
-Also as the immediate operands for 64--bit operations only the signed 32--bit
-values are possible, with the only exception being the \verb"mov" instruction with
-destination operand being 64--bit general purpose register. Trying to force the
-64--bit immediate with any other instruction will cause an error.
-
-If any operation is performed on the 32--bit general registers in long mode,
-the upper 32 bits of the 64--bit registers containing them are filled with
-zeros. This is unlike the operations on 16--bit or 8--bit portions of those
-registers, which preserve the upper bits.
-
-\index{cdqe}\index{cqo}\index{movsxd}
-Three new type conversion instructions are available. The \verb"cdqe" sign extends
-the double word in EAX into quad word and stores the result in RAX register.
-\verb"cqo" sign extends the quad word in RAX into double quad word and stores the
-extra bits in the RDX register. These instructions have no operands.
-\verb"movsxd" sign extends the double word source operand, being either the 32--bit register
-or memory, into 64--bit destination operand, which has to be register.
-No analogous instruction is needed for the zero extension, since it is done
-automatically by any operations on 32--bit registers, as noted in previous
-paragraph. And the \verb"movzx" and \verb"movsx" instructions, conforming to the general
-rule, can be used with 64--bit destination operand, allowing extension of byte
-or word values into quad words.
-
-All the binary arithmetic and logical instruction have been promoted to allow
-64--bit operands in long mode. The use of decimal arithmetic instructions in
-long mode is prohibited.
-
-The stack operations, like \verb"push" and \verb"pop" in long mode default to 64--bit
-operands and it's not possible to use 32--bit operands with them.
-The \verb"pusha" and \verb"popa" are disallowed in long mode.
-
-The indirect near jumps and calls in long mode default to 64--bit operands and
-it's not possible to use the 32--bit operands with them. On the other hand, the
-indirect far jumps and calls allow any operands that were allowed by the x86
-architecture and also 80--bit memory operand is allowed (though only EM64T seems
-to implement such variant), with the first eight bytes defining the offset and
-two last bytes specifying the selector. The direct far jumps and calls are not
-allowed in long mode.
-
-\index{movsq}\index{cmpsq}\index{scasq}\index{lodsq}\index{stosq}
-The I/O instructions, \verb"in", \verb"out", \verb"ins" and \verb"outs" are the exceptional
-instructions that are not extended to accept quad word operands in long mode.
-But all other string operations are, and there are new short forms \verb"movsq",
-\verb"cmpsq", \verb"scasq", \verb"lodsq" and \verb"stosq" introduced for the variants of string
-operations for 64--bit string elements. The RSI and RDI registers are used by
-default to address the string elements.
-
-The \verb"lfs", \verb"lgs" and \verb"lss" instructions are extended to accept 80--bit source
-memory operand with 64--bit destination register (though only EM64T seems to
-implement such variant). The \verb"lds" and \verb"les" are disallowed in long mode.
-
-The system instructions like \verb"lgdt" which required the 48--bit memory operand,
-in long mode require the 80--bit memory operand.
-
-\index{cmpxchg16b}
-The \verb"cmpxchg16b" is the 64--bit equivalent of \verb"cmpxchg8b" instruction, it uses
-the double quad word memory operand and 64--bit registers to perform the analoguous operation.
-
-\index{fxsave64}\index{fxrstor64}
-The \verb"fxsave64" and \verb"fxrstor64" are new variants of \verb"fxsave" and \verb"fxrstor"
-instructions, available only in long mode, which use a different format of
-storage area in order to store some pointers in full 64-bit size.
-
-\index{swapgs}
-\verb"swapgs" is the new instruction, which swaps the contents of GS register and
-the KernelGSbase model--specific register (MSR address 0C0000102h).
-
-\index{syscall}\index{sysret}\index{sysexitq}\index{sysretq}
-\verb"syscall" and \verb"sysret" is the pair of new instructions that provide the
-functionality similar to \verb"sysenter" and \verb"sysexit" in long mode, where the
-latter pair is disallowed. The \verb"sysexitq" and \verb"sysretq" mnemonics provide the
-64--bit versions of \verb"sysexit" and \verb"sysret" instructions.
-
-\index{rdmsrq}\index{wrmsrq}
-The \verb"rdmsrq" and \verb"wrmsrq" mnemonics are the 64--bit variants of the \verb"rdmsr"
-and \verb"wrmsr" instructions.
-
-
-\subsection{SSE4 instructions}
-
-There are actually three different sets of instructions under the name SSE4.
-Intel designed two of them, SSE4.1 and SSE4.2, with latter extending the
-former into the full Intel's SSE4 set. On the other hand, the implementation
-by AMD includes only a few instructions from this set, but also contains
-some additional instructions, that are called the SSE4a set.
-
-The SSE4.1 instructions mostly follow the same rules for operands, as
-the basic SSE operations, so they require destination operand to be SSE
-register and source operand to be 128--bit memory location or SSE register,
-and some operations require a third operand, the 8--bit immediate value.
-
-\index{pmulld}\index{pmuldq}\index{pminsb}\index{pmaxsb}\index{pminuw}
-\index{pmaxuw}\index{pminud}\index{pmaxud}\index{pminsd}\index{pmaxsd}
-\verb"pmulld" performs a signed multiplication of the packed double words and
-stores the low double words of the results in the destination operand.
-\verb"pmuldq" performs a two signed multiplications of the corresponding double
-words in the lower quad words of operands, and stores the results as
-packed quad words into the destination register. \verb"pminsb" and \verb"pmaxsb"
-return the minimum or maximum values of packed signed bytes, \verb"pminuw" and
-\verb"pmaxuw" return the minimum and maximum values of packed unsigned words,
-\verb"pminud", \verb"pmaxud", \verb"pminsd" and \verb"pmaxsd" return minimum or maximum values
-of packed unsigned or signed words. These instruction complement the
-instructions computing packed minimum or maximum introduced by SSE.
-
-\index{ptest}\index{pcmpeqq}
-\verb"ptest" sets the ZF flag to one when the result of bitwise AND of the
-both operands is zero, and zeroes the ZF otherwise. It also sets CF flag
-to one, when the result of bitwise AND of the destination operand with
-the bitwise NOT of the source operand is zero, and zeroes the CF otherwise.
-\verb"pcmpeqq" compares packed quad words for equality, and fills the
-corresponding elements of destination operand with either ones or zeros,
-depending on the result of comparison.
-
-\index{packusdw}
-\verb"packusdw" converts packed signed double words from both the source and
-destination operand into the unsigned words using saturation, and stores
-the eight resulting word values into the destination register.
-
-\index{phminposuw}
-\verb"phminposuw" finds the minimum unsigned word value in source operand
-and places it into the lowest word of destination operand, setting the
-remaining upper bits of destination to zero.
-
-\index{roundps}\index{roundss}\index{roundpd}\index{roundsd}
-\verb"roundps", \verb"roundss", \verb"roundpd" and \verb"roundsd" perform the rounding of
-packed or individual floating point value of single or double precision,
-using the rounding mode specified by the third operand.
-\begin{verbatim}
- roundsd xmm0,xmm1,0011b ; round toward zero
-\end{verbatim}
-
-\index{dpps}\index{dppd}\index{mpsadbw}\index{roundps}
-\verb"dpps" calculates dot product of packed single precision floating point
-values, that is it multiplies the corresponding pairs of values from source and
-destination operand and then sums the products up. The high four bits of the
-8--bit immediate third operand control which products are calculated and taken
-to the sum, and the low four bits control, into which elements of destination
-the resulting dot product is copied (the other elements are filled with zero).
-\verb"dppd" calculates dot product of packed double precision floating point values.
-The bits 4 and 5 of third operand control, which products are calculated and
-added, and bits 0 and 1 of this value control, which elements in destination
-register should get filled with the result. \verb"mpsadbw" calculates multiple sums
-of absolute differences of unsigned bytes. The third operand controls, with
-value in bits 0--1, which of the four-byte blocks in source operand is taken to
-calculate the absolute differencies, and with value in bit 2, at which of the
-two first four-byte block in destination operand start calculating multiple
-sums. The sum is calculated from four absolute differencies between the
-corresponding unsigned bytes in the source and destination block, and each next
-sum is calculated in the same way, but taking the four bytes from destination
-at the position one byte after the position of previous block. The four bytes
-from the source stay the same each time. This way eight sums of absolute
-differencies are calculated and stored as packed word values into the
-destination operand. The instructions described in this paragraph follow the
-same rules for operands, as \verb"roundps" instruction.
-
-\index{blendps}\index{blendvps}\index{blendpd}\index{blendvpd}
-\verb"blendps", \verb"blendvps", \verb"blendpd" and \verb"blendvpd" conditionally copy the
-values from source operand into the destination operand, depending on the bits
-of the mask provided by third operand. If a mask bit is set, the corresponding
-element of source is copied into the same place in destination, otherwise this
-position is destination is left unchanged. The rules for the first two operands
-are the same, as for general SSE instructions. \verb"blendps" and \verb"blendpd" need
-third operand to be 8--bit immediate, and they operate on single or double
-precision values, respectively. \verb"blendvps" and \verb"blendvpd" require third operand
-to be the XMM0 register.
-\begin{verbatim}
- blendvps xmm3,xmm7,xmm0 ; blend according to mask
-\end{verbatim}
-
-\index{pblendw}\index{pblendvb}
-\verb"pblendw" conditionally copies word elements from the source operand into the
-destination, depending on the bits of mask provided by third operand, which
-needs to be 8--bit immediate value. \verb"pblendvb" conditionally copies byte
-elements from the source operands into destination, depending on mask defined
-by the third operand, which has to be XMM0 register. These instructions follow
-the same rules for operands as \verb"blendps" and \verb"blendvps" instructions,
-respectively.
-
-\index{insertps}
-\verb"insertps" inserts a single precision floating point value taken from the
-position in source operand specified by bits 6--7 of third operand into location
-in destination register selected by bits 4--5 of third operand. Additionally,
-the low four bits of third operand control, which elements in destination
-register will be set to zero. The first two operands follow the same rules as
-for the general SSE operation, the third operand should be 8--bit immediate.
-
-\index{extractps}
-\verb"extractps" extracts a single precision floating point value taken from the
-location in source operand specified by low two bits of third operand, and
-stores it into the destination operand. The destination can be a 32--bit memory
-value or general purpose register, the source operand must be SSE register,
-and the third operand should be 8--bit immediate value.
-\begin{verbatim}
- extractps edx,xmm3,3 ; extract the highest value
-\end{verbatim}
-
-\index{pinsrb}\index{pinsrd}\index{pinsrq}
-\verb"pinsrb", \verb"pinsrd" and \verb"pinsrq" copy a byte, double word or quad word from
-the source operand into the location of destination operand determined by the
-third operand. The destination operand has to be SSE register, the source
-operand can be a memory location of appropriate size, or the 32--bit general
-purpose register (but 64--bit general purpose register for \verb"pinsrq", which is
-only available in long mode), and the third operand has to be 8--bit immediate
-value. These instructions complement the \verb"pinsrw" instruction operating on SSE
-register destination, which was introduced by SSE2.
-\begin{verbatim}
- pinsrd xmm4,eax,1 ; insert double word into second position
-\end{verbatim}
-
-\index{pextrb}\index{pextrw}\index{pextrd}\index{pextrq}
-\verb"pextrb", \verb"pextrw", \verb"pextrd" and \verb"pextrq" copy a byte, word, double word or
-quad word from the location in source operand specified by third operand, into
-the destination. The source operand should be SSE register, the third operand
-should be 8--bit immediate, and the destination operand can be memory location
-of appropriate size, or the 32--bit general purpose register (but 64--bit general
-purpose register for \verb"pextrq", which is only available in long mode). The
-\verb"pextrw" instruction with SSE register as source was already introduced by
-SSE2, but SSE4 extends it to allow memory operand as destination.
-\begin{verbatim}
- pextrw [ebx],xmm3,7 ; extract highest word into memory
-\end{verbatim}
-
-\index{pmovsxbw}\index{pmovzxbw}\index{pmovsxbd}\index{pmovzxbd}
-\index{pmovsxbq}\index{pmovzxbq}\index{pmovsxwd}\index{pmovzxwd}
-\index{pmovsxwq}\index{pmovzxwq}\index{pmovsxdq}\index{pmovzxdq}
-\verb"pmovsxbw" and \verb"pmovzxbw" perform sign extension or zero extension of eight
-byte values from the source operand into packed word values in destination
-operand, which has to be SSE register. The source can be 64--bit memory or SSE
-register - when it is register, only its low portion is used. \verb"pmovsxbd" and
-\verb"pmovzxbd" perform sign extension or zero extension of the four byte values
-from the source operand into packed double word values in destination operand,
-the source can be 32--bit memory or SSE register. \verb"pmovsxbq" and \verb"pmovzxbq"
-perform sign extension or zero extension of the two byte values from the
-source operand into packed quad word values in destination operand, the source
-can be 16--bit memory or SSE register. \verb"pmovsxwd" and \verb"pmovzxwd" perform sign
-extension or zero extension of the four word values from the source operand
-into packed double words in destination operand, the source can be 64--bit
-memory or SSE register. \verb"pmovsxwq" and \verb"pmovzxwq" perform sign extension or
-zero extension of the two word values from the source operand into packed quad
-words in destination operand, the source can be 32--bit memory or SSE register.
-\verb"pmovsxdq" and \verb"pmovzxdq" perform sign extension or zero extension of the two
-double word values from the source operand into packed quad words in
-destination operand, the source can be 64--bit memory or SSE register.
-\begin{verbatim}
- pmovzxbq xmm0,word [si] ; zero-extend bytes to quad words
- pmovsxwq xmm0,xmm1 ; sign-extend words to quad words
-\end{verbatim}
-
-\index{movntdqa}
-\verb"movntdqa" loads double quad word from the source operand to the destination
-using a non-temporal hint. The destination operand should be SSE register,
-and the source operand should be 128--bit memory location.
-
-The SSE4.2, described below, adds not only some new operations on SSE
-registers, but also introduces some completely new instructions operating on
-general purpose registers only.
-
-\index{pcmpistri}\index{pcmpistrm}\index{pcmpestri}\index{pcmpestrm}
-\verb"pcmpistri" compares two zero-ended (implicit length) strings provided in
-its source and destination operand and generates an index stored to ECX;
-\verb"pcmpistrm" performs the same comparison and generates a mask stored to XMM0.
-\verb"pcmpestri" compares two strings of explicit lengths, with length provided
-in EAX for the destination operand and in EDX for the source operand, and
-generates an index stored to ECX; \verb"pcmpestrm" performs the same comparision
-and generates a mask stored to XMM0. The source and destination operand follow
-the same rules as for general SSE instructions, the third operand should be
-8--bit immediate value determining the details of performed operation - refer to
-Intel documentation for information on those details.
-
-\index{pcmpgtq}
-\verb"pcmpgtq" compares packed quad words, and fills the corresponding elements of
-destination operand with either ones or zeros, depending on whether the value
-in destination is greater than the one in source, or not. This instruction
-follows the same rules for operands as \verb"pcmpeqq".
-
-\index{crc32}
-\verb"crc32" accumulates a CRC32 value for the source operand starting with
-initial value provided by destination operand, and stores the result in
-destination. Unless in long mode, the destination operand should be a 32--bit
-general purpose register, and the source operand can be a byte, word, or double
-word register or memory location. In long mode the destination operand can
-also be a 64--bit general purpose register, and the source operand in such case
-can be a byte or quad word register or memory location.
-\begin{verbatim}
- crc32 eax,dl ; accumulate CRC32 on byte value
- crc32 eax,word [ebx] ; accumulate CRC32 on word value
- crc32 rax,qword [rbx] ; accumulate CRC32 on quad word value
-\end{verbatim}
-
-\index{popcnt}
-\verb"popcnt" calculates the number of bits set in the source operand, which can
-be 16--bit, 32--bit, or 64--bit general purpose register or memory location,
-and stores this count in the destination operand, which has to be register of
-the same size as source operand. The 64--bit variant is available only in long
-mode.
-\begin{verbatim}
- popcnt ecx,eax ; count bits set to 1
-\end{verbatim}
-
-\index{lzcnt}
-The SSE4a extension, which also includes the \verb"popcnt" instruction introduced
-by SSE4.2, at the same time adds the \verb"lzcnt" instruction, which follows the
-same syntax, and calculates the count of leading zero bits in source operand
-(if the source operand is all zero bits, the total number of bits in source
-operand is stored in destination).
-
-\index{extrq}
-\verb"extrq" extract the sequence of bits from the low quad word of SSE register
-provided as first operand and stores them at the low end of this register,
-filling the remaining bits in the low quad word with zeros. The position of bit
-string and its length can either be provided with two 8--bit immediate values
-as second and third operand, or by SSE register as second operand (and there
-is no third operand in such case), which should contain position value in bits
-8--13 and length of bit string in bits 0--5.
-\begin{verbatim}
- extrq xmm0,8,7 ; extract 8 bits from position 7
- extrq xmm0,xmm5 ; extract bits defined by register
-\end{verbatim}
-
-\index{insertq}
-\verb"insertq" writes the sequence of bits from the low quad word of the source
-operand into specified position in low quad word of the destination operand,
-leaving the other bits in low quad word of destination intact. The position
-where bits should be written and the length of bit string can either be
-provided with two 8--bit immediate values as third and fourth operand, or by
-the bit fields in source operand (and there are only two operands in such
-case), which should contain position value in bits 72--77 and length of bit
-string in bits 64--69.
-\begin{verbatim}
- insertq xmm1,xmm0,4,2 ; insert 4 bits at position 2
- insertq xmm1,xmm0 ; insert bits defined by register
-\end{verbatim}
-
-\index{movntss}\index{movntsd}
-\verb"movntss" and \verb"movntsd" store single or double precision floating point
-value from the source SSE register into 32--bit or 64--bit destination memory
-location respectively, using non--temporal hint.
-
-\subsection{AVX instructions}
-
-The Advanced Vector Extensions introduce instructions that are new variants
-of SSE instructions, with new scheme of encoding that allows extended syntax
-having a destination operand separate from all the source operands. It also
-introduces 256--bit AVX registers, which extend up the old 128--bit SSE
-registers. Any AVX instruction that puts some result into SSE register, puts
-zero bits into high portion of the AVX register containing it.
-
-The AVX version of SSE instruction has the mnemonic obtained by prepending
-SSE instruction name with \verb"v". For any SSE arithmetic instruction which had a
-destination operand also being used as one of the source values, the AVX
-variant has a new syntax with three operands -- the destination and two sources.
-The destination and first source can be SSE registers, and second source can be
-SSE register or memory. If the operation is performed on single pair of values,
-the remaining bits of first source SSE register are copied into the the
-destination register.
-\begin{verbatim}
- vsubss xmm0,xmm2,xmm3 ; substract two 32-bit floats
- vmulsd xmm0,xmm7,qword [esi] ; multiply two 64-bit floats
-\end{verbatim}
-In case of packed operations, each instruction can also operate on the 256--bit
-data size when the AVX registers are specified instead of SSE registers, and
-the size of memory operand is also doubled then.
-\begin{verbatim}
- vaddps ymm1,ymm5,yword [esi] ; eight sums of 32-bit float pairs
-\end{verbatim}
-The instructions that operate on packed integer types (in particular the ones
-that earlier had been promoted from MMX to SSE) also acquired the new syntax
-with three operands, however they are only allowed to operate on 128--bit
-packed types and thus cannot use the whole AVX registers.
-\begin{verbatim}
- vpavgw xmm3,xmm0,xmm2 ; average of 16-bit integers
- vpslld xmm1,xmm0,1 ; shift double words left
-\end{verbatim}
-If the SSE version of instruction had a syntax with three operands, the third
-one being an immediate value, the AVX version of such instruction takes four
-operands, with immediate remaining the last one.
-\begin{verbatim}
- vshufpd ymm0,ymm1,ymm2,10010011b ; shuffle 64-bit floats
- vpalignr xmm0,xmm4,xmm2,3 ; extract byte aligned value
-\end{verbatim}
-The promotion to new syntax according to the rules described above has been
-applied to all the instructions from SSE extensions up to SSE4, with the
-exceptions described below.
-
-\index{vdppd}
-\verb"vdppd" instruction has syntax extended to four operans, but it does not
-have a 256--bit version.
-
-\index{vsqrtpd}\index{vsqrtps}\index{vrcpps}\index{vrsqrtps}
-The are a few instructions, namely \verb"vsqrtpd", \verb"vsqrtps", \verb"vrcpps" and
-\verb"vrsqrtps", which can operate on 256--bit data size, but retained the syntax
-with only two operands, because they use data from only one source:
-\begin{verbatim}
- vsqrtpd ymm1,ymm0 ; put square roots into other register
-\end{verbatim}
-
-\index{vroundpd}\index{vroundps}
-In a similar way \verb"vroundpd" and \verb"vroundps" retained the syntax with three
-operands, the last one being immediate value.
-\begin{verbatim}
- vroundps ymm0,ymm1,0011b ; round toward zero
-\end{verbatim}
-
-\index{vpcmpestri}\index{vpcmpestrm}\index{vpcmpistri}\index{vpcmpistrm}
-\index{vphminposuw}\index{vpshufd}\index{vpshufhw}\index{vpshuflw}
-\index{vcomiss}\index{vcomisd}\index{vcvtss2si}\index{vcvtsd2si}
-\index{vcvttss2si}\index{vcvttsd2si}\index{vextractps}\index{vpextrb}
-\index{vpextrw}\index{vpextrd}\index{vpextrq}\index{vmovd}
-\index{vmovq}\index{vmovntdqa}\index{vmaskmovdqu}\index{vpmovmskb}
-\index{vpmovsxbw}\index{vpmovsxbd}\index{vpmovsxbq}\index{vpmovsxwd}
-\index{vpmovsxwq}\index{vpmovsxdq}\index{vpmovzxbw}\index{vpmovzxbd}
-\index{vpmovzxbq}\index{vpmovzxwd}\index{vpmovzxwq}\index{vpmovzxdq}
-Also some of the operations on packed integers kept their two--operand or
-three--operand syntax while being promoted to AVX version. In such case these
-instructions follow exactly the same rules for operands as their SSE
-counterparts (since operations on packed integers do not have 256--bit variants
-in AVX extension). These include \verb"vpcmpestri", \verb"vpcmpestrm", \verb"vpcmpistri",
-\verb"vpcmpistrm", \verb"vphminposuw", \verb"vpshufd", \verb"vpshufhw", \verb"vpshuflw". And there are
-more instructions that in AVX versions keep exactly the same syntax for
-operands as the one from SSE, without any additional options: \verb"vcomiss",
-\verb"vcomisd", \verb"vcvtss2si", \verb"vcvtsd2si", \verb"vcvttss2si", \verb"vcvttsd2si", \verb"vextractps",
-\verb"vpextrb", \verb"vpextrw", \verb"vpextrd", \verb"vpextrq", \verb"vmovd", \verb"vmovq", \verb"vmovntdqa",
-\verb"vmaskmovdqu", \verb"vpmovmskb", \verb"vpmovsxbw", \verb"vpmovsxbd", \verb"vpmovsxbq", \verb"vpmovsxwd",
-\verb"vpmovsxwq", \verb"vpmovsxdq", \verb"vpmovzxbw", \verb"vpmovzxbd", \verb"vpmovzxbq", \verb"vpmovzxwd",
-\verb"vpmovzxwq" and \verb"vpmovzxdq".
-
-\index{vcvtdq2ps}\index{vcvtps2dq}\index{vcvttps2dq}\index{vmovaps}
-\index{vmovapd}\index{vmovups}\index{vmovupd}\index{vmovdqa}
-\index{vmovdqu}\index{vlddqu}\index{vmovntps}\index{vmovntpd}
-\index{vmovntdq}\index{vmovsldup}\index{vmovshdup}\index{vmovmskps}
-\index{vmovmskpd}
-The move and conversion instructions have mostly been promoted to allow
-256--bit size operands in addition to the 128--bit variant with syntax identical
-to that from SSE version of the same instruction. Each of the
-\verb"vcvtdq2ps", \verb"vcvtps2dq" and \verb"vcvttps2dq",
-\verb"vmovaps", \verb"vmovapd", \verb"vmovups", \verb"vmovupd",
-\verb"vmovdqa", \verb"vmovdqu", \verb"vlddqu",
-\verb"vmovntps", \verb"vmovntpd", \verb"vmovntdq",
-\verb"vmovsldup", \verb"vmovshdup",
-\verb"vmovmskps" and \verb"vmovmskpd" inherits the 128--bit
-syntax from SSE without any changes, and also allows a new form with 256--bit
-operands in place of 128--bit ones.
-\begin{verbatim}
- vmovups [edi],ymm6 ; store unaligned 256-bit data
-\end{verbatim}
-
-\index{vmovddup}
-\verb"vmovddup" has the identical 128--bit syntax as its SSE version, and it also
-has a 256--bit version, which stores the duplicates of the lowest quad word
-from the source operand in the lower half of destination operand, and in the
-upper half of destination the duplicates of the low quad word from the upper
-half of source. Both source and destination operands need then to be 256--bit
-values.
-
-\index{vmovlhps}\index{vmovhlps}
-\verb"vmovlhps" and \verb"vmovhlps" have only 128--bit versions, and each takes three
-operands, which all must be SSE registers. \verb"vmovlhps" copies two single
-precision values from the low quad word of second source register to the high
-quad word of destination register, and copies the low quad word of first
-source register into the low quad word of destination register. \verb"vmovhlps"
-copies two single precision values from the high quad word of second source
-register to the low quad word of destination register, and copies the high
-quad word of first source register into the high quad word of destination
-register.
-
-\index{vmovlps}\index{vmovhps}\index{vmovlpd}\index{vmovhpd}
-\verb"vmovlps", \verb"vmovhps", \verb"vmovlpd" and \verb"vmovhpd" have only 128--bit versions and
-their syntax varies depending on whether memory operand is a destination or
-source. When memory is destination, the syntax is identical to the one of
-equivalent SSE instruction, and when memory is source, the instruction requires
-three operands, first two being SSE registers and the third one 64--bit memory.
-The value put into destination is then the value copied from first source with
-either low or high quad word replaced with value from second source (the
-memory operand).
-\begin{verbatim}
- vmovhps [esi],xmm7 ; store upper half to memory
- vmovlps xmm0,xmm7,[ebx] ; low from memory, rest from register
-\end{verbatim}
-
-\index{vmovss}\index{vmovsd}
-\verb"vmovss" and \verb"vmovsd" have syntax identical to their SSE equivalents as long
-as one of the operands is memory, while the versions that operate purely on
-registers require three operands (each being SSE register). The value stored
-in destination is then the value copied from first source with lowest data
-element replaced with the lowest value from second source.
-\begin{verbatim}
- vmovss xmm3,[edi] ; low from memory, rest zeroed
- vmovss xmm0,xmm1,xmm2 ; one value from xmm2, three from xmm1
-\end{verbatim}
-
-\index{vcvtss2sd}\index{vcvtsd2ss}\index{vcvtsi2ss}\index{vcvtsi2d}
-\verb"vcvtss2sd", \verb"vcvtsd2ss", \verb"vcvtsi2ss" and \verb"vcvtsi2d" use the three--operand
-syntax, where destination and first source are always SSE registers, and the
-second source follows the same rules and the source in syntax of equivalent
-SSE instruction. The value stored in destination is then the value copied from
-first source with lowest data element replaced with the result of conversion.
-\begin{verbatim}
- vcvtsi2sd xmm4,xmm4,ecx ; 32-bit integer to 64-bit float
- vcvtsi2ss xmm0,xmm0,rax ; 64-bit integer to 32-bit float
-\end{verbatim}
-
-\index{vcvtdq2pd}\index{vcvtps2pd}\index{vcvtpd2dq}\index{vcvttpd2dq}\index{vcvtpd2ps}
-\verb"vcvtdq2pd" and \verb"vcvtps2pd" allow the same syntax as their SSE equivalents,
-plus the new variants with AVX register as destination and SSE register or
-128--bit memory as source. Analogously \verb"vcvtpd2dq", \verb"vcvttpd2dq" and
-\verb"vcvtpd2ps", in addition to variant with syntax identical to SSE version,
-allow a variant with SSE register as destination and AVX register or 256--bit
-memory as source.
-
-\index{vinsertps}\index{vpinsrb}\index{vpinsrw}\index{vpinsrd}\index{vpinsrq}\index{vpblendw}
-\verb"vinsertps", \verb"vpinsrb", \verb"vpinsrw", \verb"vpinsrd", \verb"vpinsrq" and \verb"vpblendw" use
-a syntax with four operands, where destination and first source have to be SSE
-registers, and the third and fourth operand follow the same rules as second
-and third operand in the syntax of equivalent SSE instruction. Value stored in
-destination is the the value copied from first source with some data elements
-replaced with values extracted from the second source, analogously to the
-operation of corresponding SSE instruction.
-\begin{verbatim}
- vpinsrd xmm0,xmm0,eax,3 ; insert double word
-\end{verbatim}
-
-\index{vblendvps}\index{vblendvpd}\index{vpblendvb}
-\verb"vblendvps", \verb"vblendvpd" and \verb"vpblendvb" use a new syntax with four register
-operands: destination, two sources and a mask, where second source can also be
-a memory operand. \verb"vblendvps" and \verb"vblendvpd" have 256--bit variant, where
-operands are AVX registers or 256--bit memory, as well as 128--bit variant,
-which has operands being SSE registers or 128--bit memory. \verb"vpblendvb" has only
-a 128--bit variant. Value stored in destination is the value copied from the
-first source with some data elements replaced, according to mask, by values
-from the second source.
-\begin{verbatim}
- vblendvps ymm3,ymm1,ymm2,ymm7 ; blend according to mask
-\end{verbatim}
-
-\index{vptest}\index{vtestps}\index{vtestpd}
-\verb"vptest" allows the same syntax as its SSE version and also has a 256--bit
-version, with both operands doubled in size. There are also two new
-instructions, \verb"vtestps" and \verb"vtestpd", which perform analogous tests, but only
-of the sign bits of corresponding single precision or double precision values,
-and set the ZF and CF accordingly. They follow the same syntax rules as
-\verb"vptest".
-\begin{verbatim}
- vptest ymm0,yword [ebx] ; test 256-bit values
- vtestpd xmm0,xmm1 ; test sign bits of 64-bit floats
-\end{verbatim}
-
-\index{vbroadcastss}\index{vbroadcastsd}\index{vbroadcastf128}
-\verb"vbroadcastss", \verb"vbroadcastsd" and \verb"vbroadcastf128" are new instructions,
-which broadcast the data element defined by source operand into all elements
-of corresponing size in the destination register. \verb"vbroadcastss" needs
-source to be 32--bit memory and destination to be either SSE or AVX register.
-\verb"vbroadcastsd" requires 64--bit memory as source, and AVX register as
-destination. \verb"vbroadcastf128" requires 128--bit memory as source, and AVX
-register as destination.
-\begin{verbatim}
- vbroadcastss ymm0,dword [eax] ; get eight copies of value
-\end{verbatim}
-
-\index{vinsertf128}
-\verb"vinsertf128" is the new instruction, which takes four operands. The
-destination and first source have to be AVX registers, second source can be
-SSE register or 128--bit memory location, and fourth operand should be an
-immediate value. It stores in destination the value obtained by taking
-contents of first source and replacing one of its 128--bit units with value of
-the second source. The lowest bit of fourth operand specifies at which
-position that replacement is done (either 0 or 1).
-
-\index{vextractf128}
-\verb"vextractf128" is the new instruction with three operands. The destination
-needs to be SSE register or 128--bit memory location, the source must be AVX
-register, and the third operand should be an immediate value. It extracts
-into destination one of the 128--bit units from source. The lowest bit of third
-operand specifies, which unit is extracted.
-
-\index{vmaskmovps}\index{vmaskmovpd}
-\verb"vmaskmovps" and \verb"vmaskmovpd" are the new instructions with three operands
-that selectively store in destination the elements from second source
-depending on the sign bits of corresponding elements from first source. These
-instructions can operate on either 128--bit data (SSE registers) or 256--bit
-data (AVX registers). Either destination or second source has to be a memory
-location of appropriate size, the two other operands should be registers.
-\begin{verbatim}
- vmaskmovps [edi],xmm0,xmm5 ; conditionally store
- vmaskmovpd ymm5,ymm0,[esi] ; conditionally load
-\end{verbatim}
-
-\index{vpermilpd}\index{vpermilps}
-\verb"vpermilpd" and \verb"vpermilps" are the new instructions with three operands
-that permute the values from first source according to the control fields from
-second source and put the result into destination operand. It allows to use
-either three SSE registers or three AVX registers as its operands, the second
-source can be a memory of size equal to the registers used. In alternative
-form the second source can be immediate value and then the first source
-can be a memory location of the size equal to destination register.
-
-\index{vperm2f128}
-\verb"vperm2f128" is the new instruction with four operands, which selects
-128--bit blocks of floating point data from first and second source according
-to the bit fields from fourth operand, and stores them in destination.
-Destination and first source need to be AVX registers, second source can be
-AVX register or 256--bit memory area, and fourth operand should be an immediate
-value.
-\begin{verbatim}
- vperm2f128 ymm0,ymm6,ymm7,12h ; permute 128-bit blocks
-\end{verbatim}
-
-\index{vzeroall}\index{vzeroupper}
-\verb"vzeroall" instruction sets all the AVX registers to zero. \verb"vzeroupper" sets
-the upper 128--bit portions of all AVX registers to zero, leaving the SSE
-registers intact. These new instructions take no operands.
-
-\index{vldmxcsr}\index{vstmxcsr}
-\verb"vldmxcsr" and \verb"vstmxcsr" are the AVX versions of \verb"ldmxcsr" and \verb"stmxcsr"
-instructions. The rules for their operands remain unchanged.
-
-
-\subsection{AVX2 instructions}
-
-The AVX2 extension allows all the AVX instructions operating on packed integers
-to use 256--bit data types, and introduces some new instructions as well.
-
-The AVX instructions that operate on packed integers and had only a 128--bit
-variants, have been supplemented with 256--bit variants, and thus their syntax
-rules became analogous to AVX instructions operating on packed floating point
-types.
-\begin{verbatim}
- vpsubb ymm0,ymm0,[esi] ; substract 32 packed bytes
- vpavgw ymm3,ymm0,ymm2 ; average of 16-bit integers
-\end{verbatim}
-However there are some instructions that have not been equipped with the
-256--bit variants. \verb"vpcmpestri", \verb"vpcmpestrm", \verb"vpcmpistri", \verb"vpcmpistrm",
-\verb"vpextrb", \verb"vpextrw", \verb"vpextrd", \verb"vpextrq", \verb"vpinsrb", \verb"vpinsrw", \verb"vpinsrd",
-\verb"vpinsrq" and \verb"vphminposuw" are not affected by AVX2 and allow only the
-128--bit operands.
-
-The packed shift instructions, which allowed the third operand specifying
-amount to be SSE register or 128--bit memory location, use the same rules
-for the third operand in their 256--bit variant.
-\begin{verbatim}
- vpsllw ymm2,ymm2,xmm4 ; shift words left
- vpsrad ymm0,ymm3,xword [ebx] ; shift double words right
-\end{verbatim}
-
-\index{vpsllvd}\index{vpsllvq}\index{vpsrlvd}\index{vpsrlvq}\index{vpsravd}
-There are also new packed shift instructions with standard three--operand AVX
-syntax, which shift each element from first source by the amount specified in
-corresponding element of second source, and store the results in destination.
-\verb"vpsllvd" shifts 32-bit elements left, \verb"vpsllvq" shifts 64--bit elements left,
-\verb"vpsrlvd" shifts 32-bit elements right logically, \verb"vpsrlvq" shifts 64--bit
-elements right logically and \verb"vpsravd" shifts 32-bit elements right
-arithmetically.
-
-The sign--extend and zero--extend instructions, which in AVX versions allowed
-source operand to be SSE register or a memory of specific size, in the new
-256--bit variant need memory of that size doubled or SSE register as source and
-AVX register as destination.
-\begin{verbatim}
- vpmovzxbq ymm0,dword [esi] ; bytes to quad words
-\end{verbatim}
-
-Also \verb"vmovntdqa" has been upgraded with 256--bit variant, so it allows to
-transfer 256--bit value from memory to AVX register, it needs memory address
-to be aligned to 32 bytes.
-
-\index{vpmaskmovd}\index{vpmaskmovq}
-\verb"vpmaskmovd" and \verb"vpmaskmovq" are the new instructions with syntax identical
-to \verb"vmaskmovps" or \verb"vmaskmovpd", and they performs analogous operation on
-packed 32--bit or 64--bit values.
-
-\index{vinserti128}\index{vextracti128}\index{vbroadcasti128}\index{vperm2i128}
-\verb"vinserti128", \verb"vextracti128", \verb"vbroadcasti128" and \verb"vperm2i128" are the new
-instructions with syntax identical to \verb"vinsertf128", \verb"vextractf128",
-\verb"vbroadcastf128" and \verb"vperm2f128" respectively, and they perform analogous
-operations on 128--bit blocks of integer data.
-
-\verb"vbroadcastss" and \verb"vbroadcastsd" instructions have been extended to allow
-SSE register as a source operand (which in AVX could only be a memory).
-
-\index{vpbroadcastb}\index{vpbroadcastw}\index{vpbroadcastd}\index{vpbroadcastq}
-\verb"vpbroadcastb", \verb"vpbroadcastw", \verb"vpbroadcastd" and \verb"vpbroadcastq" are the
-new instructions which broadcast the byte, word, double word or quad word from
-the source operand into all elements of corresponing size in the destination
-register. The destination operand can be either SSE or AVX register, and the
-source operand can be SSE register or memory of size equal to the size of data
-element.
-\begin{verbatim}
- vpbroadcastb ymm0,byte [ebx] ; get 32 identical bytes
-\end{verbatim}
-
-\index{vpermd}\index{vpermps}
-\verb"vpermd" and \verb"vpermps" are new three--operand instructions, which use each
-32--bit element from first source as an index of element in second source which
-is copied into destination at position corresponding to element containing
-index. The destination and first source have to be AVX registers, and the
-second source can be AVX register or 256--bit memory.
-
-\index{vpermq}\index{vpermpd}
-\verb"vpermq" and \verb"vpermpd" are new three--operand instructions, which use 2--bit
-indexes from the immediate value specified as third operand to determine which
-element from source store at given position in destination. The destination
-has to be AVX register, source can be AVX register or 256--bit memory, and the
-third operand must be 8--bit immediate value.
-
-The family of new instructions performing \verb"gather" operation have special
-syntax, as in their memory operand they use addressing mode that is unique to
-them. The base of address can be a 32--bit or 64--bit general purpose register
-(the latter only in long mode), and the index (possibly multiplied by scale
-value, as in standard addressing) is specified by SSE or AVX register. It is
-possible to use only index without base and any numerical displacement can be
-added to the address. Each of those instructions takes three operands. First
-operand is the destination register, second operand is memory addressed with
-a vector index, and third operand is register containing a mask. The most
-significant bit of each element of mask determines whether a value will be
-loaded from memory into corresponding element in destination. The address of
-each element to load is determined by using the corresponding element from
-index register in memory operand to calculate final address with given base
-and displacement. When the index register contains less elements than the
-destination and mask registers, the higher elements of destination are zeroed.
-After the value is successfuly loaded, the corresponding element in mask
-register is set to zero. The destination, index and mask should all be
-distinct registers, it is not allowed to use the same register in two
-different roles.
-
-\index{vgatherdps}
-\verb"vgatherdps" loads single precision floating point values addressed by
-32--bit indexes. The destination, index and mask should all be registers of the
-same type, either SSE or AVX. The data addressed by memory operand is 32--bit
-in size.
-\begin{verbatim}
- vgatherdps xmm0,[eax+xmm1],xmm3 ; gather four floats
- vgatherdps ymm0,[ebx+ymm7*4],ymm3 ; gather eight floats
-\end{verbatim}
-
-\index{vgatherqps}
-\verb"vgatherqps" loads single precision floating point values addressed by
-64--bit indexes. The destination and mask should always be SSE registers, while
-index register can be either SSE or AVX register. The data addressed by memory
-operand is 32--bit in size.
-\begin{verbatim}
- vgatherqps xmm0,[xmm2],xmm3 ; gather two floats
- vgatherqps xmm0,[ymm2+64],xmm3 ; gather four floats
-\end{verbatim}
-
-\index{vgatherdpd}
-\verb"vgatherdpd" loads double precision floating point values addressed by
-32--bit indexes. The index register should always be SSE register, the
-destination and mask should be two registers of the same type, either SSE or
-AVX. The data addressed by memory operand is 64--bit in size.
-\begin{verbatim}
- vgatherdpd xmm0,[ebp+xmm1],xmm3 ; gather two doubles
- vgatherdpd ymm0,[xmm3*8],ymm5 ; gather four doubles
-\end{verbatim}
-
-\index{vgatherqpd}
-\verb"vgatherqpd" loads double precision floating point values addressed by
-64--bit indexes. The destination, index and mask should all be registers of the
-same type, either SSE or AVX. The data addressed by memory operand is 64--bit
-in size.
-
-\index{vpgatherdd}\index{vpgatherqd}
-\verb"vpgatherdd" and \verb"vpgatherqd" load 32--bit values addressed by either 32--bit
-or 64--bit indexes. They follow the same rules as \verb"vgatherdps" and \verb"vgatherqps"
-respectively.
-
-\index{vpgatherdq}\index{vpgatherqq}
-\verb"vpgatherdq" and \verb"vpgatherqq" load 64--bit values addressed by either 32--bit
-or 64--bit indexes. They follow the same rules as \verb"vgatherdpd" and \verb"vgatherqpd"
-respectively.
-
-
-\subsection{Auxiliary sets of computational instructions}
-
-There is a number of additional instruction set extensions related to
-AVX. They introduce new vector instructions (and sometimes also their SSE
-equivalents that use classic instruction encoding), and even some new
-instructions operating on general registers that use the AVX--like encoding
-allowing the extended syntax with separate destination and source operands.
-The CPU support for each of these instruction sets needs to be determined
-separately.
-
-The AES extension provides a specialized set of instructions for the
-purpose of cryptographic computations defined by Advanced Encryption Standard.
-Each of these instructions has two versions: the AVX one and the one with
-SSE--like syntax that uses classic encoding. Refer to the Intel manuals for the
-details of operation of these instructions.
-
-\index{aesenc}\index{aesenclast}\index{vaesenc}\index{vaesenclast}
-\verb"aesenc" and \verb"aesenclast" perform a single round of AES encryption on data
-from first source with a round key from second source, and store result in
-destination. The destination and first source are SSE registers, and the
-second source can be SSE register or 128--bit memory. The AVX versions of these
-instructions, \verb"vaesenc" and \verb"vaesenclast", use the syntax with three operands,
-while the SSE--like version has only two operands, with first operand being
-both the destination and first source.
-
-\index{aesdec}\index{aesdeclast}
-\verb"aesdec" and \verb"aesdeclast" perform a single round of AES decryption on data
-from first source with a round key from second source. The syntax rules for
-them and their AVX versions are the same as for \verb"aesenc".
-
-\index{aesimc}\index{vaesimc}
-\verb"aesimc" performs the InvMixColumns transformation of source operand and
-store the result in destination. Both \verb"aesimc" and \verb"vaesimc" use only two
-operands, destination being SSE register, and source being SSE register or
-128--bit memory location.
-
-\index{aeskeygenassist}
-\verb"aeskeygenassist" is a helper instruction for generating the round key.
-It needs three operands: destination being SSE register, source being SSE
-register or 128--bit memory, and third operand being 8--bit immediate value.
-The AVX version of this instruction uses the same syntax.
-
-\index{pclmulqdq}\index{vpclmulqdq}
-The CLMUL extension introduces just one instruction, \verb"pclmulqdq", and its
-AVX version as well. This instruction performs a carryless multiplication of
-two 64--bit values selected from first and second source according to the bit
-fields in immediate value. The destination and first source are SSE registers,
-second source is SSE register or 128--bit memory, and immediate value is
-provided as last operand. \verb"vpclmulqdq" takes four operands, while \verb"pclmulqdq"
-takes only three operands, with the first one serving both the role of
-destination and first source.
-
-The FMA (Fused Multiply--Add) extension introduces additional AVX
-instructions which perform multiplication and summation as single operation.
-Each one takes three operands, first one serving both the role of destination
-and first source, and the following ones being the second and third source.
-The mnemonic of FMA instruction is obtained by appending to \verb"vf" prefix: first
-either \verb"m" or \verb"nm" to select whether result of multiplication should be taken
-as--is or negated, then either \verb"add" or \verb"sub" to select whether third value
-will be added to the product or substracted from the product, then either
-\verb"132", \verb"213" or \verb"231" to select which source operands are multiplied and which
-one is added or substracted, and finally the type of data on which the
-instruction operates, either \verb"ps", \verb"pd", \verb"ss" or \verb"sd". As it was with SSE
-instructions promoted to AVX, instructions operating on packed floating point
-values allow 128--bit or 256--bit syntax, in former all the operands are SSE
-registers, but the third one can also be a 128--bit memory, in latter the
-operands are AVX registers and the third one can also be a 256--bit memory.
-Instructions that compute just one floating point result need operands to be
-SSE registers, and the third operand can also be a memory, either 32--bit for
-single precision or 64--bit for double precision.
-\begin{verbatim}
- vfmsub231ps ymm1,ymm2,ymm3 ; multiply and substract
- vfnmadd132sd xmm0,xmm5,[ebx] ; multiply, negate and add
-\end{verbatim}
-In addition to the instructions created by the rule described above, there are
-families of instructions with mnemonics starting with either \verb"vfmaddsub" or
-\verb"vfmsubadd", followed by either \verb"132", \verb"213" or \verb"231" and then either \verb"ps" or
-\verb"pd" (the operation must always be on packed values in this case). They add
-to the result of multiplication or substract from it depending on the position
-of value in packed data -- instructions from the \verb"vfmaddsub" group add when the
-position is odd and substract when the position is even, instructions from the
-\verb"vfmsubadd" group add when the position is even and subtstract when the
-position is odd. The rules for operands are the same as for other FMA
-instructions.
-
-The FMA4 instructions are similar to FMA, but use syntax with four operands
-and thus allow destination to be different than all the sources. Their
-mnemonics are identical to FMA instructions with the \verb"132", \verb"213" or \verb"231" cut
-out, as having separate destination operand makes such selection of operands
-superfluous. The multiplication is always performed on values from the first
-and second source, and then the value from third source is added or
-substracted. Either second or third source can be a memory operand, and the
-rules for the sizes of operands are the same as for FMA instructions.
-\begin{verbatim}
- vfmaddpd ymm0,ymm1,[esi],ymm2 ; multiply and add
- vfmsubss xmm0,xmm1,xmm2,[ebx] ; multiply and substract
-\end{verbatim}
-
-\index{vcvtps2ph}\index{vcvtph2ps}
-The F16C extension consists of two instructions, \verb"vcvtps2ph" and
-\verb"vcvtph2ps", which convert floating point values between single precision and
-half precision (the 16--bit floating point format). \verb"vcvtps2ph" takes three
-operands: destination, source, and rounding controls. The third operand is
-always an immediate, the source is either SSE or AVX register containing
-single precision values, and the destination is SSE register or memory, the
-size of memory is 64 bits when the source is SSE register and 128 bits when
-the source is AVX register. \verb"vcvtph2ps" takes two operands, the destination
-that can be SSE or AVX register, and the source that is SSE register or memory
-with size of the half of destination operand's size.
-
-\index{vfrczps}\index{vfrczss}\index{vfrczpd}\index{vfrczsd}
-The AMD XOP extension introduces a number of new vector instructions with
-encoding and syntax analogous to AVX instructions. \verb"vfrczps", \verb"vfrczss",
-\verb"vfrczpd" and \verb"vfrczsd" extract fractional portions of single or double
-precision values, they all take two operands. The packed operations allow
-either SSE or AVX register as destination, for the other two it has to be SSE
-register. Source can be register of the same type as destination, or memory
-of appropriate size (256--bit for destination being AVX register, 128--bit for
-packed operation with destination being SSE register, 64--bit for operation
-on a solitary double precision value and 32--bit for operation on a solitary
-single precision value).
-\begin{verbatim}
- vfrczps ymm0,[esi] ; load fractional parts
-\end{verbatim}
-
-\index{vpcmov}
-\verb"vpcmov" copies bits from either first or second source into destination
-depending on the values of corresponding bits in the fourth operand (the
-selector). If the bit in selector is set, the corresponding bit from first
-source is copied into the same position in destination, otherwise the bit from
-second source is copied. Either second source or selector can be memory
-location, 128--bit or 256--bit depending on whether SSE registers or AVX
-registers are specified as the other operands.
-\begin{verbatim}
- vpcmov xmm0,xmm1,xmm2,[ebx] ; selector in memory
- vpcmov ymm0,ymm5,[esi],ymm2 ; source in memory
-\end{verbatim}
-The family of packed comparison instructions take four operands, the
-destination and first source being SSE register, second source being SSE
-register or 128--bit memory and the fourth operand being immediate value
-defining the type of comparison. The mnemonic or instruction is created
-by appending to \verb"vpcom" prefix either \verb"b" or \verb"ub" to compare signed or
-unsigned bytes, \verb"w" or \verb"uw" to compare signed or unsigned words, \verb"d" or \verb"ud"
-to compare signed or unsigned double words, \verb"q" or \verb"uq" to compare signed or
-unsigned quad words. The respective values from the first and second source
-are compared and the corresponding data element in destination is set to
-either all ones or all zeros depending on the result of comparison. The fourth
-operand has to specify one of the eight comparison types (table \ref{tab:XOP_comparisons}). All
-these instruction have also variants with only three operands and the type
-of comparison encoded within the instruction name by inserting the comparison
-mnemonic after \verb"vpcom".
-\begin{verbatim}
- vpcomb xmm0,xmm1,xmm2,4 ; test for equal bytes
- vpcomgew xmm0,xmm1,[ebx] ; compare signed words
-\end{verbatim}
-
-\begin{table}[hbt]
-\begin{center}\begin{tabular}{|c|c|c|}
-\hline
-Code & Mnemonic & Description \\
-\hline \hline
-0 & \verb"lt" & less than \\
-\hline
-1 & \verb"le" & less than or equal \\
-\hline
-2 & \verb"gt" & greater than \\
-\hline
-3 & \verb"ge" & greater than or equal \\
-\hline
-4 & \verb"eq" & equal \\
-\hline
-5 & \verb"neq" & not equal \\
-\hline
-6 & \verb"false" & false \\
-\hline
-7 & \verb"true" & true \\
-\hline
-\end{tabular}\end{center}
-\caption{XOP comparisons.}
-\label{tab:XOP_comparisons}
-\end{table}
-
-\index{vpermil2ps}\index{vpermil2pd}
-\verb"vpermil2ps" and \verb"vpermil2pd" set the elements in destination register to
-zero or to a value selected from first or second source depending on the
-corresponding bit fields from the fourth operand (the selector) and the
-immediate value provided in fifth operand. Refer to the AMD manuals for the
-detailed explanation of the operation performed by these instructions. Each
-of the first four operands can be a register, and either second source or
-selector can be memory location, 128--bit or 256--bit depending on whether SSE
-registers or AVX registers are used for the other operands.
-\begin{verbatim}
- vpermil2ps ymm0,ymm3,ymm7,ymm2,0 ; permute from two sources
-\end{verbatim}
-
-\index{vphaddbw}\index{vphaddubw}\index{vphaddbd}\index{vphaddubd}
-\index{vphaddbq}\index{vphaddubq}\index{vphaddwd}\index{vphadduwd}
-\index{vphaddwq}\index{vphadduwq}\index{vphadddq}\index{vphaddudq}
-\index{vphsubbw}\index{vphsubwd}\index{vphsubdq}
-\verb"vphaddbw" adds pairs of adjacent signed bytes to form 16--bit values and
-stores them at the same positions in destination. \verb"vphaddubw" does the same
-but treats the bytes as unsigned. \verb"vphaddbd" and \verb"vphaddubd" sum all bytes
-(either signed or unsigned) in each four--byte block to 32--bit results,
-\verb"vphaddbq" and \verb"vphaddubq" sum all bytes in each eight--byte block to
-64--bit results, \verb"vphaddwd" and \verb"vphadduwd" add pairs of words to 32--bit
-results, \verb"vphaddwq" and \verb"vphadduwq" sum all words in each four--word block to
-64--bit results, \verb"vphadddq" and \verb"vphaddudq" add pairs of double words to 64--bit
-results. \verb"vphsubbw" substracts in each two--byte block the byte at higher
-position from the one at lower position, and stores the result as a signed
-16--bit value at the corresponding position in destination, \verb"vphsubwd"
-substracts in each two--word block the word at higher position from the one at
-lower position and makes signed 32--bit results, \verb"vphsubdq" substract in each
-block of two double word the one at higher position from the one at lower
-position and makes signed 64--bit results. Each of these instructions takes
-two operands, the destination being SSE register, and the source being SSE
-register or 128--bit memory.
-\begin{verbatim}
- vphadduwq xmm0,xmm1 ; sum quadruplets of words
-\end{verbatim}
-
-\index{vpmacsww}\index{vpmacssww}\index{vpmacsdd}\index{vpmacssdd}
-\index{vpmacswd}\index{vpmacsswd}\index{vpmacsdql}\index{vpmacssdql}
-\index{vpmacsdqh}\index{vpmacssdqh}\index{vpmadcswd}\index{vpmadcsswd}
-\verb"vpmacsww" and \verb"vpmacssww" multiply the corresponding signed 16--bit values
-from the first and second source and then add the products to the parallel
-values from the third source, then \verb"vpmacsww" takes the lowest 16 bits of the
-result and \verb"vpmacssww" saturates the result down to 16--bit value, and they
-store the final 16--bit results in the destination. \verb"vpmacsdd" and \verb"vpmacssdd"
-perform the analogous operation on 32--bit values. \verb"vpmacswd" and \verb"vpmacsswd" do
-the same calculation only on the low 16--bit values from each 32--bit block and
-form the 32--bit results. \verb"vpmacsdql" and \verb"vpmacssdql" perform such operation
-on the low 32--bit values from each 64--bit block and form the 64--bit results,
-while \verb"vpmacsdqh" and \verb"vpmacssdqh" do the same on the high 32--bit values from
-each 64--bit block, also forming the 64--bit results. \verb"vpmadcswd" and
-\verb"vpmadcsswd" multiply the corresponding signed 16--bit value from the first
-and second source, then sum all the four products and add this sum to each
-16--bit element from third source, storing the truncated or saturated result
-in destination. All these instructions take four operands, the second source
-can be 128--bit memory or SSE register, all the other operands have to be
-SSE registers.
-\begin{verbatim}
- vpmacsdd xmm6,xmm1,[ebx],xmm6 ; accumulate product
-\end{verbatim}
-
-\index{vpperm}
-\verb"vpperm" selects bytes from first and second source, optionally applies a
-separate transformation to each of them, and stores them in the destination.
-The bit fields in fourth operand (the selector) specify for each position in
-destination what byte from which source is taken and what operation is applied
-to it before it is stored there. Refer to the AMD manuals for the detailed
-information about these bit fields. This instruction takes four operands,
-either second source or selector can be a 128--bit memory (or they can be SSE
-registers both), all the other operands have to be SSE registers.
-
-\index{vpshlb}\index{vpshlw}\index{vpshld}\index{vpshlq}
-\verb"vpshlb", \verb"vpshlw", \verb"vpshld" and \verb"vpshlq" shift logically bytes, words, double
-words or quad words respectively. The amount of bits to shift by is specified
-for each element separately by the signed byte placed at the corresponding
-position in the third operand. The source containing elements to shift is
-provided as second operand. Either second or third operand can be 128--bit
-memory (or they can be SSE registers both) and the other operands have to be
-SSE registers.
-\begin{verbatim}
- vpshld xmm3,xmm1,[ebx] ; shift bytes from xmm1
-\end{verbatim}
-
-\index{vpshab}\index{vpshaw}\index{vpshad}\index{vpshaq}
-\index{vprotb}\index{vprotw}\index{vprotd}\index{vprotq}
-\verb"vpshab", \verb"vpshaw", \verb"vpshad" and \verb"vpshaq" arithmetically shift bytes, words,
-double words or quad words. These instructions follow the same rules as the
-logical shifts described above. \verb"vprotb", \verb"vprotw", \verb"vprotd" and \verb"vprotq"
-rotate bytes, word, double words or quad words. They follow the same rules as
-shifts, but additionally allow third operand to be immediate value, in which
-case the same amount of rotation is specified for all the elements in source.
-\begin{verbatim}
- vprotb xmm0,[esi],3 ; rotate bytes to the left
-\end{verbatim}
-
-\index{movbe}
-The MOVBE extension introduces just one new instruction, \verb"movbe", which
-swaps bytes in value from source before storing it in destination, so can
-be used to load and store big endian values. It takes two operands, either
-the destination or source should be a 16--bit, 32--bit or 64--bit memory (the
-last one being only allowed in long mode), and the other operand should be
-a general register of the same size.
-
-The BMI extension, consisting of two subsets -- BMI1 and BMI2, introduces
-new instructions operating on general registers, which use the same encoding
-as AVX instructions and so allow the extended syntax. All these instructions
-use 32--bit operands, and in long mode they also allow the forms with 64--bit
-operands.
-
-\index{andn}
-\verb"andn" calculates the bitwise AND of second source with the inverted bits
-of first source and stores the result in destination. The destination and
-the first source have to be general registers, the second source can be
-general register or memory.
-\begin{verbatim}
- andn edx,eax,[ebx] ; bit-multiply inverted eax with memory
-\end{verbatim}
-
-\index{bextr}
-\verb"bextr" extracts from the first source the sequence of bits using an index
-and length specified by bit fields in the second source operand and stores
-it into destination. The lowest 8 bits of second source specify the position
-of bit sequence to extract and the next 8 bits of second source specify the
-length of sequence. The first source can be a general register or memory,
-the other two operands have to be general registers.
-\begin{verbatim}
- bextr eax,[esi],ecx ; extract bit field from memory
-\end{verbatim}
-
-\index{blsi}
-\verb"blsi" extracts the lowest set bit from the source, setting all the other
-bits in destination to zero. The destination must be a general register,
-the source can be general register or memory.
-\begin{verbatim}
- blsi rax,r11 ; isolate the lowest set bit
-\end{verbatim}
-
-\index{blsmsk}\index{blsr}
-\verb"blsmsk" sets all the bits in the destination up to the lowest set bit in
-the source, including this bit. \verb"blsr" copies all the bits from the source to
-destination except for the lowest set bit, which is replaced by zero. These
-instructions follow the same rules for operands as \verb"blsi".
-
-\index{tzcnt}\index{lzcnt}
-\verb"tzcnt" counts the number of trailing zero bits, that is the zero bits up to
-the lowest set bit of source value. This instruction is analogous to \verb"lzcnt"
-and follows the same rules for operands, so it also has a 16--bit version,
-unlike the other BMI instructions.
-
-\index{bzhi}
-\verb"bzhi" is BMI2 instruction, which copies the bits from first source to
-destination, zeroing all the bits up from the position specified by second
-source. It follows the same rules for operands as \verb"bextr".
-
-\index{pext}\index{pdep}
-\verb"pext" uses a mask in second source operand to select bits from first
-operands and puts the selected bits as a continuous sequence into destination.
-\verb"pdep" performs the reverse operation -- it takes sequence of bits from the
-first source and puts them consecutively at the positions where the bits in
-second source are set, setting all the other bits in destination to zero.
-These BMI2 instructions follow the same rules for operands as \verb"andn".
-
-\index{mulx}
-\verb"mulx" is a BMI2 instruction which performs an unsigned multiplication of
-value from EDX or RDX register (depending on the size of specified operands)
-by the value from third operand, and stores the low half of result in the
-second operand, and the high half of result in the first operand, and it does
-it without affecting the flags. The third operand can be general register or
-memory, and both the destination operands have to be general registers.
-\begin{verbatim}
- mulx edx,eax,ecx ; multiply edx by ecx into edx:eax
-\end{verbatim}
-
-\index{shlx}\index{shrx}\index{sarx}
-\verb"shlx", \verb"shrx" and \verb"sarx" are BMI2 instructions, which perform logical or
-arithmetical shifts of value from first source by the amount specified by
-second source, and store the result in destination without affecting the
-flags. The have the same rules for operands as \verb"bzhi" instruction.
-
-\index{rorx}
-\verb"rorx" is a BMI2 instruction which rotates right the value from source
-operand by the constant amount specified in third operand and stores the
-result in destination without affecting the flags. The destination operand
-has to be general register, the source operand can be general register or
-memory, and the third operand has to be an immediate value.
-\begin{verbatim}
- rorx eax,edx,7 ; rotate without affecting flags
-\end{verbatim}
-
-\index{blsic}\index{blsfill}
-The TBM is an extension designed by AMD to supplement the BMI set. The
-\verb"bextr" instruction is extended with a new form, in which second source is
-a 32--bit immediate value. \verb"blsic" is a new instruction which performs the
-same operation as \verb"blsi", but with the bits of result reversed. It uses the
-same rules for operands as \verb"blsi". \verb"blsfill" is a new instruction, which takes
-the value from source, sets all the bits below the lowest set bit and store
-the result in destination, it also uses the same rules for operands as \verb"blsi".
-
-\index{blci}\index{blcic}\index{blcs}\index{blcmsk}\index{blcfill}
-\verb"blci", \verb"blcic", \verb"blcs", \verb"blcmsk" and \verb"blcfill" are instructions analogous
-to \verb"blsi", \verb"blsic", \verb"blsr", \verb"blsmsk" and \verb"blsfill" respectively, but they
-perform the bit--inverted versions of the same operations. They follow the
-same rules for operands as the instructions they reflect.
-
-\index{tzmsk}\index{t1mskc}
-\verb"tzmsk" finds the lowest set bit in value from source operand, sets all bits
-below it to 1 and all the rest of bits to zero, then writes the result to
-destination. \verb"t1mskc" finds the least significant zero bit in the value from
-source operand, sets the bits below it to zero and all the other bits to 1,
-and writes the result to destination. These instructions have the same rules
-for operands as \verb"blsi".
-
-
-\subsection{Other extensions of instruction set}
-
-There is a number of additional instruction set extensions recognized by flat
-assembler, and the general syntax of the instructions introduced by those
-extensions is provided here. For a detailed information on the operations
-performed by them, check out the manuals from Intel (for the VMX, SMX, XSAVE,
-RDRAND, FSGSBASE, INVPCID, HLE and RTM extensions) or AMD (for the SVM extension).
-
-\index{vmxon}\index{vmxoff}\index{vmlaunch}\index{vmresume}\index{vmcall}
-The Virtual--Machine Extensions (VMX) provide a set of instructions for the
-management of virtual machines. The \verb"vmxon" instruction, which enters the VMX
-operation, requires a single 64--bit memory operand, which should be a physical
-address of memory region, which the logical processor may use to support VMX
-operation. The \verb"vmxoff" instruction, which leaves the VMX operation, has no
-operands. The \verb"vmlaunch" and \verb"vmresume", which launch or resume the virtual
-machines, and \verb"vmcall", which allows guest software to call the VM monitor,
-use no operands either.
-
-\index{vmptrld}\index{vmptrst}\index{vmclear}
-The \verb"vmptrld" loads the physical address of current Virtual Machine Control
-Structure (VMCS) from its memory operand, \verb"vmptrst" stores the pointer to
-current VMCS into address specified by its memory operand, and \verb"vmclear" sets
-the launch state of the VMCS referenced by its memory operand to clear. These
-three instruction all require single 64--bit memory operand.
-
-\index{vmread}\index{vmwrite}
-The \verb"vmread" reads from VCMS a field specified by the source operand and
-stores it into the destination operand. The source operand should be a
-general purpose register, and the destination operand can be a register of
-memory. The \verb"vmwrite" writes into a VMCS field specified by the destination
-operand the value provided by source operand. The source operand can be a
-general purpose register or memory, and the destination operand must be a
-register. The size of operands for those instructions should be 64--bit when
-in long mode, and 32--bit otherwise.
-
-\index{invept}\index{invvpid}
-The \verb"invept" and \verb"invvpid" invalidate the translation lookaside buffers
-(TLBs) and paging--structure caches, either derived from extended page tables
-(EPT), or based on the virtual processor identifier (VPID). These instructions
-require two operands, the first one being the general purpose register
-specifying the type of invalidation, and the second one being a 128--bit
-memory operand providing the invalidation descriptor. The first operand
-should be a 64--bit register when in long mode, and 32--bit register otherwise.
-
-\index{getsec}
-The Safer Mode Extensions (SMX) provide the functionalities available
-throught the \verb"getsec" instruction. This instruction takes no operands, and
-the function that is executed is determined by the contents of EAX register
-upon executing this instruction.
-
-\index{skinit}
-The Secure Virtual Machine (SVM) is a variant of virtual machine extension
-used by AMD. The \verb"skinit" instruction securely reinitializes the processor
-allowing the startup of trusted software, such as the virtual machine monitor
-(VMM). This instruction takes a single operand, which must be EAX, and
-provides a physical address of the secure loader block (SLB).
-
-\index{vmrun}\index{vmsave}\index{vmload}
-The \verb"vmrun" instruction is used to start a guest virtual machine,
-its only operand should be an accumulator register (AX, EAX or RAX, the
-last one available only in long mode) providing the physical address of the
-virtual machine control block (VMCB). The \verb"vmsave" stores a subset of
-processor state into VMCB specified by its operand, and \verb"vmload" loads the
-same subset of processor state from a specified VMCB. The same operand rules
-as for the \verb"vmrun" apply to those two instructions.
-
-\index{vmmcall}
-\verb"vmmcall" allows the guest software to call the VMM. This instruction takes
-no operands.
-
-\index{stgi}\index{clgi}
-\verb"stgi" set the global interrupt flag to 1, and \verb"clgi" zeroes it. These
-instructions take no operands.
-
-\index{invlpga}
-\verb"invlpga" invalidates the TLB mapping for a virtual page specified by the
-first operand (which has to be accumulator register) and address space
-identifier specified by the second operand (which must be ECX register).
-
-\index{xsave}\index{xsaveopt}\index{xrstor}\index{xsave64}\index{xsaveopt64}\index{xrstor64}
-The XSAVE set of instructions allows to save and restore processor state
-components. \verb"xsave" and \verb"xsaveopt" store the components of processor state
-defined by bit mask in EDX and EAX registers into area defined by memory
-operand. \verb"xrstor" restores from the area specified by memory operand the
-components of processor state defined by mask in EDX and EAX. The \verb"xsave64",
-\verb"xsaveopt64" and \verb"xrstor64" are 64--bit versions of these instructions, allowed
-only in long mode.
-
-\index{xgetbv}\index{xsetbv}
-\verb"xgetbv" read the contents of 64--bit XCR (extended control register)
-specified in ECX register into EDX and EAX registers. \verb"xsetbv" writes the
-contents of EDX and EAX into the 64--bit XCR specified by ECX register. These
-instructions have no operands.
-
-\index{rdrand}
-The RDRAND extension introduces one new instruction, \verb"rdrand", which loads
-the hardware--generated random value into general register. It takes one
-operand, which can be 16--bit, 32--bit or 64--bit register (with the last one
-being allowed only in long mode).
-
-\index{rdfsbase}\index{rdgsbase}\index{wrfsbase}\index{wrgsbase}
-The FSGSBASE extension adds long mode instructions that allow to read and
-write the segment base registers for FS and GS segments. \verb"rdfsbase" and
-\verb"rdgsbase" read the corresponding segment base registers into operand, while
-\verb"wrfsbase" and \verb"wrgsbase" write the value of operand into those register.
-All these instructions take one operand, which can be 32--bit or 64--bit general
-register.
-
-\index{invpcid}
-The INVPCID extension adds \verb"invpcid" instruction, which invalidates mapping
-in the TLBs and paging caches based on the invalidation type specified in
-first operand and PCID invalidate descriptor specified in second operand.
-The first operands should be 32--bit general register when not in long mode,
-or 64--bit general register when in long mode. The second operand should be
-128--bit memory location.
-
-\index{xacquire}\index{xrelease}\index{xbegin}\index{xend}\index{xabort}\index{xtest}
-The HLE and RTM extensions provide set of instructions for the transactional
-management. The \verb"xacquire" and \verb"xrelease" are new prefixes that can be used
-with some of the instructions to start or end lock elision on the memory
-address specified by prefixed instruction. The \verb"xbegin" instruction starts
-the transactional execution, its operand is the address a fallback routine
-that gets executes in case of transaction abort, specified like the operand
-for near jump instruction. \verb"xend" marks the end of transcational execution
-region, it takes no operands. \verb"xabort" forces the transaction abort, it takes
-an 8--bit immediate value as its only operand, this value is passed in the
-highest bits of EAX to the fallback routine. \verb"xtest" checks whether there is
-transactional execution in progress, this instruction takes no operands.
-
-
-\section{Control directives}
-\label{sec:control}
-This section describes the directives that control the assembly process, they
-are processed during the assembly and may cause some blocks of instructions
-to be assembled differently or not assembled at all.
-
-\subsection{Numerical constants}
-\index{=}
-The \verb"=" directive allows to define the numerical constant. It should be preceded by
-the name for the constant and followed by the numerical expression providing the value.
-The value of such constants can be a number or an address, but -- unlike labels -- the
-numerical constants are not allowed to hold the register--based addresses.
-Besides this difference, in their basic variant numerical constants behave
-very much like labels and you can even forward--reference them (access their
-values before they actually get defined).
-
-There is, however, a second variant of numerical constants, which is recognized by assembler when
-you try to define the constant of name, under which there already was a numerical constant defined.
-In such case assembler treats that constant as an assembly--time variable and allows it to be
-assigned with new value, but forbids forward--referencing it (for obvious reasons). Let's see both the
-variant of numerical constants in one example:
-\begin{verbatim}
- dd sum
- x = 1
- x = x+2
- sum = x
-\end{verbatim}
-Here the \verb"x" is an assembly--time variable, and every time it is accessed, the value
-that was assigned to it the most recently is used. Thus if we tried to access the \verb"x" before
-it gets defined the first time, like if we wrote \verb"dd x" in place of the \verb"dd sum" instruction,
-it would cause an error. And when it is re--defined with the \verb"x = x+2" directive, the previous value
-of \verb"x" is used to calculate the new one. So when the \verb"sum" constant gets defined, the \verb"x" has
-value of 3, and this value is assigned to the \verb"sum". Since this one is defined only once in source,
-it is the standard numerical constant, and can be forward--referenced. So the \verb"dd sum" is assembled
-as \verb"dd 3". To read more about how the assembler is able to resolve this, see section \ref{sec:passes}.
-
-The value of numerical constant can be preceded by size operator, which can ensure that the value
-will fit in the range for the specified size, and can affect also how some of the calculations inside
-the numerical expression are performed. This example:
-\begin{verbatim}
- c8 = byte -1
- c32 = dword -1
-\end{verbatim}
-defines two different constants, the first one fits in 8 bits, the second one fits in 32 bits.
-
-When you need to define constant with the value of address, which may be register--based
-(and thus you cannot employ numerical constant for this purpose), you can use the extended
-syntax of \verb"label" directive (already described in section \ref{sec:labels}), like:
-\begin{verbatim}
- label myaddr at ebp+4
-\end{verbatim}
-which declares label placed at \verb"ebp+4" address. However remember that labels,
-unlike numerical constants, cannot become assembly--time variables.
-
-
-\subsection{Conditional assembly}
-\index{IF}
-\verb"if" directive causes some block of instructions to be assembled only under
-certain condition. It should be followed by logical expression specifying the
-condition, instructions in next lines will be assembled only when this
-condition is met, otherwise they will be skipped. The optional \verb"else if"
-directive followed with logical expression specifying additional condition
-begins the next block of instructions that will be assembled if previous
-conditions were not met, and the additional condition is met. The optional
-\verb"else" directive begins the block of instructions that will be assembled if
-all the conditions were not met. The \verb"end if" directive ends the last block of
-instructions.
-
-You should note that \verb"if" directive is processed at assembly stage and
-therefore it doesn't affect any preprocessor directives, like the definitions
-of symbolic constants and macroinstructions -- when the assembler recognizes the
-\verb"if" directive, all the preprocessing has been already finished.
-
-The logical expression consist of logical values and logical operators. The
-logical operators are \verb"~" for logical negation, \verb"&" for logical and, \verb"|" for
-logical or. The negation has the highest priority. Logical value can be a
-numerical expression, it will be false if it is equal to zero, otherwise it
-will be true. Two numerical expression can be compared using one of the
-following operators to make the logical value: \verb"=" (equal), \verb"<" (less),
-\verb">" (greater), \verb"<=" (less or equal), \verb">=" (greater or equal),
-\verb"<>" (not equal).
-
-The \verb"used" operator followed by a symbol name, is the logical value that
-checks whether the given symbol is used somewhere (it returns correct result
-even if symbol is used only after this check). The \verb"defined" operator can be
-followed by any expression, usually just by a single symbol name; it checks
-whether the given expression contains only symbols that are defined in the
-source and accessible from the current position.
-
-With \verb"relativeto" operator it is possible to check whether values of two
-expressions differ only by constant amount. The valid syntax is a numerical
-expression followed by \verb"relativeto" and then another expression (possibly
-register-based). Labels that have no simple numerical value can be tested
-this way to determine what kind of operations may be possible with them.
-
-The following simple example uses the \verb"count" constant that should be
-defined somewhere in source:
-\begin{verbatim}
- if count>0
- mov cx,count
- rep movsb
- end if
-\end{verbatim}
-These two assembly instructions will be assembled only if the \verb"count" constant
-is greater than 0. The next sample shows more complex conditional structure:
-\begin{verbatim}
- if count & ~ count mod 4
- mov cx,count/4
- rep movsd
- else if count>4
- mov cx,count/4
- rep movsd
- mov cx,count mod 4
- rep movsb
- else
- mov cx,count
- rep movsb
- end if
-\end{verbatim}
-The first block of instructions gets assembled when the \verb"count" is non zero and
-divisible by four, if this condition is not met, the second logical expression,
-which follows the \verb"else if", is evaluated and if it's true, the second block
-of instructions get assembled, otherwise the last block of instructions, which
-follows the line containing only \verb"else", is assembled.
-
-There are also operators that allow comparison of values being any chains of
-symbols. The \verb"eq" compares whether two such values are exactly the same.
-The \verb"in" operator checks whether given value is a member of the list of values
-following this operator, the list should be enclosed between \verb"<" and \verb">"
-characters, its members should be separated with commas. The symbols are
-considered the same when they have the same meaning for the assembler -- for
-example \verb"pword" and \verb"fword" for assembler are the same and thus are not
-distinguished by the above operators. In the same way \verb"16 eq 10h" is the true
-condition, however \verb"16 eq 10+4" is not.
-
-The \verb"eqtype" operator checks whether the two compared values have the same
-structure, and whether the structural elements are of the same type. The
-distinguished types include numerical expressions, individual quoted strings,
-floating point numbers, address expressions (the expressions enclosed in square
-brackets or preceded by \verb"ptr" operator), instruction mnemonics, registers, size
-operators, jump type and code type operators. And each of the special
-characters that act as a separators, like comma or colon, is the separate type
-itself. For example, two values, each one consisting of register name followed
-by comma and numerical expression, will be regarded as of the same type, no
-matter what kind of register and how complicated numerical expression is used;
-with exception for the quoted strings and floating point values, which are the
-special kinds of numerical expressions and are treated as different types. Thus
-\verb"eax,16 eqtype fs,3+7" condition is true, but \verb"eax,16 eqtype eax,1.6" is false.
-
-\subsection{Repeating blocks of instructions}
-\label{sec:repeating}
-\index{TIMES}
-\verb"times" directive repeats one instruction specified number of times. It
-should be followed by numerical expression specifying number of repeats and
-the instruction to repeat (optionally colon can be used to separate number and
-instruction). When special symbol \verb"%" is used inside the instruction, it is
-equal to the number of current repeat. For example \verb"times 5 db %" will define
-five bytes with values 1, 2, 3, 4, 5. Recursive use of \verb"times" directive is
-also allowed, so \verb"times 3 times % db %" will define six bytes with values
-1, 1, 2, 1, 2, 3.
-
-\index{REPEAT}
-\verb"repeat" directive repeats the whole block of instructions. It should be
-followed by numerical expression specifying number of repeats. Instructions
-to repeat are expected in next lines, ended with the \verb"end repeat" directive,
-for example:
-\begin{verbatim}
- repeat 8
- mov byte [bx],%
- inc bx
- end repeat
-\end{verbatim}
-The generated code will store byte values from one to eight in the memory
-addressed by BX register.
-
-Number of repeats can be zero, in that case the instructions are not
-assembled at all.
-
-\index{BREAK}
-The \verb"break" directive allows to stop repeating earlier and continue assembly
-from the first line after the \verb"end repeat". Combined with the \verb"if" directive it
-allows to stop repeating under some special condition, like:
-\begin{verbatim}
- s = x/2
- repeat 100
- if x/s = s
- break
- end if
- s = (s+x/s)/2
- end repeat
-\end{verbatim}
-
-\index{WHILE}
-The \verb"while" directive repeats the block of instructions as long as the
-condition specified by the logical expression following it is true. The block
-of instructions to be repeated should end with the \verb"end while" directive.
-Before each repetition the logical expression is evaluated and when its value
-is false, the assembly is continued starting from the first line after the
-\verb"end while". Also in this case the \verb"%" symbol holds the number of current
-repeat. The \verb"break" directive can be used to stop this kind of loop in the same
-way as with \verb"repeat" directive. The previous sample can be rewritten to use the
-\verb"while" instead of \verb"repeat" this way:
-\begin{verbatim}
- s = x/2
- while x/s <> s
- s = (s+x/s)/2
- if % = 100
- break
- end if
- end while
-\end{verbatim}
-
-The blocks defined with \verb"if", \verb"repeat" and \verb"while" can be nested in any order,
-however they should be closed in the same order in which they were started. The
-\verb"break" directive always stops processing the block that was started last with
-either the \verb"repeat" or \verb"while" directive.
-
-\subsection{Addressing spaces}
-\index{ORG}
-\verb"org" directive sets address at which the following code is expected to
-appear in memory. It should be followed by numerical expression specifying
-the address. This directive begins the new addressing space, the following
-code itself is not moved in any way, but all the labels defined within it
-and the value of \verb"$" symbol are affected as if it was put at the given
-address. However it's the responsibility of programmer to put the code at
-correct address at run--time.
-
-\index{LOAD}
-The \verb"load" directive allows to define constant with a binary value loaded
-from the already assembled code. This directive should be followed by the name
-of the constant, then optionally size operator, then \verb"from" operator and a
-numerical expression specifying a valid address in current addressing space.
-The size operator has unusual meaning in this case -- it states how many bytes
-(up to 8) have to be loaded to form the binary value of constant. If no size
-operator is specified, one byte is loaded (thus value is in range from 0 to
-255). The loaded data cannot exceed current offset.
-
-\index{STORE}
-The \verb"store" directive can modify the already generated code by replacing
-some of the previously generated data with the value defined by given
-numerical expression, which follows. The expression can be preceded by the
-optional size operator to specify how large value the expression defines, and
-therefore how much bytes will be stored, if there is no size operator, the
-size of one byte is assumed. Then the \verb"at" operator and the numerical
-expression defining the valid address in current addressing code space, at
-which the given value have to be stored should follow. This is a directive for
-advanced appliances and should be used carefully.
-
-Both \verb"load" and \verb"store" directives are limited to operate on places in
-current addressing space. The \verb"$$" symbol is always equal to the base address
-of current addressing space, and the \verb"$" symbol is the address of current
-position in that addressing space, therefore these two values define limits
-of the area, where \verb"load" and \verb"store" can operate.
-
-Combining the \verb"load" and \verb"store" directives allows to do things like encoding
-some of the already generated code. For example to encode the whole code
-generated in current addressing space you can use such block of directives:
-\begin{verbatim}
- repeat $-$$
- load a byte from $$+%-1
- store byte a xor c at $$+%-1
- end repeat
-\end{verbatim}
-and each byte of code will be xored with the value defined by \verb"c" constant.
-
-\index{VIRTUAL}
-\verb"virtual" defines virtual data at specified address. This data will not be
-included in the output file, but labels defined there can be used in other
-parts of source. This directive can be followed by \verb"at" operator and the
-numerical expression specifying the address for virtual data, otherwise is
-uses current address, the same as \verb"virtual at $". Instructions defining data
-are expected in next lines, ended with \verb"end virtual" directive. The block of
-virtual instructions itself is an independent addressing space, after it's
-ended, the context of previous addressing space is restored.
-
-The \verb"virtual" directive can be used to create union of some variables, for
-example:
-\begin{verbatim}
- GDTR dp ?
- virtual at GDTR
- GDT_limit dw ?
- GDT_address dd ?
- end virtual
-\end{verbatim}
-It defines two labels for parts of the 48--bit variable at \verb"GDTR" address.
-
-It can be also used to define labels for some structures addressed by a
-register, for example:
-\begin{verbatim}
- virtual at bx
- LDT_limit dw ?
- LDT_address dd ?
- end virtual
-\end{verbatim}
-With such definition instruction \verb"mov ax,[LDT_limit]" will be assembled
-to the same instruction as \verb"mov ax,[bx]".
-
-Declaring defined data values or instructions inside the virtual block would
-also be useful, because the \verb"load" directive can be used to load the values
-from the virtually generated code into a constants. This directive should be
-used after the code it loads but before the virtual block ends, because it can
-only load the values from the same addressing space. For example:
-\begin{verbatim}
- virtual at 0
- xor eax,eax
- and edx,eax
- load zeroq dword from 0
- end virtual
-\end{verbatim}
-The above piece of code will define the \verb"zeroq" constant containing four bytes
-of the machine code of the instructions defined inside the virtual block.
-This method can be also used to load some binary value from external file.
-For example this code:
-\begin{verbatim}
- virtual at 0
- file 'a.txt':10h,1
- load char from 0
- end virtual
-\end{verbatim}
-loads the single byte from offset 10h in file \verb"a.txt" into the \verb"char"
-constant.
-
-Any of the \verb"section" directives described in \ref{sec:formatter} also begins a new
-addressing space.
-
-\subsection{Other directives}
-\label{sec:other}
-\index{ALIGN}
-\verb"align" directive aligns code or data to the specified boundary. It should
-be followed by a numerical expression specifying the number of bytes, to the
-multiply of which the current address has to be aligned. The boundary value
-has to be the power of two.
-
-The \verb"align" directive fills the bytes that had to be skipped to perform the
-alignment with the \verb"nop" instructions and at the same time marks this area as
-uninitialized data, so if it is placed among other uninitialized data that
-wouldn't take space in the output file, the alignment bytes will act the same
-way. If you need to fill the alignment area with some other values, you can
-combine \verb"align" with \verb"virtual" to get the size of alignment needed and then
-create the alignment yourself, like:
-\begin{verbatim}
- virtual
- align 16
- a = $ - $$
- end virtual
- db a dup 0
-\end{verbatim}
-The \verb"a" constant is defined to be the difference between address after alignment
-and address of the \verb"virtual" block (see previous section), so it is equal to
-the size of needed alignment space.
-
-\index{DISPLAY}
-\verb"display" directive displays the message at the assembly time. It should
-be followed by the quoted strings or byte values, separated with commas. It
-can be used to display values of some constants, for example:
-\begin{verbatim}
- bits = 16
- display 'Current offset is 0x'
- repeat bits/4
- d = '0' + $ shr (bits-%*4) and 0Fh
- if d > '9'
- d = d + 'A'-'9'-1
- end if
- display d
- end repeat
- display 13,10
-\end{verbatim}
-This block of directives calculates the four hexadecimal digits of 16--bit value
-and converts them into characters for displaying. Note that this will not work if
-the adresses in current addressing space are relocatable (as it might happen with
-PE or object output formats), since only absolute values can be used this way.
-The absolute value may be obtained by calculating the relative address, like
-\verb"$-$$", or \verb"rva $" in case of PE format.
-
-The \verb"err" directive immediately terminates the assembly process when it is
-encountered by assembler.
-
-The \verb"assert" directive tests whether the logical expression that follows it
-is true, and if not, it signalizes the error.
-
-
-\subsection{Multiple passes}
-\label{sec:passes}
-Because the assembler allows to reference some of the labels or constants
-before they get actually defined, it has to predict the values of such labels
-and if there is even a suspicion that prediction failed in at least one case,
-it does one more pass, assembling the whole source, this time doing better
-prediction based on the values the labels got in the previous pass.
-
-The changing values of labels can cause some instructions to have encodings
-of different length, and this can cause the change in values of labels again.
-And since the labels and constants can also be used inside the expressions that
-affect the behavior of control directives, the whole block of source can be
-processed completely differently during the new pass. Thus the assembler does
-more and more passes, each time trying to do better predictions to approach
-the final solution, when all the values get predicted correctly. It uses
-various method for predicting the values, which has been chosen to allow
-finding in a few passes the solution of possibly smallest length for the most
-of the programs.
-
-Some of the errors, like the values not fitting in required boundaries, are
-not signaled during those intermediate passes, since it may happen that when
-some of the values are predicted better, these errors will disappear. However
-if assembler meets some illegal syntax construction or unknown instruction, it
-always stops immediately. Also defining some label more than once causes such
-error, because it makes the predictions groundless.
-
-Only the messages created
-with the \verb"display" directive during the last performed pass get actually
-displayed. In case when the assembly has been stopped due to an error, these messages
-may reflect the predicted values that are not yet resolved correctly.
-
-The solution may sometimes not exist and in such cases the assembler will
-never manage to make correct predictions -- for this reason there is a limit for
-a number of passes, and when assembler reaches this limit, it stops and displays
-the message that it is not able to generate the correct output. Consider the
-following example:
-\begin{verbatim}
- if ~ defined alpha
- alpha:
- end if
-\end{verbatim}
-The \verb"defined" operator gives the true value when the expression following it
-could be calculated in this place, what in this case means that the \verb"alpha"
-label is defined somewhere. But the above block causes this label to be defined
-only when the value given by \verb"defined" operator is false, what leads to an
-antynomy and makes it impossible to resolve such code. When processing the \verb"if"
-directive assembler has to predict whether the \verb"alpha" label will be defined
-somewhere (it wouldn't have to predict only if the label was already defined
-earlier in this pass), and whatever the prediction is, the opposite always
-happens. Thus the assembly will fail, unless the \verb"alpha" label is defined
-somewhere in source preceding the above block of instructions -- in such case,
-as it was already noted, the prediction is not needed and the block will just
-get skipped.
-
-The above sample might have been written as a try to define the label only
-when it was not yet defined. It fails, because the \verb"defined" operator does
-check whether the label is defined anywhere, and this includes the definition
-inside this conditionally processed block. However adding some additional
-condition may make it possible to get it resolved:
-\begin{verbatim}
- if ~ defined alpha | defined @f
- alpha:
- @@:
- end if
-\end{verbatim}
-The \verb"@f" is always the same label as the nearest \verb"@@" symbol in the source
-following it, so the above sample would mean the same if any unique name was
-used instead of the anonymous label. When \verb"alpha" is not defined in any other
-place in source, the only possible solution is when this block gets defined,
-and this time this doesn't lead to the antynomy, because of the anonymous
-label which makes this block self--establishing. To better understand this,
-look at the blocks that has nothing more than this self-establishing:
-\begin{verbatim}
- if defined @f
- @@:
- end if
-\end{verbatim}
-This is an example of source that may have more than one solution, as both
-cases when this block gets processed or not are equally correct. Which one of
-those two solutions we get depends on the algorithm on the assembler, in case
-of flat assembler -- on the algorithm of predictions. Back to the previous
-sample, when \verb"alpha" is not defined anywhere else, the condition for \verb"if" block
-cannot be false, so we are left with only one possible solution, and we can
-hope the assembler will arrive at it. On the other hand, when \verb"alpha" is
-defined in some other place, we've got two possible solutions again, but one of
-them causes \verb"alpha" to be defined twice, and such an error causes assembler to
-abort the assembly immediately, as this is the kind of error that deeply
-disturbs the process of resolving. So we can get such source either correctly
-resolved or causing an error, and what we get may depend on the internal
-choices made by the assembler.
-
-However there are some facts about such choices that are certain. When
-assembler has to check whether the given symbol is defined and it was already
-defined in the current pass, no prediction is needed -- it was already noted
-above. And when the given symbol has been defined never before, including all
-the already finished passes, the assembler predicts it to be not defined.
-Knowing this, we can expect that the simple self--establishing block shown
-above will not be assembled at all and that the previous sample will resolve
-correctly when \verb"alpha" is defined somewhere before our conditional block,
-while it will itself define \verb"alpha" when it's not already defined earlier, thus
-potentially causing the error because of double definition if the \verb"alpha" is
-also defined somewhere later.
-
-The \verb"used" operator may be expected to behave in a similar manner in
-analogous cases, however any other kinds of predictions my not be so simple and
-you should never rely on them this way.
-
-The \verb"err" directive, usually used to stop the assembly when some condition is
-met, stops the assembly immediately, regardless of whether the current pass
-is final or intermediate. So even when the condition that caused this directive
-to be interpreted is mispredicted and temporary, and would eventually disappear in the later
-passes, the assembly is stopped anyway.
-
-The \verb"assert" directive signalizes the error only if its expression is false
-after all the symbols have been resolved. You can use \verb"assert 0" in place of
-\verb"err" when you do not want to have assembly stopped during the intermediate
-passes.
-
-
-\section{Preprocessor directives}
-\label{sec:preprocessor}
-All preprocessor directives are processed before the main assembly process,
-and therefore are not affected by the control directives. At this time also
-all comments are stripped out.
-
-\subsection{Including source files}
-\index{INCLUDE}
-\verb"include" directive includes the specified source file at the position
-where it is used. It should be followed by the quoted name of file that
-should be included, for example:
-\begin{verbatim}
- include 'macros.inc'
-\end{verbatim}
-The whole included file is preprocessed before preprocessing the lines next
-to the line containing the \verb"include" directive. There are no limits to
-the number of included files as long as they fit in memory.
-
-The quoted path can contain environment variables enclosed within \verb"%"
-characters, they will be replaced with their values inside the
-path, both the \verb"\" and \verb"/" characters are allowed as a
-path separators. The file is first
-searched for in the directory containing file which included it and when it is
-not found there, the search is continued in the directories specified in the
-environment variable called INCLUDE (the multiple paths separated with
-semicolons can be defined there, they will be searched in the same order as
-specified). If file was not found in any of these places, preprocessor looks
-for it in the directory containing the main source file (the one specified in
-command line). These rules concern also paths given with the \verb"file" directive.
-
-\subsection{Symbolic constants}
-\label{sec:symbolic_constants}
-The symbolic constants are different from the numerical constants, before the
-assembly process they are replaced with their values everywhere in source
-lines after their definitions, and anything can become their values.
-
-\index{EQU}
-The definition of symbolic constant consists of name of the constant followed
-by the \verb"equ" directive. Everything that follows this directive will
-become the value of constant. If the value of symbolic constant contains
-other symbolic constants, they are replaced with their values before
-assigning this value to the new constant. For example:
-\begin{verbatim}
- d equ dword
- NULL equ d 0
- d equ edx
-\end{verbatim}
-After these three definitions the value of \verb"NULL" constant is
-\verb"dword 0" and the value of \verb"d" is \verb"edx". So, for example,
-\verb"push NULL" will be assembled as \verb"push dword 0" and \verb"push d"
-will be assembled as \verb"push edx". And if then the following line was put:
-\begin{verbatim}
- d equ d,eax
-\end{verbatim}
-the \verb"d" constant would get the new value of \verb"edx,eax". This way the growing
-lists of symbols can be defined.
-
-\index{RESTORE}
-\verb"restore" directive allows to get back previous value of redefined symbolic
-constant. It should be followed by one more names of symbolic constants,
-separated with commas. So \verb"restore d" after the above definitions will give
-\verb"d" constant back the value \verb"edx", the second one will restore it to value
-\verb"dword", and one more will revert \verb"d" to original meaning as if no such
-constant was defined. If there was no constant defined of given name,
-\verb"restore" will not cause an error, it will be just ignored.
-
-Symbolic constant can be used to adjust the syntax of assembler to personal
-preferences. For example the following set of definitions provides the handy
-shortcuts for all the size operators:
-\begin{verbatim}
- b equ byte
- w equ word
- d equ dword
- p equ pword
- f equ fword
- q equ qword
- t equ tword
- x equ dqword
- y equ qqword
-\end{verbatim}
-
-Because symbolic constant may also have an empty value, it can be used to
-allow the syntax with \verb"offset" word before any address value:
-\begin{verbatim}
- offset equ
-\end{verbatim}
-After this definition \verb"mov ax,offset char" will be valid construction
-for copying the offset of \verb"char" variable into \verb"ax" register,
-because \verb"offset" is replaced with an empty value, and therefore ignored.
-
-\index{DEFINE}
-The \verb"define" directive followed by the name of constant and then the value,
-is the alternative way of defining symbolic constant. The only difference
-between \verb"define" and \verb"equ" is that \verb"define" assigns the value as it is, it does
-not replace the symbolic constants with their values inside it.
-
-\index{FIX}
-Symbolic constants can also be defined with the \verb"fix" directive, which has
-the same syntax as \verb"equ", but defines constants of high priority -- they are
-replaced with their symbolic values even before processing the preprocessor
-directives and macroinstructions, the only exception is \verb"fix" directive
-itself, which has the highest possible priority, so it allows redefinition of
-constants defined this way.
-
-The \verb"fix" directive can be used for syntax adjustments related to directives
-of preprocessor, what cannot be done with \verb"equ" directive. For example:
-\begin{verbatim}
- incl fix include
-\end{verbatim}
-defines a short name for \verb"include" directive, while the similar definition done
-with \verb"equ" directive wouldn't give such result, as standard symbolic constants
-are replaced with their values after searching the line for preprocessor
-directives.
-
-
-\subsection{Macroinstructions}
-\index{MACRO}
-\verb"macro" directive allows you to define your own complex instructions,
-called macroinstructions, using which can greatly simplify the process of
-programming. In its simplest form it's similar to symbolic constant
-definition. For example the following definition defines a shortcut for the
-\verb"test al,0xFF" instruction:
-\begin{verbatim}
- macro tst {test al,0xFF}
-\end{verbatim}
-After the \verb"macro" directive there is a name of macroinstruction and then
-its contents enclosed between the \verb"{" and \verb"}" characters. You can
-use \verb"tst" instruction anywhere after this definition and it will be
-assembled as \verb"test al,0xFF". Defining symbolic constant \verb"tst" of
-that value would give the similar result, but the difference is that the name
-of macroinstruction is recognized only as an instruction mnemonic. Also,
-macroinstructions are replaced with corresponding code even before the
-symbolic constants are replaced with their values. So if you define
-macroinstruction and symbolic constant of the same name, and use this name as
-an instruction mnemonic, it will be replaced with the contents of
-macroinstruction, but it will be replaced with value if symbolic constant if
-used somewhere inside the operands.
-
-The definition of macroinstruction can consist of many lines, because
-\verb"{" and \verb"}" characters don't have to be in the same line as
-\verb"macro" directive. For example:
-\begin{verbatim}
- macro stos0
- {
- xor al,al
- stosb
- }
-\end{verbatim}
-The macroinstruction \verb"stos0" will be replaced with these two assembly
-instructions anywhere it's used.
-
-Like instructions which needs some number of operands, the macroinstruction
-can be defined to need some number of arguments separated with commas. The
-names of needed argument should follow the name of macroinstruction in the
-line of \verb"macro" directive and should be separated with commas if there
-is more than one. Anywhere one of these names occurs in the contents of
-macroinstruction, it will be replaced with corresponding value, provided when
-the macroinstruction is used. Here is an example of a macroinstruction that
-will do data alignment for binary output format:
-\begin{verbatim}
- macro align value { rb (value-1)-($+value-1) mod value }
-\end{verbatim}
-When the \verb"align 4" instruction is found after this macroinstruction is
-defined, it will be replaced with contents of this macroinstruction, and the
-\verb"value" will there become 4, so the result will be
-\verb%rb (4-1)-($+4-1) mod 4%.
-
-If a macroinstruction is defined that uses an instruction with the same name
-inside its definition, the previous meaning of this name is used. Useful
-redefinition of macroinstructions can be done in that way, for example:
-\begin{verbatim}
- macro mov op1,op2
- {
- if op1 in & op2 in
- push op2
- pop op1
- else
- mov op1,op2
- end if
- }
-\end{verbatim}
-This macroinstruction extends the syntax of \verb"mov" instruction, allowing
-both operands to be segment registers. For example \verb"mov ds,es" will be
-assembled as \verb"push es" and \verb"pop ds". In all other cases the
-standard \verb"mov" instruction will be used. The syntax of this \verb"mov"
-can be extended further by defining next macroinstruction of that name, which
-will use the previous macroinstruction:
-\begin{verbatim}
- macro mov op1,op2,op3
- {
- if op3 eq
- mov op1,op2
- else
- mov op1,op2
- mov op2,op3
- end if
- }
-\end{verbatim}
-It allows \verb"mov" instruction to have three operands, but it can still
-have two operands only, because when macroinstruction is given less arguments
-than it needs, the rest of arguments will have empty values. When three
-operands are given, this macroinstruction will become two macroinstructions
-of the previous definition, so \verb"mov es,ds,dx" will be assembled as
-\verb"push ds", \verb"pop es" and \verb"mov ds,dx".
-
-By placing the \verb"*" after the name of argument you can mark the argument as
-required -- preprocessor will not allow it to have an empty value. For example the
-above macroinstruction could be declared as \verb"macro mov op1*,op2*,op3" to make
-sure that first two arguments will always have to be given some non empty
-values.
-
-Alternatively, you can provide the default value for argument, by placing
-the \verb"=" followed by value after the name of argument. Then if the argument
-has an empty value provided, the default value will be used instead.
-
-When it's needed to provide macroinstruction with argument that contains
-some commas, such argument should be enclosed between \verb"<" and \verb">"
-characters. If it contains more than one \verb"<" character, the same number
-of \verb">" should be used to tell that the value of argument ends.
-
-\index{PURGE}
-\verb"purge" directive allows removing the last definition of specified
-macroinstruction. It should be followed by one or more names of
-macroinstructions, separated with commas. If such macroinstruction has not
-been defined, you will not get any error. For example after having the syntax of
-\verb"mov" extended with the macroinstructions defined above, you can disable
-syntax with three operands back by using \verb"purge mov" directive. Next
-\verb"purge mov" will disable also syntax for two operands being segment
-registers, and all the next such directives will do nothing.
-
-If after the \verb"macro" directive you enclose some group of arguments'
-names in square brackets, it will allow giving more values for this group of
-arguments when using that macroinstruction. Any more argument given after the
-last argument of such group will begin the new group and will become the
-first argument of it. That's why after closing the square bracket no more
-argument names can follow. The contents of macroinstruction will be processed
-for each such group of arguments separately. The simplest example is to
-enclose one argument name in square brackets:
-\begin{verbatim}
- macro stoschar [char]
- {
- mov al,char
- stosb
- }
-\end{verbatim}
-This macroinstruction accepts unlimited number of arguments, and each one
-will be processed into these two instructions separately. For example
-\verb"stoschar 1,2,3" will be assembled as the following instructions:
-\begin{verbatim}
- mov al,1
- stosb
- mov al,2
- stosb
- mov al,3
- stosb
-\end{verbatim}
-
-\index{LOCAL}
-There are some special directives available only inside the definitions of
-macroinstructions. \verb"local" directive defines local names, which will be
-replaced with unique values each time the macroinstruction is used. It should
-be followed by names separated with commas. If the name given as parameter to \verb"local" directive begins with a dot or two
-dots, the unique labels generated by each evaluation of macroinstruction will
-have the same properties. This directive is usually needed
-for the constants or labels that macroinstruction defines and uses
-internally.
-For example:
-\begin{verbatim}
- macro movstr
- {
- local move
- move:
- lodsb
- stosb
- test al,al
- jnz move
- }
-\end{verbatim}
-Each time this macroinstruction is used, \verb"move" will become other
-unique name in its instructions, so you will not get an error you normally get
-when some label is defined more than once.
-
-\index{FORWARD}\index{REVERSE}\index{COMMON}
-\verb"forward", \verb"reverse" and \verb"common" directives divide
-macroinstruction into blocks, each one processed after the processing of
-previous is finished. They differ in behavior only if macroinstruction allows
-multiple groups of arguments. Block of instructions that follows
-\verb"forward" directive is processed for each group of arguments, from
-first to last -- exactly like the default block (not preceded by any of these
-directives). Block that follows \verb"reverse" directive is processed
-for each group of argument in reverse order -- from last to first. Block that
-follows \verb"common" directive is processed only once, commonly for all
-groups of arguments. Local name defined in one of the blocks is available in
-all the following blocks when processing the same group of arguments as when
-it was defined, and when it is defined in common block it is available in all
-the following blocks not depending on which group of arguments is processed.
-
-Here is an example of macroinstruction that will create the table of
-addresses to strings followed by these strings:
-\begin{verbatim}
- macro strtbl name,[string]
- {
- common
- label name dword
- forward
- local label
- dd label
- forward
- label db string,0
- }
-\end{verbatim}
-First argument given to this macroinstruction will become the label for table
-of addresses, next arguments should be the strings. First block is processed
-only once and defines the label, second block for each string declares its
-local name and defines the table entry holding the address to that string.
-Third block defines the data of each string with the corresponding label.
-
-The directive starting the block in macroinstruction can be followed by the
-first instruction of this block in the same line, like in the following
-example:
-\begin{verbatim}
- macro stdcall proc,[arg]
- {
- reverse push arg
- common call proc
- }
-\end{verbatim}
-This macroinstruction can be used for calling the procedures using STDCALL
-convention, which has all the arguments pushed on stack in the reverse order. For example
-\verb"stdcall foo,1,2,3" will be assembled as:
-\begin{verbatim}
- push 3
- push 2
- push 1
- call foo
-\end{verbatim}
-
-If some name inside macroinstruction has multiple values (it is either one of
-the arguments enclosed in square brackets or local name defined in the block
-following \verb"forward" or \verb"reverse" directive) and is used in block
-following the \verb"common" directive, it will be replaced with all of its
-values, separated with commas. For example the following macroinstruction
-will pass all of the additional arguments to the previously defined
-\verb"stdcall" macroinstruction:
-\begin{verbatim}
- macro invoke proc,[arg]
- { common stdcall [proc],arg }
-\end{verbatim}
-It can be used to call indirectly (by the pointer stored in memory) the
-procedure using STDCALL convention.
-
-Inside macroinstruction also special operator \verb"#" can be used. This
-operator causes two names to be concatenated into one name. It can be useful,
-because it's done after the arguments and local names are replaced with their
-values. The following macroinstruction will generate the conditional jump
-according to the \verb"cond" argument:
-\begin{verbatim}
- macro jif op1,cond,op2,label
- {
- cmp op1,op2
- j#cond label
- }
-\end{verbatim}
-For example \verb"jif ax,ae,10h,exit" will be assembled as \verb"cmp ax,10h"
-and \verb"jae exit" instructions.
-
-The \verb"#" operator can be also used to concatenate two quoted strings into one.
-Also conversion of name into a quoted string is possible, with the \verb"`" operator,
-which likewise can be used inside the macroinstruction. It converts the name
-that follows it into a quoted string -- but note, that when it is followed by
-a macro argument which is being replaced with value containing more than one
-symbol, only the first of them will be converted, as the \verb"`" operator converts
-only one symbol that immediately follows it. Here's an example of utilizing
-those two features:
-\begin{verbatim}
- macro label name
- {
- label name
- if ~ used name
- display `name # " is defined but not used.",13,10
- end if
- }
-\end{verbatim}
-When label defined with such macro is not used in the source, macro will warn
-you with the message, informing to which label it applies.
-
-To make macroinstruction behaving differently when some of the arguments are
-of some special type, for example a quoted strings, you can use \verb"eqtype"
-comparison operator. Here's an example of utilizing it to distinguish a
-quoted string from an other argument.
-\begin{verbatim}
- macro message arg
- {
- if arg eqtype ""
- local str
- jmp @f
- str db arg,0Dh,0Ah,24h
- @@:
- mov dx,str
- else
- mov dx,arg
- end if
- mov ah,9
- int 21h
- }
-\end{verbatim}
-The above macro is designed for displaying messages in DOS programs. When the
-argument of this macro is some number, label, or variable, the string from
-that address is displayed, but when the argument is a quoted string, the
-created code will display that string followed by the carriage return and
-line feed.
-
-It is also possible to put a declaration of macroinstruction
-inside another macroinstruction, so one macro can define another,
-but there is a problem with such definitions caused by the fact,
-that \verb"}" character cannot occur inside the macroinstruction,
-as it always means the end of definition. To
-overcome this problem, the escaping of symbols inside macroinstruction can be
-used. This is done by placing one or more
-backslashes in front of any other symbol (even the special
-character). Preprocessor sees such sequence as a single symbol,
-but each time it meets such symbol during the macroinstruction
-processing, it cuts the backslash character from the front of it.
-For example \verb"\}" is treated as single symbol, but during
-processing of the macroinstruction it becomes the \verb"}" symbol.
-This allows to put one definition of macroinstruction inside
-another:
-\begin{verbatim}
- macro ext instr
- {
- macro instr op1,op2,op3
- \{
- if op3 eq
- instr op1,op2
- else
- instr op1,op2
- instr op2,op3
- end if
- \}
- }
-
- ext add
- ext sub
-\end{verbatim}
-The macro \verb"ext" is defined correctly, but when it is used,
-the \verb"\{" and \verb"\}" become the \verb"{" and \verb"}"
-symbols. So when the \verb"ext add" is processed, the contents of
-macro becomes valid definition of a macroinstruction and this way
-the \verb"add" macro becomes defined. In the same way \verb"ext sub" defines
-the \verb"sub" macro. The use of \verb"\{" symbol wasn't
-really necessary here, but is done this way to make the definition
-more clear.
-
-If some directives specific to macroinstructions, like \verb"local" or \verb"common"
-are needed inside some macro embedded this way, they can be
-escaped in the same way. Escaping the symbol with more than one
-backslash is also allowed, which allows multiple levels of nesting
-the macroinstruction definitions.
-
-The another technique for defining one macroinstruction by another is to
-use the \verb"fix" directive, which becomes useful when some macroinstruction only
-begins the definition of another one, without closing it. For example:
-\begin{verbatim}
- macro tmacro [params]
- {
- common macro params {
- }
-
- MACRO fix tmacro
- ENDM fix }
-\end{verbatim}
-defines an alternative syntax for defining macroinstructions, which looks like:
-\begin{verbatim}
- MACRO stoschar char
- mov al,char
- stosb
- ENDM
-\end{verbatim}
-Note that symbol that has such customized definition must be defined with \verb"fix"
-directive, because only the prioritized symbolic constants are processed before
-the preprocessor looks for the \verb"}" character while defining the macro. This
-might be a problem if one needed to perform some additional tasks one the end
-of such definition, but there is one more feature which helps in such cases.
-Namely it is possible to put any directive, instruction or macroinstruction
-just after the \verb"}" character that ends the macroinstruction and it will be
-processed in the same way as if it was put in the next line.
-
-\subsection{Structures}
-\index{STRUC}
-\verb"struc" directive is a special variant of \verb"macro" directive that is
-used to define data structures. Macroinstruction defined using the
-\verb"struc" directive must be preceded by a label (like the data definition
-directive) when it's used. This label will be also attached at the beginning
-of every name starting with dot in the contents of macroinstruction. The
-macroinstruction defined using the \verb"struc" directive can have the same
-name as some other macroinstruction defined using the \verb"macro" directive,
-structure macroinstruction will not prevent the standard macroinstruction from being
-processed when there is no label before it and vice versa. All the rules and features
-concerning standard macroinstructions apply to structure macroinstructions.
-
-Here is the sample of structure macroinstruction:
-\begin{verbatim}
- struc point x,y
- {
- .x dw x
- .y dw y
- }
-\end{verbatim}
-For example \verb"my point 7,11" will define structure labeled \verb"my",
-consisting of two variables: \verb"my.x" with value 7 and \verb"my.y" with
-value 11.
-
-If somewhere inside the definition of structure the name consisting of a
-single dot it found, it is replaced by the name of the label for the given
-instance of structure and this label will not be defined automatically in
-such case, allowing to completely customize the definition. The following
-example utilizes this feature to extend the data definition directive \verb"db"
-with ability to calculate the size of defined data:
-\begin{verbatim}
- struc db [data]
- {
- common
- . db data
- .size = $ - .
- }
-\end{verbatim}
-With such definition \verb"msg db 'Hello!',13,10" will define also \verb"msg.size"
-constant, equal to the size of defined data in bytes.
-
-Defining data structures addressed by registers or absolute values should be
-done using the \verb"virtual" directive with structure macroinstruction
-(see \ref{sec:other}).
-
-\index{RESTRUC}
-\verb"restruc" directive removes the last definition of the structure, just like
-\verb"purge" does with macroinstructions and \verb"restore" with symbolic constants.
-It also has the same syntax -- should be followed by one or more names of
-structure macroinstructions, separated with commas.
-
-\subsection{Repeating macroinstructions}
-\index{REPT}
-The \verb"rept" directive is a special kind of macroinstruction, which makes given
-amount of duplicates of the block enclosed with braces. The basic syntax is
-\verb"rept" directive followed by number and then block of source enclosed between
-the \verb"{" and \verb"}" characters. The simplest example:
-\begin{verbatim}
- rept 5 { in al,dx }
-\end{verbatim}
-will make five duplicates of the \verb"in al,dx" line. The block of instructions
-is defined in the same way as for the standard macroinstruction and any
-special operators and directives which can be used only inside
-macroinstructions are also allowed here. When the given count is zero, the
-block is simply skipped, as if you defined macroinstruction but never used
-it. The number of repetitions can be followed by the name of counter symbol, which will get replaced
-symbolically with the number of duplicate currently generated. So this:
-\begin{verbatim}
- rept 3 counter
- {
- byte#counter db counter
- }
-\end{verbatim}
-will generate lines:
-\begin{verbatim}
- byte1 db 1
- byte2 db 2
- byte3 db 3
-\end{verbatim}
-The repetition mechanism applied to \verb"rept" blocks is the same as the one used
-to process multiple groups of arguments for macroinstructions, so directives
-like \verb"forward", \verb"common" and \verb"reverse" can be used in their usual meaning.
-Thus such macroinstruction:
-\begin{verbatim}
- rept 7 num { reverse display `num }
-\end{verbatim}
-will display digits from 7 to 1 as text. The \verb"local" directive behaves in the
-same way as inside macroinstruction with multiple groups of arguments, so:
-\begin{verbatim}
- rept 21
- {
- local label
- label: loop label
- }
-\end{verbatim}
-will generate unique label for each duplicate.
-
-The counter symbol by default counts from 1, but you can declare different
-base value by placing the number preceded by colon immediately after the name
-of counter. For example:
-\begin{verbatim}
- rept 8 n:0 { pxor xmm#n,xmm#n }
-\end{verbatim}
-will generate code which will clear the contents of eight SSE registers.
-You can define multiple counters separated with commas, and each one can have
-different base.
-
-The number of repetitions and the base values for counters can be specified
-using the numerical expressions with operator rules identical as in the case
-of assembler. However each value used in such expression must either be a
-directly specified number, or a symbolic constant with value also being an
-expression that can be calculated by preprocessor (in such case the value
-of expression associated with symbolic constant is calculated first, and then
-substituted into the outer expression in place of that constant). If you need
-repetitions based on values that can only be calculated at assembly time, use
-one of the code repeating directives that are processed by assembler, see
-section \ref{sec:repeating}.
-
-\index{IRP}
-The \verb"irp" directive iterates the single argument through the given list of
-parameters. The syntax is \verb"irp" followed by the argument name, then the comma
-and then the list of parameters. The parameters are specified in the same
-way like in the invocation of standard macroinstruction, so they have to be
-separated with commas and each one can be enclosed with the \verb"<" and \verb">"
-characters. Also the name of argument may be followed by \verb"*" to mark that it
-cannot get an empty value. Such block:
-\begin{verbatim}
- irp value, 2,3,5
- { db value }
-\end{verbatim}
-will generate lines:
-\begin{verbatim}
- db 2
- db 3
- db 5
-\end{verbatim}
-\index{IRPS}
-The \verb"irps" directive iterates through the given list of symbols, it should
-be followed by the argument name, then the comma and then the sequence of any
-symbols. Each symbol in this sequence, no matter whether it is the name
-symbol, symbol character or quoted string, becomes an argument value for one
-iteration. If there are no symbols following the comma, no iteration is done
-at all. This example:
-\begin{verbatim}
- irps reg, al bx ecx
- { xor reg,reg }
-\end{verbatim}
-will generate lines:
-\begin{verbatim}
- xor al,al
- xor bx,bx
- xor ecx,ecx
-\end{verbatim}
-The blocks defined by the \verb"irp" and \verb"irps" directives are also processed in
-the same way as any macroinstructions, so operators and directives specific
-to macroinstructions may be freely used also in this case.
-
-
-\subsection{Conditional preprocessing}
-\label{sec:conditional_preprocessing}
-\index{MATCH}
-\verb"match" directive causes some block of source to be preprocessed and passed
-to assembler only when the given sequence of symbols matches the specified
-pattern. The pattern comes first, ended with comma, then the symbols
-that have to be matched with the pattern, and finally the block of
-source, enclosed within braces as macroinstruction.
-
-There are the few rules for building the expression for matching, first is
-that any of symbol characters and any quoted string should be matched exactly as is. In this example:
-\begin{verbatim}
- match +,+ { include 'first.inc' }
- match +,- { include 'second.inc' }
-\end{verbatim}
-the first file will get included, since \verb"+" after comma matches the \verb"+" in
-pattern, and the second file will not be included, since there is no match.
-
-To match any other symbol literally, it has to be preceded by \verb"=" character
-in the pattern. Also to match the \verb"=" character itself, or the comma, the
-\verb"==" and \verb"=," constructions have to be used. For example the \verb"=a==" pattern
-will match the \verb"a=" sequence.
-
-If some name symbol is placed in the pattern, it matches any sequence
-consisting of at least one symbol and then this name is replaced with the
-matched sequence everywhere inside the following block, analogously to the
-parameters of macroinstruction. For instance:
-\begin{verbatim}
- match a-b, 0-7
- { dw a,b-a }
-\end{verbatim}
-will generate the \verb"dw 0,7-0" instruction. Each name is always matched with
-as few symbols as possible, leaving the rest for the following ones, so in
-this case:
-\begin{verbatim}
- match a b, 1+2+3 { db a }
-\end{verbatim}
-the \verb"a" name will match the \verb"1" symbol, leaving the \verb"+2+3" sequence to be
-matched with \verb"b". But in this case:
-\begin{verbatim}
- match a b, 1 { db a }
-\end{verbatim}
-there will be nothing left for \verb"b" to match, so the block will not get processed
-at all.
-
-The block of source defined by match is processed in the same way as any
-macroinstruction, so any operators specific to macroinstructions can be used
-also in this case.
-
-What makes "match" directive more useful is the fact, that it replaces the
-symbolic constants with their values in the matched sequence of symbols (that
-is everywhere after comma up to the beginning of the source block) before
-performing the match. Thanks to this it can be used for example to process
-some block of source under the condition that some symbolic constant has the
-given value, like:
-\begin{verbatim}
- match =TRUE, DEBUG { include 'debug.inc' }
-\end{verbatim}
-which will include the file only when the symbolic constant \verb"DEBUG" was
-defined with value \verb"TRUE".
-
-\subsection{Order of processing}
-When combining various features of the preprocessor, it's important to know
-the order in which they are processed. As it was already noted, the highest
-priority has the \verb"fix" directive and the replacements defined with it. This
-is done completely before doing any other preprocessing, therefore this
-piece of source:
-\begin{verbatim}
- V fix {
- macro empty
- V
- V fix }
- V
-\end{verbatim}
-becomes a valid definition of an empty macroinstruction. It can be interpreted
-that the \verb"fix" directive and prioritized symbolic constants are processed in
-a separate stage, and all other preprocessing is done after on the resulting
-source.
-
-The standard preprocessing that comes after, on each line begins with
-recognition of the first symbol. It starts with checking for the preprocessor
-directives, and when none of them is detected, preprocessor checks whether the
-first symbol is macroinstruction. If no macroinstruction is found, it moves
-to the second symbol of line, and again begins with checking for directives,
-which in this case is only the \verb"equ" directive, as this is the only one that
-occurs as the second symbol in line. If there is no directive, the second
-symbol is checked for the case of structure macroinstruction and when none
-of those checks gives the positive result, the symbolic constants are replaced
-with their values and such line is passed to the assembler.
-
-To see it on the example, assume that there is defined the macroinstruction
-called \verb"foo" and the structure macroinstruction called \verb"bar". Those lines:
-\begin{verbatim}
- foo equ
- foo bar
-\end{verbatim}
-would be then both interpreted as invocations of macroinstruction \verb"foo", since
-the meaning of the first symbol overrides the meaning of second one.
-
-When the macroinstruction generates the new lines from its
-definition block, in every line it first scans for
-macroinstruction directives, and interpretes them accordingly. All
-the other content in the definition block is used to brew the new
-lines, replacing the parameters with their values and then
-processing the symbol escaping and \verb"#" and \verb"`"
-operators. The conversion operator has the higher priority than
-concatenation and if any of them operates on the escaped symbol,
-the escaping is cancelled before finishing the operation. After
-this is completed, the newly generated line goes through the
-standard preprocessing, as described above.
-
-Though the symbolic constants are usually only replaced in the lines, where
-no preprocessor directives nor macroinstructions has been found, there are some
-special cases where those replacements are performed in the parts of lines
-containing directives. First one is the definition of symbolic constant, where
-the replacements are done everywhere after the \verb"equ" keyword and the resulting
-value is then assigned to the new constant (see \ref{sec:symbolic_constants}).
-The second such case is the \verb"match" directive, where the replacements are done in the symbols
-following comma before matching them with pattern. These features can be used
-for example to maintain the lists, like this set of definitions:
-\begin{verbatim}
- list equ
-
- macro append item
- {
- match any, list \{ list equ list,item \}
- match , list \{ list equ item \}
- }
-\end{verbatim}
-The \verb"list" constant is here initialized with empty value, and the \verb"append"
-macroinstruction can be used to add the new items into this list, separating
-them with commas. The first match in this macroinstruction occurs only when
-the value of list is not empty (see \ref{sec:conditional_preprocessing}), in such case the new value for the
-list is the previous one with the comma and the new item appended at the end.
-The second match happens only when the list is still empty, and in such case
-the list is defined to contain just the new item. So starting with the empty
-list, the \verb"append 1" would define \verb"list equ 1" and the \verb"append 2" following it
-would define \verb"list equ 1,2". One might then need to use this list as the
-parameters to some macroinstruction. But it cannot be done directly -- if \verb"foo"
-is the macroinstruction, then \verb"foo list" would just pass the \verb"list" symbol
-as a parameter to macro, since symbolic constants are not unrolled at this
-stage. For this purpose again \verb"match" directive comes in handy:
-\begin{verbatim}
- match params, list { foo params }
-\end{verbatim}
-The value of \verb"list", if it's not empty, matches the \verb"params" keyword, which is
-then replaced with matched value when generating the new lines defined by the
-block enclosed with braces. So if the \verb"list" had value \verb"1,2", the above line
-would generate the line containing \verb"foo 1,2", which would then go through the
-standard preprocessing.
-
-The other special case is in the parameters of \verb"rept" directive. The amount
-of repetitions and the base value for counter can be specified using
-numerical expressions, and if there is a symbolic constant with non--numerical
-name used in such an expression, preprocessor tries to evaluate its value as a numerical expression
-and if succeeds, it replaces the symbolic constant with the result of that
-calculation and continues to evaluate the primary expression. If the
-expression inside that symbolic constants also contains some symbolic
-constants, preprocessor will try to calculate all the needed values
-recursively.
-
-This allows to perform some calculations at the time of preprocessing, as
-long as all the values used are the numbers known at the preprocessing stage.
-A single repetition with \verb"rept" can be used for the sole purpose of
-calculating some value, like in this example:
-\begin{verbatim}
- define a b+4
- define b 3
- rept 1 result:a*b+2 { define c result }
-\end{verbatim}
-To compute the base value for \verb"result" counter, preprocessor replaces the \verb"b"
-with its value and recursively calculates the value of \verb"a", obtaining 7 as
-the result, then it calculates the main expression with the result being 23.
-The \verb"c" then gets defined with the first value of counter (because the block
-is processed just one time), which is the result of the computation, so the
-value of \verb"c" is simple \verb"23" symbol. Note that if \verb"b" is later redefined with
-some other numerical value, the next time and expression containing \verb"a" is
-calculated, the value of \verb"a" will reflect the new value of \verb"b", because the
-symbolic constant contains just the text of the expression.
-
-There is one more special case -- when preprocessor goes to checking the
-second symbol in the line and it happens to be the colon character (what is
-then interpreted by assembler as definition of a label), it stops in this
-place and finishes the preprocessing of the first symbol (so if it's the
-symbolic constant it gets unrolled) and if it still appears to be the label,
-it performs the standard preprocessing starting from the place after the
-label. This allows to place preprocessor directives and macroinstructions
-after the labels, analogously to the instructions and directives processed
-by assembler, like:
-\begin{verbatim}
- start: include 'start.inc'
-\end{verbatim}
-However if the label becomes broken during preprocessing (for example when
-it is the symbolic constant with empty value), only replacing of the symbolic
-constants is continued for the rest of line.
-
-It should be remembered, that the jobs performed by preprocessor are the
-preliminary operations on the texts symbols, that are done in a simple
-single pass before the main process of assembly. The text that is the
-result of preprocessing is passed to assembler, and it then does its
-multiple passes on it. Thus the control directives, which are recognized and
-processed only by the assembler -- as they are dependent on the numerical
-values that may even vary between passes -- are not recognized in any way by
-the preprocessor and have no effect on the preprocessing. Consider this
-example source:
-\begin{verbatim}
- if 0
- a = 1
- b equ 2
- end if
- dd b
-\end{verbatim}
-When it is preprocessed, they only directive that is recognized by the
-preprocessor is the \verb"equ", which defines symbolic constant \verb"b", so later
-in the source the \verb"b" symbol is replaced with the value \verb"2". Except for this
-replacement, the other lines are passes unchanged to the assembler. So
-after preprocessing the above source becomes:
-\begin{verbatim}
- if 0
- a = 1
- end if
- dd 2
-\end{verbatim}
-Now when assembler processes it, the condition for the \verb"if" is false, and
-the \verb"a" constant doesn't get defined. However symbolic constant \verb"b" was
-processed normally, even though its definition was put just next to the one
-of \verb"a". So because of the possible confusion you should be very careful
-every time when mixing the features of preprocessor and assembler - in such
-cases it is important to realize what the source will become after the
-preprocessing, and thus what the assembler will see and do its multiple passes
-on.
-
-\section{Formatter directives}
-\label{sec:formatter}
-\index{FORMAT}
-These directives are actually also a kind of control directives, with the
-purpose of controlling the format of generated code.
-
-\verb"format" directive followed by the format identifier allows to select
-the output format. This directive should be put at the beginning of the
-source. Default output format is a flat binary file, it can also be selected
-by using \verb"format binary" directive.
-This directive can be followed by the \verb"as" keyword
-and the quoted string specifying the default file extension for the output
-file. Unless the output file name was specified from the command line,
-assembler will use this extension when generating the output file.
-
-\index{USE16, USE32, USE64}
-\verb"use16" and \verb"use32" directives force the assembler to generate 16--bit or
-32--bit code, omitting the default setting for selected output format. \verb"use64"
-enables generating the code for the long mode of x86--64 processors.
-
-Below are described different output formats with the directives
-specific to these formats.
-
-\subsection{MZ executable}
-To select the MZ output format, use \verb"format MZ" directive. The default
-code setting for this format is 16--bit.
-
-\index{SEGMENT}
-\verb"segment" directive defines a new segment, it should be followed by
-label, which value will be the number of defined segment, optionally
-\verb"use16" or \verb"use32" word can follow to specify whether code in this
-segment should be 16--bit or 32--bit. The origin of segment is aligned to
-paragraph (16 bytes). All the labels defined then will have values relative
-to the beginning of this segment.
-
-\index{ENTRY}
-\verb"entry" directive sets the entry point for MZ executable, it should be
-followed by the far address (name of segment, colon and the offset inside
-segment) of desired entry point.
-
-\index{STACK}
-\verb"stack" directive sets up the stack for MZ executable. It can be
-followed by numerical expression specifying the size of stack to be created
-automatically or by the far address of initial stack frame when you want to
-set up the stack manually. When no stack is defined, the stack of default
-size 4096 bytes will be created.
-
-\index{HEAP}
-\verb"heap" directive should be followed by a 16--bit value defining maximum
-size of additional heap in paragraphs (this is heap in addition to stack and
-undefined data). Use \verb"heap 0" to always allocate only memory program
-really needs. Default size of heap is 65535.
-
-\subsection{Portable Executable}
-To select the Portable Executable output format, use \verb"format PE" directive,
-it can be followed by additional format settings: first the target subsystem
-setting, which can be \verb"console" or \verb"GUI" for Windows applications, \verb"native"
-for Windows drivers, \verb"EFI", \verb"EFIboot" or \verb"EFIruntime" for the UEFI, it may be
-followed by the minimum version of system that the executable is targeted to
-(specified in form of floating-point value). Optional \verb"DLL" and \verb"WDM" keywords
-mark the output file as a dynamic link library and WDM driver respectively,
-and the \verb"large" keyword marks the executable as able to handle addresses
-larger than 2 GB.
-
-After those settings can follow the \verb"at" operator and the numerical expression
-specifying the base of PE image and then optionally \verb"on" operator followed by
-the quoted string containing file name selects custom MZ stub for PE program
-(when specified file is not a MZ executable, it is treated as a flat binary
-executable file and converted into MZ format). The default code setting for
-this format is 32--bit. The example of fully featured PE format declaration:
-\begin{verbatim}
- format PE GUI 4.0 DLL at 7000000h on 'stub.exe'
-\end{verbatim}
-
-To create PE file for the x86--64 architecture, use \verb"PE64" keyword instead of
-\verb"PE" in the format declaration, in such case the long mode code is generated
-by default.
-
-\index{SECTION}
-\verb"section" directive defines a new section, it should be
-followed by quoted string defining the name of section, then one
-or more section flags can follow. Available flags are:
-\verb"code", \verb"data", \verb"readable", \verb"writeable",
-\verb"executable", \verb"shareable", \verb"discardable",
-\verb"notpageable". The origin of section is aligned to page (4096
-bytes). Example declaration of PE section:
-\begin{verbatim}
- section '.text' code readable executable
-\end{verbatim}
-Among with flags also on of special PE data identifiers can be
-specified to mark the whole section as a special data, possible
-identifiers are \verb"export", \verb"import", \verb"resource" and
-\verb"fixups". If the section is marked to contain fixups, they
-are generated automatically and no more data needs to be defined
-in this section. Also resource data can be generated automatically
-from the resource file, it can be achieved by writing the
-\verb"from" operator and quoted file name after the
-\verb"resource" identifier. Below are the examples of sections
-containing some special PE data:
-\begin{verbatim}
- section '.reloc' data readable discardable fixups
- section '.rsrc' data readable resource from 'my.res'
-\end{verbatim}
-
-\index{ENTRY}
-\verb"entry" directive sets the entry point for Portable Executable, the
-value of entry point should follow.
-
-\index{STACK}
-\verb"stack" directive sets up the size of stack for Portable Executable,
-value of stack reserve size should follow, optionally value of stack commit
-separated with comma can follow. When stack is not defined, it's set by
-default to size of 4096 bytes.
-
-\index{HEAP}
-\verb"heap" directive chooses the size of heap for Portable Executable, value
-of heap reserve size should follow, optionally value of heap commit separated
-with comma can follow. When no heap is defined, it is set by default to size
-of 65536 bytes, when size of heap commit is unspecified, it is by default set
-to zero.
-
-\index{DATA}\index{END}
-\verb"data" directive begins the definition of special PE data, it should be
-followed by one of the data identifiers (\verb"export", \verb"import",
-\verb"resource" or \verb"fixups") or by the number of data entry in PE
-header. The data should be defined in next lines, ended with \verb"end data"
-directive. When fixups data definition is chosen, they are generated
-automatically and no more data needs to be defined there.
-The same applies to the resource data when the \verb"resource"
-identifier is followed by \verb"from" operator and quoted file name --
-in such case data is taken from the given resource file.
-
-The \verb"rva" operator can be used inside the numerical expressions to obtain
-the RVA of the item addressed by the value it is applied to, that is the
-offset relative to the base of PE image.
-
-\subsection{Common Object File Format}
-To select Common Object File Format, use \verb"format COFF" or \verb"format MS COFF"
-directive, depending whether you want to create classic (DJGPP) or Microsoft's
-variant of COFF file. The default code setting for this format is 32-bit. To
-create the file in Microsoft's COFF format for the x86-64 architecture, use
-\verb"format MS64 COFF" setting, in such case long mode code is generated by
-default.
-
-\index{SECTION}
-\verb"section" directive defines a new section, it should be followed by
-quoted string defining the name of section, then one or more section flags
-can follow. Section flags available for both COFF variants are \verb"code" and \verb"data",
-while flags \verb"readable", \verb"writeable", \verb"executable", \verb"shareable", \verb"discardable",
-\verb"notpageable", \verb"linkremove" and \verb"linkinfo" are available only with
-Microsoft's COFF variant.
-
-By default section is aligned
-to double word (four bytes), in case of Microsoft COFF variant other alignment
-can be specified by providing the \verb"align" operator followed by alignment value
-(any power of two up to 8192) among the section flags.
-
-\index{EXTRN}
-\verb"extrn" directive defines the external symbol, it should be
-followed by the name of symbol and optionally the size operator
-specifying the size of data labeled by this symbol. The name of
-symbol can be also preceded by quoted string containing name of
-the external symbol and the \verb"as" operator. Some example
-declarations of external symbols:
-\begin{verbatim}
- extrn exit
- extrn '__imp__MessageBoxA@16' as MessageBox:dword
-\end{verbatim}
-
-\index{PUBLIC}
-\verb"public" directive declares the existing symbol as public, it
-should be followed by the name of symbol, optionally it can be
-followed by the \verb"as" operator and the quoted string
-containing name under which symbol should be available as public.
-Some examples of public symbols declarations:
-\begin{verbatim}
- public main
- public start as '_start'
-\end{verbatim}
-Additionally, with COFF format it's possible to specify exported symbol as
-static, it's done by preceding the name of symbol with the \verb"static" keyword.
-
-When using the Microsoft's COFF format, the \verb"rva" operator can be used
-inside the numerical expressions to obtain the RVA of the item addressed by the
-value it is applied to.
-
-
-\subsection{Executable and Linkable Format}
-To select ELF output format, use \verb"format ELF" directive. The default code
-setting for this format is 32--bit. To create ELF file for the x86--64
-architecture, use \verb"format ELF64" directive, in such case the long mode code is
-generated by default.
-
-\index{SECTION}
-\verb"section" directive defines a new section, it should be followed by quoted
-string defining the name of section, then can follow one or both of the
-\verb"executable" and \verb"writeable" flags, optionally also \verb"align" operator
-followed by the number specifying the alignment of section (it has to be the power of
-two), if no alignment is specified, the default value is used, which is 4 or 8,
-depending on which format variant has been chosen.
-
-\index{EXTRN}\index{PUBLIC}
-\verb"extrn" and \verb"public" directives have the same meaning and syntax as
-when the COFF output format is selected (described in previous section).
-
-The \verb"rva" operator can be used also in the case of this format (however not
-when target architecture is x86--64), it converts the address into the offset
-relative to the GOT table, so it may be useful to create position-independent
-code. There's also a special \verb"plt" operator, which allows to call the external
-functions through the Procedure Linkage Table. You can even create an alias
-for external function that will make it always be called through PLT, with
-the code like:
-\begin{verbatim}
- extrn 'printf' as _printf
- printf = PLT _printf
-\end{verbatim}
-
-To create executable file, follow the format choice directive with the \verb"executable" keyword
-and optionally the number specifying the brand of the target operating system
-(for example value 3 would mark the executable for Linux systems).
-With this format selected it is allowed to use \verb"entry" directive followed by the value to set as entry
-point of program. On the other hand it makes \verb"extrn" and
-\verb"public" directives unavailable, and instead of \verb"section" there should be the
-\verb"segment" directive used, followed by one or
-more segment permission flags and optionally a marker of special ELF
-executable segment, which can be \verb"interpreter", \verb"dynamic" or \verb"note".
-The origin of segment is aligned to page (4096 bytes), and available
-permission flags are: \verb"readable", \verb"writeable" and \verb"executable".
-
-
-\chapter{Windows programming}
-With the Windows version of flat assembler comes the package of
-standard includes designed to help in writing the programs for
-Windows environment.
-
-The includes package contains the headers for 32--bit and 64--bit Windows
-programming in the root folder and the specialized includes in the
-subfolders. In general, the headers include the required
-specialized files for you, though sometimes you might prefer to
-include some of the macroinstruction packages yourself (since few
-of them are not included by some or even all of the headers).
-
-There are six headers for 32--bit Windows that you can choose from, with names
-starting with \verb"win32" followed by either a letter \verb"a"
-for using the ASCII encoding, or a letter \verb"w" for the
-WideChar encoding. The \verb"win32a.inc" and \verb"win32w.inc" are
-the basic headers, the \verb"win32ax.inc" and \verb"win32wx.inc"
-are the extended headers, they provide more advanced
-macroinstructions, those extensions will be discussed separately.
-Finally the \verb"win32axp.inc" and \verb"win32wxp.inc" are the
-same extended headers with enabled feature of checking the count
-of parameters in procedure calls.
-
-There are analogous six packages for the 64--bit Windows, with
-names starting with \verb"win64". They provide in general the
-same functionality as the ones for 32--bit Windows, with just a few
-differences explained later.
-
-You can include the headers any way you prefer, by providing the
-full path or using the custom environment variable, but the
-simplest method is to define the \verb"INCLUDE" environment
-variable properly pointing to the directory containing headers and
-then include them just like:
-\begin{verbatim}
- include 'win32a.inc'
-\end{verbatim}
-
-It's important to note that all macroinstructions, as opposed to
-internal directives of flat assembler, are case sensitive and the
-lower case is used for the most of them. If you'd prefer to use
-the other case than default, you should do the appropriate
-adjustments with \verb"fix" directive.
-
-\section{Basic headers}
-The basic headers \verb"win32a.inc", \verb"win32w.inc",
-\verb"win64a.inc" and \verb"win64w.inc" include
-the declarations of Windows equates and structures and provide the
-standard set of macroinstructions.
-
-\subsection{Structures}
-All headers enable the \verb"struct" macroinstruction, which
-allows to define structures in a way more similar to other
-assemblers than the \verb"struc" directive. The definition of
-structure should be started with \verb"struct" macroinstruction
-followed by the name, and ended with \verb"ends" macroinstruction.
-In lines between only data definition directives are allowed, with
-labels being the pure names for the fields of structure:
-\begin{verbatim}
- struct POINT
- x dd ?
- y dd ?
- ends
-\end{verbatim}
-With such definition this line:
-\begin{verbatim}
- point1 POINT
-\end{verbatim}
-will declare the \verb"point1" structure with the \verb"point1.x"
-and \verb"point1.y" fields, giving them the default values -- the
-same ones as provided in the definition of structure (in this case
-the defaults are both uninitialized values). But declaration of
-structure also accepts the parameters, in the same count as the
-number of fields in the structure, and those parameters, when
-specified, override the default values for fields. For example:
-\begin{verbatim}
- point2 POINT 10,20
-\end{verbatim}
-initializes the \verb"point2.x" field with value 10, and the
-\verb"point2.y" with value 20.
-
-The \verb"struct" macro not only enables to declare the structures
-of given type, but also defines labels for offsets of fields
-inside the structure and constants for sized of every field and
-the whole structure. For example the above definition of
-\verb"POINT" structure defines the \verb"POINT.x" and
-\verb"POINT.y" labels to be the offsets of fields inside the
-structure, and \verb"sizeof.POINT.x", \verb"sizeof.POINT.y" and
-\verb"sizeof.POINT" as sizes of the corresponding fields and of
-the whole structure. The offset labels may be used for accessing
-the structures addressed indirectly, like:
-\begin{verbatim}
- mov eax,[ebx+POINT.x]
-\end{verbatim}
-when the \verb"ebx" register contains the pointer to \verb"POINT"
-structure. Note that field size checking will be performed with
-such accessing as well.
-
-The structures itself are also allowed inside the structure
-definitions, so the structures may have some other structures as a
-fields:
-\begin{verbatim}
- struct LINE
- start POINT
- end POINT
- ends
-\end{verbatim}
-When no default values for substructure fields are specified, as
-in this example, the defaults from the definition of the type of
-substructure apply.
-
-Since value for each field is a single parameter in the
-declaration of the structure, to initialize the substructures with
-custom values the parameters for each substructure must be grouped
-into a single parameter for the structure:
-\begin{verbatim}
- line1 LINE <0,0>,<100,100>
-\end{verbatim}
-This declaration initializes each of the \verb"line1.start.x" and
-\verb"line1.start.y" fields with 0, and each of the
-\verb"line1.end.x" and \verb"line1.end.y" with 100.
-
-When the size of data defined by some value passed to the
-declaration structure is smaller than the size of corresponding
-field, it is padded to that size with undefined bytes (and when it
-is larger, the error happens). For example:
-\begin{verbatim}
- struct FOO
- data db 256 dup (?)
- ends
-
- some FOO <"ABC",0>
-\end{verbatim}
-fills the first four bytes of \verb"some.data" with defined values
-and reserves the rest.
-
-Inside the structures also unions and unnamed substructures can be
-defined. The definition of union should start with \verb"union"
-and end with \verb"ends", like in this example:
-\begin{verbatim}
- struct BAR
- field_1 dd ?
- union
- field_2 dd ?
- field_2b db ?
- ends
- ends
-\end{verbatim}
-Each of the fields defined inside union has the same offset and
-they share the same memory. Only the first field of union is
-initialized with given value, the values for the rest of fields
-are ignored (however if one of the other fields requires more
-memory than the first one, the union is padded to the required
-size with undefined bytes). The whole union is initialized by the
-single parameter given in structure declaration, and this
-parameter gives value to the first field of union.
-
-The unnamed substructure is defined in a similar way to the union,
-only starts with the \verb"struct" line instead of \verb"union",
-like:
-\begin{verbatim}
- struct WBB
- word dw ?
- struct
- byte1 db ?
- byte2 db ?
- ends
- ends
-\end{verbatim}
-Such substructure only takes one parameter in the declaration of
-whole structure to define its values, and this parameter can
-itself be the group of parameters defining each field of the
-substructure. So the above type of structure may get declared
-like:
-\begin{verbatim}
- my WBB 1,<2,3>
-\end{verbatim}
-The fields inside unions and unnamed substructures are accessed
-just as if the were directly the fields of the parent structure.
-For example with above declaration \verb"my.byte1" and
-\verb"my.byte2" are correct labels for the substructure fields.
-
-The substructures and unions can be nested with no limits for the
-nesting depth:
-\begin{verbatim}
- struct LINE
- union
- start POINT
- struct
- x1 dd ?
- y1 dd ?
- ends
- ends
- union
- end POINT
- struct
- x2 dd ?
- y2 dd ?
- ends
- ends
- ends
-\end{verbatim}
-
-The definition of structure may also be based on some of the
-already defined structure types and it inherits all the fields
-from that structure, for example:
-\begin{verbatim}
- struct CPOINT POINT
- color dd ?
- ends
-\end{verbatim}
-defines the same structure as:
-\begin{verbatim}
- struct CPOINT
- x dd ?
- y dd ?
- color dd ?
- ends
-\end{verbatim}
-
-All headers define the \verb"CHAR" data type, which can be used to
-define character strings in the data structures.
-
-\subsection{Imports}
-The import macroinstructions help to build the import data for PE
-file (usually put in the separate section). There are two
-macroinstructions for this purpose. The first one is called
-\verb"library", must be placed directly in the beginning of the
-import data and it defines from what libraries the functions will
-be imported. It should be followed by any amount of the pairs of
-parameters, each pair being the label for the table of imports
-from the given library, and the quoted string defining the name of
-the library. For example:
-\begin{verbatim}
- library kernel32,'KERNEL32.DLL',\
- user32,'USER32.DLL'
-\end{verbatim}
-declares to import from the two libraries. For each of libraries,
-the table of imports must be then declared somewhere inside the
-import data. This is done with \verb"import" macroinstruction,
-which needs first parameter to define the label for the table (the
-same as declared earlier to the \verb"library" macro), and then
-the pairs of parameters each containing the label for imported
-pointer and the quoted string defining the name of function
-exactly as exported by library. For example the above
-\verb"library" declaration may be completed with following
-\verb"import" declarations:
-\begin{verbatim}
- import kernel32,\
- ExitProcess,'ExitProcess'
-
- import user32,\
- MessageBeep,'MessageBeep',\
- MessageBox,'MessageBoxA'
-\end{verbatim}
-The labels defined by first parameters in each pair passed to the
-\verb"import" macro address the double word pointers, which after
-loading the PE are filled with the addresses to exported
-procedures.
-
-Instead of quoted string for the name of procedure to import, the
-number may be given to define import by ordinal, like:
-\begin{verbatim}
- import custom,\
- ByName,'FunctionName',\
- ByOrdinal,17
-\end{verbatim}
-
-The import macros optimize the import data, so only imports for
-functions that are used somewhere in program are placed in the
-import tables, and if some import table would be empty this way,
-the whole library is not referenced at all. For this reason it's
-handy to have the complete import table for each library -- the
-package contains such tables for some of the standard libraries,
-they are stored in the \verb"APIA" and \verb"APIW" subdirectories
-and import the ASCII and WideChar variants of the API functions.
-Each file contains one import table, with lowercase label the same
-as the name of the file. So the complete tables for importing from
-the \verb"KERNEL32.DLL" and \verb"USER32.DLL" libraries can be
-defined this way (assuming your \verb"INCLUDE" environment
-variable points to the directory containing the includes package):
-\begin{verbatim}
- library kernel32,'KERNEL32.DLL',\
- user32,'USER32.DLL'
-
- include 'apia\kernel32.inc'
- include 'apiw\user32.inc'
-\end{verbatim}
-
-\subsection{Procedures (32--bit)}
-Headers for 32--bit Windows provide four macroinstructions for calling procedures with
-parameters passed on stack. The \verb"stdcall" calls directly the
-procedure specified by the first argument using the STDCALL
-calling convention. The rest of arguments passed to macro define
-the parameters to procedure and are stored on the stack in reverse
-order. The \verb"invoke" macro does the same, however it calls the
-procedure indirectly, through the pointer labelled by the first
-argument. Thus \verb"invoke" can be used to call the procedures
-through pointers defined in the import tables. This line:
-\begin{verbatim}
- invoke MessageBox,0,szText,szCaption,MB_OK
-\end{verbatim}
-is equivalent to:
-\begin{verbatim}
- stdcall [MessageBox],0,szText,szCaption,MB_OK
-\end{verbatim}
-and they both generate this code:
-\begin{verbatim}
- push MB_OK
- push szCaption
- push szText
- push 0
- call [MessageBox]
-\end{verbatim}
-
-The \verb"ccall" and \verb"cinvoke" are analogous to the
-\verb"stdcall" and \verb"invoke", but they should be used to call
-the procedures that use the C calling convention, where the stack
-frame has to be restored by the caller.
-
-To define the procedure that uses the stack for parameters and
-local variables, you should use the \verb"proc" macroinstruction.
-In its simplest form it has to be followed by the name for the
-procedure and then names for the all the parameters it takes,
-like:
-\begin{verbatim}
- proc WindowProc,hwnd,wmsg,wparam,lparam
-\end{verbatim}
-The comma between the name of procedure and the first parameter is
-optional. The procedure instructions should follow in the next
-lines, ended with the \verb"endp" macroinstruction. The stack
-frame is set up automatically on the entry to procedure, the EBP
-register is used as a base to access the parameters, so you should
-avoid using this register for other purposes. The names specified
-for the parameters are used to define EBP-based labels, which you
-can use to access the parameters as regular variables. For example
-the \verb"mov eax,[hwnd]" instruction inside the procedure defined
-as in above sample, is equivalent to \verb"mov eax,[ebp+8]". The
-scope of those labels is limited to the procedure, so you may use
-the same names for other purposes outside the given procedure.
-
-Since any parameters are pushed on the stack as double words when
-calling such procedures, the labels for parameters are defined to
-mark the double word data by default, however you can you specify
-the sizes for the parameters if you want, by following the name of
-parameter with colon and the size operator. The previous sample
-can be rewritten this way, which is again equivalent:
-\begin{verbatim}
- proc WindowProc,hwnd:DWORD,wmsg:DWORD,wparam:DWORD,lparam:DWORD
-\end{verbatim}
-If you specify a size smaller than double word, the given label
-applies to the smaller portion of the whole double word stored on
-stack. If you you specify a larger size, like far pointer of quad
-word, the two double word parameters are defined to hold this
-value, but are labelled as one variable.
-
-The name of procedure can be also followed by either the
-\verb"stdcall" or \verb"c" keyword to define the calling
-convention it uses. When no such type is specified, the default is
-used, which is equivalent to STDCALL. Then also the \verb"uses"
-keyword may follow, and after it the list of registers (separated
-only with spaces) that will be automatically stored on entry to
-procedure and restored on exit. In this case the comma after the
-list of registers and before the first parameter is required. So
-the fully featured procedure statement might look like this:
-\begin{verbatim}
- proc WindowProc stdcall uses ebx esi edi,\
- hwnd:DWORD,wmsg:DWORD,wparam:DWORD,lparam:DWORD
-\end{verbatim}
-
-To declare the local variable you can use the \verb"local"
-macroinstruction, followed by one or more declarations separated
-with commas, each one consisting of the name for variable followed
-by colon and the type of variable -- either one of the standard
-types (must be upper case) or the name of data structure. For
-example:
-\begin{verbatim}
- local hDC:DWORD,rc:RECT
-\end{verbatim}
-To declare a local array, you can follow the name of variable by
-the size of array enclosed in square brackets, like:
-\begin{verbatim}
- local str[256]:BYTE
-\end{verbatim}
-The other way to define the local variables is to declare them
-inside the block started with "locals" macroinstruction and ended
-with "endl", in this case they can be defined just like regular
-data. This declaration is the equivalent of the earlier sample:
-\begin{verbatim}
- locals
- hDC dd ?
- rc RECT
- endl
-\end{verbatim}
-The local variables can be declared anywhere inside the procedure,
-with the only limitation that they have to be declared before they
-are used. The scope of labels for the variables defined as local
-is limited to inside the procedure, you can use the same names for
-other purposes outside the procedure. If you give some initialized
-values to the variables declared as local, the macroinstruction
-generates the instructions that will initialize these variables
-with the given values and puts these instruction at the same
-position in procedure, where the declaration is placed.
-
-The \verb"ret" placed anywhere inside the procedure, generates the
-complete code needed to correctly exit the procedure, restoring
-the stack frame and the registers used by procedure. If you need
-to generate the raw return instruction, use the \verb"retn"
-mnemonic, or follow the \verb"ret" with the number parameter, what
-also causes it to be interpreted as single instruction.
-
-To recapitulate, the complete definition of procedure may look
-like this:
-\begin{verbatim}
- proc WindowProc uses ebx esi edi,hwnd,wmsg,wparam,lparam
- local hDC:DWORD,rc:RECT
- ; the instructions
- ret
- endp
-\end{verbatim}
-
-\subsection{Procedures (64--bit)}
-
-In 64--bit Windows there is only one calling convention, and thus only two macroinstructions for calling procedures are provided.
-The \verb"fastcall" calls directly the procedure specified by the first argument using the standard convention of 64--bit Windows system.
-The \verb"invoke" macro does the same, but indirectly, through the pointer labelled by the first argument.
-Parameters are provided by the arguments that follow, and they can be of any size up to 64 bits.
-The macroinstructions use RAX register as a temporary storage when some parameter value cannot be copied directly into the stack using the
-\verb"mov" instruction. If the parameter is preceded with \verb"addr" word, it is treated as an address and is
-calculated with the \verb"lea" instruction -- so if the address is absolute, it will get calculated as RIP-relative,
-thus preventing generating a relocation in case of file with fixups.
-
-Because in 64--bit Windows the floating--point parameters are passed in a different way, they have to be marked by preceding each one of them
-with \verb"float" word. They can be either double word or quad word in size.
-Here is an example of calling some OpenGL procedures with either double--precision or single--precision parameters:
-\begin{verbatim}
- invoke glVertex3d,float 0.6,float -0.6,float 0.0
- invoke glVertex2f,float dword 0.1,float dword 0.2
-\end{verbatim}
-
-The stack space for parameters are allocated before each call and freed immediately after it.
-However it is possible to allocate this space just once for all the calls inside some given block of code,
-for this purpose there are \verb"frame" and \verb"endf" macros provided. They should be used to enclose a block,
-inside which the RSP register is not altered between the procedure calls and they prevent each call from allocating
-stack space for parameters, as it is reserved just once by the \verb"frame" macro and then freed at the end by the \verb"endf" macro.
-\begin{verbatim}
- frame ; allocate stack space just once
- invoke TranslateMessage,msg
- invoke DispatchMessage,msg
- endf
-\end{verbatim}
-The \verb"proc" macro for 64--bit Windows has the same syntax and features as 32--bit one (though \verb"stdcall" and \verb"c" options are of no use in its case).
-It should be noted however that in the calling convention used in 64--bit Windows first four parameters are passed in registers (RCX, RDX, R8 and R9),
-and therefore, even though there is a space reserved for them at the stack and it is labelled with name provided in the procedure definition,
-those four parameters will not initially reside there. They should be accessed by directly reading the registers. But if those registers are
-needed to be used for some other purpose, it is recommended to store the value of such parameter into the memory cell reserved for it.
-The beginning of such procedure may look like:
-\begin{verbatim}
- proc WindowProc hwnd,wmsg,wparam,lparam
- mov [hwnd],rcx
- mov [wmsg],edx
- mov [wparam],r8
- mov [lparam],r9
- ; now registers can be used for other purpose
- ; and parameters can still be accessed later
-\end{verbatim}
-
-\subsection{Customizing procedures}
-It is possible to create a custom code for procedure framework when using \verb"proc" macroinstruction.
-There are three symbolic variables, \verb"prologue@proc", \verb"epilogue@proc" and \verb"close@proc",
-which define the names of macroinstructions that \verb"proc" calls upon entry to the procedure,
-return from procedure (created with \verb"ret" macro) and at the end of procedure (made with \verb"endp" macro).
-Those variables can be re--defined to point to some other macroinstructions, so that all the code
-generated with \verb"proc" macro can be customized.
-
-Each of those three macroinstructions takes five parameters.
-The first one provides a label of procedure entry point, which is the name of procedure aswell.
-The second one is a bitfield containing some flags, notably the bit 4 is set when the caller is supposed to restore the stack, and cleared otherwise.
-The third one is a value that specifies the number of bytes that parameters to the procedure take on the stack.
-The fourth one is a value that specified the number of bytes that should be reserved for the local variables.
-Finally, the fifth an last parameter is the list of comma--separated registers, which procedure declared to be used
-and which should therefore be saved by prologue and restored by epilogue.
-
-The prologue macro apart from generating code that would set up the stack frame and the pointer to local variables
-has to define two symbolic variables, \verb"parmbase@proc" and \verb"localbase@proc".
-The first one should provide the base address for where the parameters reside, and the second
-one should provide the address for where the local variables reside -- usually relative to
-EBP/RBP register, but it is possible to use other bases if it can be ensured that those pointers
-will be valid at any point inside the procedure where parameters or local variables are accessed.
-It is also up to the prologue macro to make any alignments necessary for valid procedure implementation;
-the size of local variables provided as fourth parameter may itself be not aligned at all.
-
-The default behavior of \verb"proc" is defined by \verb"prologuedef" and \verb"epiloguedef" macros
-(in default case there is no need for closing macro, so the \verb"close@proc" has an empty value).
-If it is needed to return to the defaults after some customizations were used, it should be done
-with the following three lines:
-\begin{verbatim}
- prologue@proc equ prologuedef
- epilogue@proc equ epiloguedef
- close@proc equ
-\end{verbatim}
-
-As an example of modified prologue, below is the macroinstruction that implements stack-probing prologue for
-32--bit Windows. Such method of allocation should be used every time the area of local variables may
-get larger than 4096 bytes.
-\begin{verbatim}
- macro sp_prologue procname,flag,parmbytes,localbytes,reglist
- { local loc
- loc = (localbytes+3) and (not 3)
- parmbase@proc equ ebp+8
- localbase@proc equ ebp-loc
- if parmbytes | localbytes
- push ebp
- mov ebp,esp
- if localbytes
- repeat localbytes shr 12
- mov byte [esp-%*4096],0
- end repeat
- sub esp,loc
- end if
- end if
- irps reg, reglist \{ push reg \} }
-
- prologue@proc equ sp_prologue
-\end{verbatim}
-It can be easily modified to use any other stack probing method of the programmer's preference.
-
-The 64--bit headers provide an additional set of prologue/epilogue macros, which allow to define
-procedure that uses RSP to access parameters and local variables (so RBP register is free to use for any other by procedure)
-and also allocates the common space for all the procedure calls made inside, so that \verb"fastcall"
-or \verb"invoke" macros called do not need to allocate any stack space themselves. It is an effect
-similar to the one obtained by putting the code inside the procedure into \verb"frame" block, but in
-this case the allocation of stack space for procedure calls is merged with the allocation of space
-for local variables. The code inside such procedure must not alter RSP register in any way.
-To switch to this behavior of 64--bit \verb"proc", use the following instructions:
-\begin{verbatim}
- prologue@proc equ static_rsp_prologue
- epilogue@proc equ static_rsp_epilogue
- close@proc equ static_rsp_close
-\end{verbatim}
-
-
-\subsection{Exports}
-The \verb"export" macroinstruction constructs the export data for
-the PE file (it should be either placed in the section marked as
-export, or within the \verb"data export" block. The first argument
-should be quoted string defining the name of library file, and the
-rest should be any number of pairs of arguments, first in each
-pair being the name of procedure defined somewhere inside the
-source, and the second being the quoted string containing the name
-under which this procedure should be exported by the library. This
-sample:
-\begin{verbatim}
- export 'MYLIB.DLL',\
- MyStart,'Start',\
- MyStop,'Stop'
-\end{verbatim}
-defines the table exporting two functions, which are defined under
-the names \verb"MyStart" and \verb"MyStop" in the sources, but
-will be exported by library under the shorter names. The
-macroinstruction take care of the alphabetical sorting of the
-table, which is required by PE format.
-
-\subsection{Component Object Model}
-The \verb"interface" macro allows to declare the interface of the
-COM object type, the first parameter is the name of interface, and
-then the consecutive names of the methods should follow, like in
-this example:
-\begin{verbatim}
- interface ITaskBarList,\
- QueryInterface,\
- AddRef,\
- Release,\
- HrInit,\
- AddTab,\
- DeleteTab,\
- ActivateTab,\
- SetActiveAlt
-\end{verbatim}
-
-The \verb"comcall" macro may be then used to call the method of
-the given object. The first parameter to this macro should be the
-handle to object, the second one should be name of COM interface
-implemented by this object, and then the name of method and
-parameters to this method. For example:
-\begin{verbatim}
- comcall ebx,ITaskBarList,ActivateTab,[hwnd]
-\end{verbatim}
-uses the contents of EBX register as a handle to COM object with
-the \verb"ITaskBarList" interface, and calls the
-\verb"ActivateTab" method of this object with the \verb"[hwnd]"
-parameter.
-
-You can also use the name of COM interface in the same way as the
-name of data structure, to define the variable that will hold the
-handle to object of given type:
-\begin{verbatim}
- ShellTaskBar ITaskBarList
-\end{verbatim}
-The above line defines the variable, in which the
-handle to COM object can be stored. After storing there the handle
-to an object, its methods can be called with the \verb"cominvk".
-This macro needs only the name of the variable with assigned
-interface and the name of method as first two parameters, and then
-parameters for the method. So the \verb"ActivateTab" method of
-object whose handle is stored in the \verb"ShellTaskBar" variable
-as defined above can be called this way:
-\begin{verbatim}
- cominvk ShellTaskBar,ActivateTab,[hwnd]
-\end{verbatim}
-which does the same as:
-\begin{verbatim}
- comcall [ShellTaskBar],ITaskBarList,ActivateTab,[hwnd]
-\end{verbatim}
-
-\subsection{Resources}
-There are two ways to create resources, one is to include the
-external resource file created with some other program, and the
-other one is to create resource section manually. The latter
-method, though doesn't need any additional program to be involved,
-is more laborious, but the standard headers provide the assistance
--- the set of elementary macroinstructions that serve as bricks to
-compose the resource section.
-
-The \verb"directory" macroinstruction must be placed directly in
-the beginning of manually built resource data and it defines what
-types of resources it contains. It should be followed by the pairs
-of values, the first one in each pair being the identifier of the
-type of resource, and the second one the label of subdirectory of
-the resources of given type. It may look like this:
-\begin{verbatim}
- directory RT_MENU,menus,\
- RT_ICON,icons,\
- RT_GROUP_ICON,group_icons
-\end{verbatim}
-
-The subdirectories can be placed anywhere in the resource area
-after the main directory, and they have to be defined with the
-\verb"resource" macroinstruction, which requires first parameter
-to be the label of the subdirectory (corresponding to the entry in
-main directory) followed by the trios of parameters -- in each
-such entry the first parameter defines the identifier of resource
-(this value is freely chosen by the programmer and is then used to
-access the given resource from the program), the second specifies
-the language and the third one is the label of resource. Standard
-equates should be used to create language identifiers. For example
-the subdirectory of menus may be defined this way:
-\begin{verbatim}
- resource menus,\
- 1,LANG_ENGLISH+SUBLANG_DEFAULT,main_menu,\
- 2,LANG_ENGLISH+SUBLANG_DEFAULT,other_menu
-\end{verbatim}
-If the resource is of kind for which the language doesn't matter,
-the language identifier \verb"LANG_NEUTRAL" should be used. To define the
-resources of various types there are specialized
-macroinstructions, which should be placed inside the resource
-area.
-
-The bitmaps are the resources with \verb"RT_BITMAP" type
-identifier. To define the bitmap resource use the \verb"bitmap"
-macroinstruction with the first parameter being the label of
-resource (corresponding to the entry in the subdirectory of
-bitmaps) and the second being the quoted string containing the
-path to the bitmap file, like:
-\begin{verbatim}
- bitmap program_logo,'logo.bmp'
-\end{verbatim}
-
-The are two resource types related to icons, the
-\verb"RT_GROUP_ICON" is the type for the resource, which has to be
-linked to one or more resources of \verb"RT_ICON" type, each one
-containing single image. This allows to declare images of
-different sizes and color depths under the common resource
-identifier. This identifier, given to the resource of
-\verb"RT_GROUP_ICON" type may be then passed to the
-\verb"LoadIcon" function, and it will choose the image of suitable
-dimensions from the group. To define the icon, use the \verb"icon"
-macroinstruction, with first parameter being the label of
-\verb"RT_GROUP_ICON" resource, followed by the pairs of parameters
-declaring the images. First parameter in each pair should be the
-label of \verb"RT_ICON" resource, and the second one the quoted
-string containing the path to the icon file. In the simplest
-variant, when group of icon contains just one image, it will look
-like:
-\begin{verbatim}
- icon main_icon,icon_data,'main.ico'
-\end{verbatim}
-where the \verb"main_icon" is the label for entry in resource
-subdirectory for \verb"RT_GROUP_ICON" type, and the
-\verb"icon_data" is the label for entry of \verb"RT_ICON" type.
-
-The cursors are defined in a way similar to icons,
-with the \verb"RT_GROUP_CURSOR" and \verb"RT_CURSOR" types and the
-\verb"cursor" macro, which takes parameters analogous to those
-taken by \verb"icon" macro. So the definition of cursor may look
-like this:
-\begin{verbatim}
- cursor my_cursor,cursor_data,'my.cur'
-\end{verbatim}
-
-The menus have the \verb"RT_MENU" type of resource and are defined
-with the \verb"menu" macroinstruction followed by few others
-defining the items inside the menu. The \verb"menu" itself takes
-only one parameter -- the label of resource. The \verb"menuitem"
-defines the item in the menu, it takes up to five parameters, but
-only two are required -- the first one is the quoted string
-containing the text for the item, and the second one is the
-identifier value (which is the value that will be returned when
-user selects the given item from the menu). The
-\verb"menuseparator" defines a separator in the menu and doesn't
-require any parameters.
-
-The optional third parameter of \verb"menuitem" specifies the menu
-resource flags. There are two such flags available --
-\verb"MFR_END" is the flag for the last item in the given menu,
-and the \verb"MFR_POPUP" marks that the given item is the submenu,
-and the following items will be items composing that submenu until
-the item with \verb"MFR_END" flag is found. The \verb"MFR_END"
-flag can be also given as the parameter to the
-\verb"menuseparator" and is the only parameter this
-macroinstruction can take. For the menu definition to be complete,
-every submenu must be closed by the item with \verb"MFR_END" flag,
-and the whole menu must also be closed this way. Here is an
-example of complete definition of the menu:
-\begin{verbatim}
- menu main_menu
- menuitem '&File',100,MFR_POPUP
- menuitem '&New',101
- menuseparator
- menuitem 'E&xit',109,MFR_END
- menuitem '&Help',900,MFR_POPUP + MFR_END
- menuitem '&About...',901,MFR_END
-\end{verbatim}
-
-The optional fourth parameter of \verb"menuitem" specifies the
-state flags for the given item, these flags are the same as the
-ones used by API functions, like \verb"MFS_CHECKED" or
-\verb"MFS_DISABLED". Similarly, the fifth parameter can specify
-the type flags. For example this will define item checked with a
-radio--button mark:
-\begin{verbatim}
- menuitem 'Selection',102, ,MFS_CHECKED,MFT_RADIOCHECK
-\end{verbatim}
-
-The dialog boxes have the \verb"RT_DIALOG" type of resource and
-are defined with the \verb"dialog" macroinstruction followed by
-any number of items defined with \verb"dialogitem" ended with the
-\verb"enddialog".
-
-The \verb"dialog" can take up to eleven parameters, first seven
-being required. First parameter, as usual, specifies the label of
-resource, second is the quoted string containing the title of the
-dialog box, the next four parameters specify the horizontal and
-vertical coordinates, the width and the height of the dialog box
-window respectively. The seventh parameter specifies the style
-flags for the dialog box window, the optional eighth one specifies
-the extended style flags. The ninth parameter can specify the menu
-for window -- it should be the identifier of menu resource, the
-same as one specified in the subdirectory of resources with
-\verb"RT_MENU" type. Finally the tenth and eleventh parameter can
-be used to define the font for the dialog box -- first of them
-should be the quoted string containing the name of font, and the
-latter one the number defining the size of font. When these
-optional parameters are not specified, the default MS Sans Serif
-of size 8 is used.
-
-This example shows the \verb"dialog" macroinstruction with all the
-parameters except for the menu (which is left with blank value),
-the optional ones are in the second line:
-\begin{verbatim}
- dialog about,'About',50,50,200,100,WS_CAPTION+WS_SYSMENU,\
- WS_EX_TOPMOST, ,'Times New Roman',10
-\end{verbatim}
-
-The \verb"dialogitem" has eight required parameters and one
-optional. First parameter should be the quoted string containing
-the class name for the item. Second parameter can be either the
-quoted string containing text for the item, or resource identifier
-in case when the contents of item has to be defined by some
-additional resource (like the item of \verb"STATIC" class with the
-\verb"SS_BITMAP" style). The third parameter is the identifier for
-the item, used to identify the item by the API functions. Next
-four parameters specify the horizontal, vertical coordinates, the
-width and height of the item respectively. The eighth parameter
-specifies the style for the item, and the optional ninth specifies
-the extended style flags. An example dialog item definition:
-\begin{verbatim}
- dialogitem 'BUTTON','OK',IDOK,8,8,45,15,WS_VISIBLE+WS_TABSTOP
-\end{verbatim}
-And an example of static item containing bitmap, assuming that
-there exists a bitmap resource of identifier 7:
-\begin{verbatim}
- dialogitem 'STATIC',7,0,10,50,50,20,WS_VISIBLE+SS_BITMAP
-\end{verbatim}
-
-The definition of dialog resource can contain any amount of items
-or none at all, and it should be always ended with
-\verb"enddialog" macroinstruction.
-
-The resources of type \verb"RT_ACCELERATOR" are created with
-\verb"accelerator" macroinstruction. After first parameter
-traditionally being the label of resource, there should follow the
-trios of parameters -- the accelerator flags followed by the
-virtual key code or ASCII character and the identifier value
-(which is like the identifier of the menu item). A simple
-accelerator definition may look like this:
-\begin{verbatim}
- accelerator main_keys,\
- FVIRTKEY+FNOINVERT,VK_F1,901,\
- FVIRTKEY+FNOINVERT,VK_F10,109
-\end{verbatim}
-
-The version information is the resource of type \verb"RT_VERSION"
-and is created with the \verb"versioninfo" macroinstruction. After the
-label of the resource, the second parameter specifies the
-operating system of PE file (usually it should be
-\verb"VOS__WINDOWS32"), third parameter the type of file (the most
-common are \verb"VFT_APP" for program and \verb"VFT_DLL" for
-library), fourth the subtype (usually \verb"VFT2_UNKNOWN"), fifth
-the language identifier, sixth the code page and then the quoted
-string parameters, being the pairs of property name and
-corresponding value. The simplest version information can be
-defined like:
-\begin{verbatim}
- versioninfo vinfo,VOS__WINDOWS32,VFT_APP,VFT2_UNKNOWN,\
- LANG_ENGLISH+SUBLANG_DEFAULT,0,\
- 'FileDescription','Description of program',\
- 'LegalCopyright','Copyright et cetera',\
- 'FileVersion','1.0',\
- 'ProductVersion','1.0'
-\end{verbatim}
-
-Other kinds of resources may be defined with \verb"resdata"
-macroinstruction, which takes only one parameter -- the label of
-resource, and can be followed by any instructions defining the
-data, ended with \verb"endres" macroinstruction, like:
-\begin{verbatim}
- resdata manifest
- file 'manifest.xml'
- endres
-\end{verbatim}
-
-\subsection{Text encoding}
-The resource macroinstructions use the \verb"du" directive to
-define any Unicode strings inside resources -- since this
-directive simply zero extends the characters to the 16--bit
-values, for the strings containing some non--ASCII characters, the
-\verb"du" may need to be redefined. For some of the encodings the
-macroinstructions redefining the \verb"du" to generate the Unicode
-texts properly are provided in the \verb"ENCODING" subdirectory.
-For example if the source text is encoded with Windows 1250 code
-page, such line should be put somewhere in the beginning of the
-source:
-\begin{verbatim}
- include 'encoding\win1250.inc'
-\end{verbatim}
-
-\section{Extended headers}
-The files \verb"win32ax.inc", \verb"win32wx.inc", \verb"win64ax.inc" and \verb"win64wx.inc"
-provide all the functionality of base headers and include a few
-more features involving more complex macroinstructions. Also if no
-PE format is declared before including the extended headers, the
-headers declare it automatically. The files \verb"win32axp.inc",
-\verb"win32wxp.inc", \verb"win64axp.inc" and \verb"win64wxp.inc"
-are the variants of extended headers which
-additionally perform checking the count of parameters to procedure
-calls.
-
-\subsection{Procedure parameters}
-With the extended headers the macroinstructions for calling
-procedures allow more types of parameters than just the double
-word values as with basic headers. First of all, when the quoted
-string is passes as a parameter to procedure, it is used to define
-string data placed among the code, and passes to procedure the
-double word pointer to this string. This allows to easily define
-the strings that don't have to be re-used, just in the line
-calling the procedure that requires pointers to those strings,
-like:
-\begin{verbatim}
- invoke MessageBox,HWND_DESKTOP,"Message","Caption",MB_OK
-\end{verbatim}
-If the parameter is the group containing some values separated
-with commas, it is treated in the same way as simple quoted string
-parameter.
-
-If the parameter is preceded by the \verb"addr" word, it means
-that this value is an address and this address should
-be passed to procedure, even if it cannot be done directly -- like
-in the case of local variables, which have addresses relative to
-EBP/RBP register. In 32--bit case the EDX register is used temporarily to
-calculate the value of address and pass it to the procedure. For
-example:
-\begin{verbatim}
- invoke RegisterClass,addr wc
-\end{verbatim}
-in case when the \verb"wc" is the local variable with address
-\verb"ebp-100h", will generate this sequence of instructions:
-\begin{verbatim}
- lea edx,[ebp-100h]
- push edx
- call [RegisterClass]
-\end{verbatim}
-However when the given address is not relative to any register, it
-is stored directly.
-
-In 64--bit case the \verb"addr" prefix is allowed even when only standard
-headers are used, as it can be useful even in case of the regular addresses,
-because it enforces RIP-relative address calculation.
-
-With 32--bit headers, if the parameter is preceded by the word \verb"double", it is
-treated as 64--bit value and passed to the procedure as two
-32--bit parameters. For example:
-\begin{verbatim}
- invoke glColor3d,double 1.0,double 0.1,double 0.1
-\end{verbatim}
-will pass the three 64--bit parameters as six double words to
-procedure. If the parameter following \verb"double" is the memory
-operand, it should not have size operator, the \verb"double"
-already works as the size override.
-
-Finally, the calls to procedures can be nested, that is call to
-one procedure may be used as the parameter to another. In such
-case the value returned in EAX/RAX by the nested procedure is passed
-as the parameter to the procedure which it is nested in. A sample
-of such nesting:
-\begin{verbatim}
- invoke MessageBox,,\
- "Message","Caption",MB_OK
-\end{verbatim}
-There are no limits for the depth of nesting the procedure calls.
-
-\subsection{Structuring the source}
-The extended headers enable some macroinstructions that help with
-easy structuring the program. The \verb".data" and \verb".code"
-are just the shortcuts to the declarations of sections for data
-and for the code. The \verb".end" macroinstruction should be put
-at the end of program, with one parameter specifying the entry
-point of program, and it also automatically generates the import
-section using all the standard import tables. In 64--bit Windows
-the \verb".end" automatically aligns the stack on 16 bytes
-boundary.
-
-The \verb".if" macroinstruction generates a piece of code that
-checks for some simple condition at the execution time, and
-depending on the result continues execution of following block or
-skips it. The block should be ended with \verb".endif", but
-earlier also \verb".elseif" macroinstruction might be used to
-begin the code that will be executed under some additional
-condition, when the previous were not met, and the \verb".else" as
-the last before \verb".endif" to begin the block that will be
-executed when all the conditions were false.
-
-The condition can be specified by using comparison operator -- one of the \verb"=",
-\verb"<", \verb">", \verb"<=", \verb">=", and \verb"<>" -- between the two
-values, first of which must be either register or memory operand.
-The values are compared as unsigned ones, unless the comparison expression is preceded by the word \verb"signed".
-If you provide only single value as a condition, it will be tested to be zero,
-and the condition will be true only if it's not. For example:
-\begin{verbatim}
- .if eax
- ret
- .endif
-\end{verbatim}
-generates the instructions, which skip over the \verb"ret" when the EAX is zero.
-
-There are also some special symbols recognized as conditions: the \verb"ZERO?" is true when the ZF flag is set,
-in the same way the \verb"CARRY?", \verb"SIGN?", \verb"OVERFLOW?" and \verb"PARITY?" correspond to the state of CF, SF, OF and PF flags.
-
-The simple conditions like above can be composed into complex conditional expressions
-using the \verb"&", \verb"|" operators for conjunction and alternative, the \verb"~" operator for negation, and parenthesis. For example:
-\begin{verbatim}
- .if eax<=100 & ( ecx | edx )
- inc ebx
- .endif
-\end{verbatim}
-will generate the compare and jump instructions that will cause the given block to get executed only when EAX is below or
-equal 100 and at the same time at least one of the ECX and EDX is not zero.
-
-The \verb".while" macroinstruction generates the instructions that
-will repeat executing the given block (ended with \verb".endw"
-macroinstruction) as long as the condition is true. The condition
-should follow the \verb".while" and can be specified in the same
-way as for the \verb".if". The pair of \verb".repeat" and
-\verb".until" macroinstructions define the block that will be
-repeatedly executed until the given condition will be met -- this
-time the condition should follow the \verb".until"
-macroinstruction, placed at the end of block, like:
-\begin{verbatim}
- .repeat
- add ecx,2
- .until ecx>100
-\end{verbatim}
-
-\end{document}
DELETED doc/source/_images/AliasFastChange.png
Index: doc/source/_images/AliasFastChange.png
==================================================================
--- doc/source/_images/AliasFastChange.png
+++ /dev/null
cannot compute difference between binary files
DELETED doc/source/_images/AliasesDlg.png
Index: doc/source/_images/AliasesDlg.png
==================================================================
--- doc/source/_images/AliasesDlg.png
+++ /dev/null
cannot compute difference between binary files
DELETED doc/source/_images/CodeCompletion.png
Index: doc/source/_images/CodeCompletion.png
==================================================================
--- doc/source/_images/CodeCompletion.png
+++ /dev/null
cannot compute difference between binary files
DELETED doc/source/_images/CrossReference.png
Index: doc/source/_images/CrossReference.png
==================================================================
--- doc/source/_images/CrossReference.png
+++ /dev/null
cannot compute difference between binary files
DELETED doc/source/_images/EmbededHelp.png
Index: doc/source/_images/EmbededHelp.png
==================================================================
--- doc/source/_images/EmbededHelp.png
+++ /dev/null
cannot compute difference between binary files
DELETED doc/source/_images/ProcArgumentsHint.png
Index: doc/source/_images/ProcArgumentsHint.png
==================================================================
--- doc/source/_images/ProcArgumentsHint.png
+++ /dev/null
cannot compute difference between binary files
DELETED doc/source/_images/ProjectOptions.png
Index: doc/source/_images/ProjectOptions.png
==================================================================
--- doc/source/_images/ProjectOptions.png
+++ /dev/null
cannot compute difference between binary files
DELETED doc/source/_images/debug.gif
Index: doc/source/_images/debug.gif
==================================================================
--- doc/source/_images/debug.gif
+++ /dev/null
cannot compute difference between binary files
DELETED doc/source/_images/error.gif
Index: doc/source/_images/error.gif
==================================================================
--- doc/source/_images/error.gif
+++ /dev/null
cannot compute difference between binary files
DELETED doc/source/_images/fastswitch.png
Index: doc/source/_images/fastswitch.png
==================================================================
--- doc/source/_images/fastswitch.png
+++ /dev/null
cannot compute difference between binary files
DELETED doc/source/_images/find.gif
Index: doc/source/_images/find.gif
==================================================================
--- doc/source/_images/find.gif
+++ /dev/null
cannot compute difference between binary files
DELETED doc/source/_images/goto.png
Index: doc/source/_images/goto.png
==================================================================
--- doc/source/_images/goto.png
+++ /dev/null
cannot compute difference between binary files
DELETED doc/source/_images/information.gif
Index: doc/source/_images/information.gif
==================================================================
--- doc/source/_images/information.gif
+++ /dev/null
cannot compute difference between binary files
DELETED doc/source/_images/warning.gif
Index: doc/source/_images/warning.gif
==================================================================
--- doc/source/_images/warning.gif
+++ /dev/null
cannot compute difference between binary files
DELETED doc/source/clean.bat
Index: doc/source/clean.bat
==================================================================
--- doc/source/clean.bat
+++ /dev/null
@@ -1,8 +0,0 @@
-del *.hhc
-del *.hhk
-del *.hhp
-del *.tid
-del *.tms
-del *.html
-del *.chm
-del *.htm
DELETED doc/source/clean.sh
Index: doc/source/clean.sh
==================================================================
--- doc/source/clean.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/usr/bin/env bash
-rm *.hhc
-rm *.hhk
-rm *.hhp
-rm *.tid
-rm *.tms
-rm *.htm
-rm *.html
-rm *.chm
DELETED doc/source/compile.bat
Index: doc/source/compile.bat
==================================================================
--- doc/source/compile.bat
+++ /dev/null
@@ -1,3 +0,0 @@
-tools\tth -w1 -zhelp.css FASM.TEX
-tools\FreshHelp.exe -x FASM.tid FASM.html 0_advanced_setup.txt 1_tips.txt 2_FreshLibDoc.txt
-tools\chmcmd project.hhp
DELETED doc/source/compile.sh
Index: doc/source/compile.sh
==================================================================
--- doc/source/compile.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/usr/bin/env bash
-tools/tth -w1 -zhelp.css FASM.TEX
-tools/FreshHelp -x FASM.tid FASM.html 0_advanced_setup.txt 1_tips.txt 2_FreshLibDoc.txt
-tools/chmcmd project.hhp
DELETED doc/source/help.css
Index: doc/source/help.css
==================================================================
--- doc/source/help.css
+++ /dev/null
@@ -1,155 +0,0 @@
-/* Common layout styles */
-/* They will define the common web site appearance */
-
-body {
- font-family: Verdana, Helvetica, sans-serif;
- font-size: 10pt;
- background-color: #fffff0;
-}
-
-/* Styles for the article formating. */
-
-table {
- border-left-width: 0px;
- border-top-width: 0px;
- border-right-width: 0px;
- border-bottom-width: 0px;
-
- border-style: solid;
- border-color: #606060;
- background-color: white;
- border-collapse: collapse;
- margin: auto;
-}
-
-
-table td {
- font-size: 10pt;
- border-right-width: 1px;
- border-bottom-width: 1px;
- border-left-width: 1px;
- border-top-width: 1px;
-
- border-style: solid;
- border-color: #606060;
- padding-left: 4px;
- padding-right: 4px;
- padding-top: 1px;
- padding-bottom: 1px;
- margin: 0px;
-}
-
-
-h1 {
- color: black;
- font-size: 13pt;
- text-align: center;
-}
-
-
-h2 {
- font-size: 11pt;
- margin-top: 20pt;
- margin-bottom: 10pt;
- text-align: left;
-}
-
-h3 {
- font-size: 10pt;
- margin-top: 20pt;
- margin-bottom: 10pt;
- text-align: left;
-}
-
-h4 {
- font-size: 9pt;
- margin-top: 10pt;
- margin-bottom: 8pt;
- text-align: left;
-}
-
-
-p {
- text-align: justify;
- font-size: 10pt;
- margin-top: 0.75em;
- margin-bottom: 0.75em;
-}
-
-
-p.uli {
- display: list-item;
- list-style: disc inside;
-}
-
-
-code, tt {
- font-family: "Courier New", monospace;
- font-size: 10pt;
- font-weight: bold;
-
- padding: 0px 3px 0px 3px;
- text-indent: 0px;
- display: inline;
- white-space: nowrap;
-}
-
-
-div.code {
- padding: 1em;
- margin: 0.5em;
-
- font-family: "Courier New", monospace;
- font-size: 10pt;
- font-weight: bold;
-
- overflow: auto;
- max-height: 30em;
- max-width: 150%;
- white-space: pre;
-
- background-color: white;
- border: 2px solid gray;
-}
-
-
-img.txt {
- margin-left:auto;
- margin-right: auto;
- display: block;
- clear: both;
- max-width: 100%;
-}
-
-
-div.bq {
- border: 0px solid #808080;
- padding: 1em;
- padding-left: 2em;
- margin: 0.5em;
-
- background-color: #f8f8f8;
- opacity: 0.7;
- filter:alpha(opacity=70);
-
- -webkit-box-shadow: 3px 3px 5px #808080;
- -moz-box-shadow: 3px 3px 5px #808080;
- box-shadow: 3px 3px 5px #808080;
-
- clear: both;
-}
-
-/* Article anchors content */
-a.a:before {
- text-decoration: none;
- display: inline-block;
- overflow: hidden;
- content: url(images/anchor.gif);
- vertical-align: middle;
-}
-
-
-hr {
- margin-top: 1em;
- margin-bottom: 1em;
-}
DELETED doc/source/tools/FreshHelp
Index: doc/source/tools/FreshHelp
==================================================================
--- doc/source/tools/FreshHelp
+++ /dev/null
cannot compute difference between binary files
DELETED doc/source/tools/FreshHelp.exe
Index: doc/source/tools/FreshHelp.exe
==================================================================
--- doc/source/tools/FreshHelp.exe
+++ /dev/null
cannot compute difference between binary files
DELETED doc/source/tools/chmcmd
Index: doc/source/tools/chmcmd
==================================================================
--- doc/source/tools/chmcmd
+++ /dev/null
cannot compute difference between binary files
DELETED doc/source/tools/chmcmd.exe
Index: doc/source/tools/chmcmd.exe
==================================================================
--- doc/source/tools/chmcmd.exe
+++ /dev/null
cannot compute difference between binary files
DELETED doc/source/tools/tth
Index: doc/source/tools/tth
==================================================================
--- doc/source/tools/tth
+++ /dev/null
cannot compute difference between binary files
DELETED doc/source/tools/tth.exe
Index: doc/source/tools/tth.exe
==================================================================
--- doc/source/tools/tth.exe
+++ /dev/null
cannot compute difference between binary files
DELETED examples/Arrays/Arrays.asm
Index: examples/Arrays/Arrays.asm
==================================================================
--- examples/Arrays/Arrays.asm
+++ /dev/null
@@ -1,101 +0,0 @@
-include '%lib%/freshlib.inc'
-
-@BinaryType console
-
-include '%lib%/freshlib.asm'
-
-; Topic: Complex data structures in FASM
-; subtopic: Easy way to create initialized arrays of structures in FASM.
-;
-; This example was written, because this is one of most common
-; questions on FASM message board. Sometimes it is problem even for
-; expirianced assembly programmers using other assemblers. Actually it is
-; not so hard to create not only arrays but even more complex data structures
-; as linked lists or trees, using so powerfull macro system of FASM.
-;
-; I will refrain from using very complex macroses, because it is not
-; very useful for beginers to use them, even using ready for use libraries.
-; IMHO, it is better for every beginer to understand what actually happen and
-; then to begin to use complex macro libaries with full understanding.
-;
-; Actually structures in FASM are almost same thing as macroses.
-; Only difference is that structures need label before it, but macro does
-; not need it.
-;
-; There are two aspects in the "arrays" problem: "definition" and "using".
-; I will try to explain both aspects on the simple example.
-; Let we need some array with points and then we need some procedure that will
-; draw poliline from the first point to the last point of the array.
-; Indication for end of the array will be the point with negative x coordinate.
-;
-; At first we will define base point structure, because we will need it when we
-; want to access defined data:
-
-struct TPoint
- .x dd ?
- .y dd ?
-ends
-
-; Then we will define macro for definition of initialized array.
-macro PointArray [x, y] {
- forward ; This means that following rows will be repeated for every set of arguments
- dd x
- dd y
- common
- dd -1 ; This will define one dword with content -1 at the end of the array.
-}
-
-
-iglobal
-
-; Ok, we have the macro definitions, let's define an array:
-MyArray:
- PointArray \
- 100, 100, \
- 200, 100, \
- 200, 200, \
- 100, 200, \
- 100, 100, \
- 150, 130, \
- 200, 100
-
-cMessage:
- db 'Look at upper left side of the console. There you can see', 13
- db 'black wireframe figure like "envelope".',13, 13, 13
- db 'This is example how to create and use initialized arrays in FASM.',13
- db 'author: John Found', 13, 0
-endg
-
-
-start:
- invoke GetConsoleWindow
- invoke GetDC, eax
- mov edi, eax
-
- invoke Rectangle, edi, 0, 0, 300, 300
-
-; And here the program will make some draw on the surface of the application console.
-; I make it this way to keep additional code as small as possible.
-
- mov esi, MyArray
- invoke MoveToEx, edi, [esi+TPoint.x], [esi+TPoint.y], NULL ; first point
- add esi, sizeof.TPoint
-
-.drawloop:
- cmp [esi+TPoint.x], -1
- je .enddraw
-
- invoke LineTo, edi, [esi+TPoint.x], [esi+TPoint.y]
- add esi, sizeof.TPoint
- jmp .drawloop
-
-.enddraw:
- invoke ReleaseDC, edi
- invoke MessageBoxA, NULL, cMessage, NULL, MB_OK or MB_ICONINFORMATION
- invoke ExitProcess, 0
-
-
-
-@AllImportSection
-@AllDataSection
-
DELETED examples/Arrays/Arrays.fpr
Index: examples/Arrays/Arrays.fpr
==================================================================
--- examples/Arrays/Arrays.fpr
+++ /dev/null
cannot compute difference between binary files
DELETED examples/CharCount/CharCount.fpr
Index: examples/CharCount/CharCount.fpr
==================================================================
--- examples/CharCount/CharCount.fpr
+++ /dev/null
cannot compute difference between binary files
DELETED examples/CharCount/Main.asm
Index: examples/CharCount/Main.asm
==================================================================
--- examples/CharCount/Main.asm
+++ /dev/null
@@ -1,51 +0,0 @@
-include '%lib%/freshlib.inc'
-
-@BinaryType GUI
-
-uses gdi32
-
-LIB_MODE equ old
-
-include '%lib%/freshlib.asm'
-
-include '%finc%/libs/msgutils.inc'
-include '%finc%/libs/templates.inc'
-include '%finc%/libs/TForm.inc'
-include '%finc%/libs/parents.inc'
-
-include '%finc%/libs/msgutils.asm'
-include '%finc%/libs/templates.asm'
-include '%finc%/libs/TForm.asm'
-include '%finc%/libs/parents.asm'
-
-
-include 'MainForm.frm'
-
-uglobal
- hMainForm dd ?
- hInstance dd ?
-endg
-
-start:
- invoke GetModuleHandleA, 0
- mov [hInstance], eax
-
- InitializeAll
-
- call RegisterFormClass
- stdcall CreateForm, frmMainForm, NULL
- mov [hMainForm],ebx
-
-include '%finc%/libs/mainloop.asm'
-
- push eax
- FinalizeAll
- invoke ExitProcess
-
-
-@AllImportSection
-@AllDataSection
-
-
-
-
DELETED examples/CharCount/MainForm.frm
Index: examples/CharCount/MainForm.frm
==================================================================
--- examples/CharCount/MainForm.frm
+++ /dev/null
@@ -1,64 +0,0 @@
-;
-
-;-----------------------------------------------------------------------
-; Window procedure for the form.
-; Arguments:
-; .hwnd - handle of the window
-; .wmsg - code of the message
-; .wparam \ Parameters of the message
-; .lparam /
-;-----------------------------------------------------------------------
-winproc frmMainWinProc
-begin
-;-----------------------------------------------------------------------
-; Write here the code that have to be executed before
-; message dispathing.
-;-----------------------------------------------------------------------
-ondefault
-;-----------------------------------------------------------------------
-; Write here the code that have to be executed if message
-; was not processed by this procedure.
-;-----------------------------------------------------------------------
- stc
- return
-
-onmessage WM_COMMAND
-
-cLabelPrefix text 'Characters: '
-
- cmp word [.wparam+2], EN_CHANGE
- jne .ondefault
- invoke SendDlgItemMessageA, [.hwnd], 100, WM_GETTEXTLENGTH, 0, 0
- mov edx, eax
-
- stdcall StrDup, cLabelPrefix
- mov ebx, eax
- stdcall NumToStr, edx, ntsDec or ntsUnsigned
- stdcall StrCat, ebx, eax
- stdcall StrDel, eax
-
- stdcall StrPtr, ebx
- invoke SendDlgItemMessageA, [.hwnd], 2, WM_SETTEXT, 0, eax
- stdcall StrDel, ebx
- clc
- return
-endwp
-
-
-
-winproc multiEditProc
-begin
-
-ondefault
- stc
- return
-
-onmessage WM_GETDLGCODE
- mov eax, DLGC_WANTARROWS or DLGC_WANTTAB or DLGC_WANTALLKEYS or DLGC_HASSETSEL or DLGC_WANTCHARS
- clc
- return
-endwp
DELETED examples/ELFExe/Linux.fpr
Index: examples/ELFExe/Linux.fpr
==================================================================
--- examples/ELFExe/Linux.fpr
+++ /dev/null
cannot compute difference between binary files
DELETED examples/ELFExe/hello.asm
Index: examples/ELFExe/hello.asm
==================================================================
--- examples/ELFExe/hello.asm
+++ /dev/null
@@ -1,21 +0,0 @@
-format ELF executable
-entry _start
-
-segment readable executable
-_start:
-
- mov eax,4
- mov ebx,1
- mov ecx,msg
- mov edx,msg_size
- int $80
-
- mov eax,1
- xor ebx,ebx
- int $80
-
-
-segment readable writeable
-msg db 'Hello world!',$0a
- db 'Now Fresh can run Linux ELF executables. :)', $0a
-msg_size = $-msg
DELETED examples/ELFExe/readame.txt
Index: examples/ELFExe/readame.txt
==================================================================
--- examples/ELFExe/readame.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-This example creates simple Hello world program for Linux.
-You can run it from inside Fresh IDE, but you need to install andLinux
-and configure Fresh IDE to run Linux applications in andLinux
-For detailed explanation how to do it, browse to
-[http://chiselapp.com/user/johnfound/repository/FreshIDE/wiki?name=Fresh+and+Linux]
-or read the related chapter in "%Fresh%/doc/GreshGuide.chm"
DELETED examples/Fractal/Mandelbrod.asm
Index: examples/Fractal/Mandelbrod.asm
==================================================================
--- examples/Fractal/Mandelbrod.asm
+++ /dev/null
@@ -1,63 +0,0 @@
-format binary as "tga"
-
-; DON'T _RUN_ this file, just COMPILE it and view it with any
-; image program that supports 8-bit paletted TGA-images (many does).
-
-; usage: "FASM MANDELDB.ASM MANDELDB.TGA"
-; better keep the ".TGA"-extension, else this might confuse some lamish
-; image programs.
-
-; Some basic image properties. Feel free to modify
-Width equ 80
-Height equ 80
-IterLim equ 256
-Prec equ 29; don't set above 29 nor to low, else image may be scrambled
-
-; TGA-header: 8-bit paletted image
-dw 256,1
-db 0,0,1,24
-dw 0,0,Width,Height
-db 8,8
-
-; palette: 256*3bytes (RGB)
-repeat 256
-db (%+54h) and 0FFh
-db (%+0A9h) and 0FFh
-db % - 1
-end repeat
-
-; actual image (Mandelbrot fractal)
-PrecScale = 1 shl (Prec-1)
-
-StepR = (5 shl (Prec-1) +Width shr 1) / Width; = 2.5/Width
-StepI = (5 shl (Prec-1) +Height shr 1) / Height; = 3/Height
-
-PosI = -5 shl (Prec-2); = -1.25
-repeat Height
-PosR = -2 shl Prec; = -2
-repeat Width
-R = PosR
-I = PosI
-RR = (PosR*PosR) shr Prec
-II = (PosI*PosI) shr Prec
-
-Color = IterLim - 1; Color is also the current iteration number
-repeat IterLim
-if (RR + II) < 4 shl Prec
-Tmp = (RR - II) + PosR
-I = (R*I) / PrecScale + PosI
-R = Tmp
-RR = (Tmp*Tmp) shr Prec
-II = (I*I) shr Prec
-Color = Color - 1; discounting Color
-end if
-end repeat
-if Color < 0
-Color = 0
-end if
-db Color
-
-PosR = PosR + StepR
-end repeat
-PosI = PosI + StepI
-end repeat
DELETED examples/Fractal/Mandelbrod.fpr
Index: examples/Fractal/Mandelbrod.fpr
==================================================================
--- examples/Fractal/Mandelbrod.fpr
+++ /dev/null
cannot compute difference between binary files
DELETED examples/HotButton/HotButton.asm
Index: examples/HotButton/HotButton.asm
==================================================================
--- examples/HotButton/HotButton.asm
+++ /dev/null
@@ -1,63 +0,0 @@
-format PE GUI 4.0
-entry Start
-
-include '%finc%\win32\win32a.inc'
-
-include "%finc%\libs\msgutils.inc"
-include "%finc%\libs\tform.inc"
-include "%finc%\libs\parents.inc"
-include "%finc%\libs\templates.inc"
-
-include "%finc%\libs\msgutils.asm"
-include "%finc%\libs\tform.asm"
-include "%finc%\libs\parents.asm"
-include "%finc%\libs\templates.asm"
-
-include "MainForm.frm"
-
-uglobal
- hInstance dd ?
- hHeap dd ?
- hMainForm dd ?
-
-; baddata ddcdcb 1234
-endg
-
-
-iglobal
- cString db 'test',0
-endg
-
-
-Start:
- invoke GetModuleHandleA,0
- mov [hInstance],eax
- invoke GetProcessHeap
- mov [hHeap], eax
-
- InitializeAll
-
- stdcall CreateForm, frmMain, NULL
- xor eax, eax
- test ebx, ebx
- jz .terminate
-
- mov [hMainForm], ebx
-
-.run:
- call ProcessMessages
- jc .terminate
-
- invoke WaitMessage
- jmp .run
-
-.terminate:
- push eax
- ; FinalizeAll
- invoke ExitProcess ; exit code from the stack.
-
-data import
- include "%finc%\win32\allimports.asm"
-end data
-
-IncludeAllGlobals
DELETED examples/HotButton/HotButton.fpr
Index: examples/HotButton/HotButton.fpr
==================================================================
--- examples/HotButton/HotButton.fpr
+++ /dev/null
cannot compute difference between binary files
DELETED examples/HotButton/MainForm.frm
Index: examples/HotButton/MainForm.frm
==================================================================
--- examples/HotButton/MainForm.frm
+++ /dev/null
@@ -1,56 +0,0 @@
-;
-btnID = 1
-
-winproc btnWinProc
-begin
-
-ondefault
- stc
- return
-
-onmessage WM_MOUSEMOVE
-
- invoke GetCapture
- cmp eax, [.hwnd]
- je .captured
-
- invoke SetCapture, [.hwnd]
-
- invoke GetWindowLongA, [.hwnd], GWL_STYLE
- and eax, not BS_FLAT
- invoke SetWindowLongA, [.hwnd], GWL_STYLE, eax
- invoke InvalidateRect, [.hwnd], 0, 0
- clc
- return
-
-.captured:
- locals
- .rect RECT
- endl
- lea esi, [.rect]
- invoke GetClientRect, [.hwnd], esi
-
- movsx eax, word [.lparam]
- movsx ecx, word [.lparam+2]
- invoke PtInRect, esi, eax, ecx
- test eax, eax
- jz .outside
-
- clc
- return
-
-.outside:
- invoke SetCapture, NULL
- invoke GetWindowLongA, [.hwnd], GWL_STYLE
- or eax, BS_FLAT
- invoke SetWindowLongA, [.hwnd], GWL_STYLE, eax
- invoke InvalidateRect, [.hwnd], 0, 0
-
- clc
- return
-
-endwp
-
DELETED examples/HotButton/README.TXT
Index: examples/HotButton/README.TXT
==================================================================
--- examples/HotButton/README.TXT
+++ /dev/null
@@ -1,3 +0,0 @@
-This is very simple example for creating hot buttons.
-
-
DELETED examples/Portable/Portable.asm
Index: examples/Portable/Portable.asm
==================================================================
--- examples/Portable/Portable.asm
+++ /dev/null
@@ -1,98 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| Portable GUI application in assembler. |
-;|_______________________________________________________________________________________|
-;
-; Description: The main file of very simple example demonstrating how to write portable
-; GUI applications using FreshLib.
-;
-; Target OS: Any
-;
-; Dependencies: FreshLib - see includes in the source.
-;_________________________________________________________________________________________
-
-include '%lib%/freshlib.inc'
-@BinaryType GUI
-
-include '%lib%/freshlib.asm'
-
-options.FastEnter = 0 ; enter/leave or push ebp/pop ebp approach to the procedures.
-options.ShowSkipped = 0 ; shows the procedures skiped because of no use.
-options.ShowSizes = 1 ; enable/disable work of DispSize macro.
-options.DebugMode = 0 ; enable/disable macroses of simpledebug library.
-
-
-iglobal
- frmMainForm:
- ObjTemplate tfParent or tfEnd, Form, frmMain, \
- x, 100, \
- y, 50, \
- width, 320, \
- height, 240, \
- Visible, TRUE, \
- Caption, 'FreshLib portable application.'
-
- ObjTemplate tfEnd, Button, btnTest, \
- x, 50, y, 50, \
- width, 128, height, 24, \
- Visible, TRUE, \
- TextAlign, dtfAlignCenter or dtfAlignMiddle, \
- IconPosition, AlignLeft, \
- OnClick, procOnClick, \
- Caption, 'Do something'
-endg
-
-
-uglobal
- ClickCount dd ?
-endg
-
-cCaption text 'Clicked: '
-
-proc procOnClick, .self, .button
-begin
-; On click handler for the button.
-
- inc [ClickCount]
-
- stdcall NumToStr, [ClickCount], ntsDec or ntsUnsigned
- push eax
- push eax
- stdcall StrDup, cCaption
- stdcall StrCat, eax ; second from the stack.
- stdcall StrDel ; from the stack.
- push eax
- stdcall Set, [btnTest], TButton.Caption, eax
- stdcall StrDel ; from the stack.
-
- return
-endp
-
-
-
-; Main Program
-start:
- InitializeAll
-
- stdcall Create, CApplication
- jc .terminate
-
- mov [pApplication], ebx
-
- stdcall CreateFromTemplate, frmMainForm, 0
- mov ecx, [pApplication]
- mov [ecx+TApplication.MainWindow], frmMain
-
- stdcall Run
-
-.terminate:
- push eax
- FinalizeAll
-
- stdcall Terminate ; from the stack
-
-; end of main program
-
-@AllImportSection
-@AllDataSection
-
DELETED examples/Portable/Portable.fpr
Index: examples/Portable/Portable.fpr
==================================================================
--- examples/Portable/Portable.fpr
+++ /dev/null
cannot compute difference between binary files
DELETED examples/ReadMe.txt
Index: examples/ReadMe.txt
==================================================================
--- examples/ReadMe.txt
+++ /dev/null
@@ -1,84 +0,0 @@
-IMPORTANT:
-These examples are intended to be open and compile from this directory.
-They expect that the include libraries will be located in "../../include"
-and "../../freshlib/" directories.
-It was made in order to ensure compilation even if Fresh IDE is not set up
-properly.
-If you want to copy these projects somewhere and to play with them, you
-have to edit the options of the project (Project|Project options) and to
-remove "finc" and "lib" aliases from the list.
-
-simple.asm
-~~~~~~~~~~
-Very simple "Hello world" Win32 GUI application, it doesn't use any
-includes, so you can compile and run it with Fresh even if it is not
-configured properly.
-
-
-Arrays\
-~~~~~~~
- Example how to create and use initialized arrays of structures in
-FASM/Fresh.
-
-
-Char count\
-~~~~~~~~~~~
- Windows program that counts characters typed in edit box.
-
-
-ElfExe\
-~~~~~~~
- Simple "Hello world" application for Linux.
-In order to run it in Fresh you need to install andLinux distribution -
-see on "www.adnlinux.org" and to set its path in Fresh IDE options.
-Of course you can compile this example without using andLinux and
-start it on your own Linux instalation.
-
-
-Fractal\
-~~~~~~~~
- Good example how powerfull is FASM compiler. This project creates
-not an executable file, but .tga image file. You can view it using
-any graphic editor/viewer.
-
-
-HotButton\
-~~~~~~~~~~
- Demonstrates how to create simple "Hot" buttons - i.e. the button
-changes his look when the mouse pointer hovers over it.
-
-
-ScrollBox\
-~~~~~~~~~~
- Example how to create Windows with scrollable client area using
-standard Fresh libraries.
-
-
-SEH\
-~~~
- Example how to use structured exception handling libary
-in assembly programs.
-
-SQLiteExample\
-~~~~~~~~~~~~~~
-
- Demonstrates how to use SQLite library for work with relational
-databases.
-
-VisualPad\
-~~~~~~~~~~
- Simple project for Notepad like text editor, using Fresh GUI
-library. Not finished, but you can use it as a example for project
-created with current Fresh visual programming features.
-
-ToolPanel\
-~~~~~~~~~~
-
- Simple tool panel, that hides itself when not needed.
-Demonstrates use of timers and how to handle mouse messages.
-
-XLib\
-~~~~
- Simple GUI application for Linux. This example is stand alone
-and does not depend on Fresh include files.
- Demonstrate the use of XLib in Linux.
DELETED examples/SEH/Main.asm
Index: examples/SEH/Main.asm
==================================================================
--- examples/SEH/Main.asm
+++ /dev/null
@@ -1,82 +0,0 @@
-include '%lib%/freshlib.inc'
-
-@BinaryType GUI
-
-include '%lib%/freshlib.asm'
-
-start:
- InitializeAll
-
-; First level of exception handling
-beginTry
-
- ; Second level of exception handling
- beginTry
-
- xor esi, esi
- mov eax, [esi] ; exception
- invoke MessageBoxA, NULL, eax, NULL, MB_ICONINFORMATION or MB_OK
-
- onException
-
- ; Get the exception number
- mov eax, [ptrExceptionRecord]
- mov eax, [eax+EXCEPTION_RECORD.ExceptionCode]
-
- ; This is simply creating of the message for message box.
- ; Strictly preserve esi, edi, ebx and ebp registers
- push ebx
- stdcall NumToStr, eax, ntsUnsigned or ntsHex
- mov ebx, eax
- stdcall StrInsert, ebx, msgException, 0
- stdcall StrCat, ebx, msgSecond
- stdcall StrPtr, ebx
- invoke MessageBoxA, NULL, eax, NULL, MB_ICONINFORMATION or MB_YESNO
- stdcall StrDel, ebx
- pop ebx
-
- ; How to proceed? Yes means the exception will be passed to the
- ; previous exception handler - i.e. the first one.
- cmp eax, IDYES
- jne @f
-
- Next
-
-@@:
-
- Ignore
-
- endTry
-
- invoke MessageBoxA, NULL, msgAfterSecond, NULL, MB_ICONINFORMATION or MB_OK
-
-onException
-
- invoke MessageBoxA, NULL, msgFirst, NULL, MB_ICONINFORMATION or MB_YESNO
- cmp eax, IDYES
- je .patchesi
-
- Ignore
-
- ; Change esi register to have valid value after retry.
- .patchesi:
- mov eax, [ptrExceptionContext]
- mov [eax+CONTEXT.regEsi], ptrRecovered
- Retry
-
-endTry
-
- FinalizeAll
- invoke MessageBoxA, NULL, msgBeforeEnd, NULL, MB_ICONINFORMATION or MB_OK
- invoke ExitProcess, 0
-
-msgBeforeEnd db 'Just before termination.', 0
-msgRecovered db 'Recovered. ESI have proper value now.', 0
-msgSecond db ' Second level exception handler. Do you want to pass exception to the first level handler?', 0
-msgFirst db 'First level exception handler. Do you want to fix the value of the esi register?', 0
-msgAfterSecond db 'Code, after second level exception handler.', 0
-msgException db 'Exception No. $', 0
-ptrRecovered dd msgRecovered
-
-@AllImportEmbeded
-@AllDataEmbeded
DELETED examples/SEH/seh.fpr
Index: examples/SEH/seh.fpr
==================================================================
--- examples/SEH/seh.fpr
+++ /dev/null
cannot compute difference between binary files
DELETED examples/SQLiteExample/CreateDB/DBCreate.fpr
Index: examples/SQLiteExample/CreateDB/DBCreate.fpr
==================================================================
--- examples/SQLiteExample/CreateDB/DBCreate.fpr
+++ /dev/null
cannot compute difference between binary files
DELETED examples/SQLiteExample/CreateDB/MainFile.asm
Index: examples/SQLiteExample/CreateDB/MainFile.asm
==================================================================
--- examples/SQLiteExample/CreateDB/MainFile.asm
+++ /dev/null
@@ -1,154 +0,0 @@
-
-; Win32 Console Application
-
-format PE Console
-entry Start
-
-include '%finc%\win32\win32a.inc'
-
-uglobal
- hInstance dd ?
- hHeap dd ?
- ptrDBase dd ?
- hSQL dd ?
- ptrDummy dd ?
-
- findData FINDDATA
- hFind dd ?
-endg
-
-iglobal
- cDBName db 'Pictures.sqlite', 0
- files db '.\pictures\*.bmp', 0
-
- filePath db '.\pictures\'
- filename rb 100
-
- sqlCreateDB file 'createdb.sql'
- db 0
-
- sqlInsert db 'insert into Pictures (Name, Picture) values (?, ?);', 0
-endg
-
-Start:
- invoke GetModuleHandleA,0
- mov [hInstance],eax
- invoke GetProcessHeap
- mov [hHeap], eax
- InitializeAll
-
- ; TODO: Insert code here
- cinvoke sqliteOpen, cDBName, ptrDBase
- cinvoke sqliteExec, [ptrDBase], sqlCreateDB, NULL, NULL, NULL
-
- invoke FindFirstFileA, files, findData
- cmp eax, INVALID_HANDLE_VALUE
- je .finish
-
- mov [hFind], eax
-
-.readloop:
- lea esi, [findData.cFileName]
- lea edi, [filename]
- cld
-.copy:
- lodsb
- stosb
- test al,al
- jnz .copy
-
- stdcall LoadBinaryFile, filePath
-
- mov esi, eax
- mov ebx, ecx
-
- cinvoke sqlitePrepare, [ptrDBase], sqlInsert, -1, hSQL, ptrDummy
-
- cinvoke sqliteBindText, [hSQL], 1, findData.cFileName, -1, NULL
- cinvoke sqliteBindBlob, [hSQL], 2, esi, ebx, SQLITE_TRANSIENT
- cinvoke sqliteStep, [hSQL]
- cinvoke sqliteFinalize, [hSQL]
-
- invoke HeapFree, [hHeap], 0, esi
-
- invoke FindNextFileA, [hFind], findData
- test eax, eax
- jnz .readloop
-
-
-.finish:
- cinvoke sqliteClose, [ptrDBase]
-
-Exit:
- push eax
- FinalizeAll
- invoke ExitProcess ; exit code from the stack.
-
-
-;--------------------------------------------------------------------
-; Allocates needed memory and loads the entire file in this memory.
-; Returns pointer to memory block or NULL if there is error.
-; Returns size in ecx
-;--------------------------------------------------------------------
-proc LoadBinaryFile, .ptrFileName
-.bytes dd ?
-begin
- push esi edi ebx
-
- invoke CreateFileA, [.ptrFileName], GENERIC_READ,FILE_SHARE_READ, 0, \
- OPEN_EXISTING, 0, 0
-
- cmp eax, INVALID_HANDLE_VALUE
- je .error
- mov edi, eax
-
- invoke GetFileSize, edi, NULL
- mov ebx, eax
-
- lea ecx, [ebx+2] ; It is for the case that the file is
- ; text and we want to use it as null terminated
- ; string.
-
- invoke HeapAlloc, [hHeap], HEAP_ZERO_MEMORY, ecx
- mov esi, eax
- test esi, esi
- jz .close
-
- lea ecx, [.bytes]
- invoke ReadFile, edi, esi, ebx, ecx, NULL
-
-.close:
- invoke CloseHandle, edi
-
- test esi, esi
- jz .error
-
- cmp [.bytes], ebx
- je .ok
-
- invoke HeapFree, [hHeap], 0, esi
-
-.error:
- xor eax, eax
- xor ecx, ecx
- pop ebx edi esi
- return
-
-.ok:
- mov eax, esi
- mov ecx, ebx
- pop ebx edi esi
- return
-endp
-
-
-
-
-
-
-
-data import
- include '%finc%/win32/allimports.asm'
-end data
-
-IncludeAllGlobals
DELETED examples/SQLiteExample/CreateDB/PICTURES/Earth.bmp
Index: examples/SQLiteExample/CreateDB/PICTURES/Earth.bmp
==================================================================
--- examples/SQLiteExample/CreateDB/PICTURES/Earth.bmp
+++ /dev/null
cannot compute difference between binary files
DELETED examples/SQLiteExample/CreateDB/PICTURES/Jupiter.bmp
Index: examples/SQLiteExample/CreateDB/PICTURES/Jupiter.bmp
==================================================================
--- examples/SQLiteExample/CreateDB/PICTURES/Jupiter.bmp
+++ /dev/null
cannot compute difference between binary files
DELETED examples/SQLiteExample/CreateDB/PICTURES/Mars.bmp
Index: examples/SQLiteExample/CreateDB/PICTURES/Mars.bmp
==================================================================
--- examples/SQLiteExample/CreateDB/PICTURES/Mars.bmp
+++ /dev/null
cannot compute difference between binary files
DELETED examples/SQLiteExample/CreateDB/PICTURES/Mercury.bmp
Index: examples/SQLiteExample/CreateDB/PICTURES/Mercury.bmp
==================================================================
--- examples/SQLiteExample/CreateDB/PICTURES/Mercury.bmp
+++ /dev/null
cannot compute difference between binary files
DELETED examples/SQLiteExample/CreateDB/PICTURES/Neptune.bmp
Index: examples/SQLiteExample/CreateDB/PICTURES/Neptune.bmp
==================================================================
--- examples/SQLiteExample/CreateDB/PICTURES/Neptune.bmp
+++ /dev/null
cannot compute difference between binary files
DELETED examples/SQLiteExample/CreateDB/PICTURES/Saturn.bmp
Index: examples/SQLiteExample/CreateDB/PICTURES/Saturn.bmp
==================================================================
--- examples/SQLiteExample/CreateDB/PICTURES/Saturn.bmp
+++ /dev/null
cannot compute difference between binary files
DELETED examples/SQLiteExample/CreateDB/PICTURES/Uranus.bmp
Index: examples/SQLiteExample/CreateDB/PICTURES/Uranus.bmp
==================================================================
--- examples/SQLiteExample/CreateDB/PICTURES/Uranus.bmp
+++ /dev/null
cannot compute difference between binary files
DELETED examples/SQLiteExample/CreateDB/PICTURES/Venus.bmp
Index: examples/SQLiteExample/CreateDB/PICTURES/Venus.bmp
==================================================================
--- examples/SQLiteExample/CreateDB/PICTURES/Venus.bmp
+++ /dev/null
cannot compute difference between binary files
DELETED examples/SQLiteExample/CreateDB/PICTURES/pluto_sri.bmp
Index: examples/SQLiteExample/CreateDB/PICTURES/pluto_sri.bmp
==================================================================
--- examples/SQLiteExample/CreateDB/PICTURES/pluto_sri.bmp
+++ /dev/null
cannot compute difference between binary files
DELETED examples/SQLiteExample/CreateDB/createdb.sql
Index: examples/SQLiteExample/CreateDB/createdb.sql
==================================================================
--- examples/SQLiteExample/CreateDB/createdb.sql
+++ /dev/null
@@ -1,7 +0,0 @@
-create table Pictures (
- ID integer primary key autoincrement,
- FromSun integer,
- Name text,
- Description text,
- Picture blob
-);
DELETED examples/SQLiteExample/CreateDB/readme.txt
Index: examples/SQLiteExample/CreateDB/readme.txt
==================================================================
--- examples/SQLiteExample/CreateDB/readme.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-This example creates database with the images from the directory "PICTURES".
-In order to run it you need the file "sqlite3.dll" that is placed one
-directory up in the tree. Simply copy it here or in some of the system
-directories, as Windows/system32 ; Windows/system ; etc.
DELETED examples/SQLiteExample/MainForm.frm
Index: examples/SQLiteExample/MainForm.frm
==================================================================
--- examples/SQLiteExample/MainForm.frm
+++ /dev/null
@@ -1,145 +0,0 @@
-;
-idListBox = 100
-idImage = 101
-
-idMainIcon = 2
-idDefaultImage = 1
-
-uglobal
- ptrDatabase dd ?
- hSQL dd ?
- ptrDummy dd ?
-endg
-
-
-winproc MainFormWinProc
-begin
-
-ondefault
- stc
- return
-
-onmessage FM_AFTERCREATE
-; Set main window icons
- invoke LoadImageA, [hInstance], idMainIcon, IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR
- invoke SendMessageA, [.hwnd], WM_SETICON, ICON_SMALL, eax
- invoke LoadImageA, [hInstance], idMainIcon, IMAGE_ICON, 32, 32, LR_DEFAULTCOLOR
- invoke SendMessageA, [.hwnd], WM_SETICON, ICON_BIG, eax
-
-; set default image.
- invoke LoadImageA, [hInstance], idDefaultImage, IMAGE_BITMAP, 0, 0, 0
- invoke SendDlgItemMessageA, [.hwnd], idImage, STM_SETIMAGE, IMAGE_BITMAP, eax
-
-; Open the images database
-iglobal
- cDBName db 'pictures.sqlite', 0
-endg
- cinvoke sqliteOpen, cDBName, ptrDatabase
-
-; Read the list of the images in the database and fill the listbox with names and ID's of the images.
-iglobal
- sqlSelectNames db 'select ID, Name from Pictures order by FromSun',0
-endg
- cinvoke sqlitePrepare, [ptrDatabase], sqlSelectNames, -1, hSQL, ptrDummy
-.loop:
- cinvoke sqliteStep, [hSQL]
- cmp eax, SQLITE_ROW
- jne .endloop
-
- cinvoke sqliteColumnInt, [hSQL], 0 ; ID
- mov ebx, eax
- cinvoke sqliteColumnText, [hSQL], 1 ; Name
-
- invoke SendDlgItemMessageA, [.hwnd], idListBox, LB_ADDSTRING, 0, eax
- cmp eax, LB_ERR
- je .loop
- invoke SendDlgItemMessageA, [.hwnd], idListBox, LB_SETITEMDATA, eax, ebx
- jmp .loop
-
-.endloop:
- cinvoke sqliteFinalize, [hSQL]
- clc
- return
-
-onmessage WM_DESTROY
- cinvoke sqliteClose, [ptrDatabase]
- xor eax, eax
- clc
- return
-
-
-
-onmessage WM_COMMAND
-locals
- .ptrBits dd ?
-endl
- cmp word [.wparam], idListBox ; ID of the control that sends the message.
- jne .ondefault
-
- cmp word [.wparam+2], LBN_SELCHANGE
- jne .ondefault
-
-; The selection in the listbox were changed, so read the image from database and assign it to
-; the static control at the right (idImage)
-iglobal
- sqlGetPicture db 'select Picture from Pictures where ID = ?', 0
-endg
- cinvoke sqlitePrepare, [ptrDatabase], sqlGetPicture, -1, hSQL, ptrDummy
-
- invoke SendDlgItemMessageA, [.hwnd], idListBox, LB_GETCURSEL, 0, 0
- cmp eax, LB_ERR
- je .finalize
- invoke SendDlgItemMessageA, [.hwnd], idListBox, LB_GETITEMDATA, eax, 0
-
- cinvoke sqliteBindInt, [hSQL], 1, eax
- cinvoke sqliteStep, [hSQL]
-
- cinvoke sqliteColumnBytes, [hSQL], 0
- mov ebx, eax
-
- cinvoke sqliteColumnBlob, [hSQL], 0
- mov esi, eax
-
-; Here you can see how to read bitmap directly from the memory, not from resource or file...
- lea eax, [esi+14] ; start of the BITMAPINFOHEADER
- lea ecx, [.ptrBits]
- invoke CreateDIBSection, 0, eax, 0, ecx, 0, 0
-
- push eax ; store the handle in the stack for future processing...
-
- xor eax, eax
- movzx ecx, [esi+sizeof.BITMAPFILEHEADER+BITMAPINFOHEADER.biBitCount]
- cmp ecx, 8
- ja .paletteok
-
- mov eax, 1
- add ecx, 2 ; every palette item is 4 bytes
- shl eax, cl
-
-.paletteok:
- lea esi, [esi + sizeof.BITMAPFILEHEADER + sizeof.BITMAPINFOHEADER + eax]
- lea ecx, [ebx - sizeof.BITMAPFILEHEADER - sizeof.BITMAPINFOHEADER]
- sub ecx, eax
-
- shr ecx, 2
-
- mov edi, [.ptrBits]
- rep movsd
-
- invoke SendDlgItemMessageA, [.hwnd], idImage, STM_SETIMAGE, IMAGE_BITMAP ; handle from the stack
- test eax, eax
- jz .finalize
-
- invoke DeleteObject, eax ; delete the previous selected image
-
-.finalize:
- cinvoke sqliteFinalize, [hSQL] ; don't forget to finalize SQL statements.
- xor eax, eax
- clc
- return
-
-endwp
DELETED examples/SQLiteExample/Pictures.sqlite
Index: examples/SQLiteExample/Pictures.sqlite
==================================================================
--- examples/SQLiteExample/Pictures.sqlite
+++ /dev/null
cannot compute difference between binary files
DELETED examples/SQLiteExample/Planets.asm
Index: examples/SQLiteExample/Planets.asm
==================================================================
--- examples/SQLiteExample/Planets.asm
+++ /dev/null
@@ -1,59 +0,0 @@
-format PE GUI 4.0
-entry Start
-
-include '%finc%\win32\win32a.inc'
-
-include "%finc%\libs\msgutils.inc"
-include "%finc%\libs\tform.inc"
-include "%finc%\libs\parents.inc"
-include "%finc%\libs\templates.inc"
-
-include "%finc%\libs\msgutils.asm"
-include "%finc%\libs\tform.asm"
-include "%finc%\libs\parents.asm"
-include "%finc%\libs\templates.asm"
-
-include "MainForm.frm"
-
-uglobal
- hInstance dd ?
- hHeap dd ?
- hMainForm dd ?
-endg
-
-Start:
- invoke GetModuleHandleA,0
- mov [hInstance],eax
- invoke GetProcessHeap
- mov [hHeap], eax
-
- InitializeAll
-
- stdcall CreateForm, frmMain, NULL
- xor eax, eax
- test ebx, ebx
- jz .terminate
-
- mov [hMainForm], ebx
-
-.run:
- call ProcessMessages
- jc .terminate
-
- invoke WaitMessage
- jmp .run
-
-.terminate:
- push eax
- FinalizeAll
- invoke ExitProcess ; exit code from the stack.
-
-data import
- include '%finc%/win32/allimports.asm'
-end data
-
-
-data resource from 'resources/planets.res'
-end data
-
-IncludeAllGlobals
DELETED examples/SQLiteExample/Planets.fpr
Index: examples/SQLiteExample/Planets.fpr
==================================================================
--- examples/SQLiteExample/Planets.fpr
+++ /dev/null
cannot compute difference between binary files
DELETED examples/SQLiteExample/README.TXT
Index: examples/SQLiteExample/README.TXT
==================================================================
--- examples/SQLiteExample/README.TXT
+++ /dev/null
@@ -1,13 +0,0 @@
-This example demonstrates how SQLite database engine can be used in
-assembly written applications.
-
-Actually there are 2 examples - first one "DBCreate.fpr" is console
-application, that creates database with images inside as a blob fields.
-(I wrote it only because standard SQLite management utilities can't
-handle blob fields properly)
-
-The second one "Planets.fpr" is simple catalog of all planets from the
-Solar system with pictures. There is already prepared database with the
-information: "Pictures.sqlite".
-
-Enjoy.
DELETED examples/SQLiteExample/Resources/Neptune.ico
Index: examples/SQLiteExample/Resources/Neptune.ico
==================================================================
--- examples/SQLiteExample/Resources/Neptune.ico
+++ /dev/null
cannot compute difference between binary files
DELETED examples/SQLiteExample/Resources/planets.res
Index: examples/SQLiteExample/Resources/planets.res
==================================================================
--- examples/SQLiteExample/Resources/planets.res
+++ /dev/null
cannot compute difference between binary files
DELETED examples/SQLiteExample/Resources/sqlite.bmp
Index: examples/SQLiteExample/Resources/sqlite.bmp
==================================================================
--- examples/SQLiteExample/Resources/sqlite.bmp
+++ /dev/null
cannot compute difference between binary files
DELETED examples/SQLiteExample/sqlite3.dll
Index: examples/SQLiteExample/sqlite3.dll
==================================================================
--- examples/SQLiteExample/sqlite3.dll
+++ /dev/null
cannot compute difference between binary files
DELETED examples/ScrollBox/Main.asm
Index: examples/ScrollBox/Main.asm
==================================================================
--- examples/ScrollBox/Main.asm
+++ /dev/null
@@ -1,53 +0,0 @@
-format PE GUI 4.0
-entry Start
-
-include '%finc%\win32\win32a.inc'
-include '%finc%\libs\msgutils.inc'
-include '%finc%\libs\templates.inc'
-include '%finc%\libs\TForm.inc'
-include '%finc%\libs\parents.inc'
-
-section '.code' code readable executable
-
-include '%finc%\libs\msgutils.asm'
-include '%finc%\libs\templates.asm'
-include '%finc%\libs\TForm.asm'
-include '%finc%\libs\parents.asm'
-
-include 'MainForm.frm'
-include '%finc%\libs\scrollbars.asm'
-
-uglobal
- hMainForm dd ?
- hInstance dd ?
- hHeap dd ?
-endg
-
-Start:
- invoke GetModuleHandleA, 0
- mov [hInstance], eax
- invoke GetProcessHeap
- mov [hHeap], eax
-
- invoke InitCommonControls
- InitializeAll
-
- call RegisterFormClass
- stdcall CreateForm, frmMainForm, NULL
- mov [hMainForm],ebx
-
-include '%finc%\libs\mainloop.asm'
- push eax
- FinalizeAll
- invoke ExitProcess
-
-
-section '.idata' data import readable writeable
-ImportTable:
-include '%finc%\win32\allimports.asm'
-DispSize 'ImportTable', $ - ImportTable
-
-section '.data' data readable writeable
-IncludeAllGlobals
-
-
DELETED examples/ScrollBox/MainForm.frm
Index: examples/ScrollBox/MainForm.frm
==================================================================
--- examples/ScrollBox/MainForm.frm
+++ /dev/null
@@ -1,62 +0,0 @@
-;
-
-;-----------------------------------------------------------------------
-; Window procedure for the form.
-; Arguments:
-; .hwnd - handle of the window
-; .wmsg - code of the message
-; .wparam \ Parameters of the message
-; .lparam /
-;-----------------------------------------------------------------------
-winproc MainFormProc
-begin
-
-ondefault
- stc
- return
-
-onmessage FM_AFTERCREATE
- stdcall AutoSizeScrollers, [.hwnd]
- stdcall UpdateThumbs, [.hwnd]
- clc
- return
-
-onmessage WM_VSCROLL
-onmessage WM_HSCROLL
- stdcall ScrollBarMessage, [.hwnd], [.wmsg], [.wparam], DoCorrectChildren
- clc
- return
-
-onmessage WM_SIZE
- stdcall UpdateThumbs, [.hwnd]
- clc
- return
-
-onmessage WM_COMMAND
- cmp word [.wparam], 1001
- jne .ondefault
-
- invoke GetDlgItem, [.hwnd], 1002
- invoke SetWindowPos, eax, 0, 100, 200000, 0, 0, SWP_NOSIZE or SWP_NOZORDER
- stdcall AutoSizeScrollers, [.hwnd]
- stdcall UpdateThumbs, [.hwnd]
-
- clc
- return
-
-endwp
-
-
DELETED examples/ScrollBox/ScrollBox.fpr
Index: examples/ScrollBox/ScrollBox.fpr
==================================================================
--- examples/ScrollBox/ScrollBox.fpr
+++ /dev/null
cannot compute difference between binary files
DELETED examples/ScrollBox/Scrollbars.asm
Index: examples/ScrollBox/Scrollbars.asm
==================================================================
--- examples/ScrollBox/Scrollbars.asm
+++ /dev/null
@@ -1,261 +0,0 @@
-ScrollbarsLib:
-;---------------------------------------------------------
-; Scrollbar lib is small library that provides
-; windows with client area bigger than its actual size.
-;---------------------------------------------------------
-
-;----------------------------------------------------------------------
-; This procedure is handler for WM_HSCROLL and WM_VSCROLL
-; messages. Call it from window message procedure passing
-; the message parameters.
-;----------------------------------------------------------------------
-proc ScrollBarMessage, .hwnd, .wmsg, .wparam, .updateproc
-.sbi SCROLLINFO
-.kind dd ?
-begin
- mov eax, [.wmsg]
- sub eax, WM_HSCROLL
- mov [.kind], eax
-
- lea edi, [.sbi]
-
- mov [.sbi.cbSize], sizeof.SCROLLINFO
- mov [.sbi.fMask], SIF_RANGE or SIF_PAGE or SIF_POS
- invoke GetScrollInfo, [.hwnd], [.kind], edi
-
- movzx ebx, word [.wparam]
- cmp ebx, SB_THUMBTRACK
- je .track
- cmp ebx, SB_THUMBPOSITION
- je .track
-
- cmp ebx, SB_TOP
- je .top
- cmp ebx, SB_BOTTOM
- je .bottom
-
- mov edx, 1 ; multiplier down
-
- cmp ebx, SB_PAGEDOWN
- je .pageupdn
- cmp ebx, SB_LINEDOWN
- je .lineupdn
-
- mov edx, -1 ; multiplier UP
-
- cmp ebx, SB_PAGEUP
- je .pageupdn
- cmp ebx, SB_LINEUP
- je .lineupdn
-; Undefined command...
- return
-
-;-----------------------------------------------------
-; Handling of different actions...
-;-----------------------------------------------------
-.track:
- movsx eax, word [.wparam+2]
- jmp .setpos
-
-.top:
- mov eax, [.sbi.nMin]
- jmp .setpos
-
-.bottom:
- mov eax, [.sbi.nMax]
- sub eax, [.sbi.nPage]
- jmp .setpos
-
-.pageupdn:
- mov eax, [.sbi.nPos]
- mov ecx, [.sbi.nPage]
- imul ecx, edx
- add eax, ecx
- jmp .setpos
-
-.lineupdn:
- mov eax, [.sbi.nPos]
- mov ecx, [.sbi.nPage]
- sar ecx, 4
- jnz @f
- inc ecx
-@@:
- imul ecx, edx
- add eax, ecx
-
-.setpos:
- mov esi, [.sbi.nPos] ; Old scroll position.
-
- mov [.sbi.nPos], eax ; New scroll position.
- mov [.sbi.fMask], SIF_POS
- invoke SetScrollInfo, [.hwnd], [.kind], edi, TRUE
-
-; Update children windows positions
- mov [.sbi.fMask], SIF_POS
- invoke GetScrollInfo, [.hwnd], [.kind], edi ; get the position corrected by Windows
-
- sub esi, [.sbi.nPos] ; correction value
- stdcall [.updateproc], [.hwnd], [.kind], esi
- return
-endp
-
-
-
-;--------------------------------------------------------------------
-; Call this procedure when the window size have been changed, to
-; adjust scrollbars thumbs size acordingly.
-;--------------------------------------------------------------------
-proc UpdateThumbs, .hwnd
-.rect RECT
-begin
- lea eax, [.rect]
- invoke GetClientRect, [.hwnd], eax
- stdcall _DoUpdateOneThumb, [.hwnd], SB_HORZ, [.rect.right]
- stdcall _DoUpdateOneThumb, [.hwnd], SB_VERT, [.rect.bottom]
- return
-endp
-
-
-
-proc _DoUpdateOneThumb, .hwnd, .kind, .size
-.sbi SCROLLINFO
-begin
-; Get the current possition of the scrollbar.
- mov [.sbi.cbSize], sizeof.SCROLLINFO
- mov [.sbi.fMask], SIF_POS
- lea eax, [.sbi]
- invoke GetScrollInfo, [.hwnd], [.kind], eax
- mov esi, [.sbi.nPos] ; Old position of the scrollbar
-
-; Set the new page size of the scrollbar.
- mov eax, [.size]
- mov [.sbi.nPage], eax
- mov [.sbi.fMask], SIF_PAGE
- lea eax, [.sbi]
- invoke SetScrollInfo, [.hwnd], [.kind], eax, TRUE
-
-; Get again the new position, because possibly Windows changed it.
- mov [.sbi.fMask], SIF_POS
- lea eax, [.sbi]
- invoke GetScrollInfo, [.hwnd], [.kind], eax
-
-; Move the first level children acording to the new scroll position.
- sub esi, [.sbi.nPos] ; correction value
- jz .finish
- stdcall DoCorrectChildren, [.hwnd], [.kind], esi
-.finish:
- return
-endp
-
-
-proc DoCorrectChildren, .hwnd, .kind, .correct
-.defer dd ?
-.rect RECT
-begin
- mov edi, [.kind]
- shl edi, 2 ; eax = 0 if .kind = SB_HORZ (0) and eax = 4 if .kind = SB_VERT (1)
- mov esi, [.correct]
-
- invoke BeginDeferWindowPos, 10
- mov [.defer], eax
-
- invoke GetWindow, [.hwnd], GW_CHILD
-.loop:
- test eax, eax
- je .enddefer
-
- mov ebx, eax
-
- lea eax, [.rect]
- invoke GetWindowRect, ebx, eax
-
- lea eax, [.rect]
- invoke ScreenToClient, [.hwnd], eax
-
- add [.rect+edi], esi
- invoke DeferWindowPos, [.defer], ebx, 0, [.rect.left], [.rect.top], 0, 0, SWP_NOSIZE or SWP_NOZORDER
- mov [.defer], eax
-
- invoke GetWindow, ebx, GW_HWNDNEXT
- jmp .loop
-
-.enddefer:
- invoke EndDeferWindowPos, [.defer]
- return
-endp
-
-
-
-
-proc AutoSizeScrollers, .hwnd
-.sbi SCROLLINFO
-.rect RECT
-.maxrect RECT
-begin
- mov eax, $7fffffff
- mov [.maxrect.left], eax
- mov [.maxrect.top], eax
- inc eax
- mov [.maxrect.right], eax
- mov [.maxrect.bottom], eax
-
- invoke GetWindow, [.hwnd], GW_CHILD
-
-.loop:
- test eax, eax
- jz .endloop
- mov ebx, eax
-
- lea esi, [.rect]
- invoke GetWindowRect, ebx, esi
- invoke ScreenToClient, [.hwnd], esi
- lea eax, [esi+8]
- invoke ScreenToClient, [.hwnd], eax
-
- mov eax, [.rect.left]
- cmp eax, [.maxrect.left]
- jge @f
- mov [.maxrect.left], eax
-@@:
- mov eax, [.rect.top]
- cmp eax, [.maxrect.top]
- jge @f
- mov [.maxrect.top], eax
-@@:
- mov eax, [.rect.right]
- cmp eax, [.maxrect.right]
- jle @f
- mov [.maxrect.right], eax
-@@:
- mov eax, [.rect.bottom]
- cmp eax, [.maxrect.bottom]
- jle @f
- mov [.maxrect.bottom], eax
-@@:
- invoke GetWindow, ebx, GW_HWNDNEXT
- jmp .loop
-
-.endloop:
- mov eax, [.maxrect.left]
- mov ecx, [.maxrect.right]
-
- mov [.sbi.nMin], 0
- mov [.sbi.nMax], ecx
- mov [.sbi.fMask], SIF_RANGE
- mov [.sbi.cbSize], sizeof.SCROLLINFO
- lea eax, [.sbi]
- invoke SetScrollInfo, [.hwnd], SB_HORZ, eax, TRUE
-
- mov eax, [.maxrect.top]
- mov ecx, [.maxrect.bottom]
-
- mov [.sbi.nMin], 0
- mov [.sbi.nMax], ecx
- lea eax, [.sbi]
- invoke SetScrollInfo, [.hwnd], SB_VERT, eax, TRUE
-
- return
-endp
-
-
-DispSize 'Scrollbars library:', $-ScrollbarsLib
DELETED examples/Simple.asm
Index: examples/Simple.asm
==================================================================
--- examples/Simple.asm
+++ /dev/null
@@ -1,83 +0,0 @@
-
- ; fasm example of writing 32-bit PE program using Win32 API
-
-format PE GUI
-entry start
-
-; MessageBox type flags
-
-MB_OK = 0000h
-MB_OKCANCEL = 0001h
-MB_ABORTRETRYIGNORE = 0002h
-MB_YESNOCANCEL = 0003h
-MB_YESNO = 0004h
-MB_RETRYCANCEL = 0005h
-MB_ICONHAND = 0010h
-MB_ICONQUESTION = 0020h
-MB_ICONEXCLAMATION = 0030h
-MB_ICONASTERISK = 0040h
-MB_DEFBUTTON1 = 0000h
-MB_DEFBUTTON2 = 0100h
-MB_DEFBUTTON3 = 0200h
-MB_APPLMODAL = 0000h
-MB_SYSTEMMODAL = 1000h
-MB_TASKMODAL = 2000h
-MB_NOFOCUS = 8000h
-
-; Conventional dialog box and message box command IDs
-
-IDOK = 1
-IDCANCEL = 2
-IDABORT = 3
-IDRETRY = 4
-IDIGNORE = 5
-IDYES = 6
-IDNO = 7
-
-section '.code' code readable executable
-
-CodeSectionOrigin:
-
- start:
- push MB_OK + MB_ICONEXCLAMATION
- push _caption
-
- push _message
- push 0
- call [MessageBox]
- .local1:
- push 0
- .local2:
- call [ExitProcess]
-
- jmp .local1
-
-section '.data' data readable writeable
-
-DataSectionOrigin:
-
- _caption db 'Win32 assembly program',0
- _message db 'Hello World!',0
-
-section '.idata' import data readable writeable
-
-ImportSectionOrigin:
-
- dd 0,0,0,RVA kernel_name,RVA kernel_table
- dd 0,0,0,RVA user_name,RVA user_table
- dd 0,0,0,0,0
-
- kernel_table:
- ExitProcess dd RVA _ExitProcess
- dd 0
- user_table:
- MessageBox dd RVA _MessageBoxA
- dd 0
-
- kernel_name db 'KERNEL32.DLL',0
- user_name db 'USER32.DLL',0
-
- _ExitProcess dw 0
- db 'ExitProcess',0
- _MessageBoxA dw 0
- db 'MessageBoxA',0
DELETED examples/VisualPad/Form1.frm
Index: examples/VisualPad/Form1.frm
==================================================================
--- examples/VisualPad/Form1.frm
+++ /dev/null
@@ -1,67 +0,0 @@
-;
-uglobal
- hMainForm dd ?
- hMainMenu dd ?
- hMainToolbar dd ?
-endg
-
-
-winproc Form1WinProc
-begin
-
-ondefault
- stc
- return
-
-onmessage WM_COMMAND
- movzx esi,word [.wparam]
- cmp esi, FirstID
- jl .ondefault
-
- sub esi,FirstID
- cmp esi,[MainActionList.Number]
- jge .ondefault
-
- imul esi,sizeof.TAction
- add esi,MainActionList
-
- stdcall [esi+TAction.OnExecute], [.wparam], [.lparam]
- xor eax, eax
- clc
- return
-
-onmessage AM_INITWINDOW
-
- stdcall ImageList_LoadGif, [hInstance], resMainToolbar, 16, FALSE
- mov [hIml], eax
-
- stdcall ImageList_LoadGif, [hInstance], resMainToolbar, 16, TRUE
- mov [hImlGray],eax
-
- stdcall CreateCoolMenu, MainMenu, FALSE
- mov [hMainMenu], eax
- invoke SetMenu, [.hwnd], eax
-
- stdcall CreateCoolToolbar, MainActionList, MainToolbar, [.hwnd], 11, [hIml], [hImlGray]
- mov [hMainToolbar],eax
- stdcall SetAlign, eax, waTop
-; stdcall SetAutoSize, [hMainToolbar], TRUE
- invoke SetPropA, [hApplication], [propMainForm], [.hwnd]
- clc
- return
-
-onmessage WM_CLOSE
- invoke GetWindow, [.hwnd], GW_OWNER
- invoke SendMessageA, eax, [.wmsg], [.wparam], [.lparam]
- clc
- return
-
-onmessage WM_INITDIALOG
- clc
- return
-
-endwp
DELETED examples/VisualPad/ReadMe.txt
Index: examples/VisualPad/ReadMe.txt
==================================================================
--- examples/VisualPad/ReadMe.txt
+++ /dev/null
@@ -1,4 +0,0 @@
- This is small Notepad like program,
-created using Fresh visual design and
-Fresh graphic libraries for menues
-and toolbars.
DELETED examples/VisualPad/VisualPad.asm
Index: examples/VisualPad/VisualPad.asm
==================================================================
--- examples/VisualPad/VisualPad.asm
+++ /dev/null
@@ -1,85 +0,0 @@
-format PE GUI 4.0
-entry start
-
-include "%finc%/win32/win32a.inc"
-
-include '%finc%/libs/gui.inc'
-include '%finc%/libs/parents.inc'
-include '%finc%/libs/msgutils.inc'
-include '%finc%/libs/templates.inc'
-include '%finc%/libs/tform.inc'
-include '%finc%/libs/application.inc'
-
-
-section '.code' code readable executable
-
-include '%finc%/libs/gui.asm'
-include '%finc%/libs/parents.asm'
-include '%finc%/libs/msgutils.asm'
-include '%finc%/libs/templates.asm'
-include '%finc%/libs/tform.asm'
-include '%lib%/system/memory.asm'
-include '%finc%/libs/giflib.asm'
-include '%finc%/libs/application.asm'
-
-include 'actions.asm'
-
-include 'Form1.frm'
-
-uglobal
- hInstance dd 0 ; Instance handle for common use.
- hHeap dd 0
-
- hIml dd 0
- hImlGray dd 0
-endg
-
-iglobal
- cMainTitle db 'Visual test',0
-endg
-
-resAppIcon = 1
-resMainToolbar = 2
-
-start:
- invoke GetModuleHandleA, 0
- mov [hInstance],eax
- invoke GetProcessHeap
- mov [hHeap], eax
-
-; Init common controls
- invoke InitCommonControls ;Ex,ComCtrlsFlags
-
- InitializeAll
- stdcall InitApplication, resAppIcon, cMainTitle
-
- stdcall CreateForm, Form1, [hApplication]
- mov [hMainForm], ebx
-
-;----------------------------------------------
-; Main message loop
-;----------------------------------------------
-Run:
- call ProcessMessages
- jc .terminate
-
- invoke SendMessageA, [hApplication], AM_ONIDLE, 0, 0
- invoke WaitMessage
- jmp Run
-
-.terminate:
- push eax
- FinalizeAll
- invoke ExitProcess
-
-
-section '.data' data readable writeable
- data resource from 'resources/resources.res'
- end data
-
- IncludeAllGlobals
-
-
-section '.idata' import data readable writeable
- include '%finc%/win32/allimports.asm'
-
DELETED examples/VisualPad/VisualPad.fpr
Index: examples/VisualPad/VisualPad.fpr
==================================================================
--- examples/VisualPad/VisualPad.fpr
+++ /dev/null
cannot compute difference between binary files
DELETED examples/VisualPad/actions.asm
Index: examples/VisualPad/actions.asm
==================================================================
--- examples/VisualPad/actions.asm
+++ /dev/null
@@ -1,119 +0,0 @@
-ImageChecked = 8
-
-iglobal
-
-ActionList MainActionList, MainAccels, \
- actNew, 0, '&New...', , 'Creates new file.', OnNew, \
- actOpen, 1, '&Open', , 'Open file', OnOpen, \
- actSave, 2, '&Save', , 'Save file', OnSave, \
- actSaveAs, -1, 'Save &As', , 'Save file with new name', OnSaveAs, \
- actExit, -1, '&Exit', , 'Exit program', OnExit, \
-\
- actUndo, 3, '&Undo', , 'Undo last change', OnUndo, \
- actCut , 4, 'Cu&t', , 'Cut to clipboard', OnCut, \
- actCopy, 5, '&Copy', , 'Copy to clipboard', OnCopy, \
- actPaste, 6, '&Paste', , 'Paste from clipboard', OnPaste
-
-
-CoolMenu MainMenu, \
- mfSubmenu, '&File', \
- mfNormal, actNew, \
- mfNormal, actOpen, \
- mfNormal, actSave, \
- mfNormal, actSaveAs, \
- mfSeparator, NONE, \
- mfNormal, actExit, \
- mfEnd, NONE, \
- mfSubmenu, '&Edit', \
- mfNormal, actUndo, \
- mfSeparator, NONE, \
- mfNormal, actCut, \
- mfNormal, actCopy, \
- mfNormal, actPaste, \
- mfEnd, NONE
-
-CoolToolbar MainToolbar, \
- bfButton, actNew, \
- bfButton, actOpen, \
- bfButton, actSave, \
- bfSeparator, NONE, \
- bfButton, actUndo, \
- bfSeparator, NONE, \
- bfButton, actCut, \
- bfButton, actCopy, \
- bfButton, actPaste
-
-endg
-
-
-proc OnNew, .wparam, .lparam
-begin
- invoke SendDlgItemMessageA, [hMainForm], 1, WM_SETTEXT, 0, 0
- return
-endp
-
-proc OnOpen, .wparam, .lparam
-begin
- invoke MessageBoxA, [hMainForm], \
- 'So, this is simply example. You have to write this action handler yourself. Check "actions.asm" to see where you should code it.', \
- 'Just an example.', MB_ICONINFORMATION or MB_OK
- return
-endp
-
-
-proc OnSave, .wparam, .lparam
-begin
- invoke MessageBoxA, [hMainForm], \
- 'So, this is simply example. You have to write this action handler yourself. Check "actions.asm" to see where you should code it.', \
- 'Just an example.', MB_ICONINFORMATION or MB_OK
- return
-endp
-
-proc OnSaveAs, .wparam, .lparam
-begin
- invoke MessageBoxA, [hMainForm], \
- 'So, this is simply example. You have to write this action handler yourself. Check "actions.asm" to see where you should code it.', \
- 'Just an example.', MB_ICONINFORMATION or MB_OK
- return
-endp
-
-proc OnExit, .wparam, .lparam
-begin
- invoke MessageBoxA, [hMainForm], \
- 'So, this is simply example. You have to write this action handler yourself. Check "actions.asm" to see where you should code it.', \
- 'Just an example.', MB_ICONINFORMATION or MB_OK
- return
-endp
-
-proc OnUndo, .wparam, .lparam
-begin
- invoke MessageBoxA, [hMainForm], \
- 'So, this is simply example. You have to write this action handler yourself. Check "actions.asm" to see where you should code it.', \
- 'Just an example.', MB_ICONINFORMATION or MB_OK
- return
-endp
-
-proc OnCut, .wparam, .lparam
-begin
- invoke MessageBoxA, [hMainForm], \
- 'So, this is simply example. You have to write this action handler yourself. Check "actions.asm" to see where you should code it.', \
- 'Just an example.', MB_ICONINFORMATION or MB_OK
- return
-endp
-
-proc OnCopy, .wparam, .lparam
-begin
- invoke MessageBoxA, [hMainForm], \
- 'So, this is simply example. You have to write this action handler yourself. Check "actions.asm" to see where you should code it.', \
- 'Just an example.', MB_ICONINFORMATION or MB_OK
- return
-endp
-
-proc OnPaste, .wparam, .lparam
-begin
- invoke MessageBoxA, [hMainForm], \
- 'So, this is simply example. You have to write this action handler yourself. Check "actions.asm" to see where you should code it.', \
- 'Just an example.', MB_ICONINFORMATION or MB_OK
- return
-endp
-
DELETED examples/VisualPad/resources/minimalistic.gif
Index: examples/VisualPad/resources/minimalistic.gif
==================================================================
--- examples/VisualPad/resources/minimalistic.gif
+++ /dev/null
cannot compute difference between binary files
DELETED examples/VisualPad/resources/resources.res
Index: examples/VisualPad/resources/resources.res
==================================================================
--- examples/VisualPad/resources/resources.res
+++ /dev/null
cannot compute difference between binary files
DELETED examples/VisualPad/resources/turtlemini.ico
Index: examples/VisualPad/resources/turtlemini.ico
==================================================================
--- examples/VisualPad/resources/turtlemini.ico
+++ /dev/null
cannot compute difference between binary files
DELETED examples/XLib/XLib.fpr
Index: examples/XLib/XLib.fpr
==================================================================
--- examples/XLib/XLib.fpr
+++ /dev/null
cannot compute difference between binary files
DELETED examples/XLib/Xlib.asm
Index: examples/XLib/Xlib.asm
==================================================================
--- examples/XLib/Xlib.asm
+++ /dev/null
@@ -1,21 +0,0 @@
-format ELF executable 3
-entry start
-
-include 'linux_inc/elf_import.inc'
-
-include 'linux_inc/_display.inc'
-include 'linux_inc/_globals.inc'
-include 'linux_inc/_stdcall.inc'
-include 'linux_inc/_struct.inc'
-include 'linux_inc/x.inc'
-include 'linux_inc/geometry.inc'
-
-segment readable executable
-include 'test.asm'
-
-segment readable writeable
-IncludeAllGlobals
-
-segment interpreter readable
-
-include 'linux_inc/allimports.asm'
DELETED examples/XLib/linux_inc/_display.inc
Index: examples/XLib/linux_inc/_display.inc
==================================================================
--- examples/XLib/linux_inc/_display.inc
+++ /dev/null
@@ -1,56 +0,0 @@
-iconWarning = 1
-iconError = 2
-iconInfo = 3
-iconFind = 4
-iconNone = 5
-iconDebug = 6
-
-
-macro __digit num
-{
- if num < 10
- display '0'+num
- else
- display 'A'+num-10
- end if
-}
-
-
-macro __disp arg1,arg2
-{
- if arg2 eq
- display arg1
- else
- local ..tmp
- ..tmp = arg1
- virtual at 0
- repeat 32
- if ..tmp > 0
- db ..tmp mod arg2
- ..tmp = ..tmp / arg2
- end if
- end repeat
- repeat $
- load ..tmp byte from $-%
- __digit ..tmp
- end repeat
- if $ = 0
- display '0'
- end if
- end virtual
- end if
-}
-
-macro disp [arg] { __disp arg }
-
-
-macro DispSize Text, Sz {
- if defined options.ShowSizes & options.ShowSizes
- disp 3,"Sizeof [", Text, "] is: "
- if Sz>10000
- disp , 'K',$0d,$0a
- else
- disp , ' bytes.',$0d,$0a
- end if
- end if
-}
DELETED examples/XLib/linux_inc/_globals.inc
Index: examples/XLib/linux_inc/_globals.inc
==================================================================
--- examples/XLib/linux_inc/_globals.inc
+++ /dev/null
@@ -1,150 +0,0 @@
-;**********************************************
-; Macroses for global variables handling.
-; This macro library is part of Fresh project.
-;
-; (C)2003, 2004
-;
-; Authors:
-; John Found
-; Tomasz Grisztar
-;
-; usage:
-; 1. Include this library in the begining
-; of your source file.
-; 2. Use it as blocks anywhere in the source.
-; iglobal
-; somelabel dd 1234h
-; otherlabel RECT
-; lbl3 db 12h
-; endg
-;
-; 3. Data section must be at the end of the
-; source file. Use 'IncludeAllGlobals' to
-; really define variables.
-;
-;**********************************************
-
-
-;------------------------------------------------------------------
-; use "iglobal" for inserting initialized global data definitions.
-;------------------------------------------------------------------
-macro iglobal {
- IGlobals equ IGlobals,
- macro __IGlobalBlock \{
-}
-
-
-;-------------------------------------------------------------
-; use 'uglobal' for inserting uninitialized global definitions.
-; even when you define some data values, these variables
-; will be stored as uninitialized data.
-;-------------------------------------------------------------
-macro uglobal {
- UGlobals equ UGlobals,
- macro __UGlobalBlock \{
-}
-
-; Use endg for ending iglobal and uglobal blocks.
-endg fix }
-
-
-macro IncludeIGlobals {
- macro IGlobals dummy, [n] \{
- __IGlobalBlock
- purge __IGlobalBlock
- \}
- match I, IGlobals \{
- I
- \}
-}
-
-
-macro IncludeUGlobals {
- macro UGlobals dummy, [n] \{
- \common
- \local begin, size
- begin = $
- virtual at $
- \forward
- __UGlobalBlock
- purge __UGlobalBlock
- \common
- size = $ - begin
- end virtual
- rb size
- \}
- match U, UGlobals \{
- U
- \}
-}
-
-
-macro CmpStr newtext, [lbl, text] {
-
- forward
- if newtext eq text
-
-
-}
-
-
-
-;--------------------------------------------
-; Use this macro to define non duplicated
-; string constants.
-;
-; constStr Str1, 'This is string constant'
-;--------------------------------------------
-macro constStr lbl, text {
- __StringsArray equ __StringsArray, lbl, text ;; add to the list
-}
-
-
-macro IncludeStringConstants {
- macro __StringsArray dummy, [lbls, text] \{
- forward
- if text eqtype 'A'
- align 4
-
- lbls db text
- sizeof.#lbls = $ - lbls
- dw 0
- else
- if text eqtype 0
- lbls = text
- end if
- end if
- \}
-
- match S, __StringsArray \{
- S
- \}
-}
-
-
-
-
-macro IncludeAllGlobals {
- local begin
-
- begin = $
- IncludeIGlobals
- DispSize 'Initialized data', ($ - begin)
-
- begin = $
- IncludeStringConstants
- DispSize 'String constants data', ($ - begin)
-
- begin = $
- IncludeUGlobals
- DispSize 'Uninitialized data', ($ - begin)
-}
-
-
-
-
-iglobal
-endg
-
-uglobal
-endg
DELETED examples/XLib/linux_inc/_stdcall.inc
Index: examples/XLib/linux_inc/_stdcall.inc
==================================================================
--- examples/XLib/linux_inc/_stdcall.inc
+++ /dev/null
@@ -1,330 +0,0 @@
-;-----------------------------------------
-; This file is part of Fresh standard
-; macro library.
-;-----------------------------------------
-
- INIT@CHAIN = 0
-
-
-macro locals {
- local ..locsize
- locsize equ ..locsize
- virtual at ebp - ..locsize - .__info.commonframe.size
- @@:
-}
-
-
-macro endl {
- rb (4 - ($- @b) and 11b) and 11b
- locsize = $ - @b
- if $-@b > maxsize
- maxsize = $-@b
- end if
- end virtual
- restore locsize
-}
-
-
-macro err@endp { }
-
-
-macro proc name, [arg] {
- common
- \err@endp
-
- macro err@endp \{
- end if
- Missing 'endp' or 'endwp' before the procedure.
- \}
-
- if ~ used name
- if defined options.ShowSkipped & options.ShowSkipped
- display 1,'Procedure skiped: ',`name, $0d, $0a
- end if
- else
-
- name:
- .__info.id = 1
-
- virtual at ebp+8
- if ~ arg eq
- forward
- arg dd ?
- if ~ defined name#arg
- ERROR! the argument `arg MUST begins with dot
- end if
- common
- end if
- .__info.argsize = $-ebp-8
- end virtual
-
- virtual at ebp - .__info.commonframe.size
- .__info.commonframe.begin:
-}
-
-
-macro begin {
- rb (4 - ($ - .__info.commonframe.begin) and 11b) and 11b
- .__info.commonframe.size = $ - .__info.commonframe.begin
- end virtual
-
- local ..maxsize
- maxsize equ ..maxsize
- ..maxsize = 0
-
- if .__info.framesize
- if defined options.FastEnter & options.FastEnter
- push ebp
- mov ebp, esp
- sub esp, .__info.framesize
- else
- enter .__info.framesize, 0
- end if
- else
- if .__info.argsize
- push ebp
- mov ebp, esp
- end if
- end if
-}
-
-
-macro cret {
- if .__info.argsize | .__info.framesize
- if ..FastEnter
- mov esp, ebp
- pop ebp
- else
- leave
- end if
- end if
- retn
-}
-
-
-macro return {
- if .__info.argsize | .__info.framesize
- if defined options.FastEnter & options.FastEnter
- mov esp, ebp
- pop ebp
- else
- leave
- end if
- end if
-
- if .__info.argsize
- retn .__info.argsize
- else
- retn
- end if
-}
-
-
-
-macro endp {
- .__info.framesize = maxsize + .__info.commonframe.size
- end if
- restore maxsize
- purge err@endp
-}
-
-
-
-macro winproc name, [arg] {
-common
-
- \err@endp
-
- macro err@endp \{
- end if
- Missing 'endp' or 'endwp' before the procedure.
- \}
-
-
- if ~ used name
- if defined options.ShowSkipped & options.ShowSkipped
- display 1,'Message procedure skiped: ',`name, $0d, $0a
- end if
- else
-
- name:
- .__info.id = 2
-
- if arg eq
- virtual at ebp+8
- .hwnd dd ?
- .wmsg dd ?
- .wparam dd ?
- .lparam dd ?
- .__info.argsize = 16
- end virtual
- else
- virtual at ebp+8
- forward
- arg dd ?
- if ~ defined name#arg
- ERROR! the argument `arg MUST begin with dot
- end if
- common
- .__info.argsize = $ - ebp - 8
- end virtual
- end if
-
- if .__info.argsize <> 16
- Error! The count of `name arguments MUST be 4 dwords.
- end if
-
- virtual at ebp - .__info.commonframe.size
- .__info.commonframe.begin:
-}
-
-
-
-macro ondefault { ; begins procedure instructions
- common
- local ..msgcounter, ..msglist
- msgcounter equ ..msgcounter
- msglist equ ..msglist
-
- ..msgcounter = 0
-
- call JumpTo
- ..msglist:
- rd .__info.msgcount
- dd 0
-
- .ondefault:
-}
-
-
-macro onmessage message {
- .#message:
- .#message#.__info.id = 3
- .#message#.__info.number = msgcounter / 4
- store word message at (msglist + msgcounter)
- store word ($ - msglist - msgcounter - 4 ) at (msglist + msgcounter + 2)
- msgcounter = msgcounter + 4
-}
-
-
-macro endwp {
- .__info.msgcount = msgcounter / 4
- .__info.framesize = maxsize + .__info.commonframe.size
- end if
- restore maxsize, msgcounter, msglist
- purge err@endp
-}
-
-
-macro initialize procname {
- INIT@CHAIN equ INIT@CHAIN, procname
- proc procname
-}
-
-macro finalize procname {
- FINISH@CHAIN equ FINISH@CHAIN,procname
- proc procname
-}
-
-;macro callchain dummy, [arg] {
-;common
-; call dummy
-;forward
-; call arg
-;}
-
-macro InitializeAll {
- macro INIT@CHAIN dummy, [n] \{
- \forward
- call n
- \}
-
- match I, INIT@CHAIN \{
- I
- \}
-}
-
-macro FinalizeAll {
- macro FINISH@CHAIN dummy, [n] \{
- \forward
- if n eqtype 1234
- call n
- end if
- \}
-
- match F, FINISH@CHAIN \{
- F
- \}
-}
-
-
-;*****************************************
-; Call macroses
-;*****************************************
-
-macro stdcall proc, [arg] { ; call procedure
-common
- local ..argsize
- ..argsize = 0
- if ~ arg eq
-reverse
- pushd arg
- ..argsize = ..argsize + 4
-common
- end if
- if defined options.CheckArguments & options.CheckArguments
- if (defined proc#.__info.argsize) & (proc#.__info.argsize <> ..argsize)
- ERROR! wrong argument count for procedure call.
- end if
- end if
-
- call proc
-}
-
-
-macro invoke proc,[arg] { ; invoke procedure (indirect)
-common
- if ~ arg eq
-reverse
- pushd arg
-common
- end if
- call [proc]
-}
-
-
-macro ccall proc,[arg] ; call procedure in C calling convention
- { common local ..size
- ..size = 0
- reverse
- pushd arg
- ..size = ..size+4
- common
- call proc
- add esp,..size }
-
-macro cinvoke proc,[arg] ; invoke procedure (indirect)
- { common
- if ~ arg eq
- ccall [proc],arg
- else
- call [proc]
- end if }
-
-
-;****************************************
-; INT3 break point, when first = second.
-;****************************************
-
-macro BreakEq first, second {
- local .lbl
- push eax
- mov eax, first
- cmp eax, second
- pop eax
- jne .lbl
-
- int3
-
-.lbl:
-}
DELETED examples/XLib/linux_inc/_struct.inc
Index: examples/XLib/linux_inc/_struct.inc
==================================================================
--- examples/XLib/linux_inc/_struct.inc
+++ /dev/null
@@ -1,20 +0,0 @@
-; structure definition helper
-
-macro struct name {
- macro name@struct \{ name name \}
- macro size@struct \{ sizeof.#name = $ \}
- struc name \{
-}
-
-
-ends fix } struct_helper
-
-
-macro struct_helper {
- virtual at 0
- name@struct
- size@struct
- end virtual
- purge name@struc
- purge size@struct
-}
DELETED examples/XLib/linux_inc/allimports.asm
Index: examples/XLib/linux_inc/allimports.asm
==================================================================
--- examples/XLib/linux_inc/allimports.asm
+++ /dev/null
@@ -1,790 +0,0 @@
-_importdata:
-interpreter '/lib/ld-linux.so.2'
-needed 'libc.so.6', 'libX11.so.6'
-import \
- XActivateScreenSaver ,\
- XAddConnectionWatch ,\
- XAddExtension ,\
- XAddHost ,\
- XAddHosts ,\
- XAddPixel ,\
- XAddToExtensionList ,\
- XAddToSaveSet ,\
- XAllPlanes ,\
- XAllocClassHint ,\
- XAllocColor ,\
- XAllocColorCells ,\
- XAllocColorPlanes ,\
- XAllocIconSize ,\
- XAllocNamedColor ,\
- XAllocSizeHints ,\
- XAllocStandardColormap ,\
- XAllocWMHints ,\
- XAllowEvents ,\
- XAutoRepeatOff ,\
- XAutoRepeatOn ,\
- XBaseFontNameListOfFontSet ,\
- XBell ,\
- XBitmapBitOrder ,\
- XBitmapPad ,\
- XBitmapUnit ,\
- XBlackPixel ,\
- XBlackPixelOfScreen ,\
- XCellsOfScreen ,\
- XChangeActivePointerGrab ,\
- XChangeGC ,\
- XChangeKeyboardControl ,\
- XChangeKeyboardMapping ,\
- XChangePointerControl ,\
- XChangeProperty ,\
- XChangeSaveSet ,\
- XChangeWindowAttributes ,\
- XCheckIfEvent ,\
- XCheckMaskEvent ,\
- XCheckTypedEvent ,\
- XCheckTypedWindowEvent ,\
- XCheckWindowEvent ,\
- XCirculateSubwindows ,\
- XCirculateSubwindowsDown ,\
- XCirculateSubwindowsUp ,\
- XClearArea ,\
- XClearWindow ,\
- XClipBox ,\
- XCloseDisplay ,\
- XCloseIM ,\
- XCloseOM ,\
- XConfigureWindow ,\
- XConnectionNumber ,\
- XContextDependentDrawing ,\
- XContextualDrawing ,\
- XConvertCase ,\
- XConvertSelection ,\
- XCopyArea ,\
- XCopyColormapAndFree ,\
- XCopyGC ,\
- XCopyPlane ,\
- XCreateBitmapFromData ,\
- XCreateColormap ,\
- XCreateFontCursor ,\
- XCreateFontSet ,\
- XCreateGC ,\
- XCreateGlyphCursor ,\
- XCreateIC ,\
- XCreateImage ,\
- XCreateOC ,\
- XCreatePixmap ,\
- XCreatePixmapCursor ,\
- XCreatePixmapFromBitmapData ,\
- XCreateRegion ,\
- XCreateSimpleWindow ,\
- XCreateWindow ,\
- XDefaultColormap ,\
- XDefaultColormapOfScreen ,\
- XDefaultDepth ,\
- XDefaultDepthOfScreen ,\
- XDefaultGC ,\
- XDefaultGCOfScreen ,\
- XDefaultRootWindow ,\
- XDefaultScreen ,\
- XDefaultScreenOfDisplay ,\
- XDefaultString ,\
- XDefaultVisual ,\
- XDefaultVisualOfScreen ,\
- XDefineCursor ,\
- XDeleteContext ,\
- XDeleteModifiermapEntry ,\
- XDeleteProperty ,\
- XDestroyIC ,\
- XDestroyImage ,\
- XDestroyOC ,\
- XDestroyRegion ,\
- XDestroySubwindows ,\
- XDestroyWindow ,\
- XDirectionalDependentDrawing ,\
- XDisableAccessControl ,\
- XDisplayCells ,\
- XDisplayHeight ,\
- XDisplayHeightMM ,\
- XDisplayKeycodes ,\
- XDisplayMotionBufferSize ,\
- XDisplayName ,\
- XDisplayOfIM ,\
- XDisplayOfOM ,\
- XDisplayOfScreen ,\
- XDisplayPlanes ,\
- XDisplayString ,\
- XDisplayWidth ,\
- XDisplayWidthMM ,\
- XDoesBackingStore ,\
- XDoesSaveUnders ,\
- XDrawArc ,\
- XDrawArcs ,\
- XDrawImageString ,\
- XDrawImageString16 ,\
- XDrawLine ,\
- XDrawLines ,\
- XDrawPoint ,\
- XDrawPoints ,\
- XDrawRectangle ,\
- XDrawRectangles ,\
- XDrawSegments ,\
- XDrawString ,\
- XDrawString16 ,\
- XDrawText ,\
- XDrawText16 ,\
- XEHeadOfExtensionList ,\
- XESetBeforeFlush ,\
- XESetCloseDisplay ,\
- XESetCopyGC ,\
- XESetCreateFont ,\
- XESetCreateGC ,\
- XESetError ,\
- XESetErrorString ,\
- XESetEventToWire ,\
- XESetFlushGC ,\
- XESetFreeFont ,\
- XESetFreeGC ,\
- XESetPrintErrorValues ,\
- XESetWireToError ,\
- XESetWireToEvent ,\
- XEmptyRegion ,\
- XEnableAccessControl ,\
- XEqualRegion ,\
- XEventMaskOfScreen ,\
- XEventsQueued ,\
- XExtendedMaxRequestSize ,\
- XExtentsOfFontSet ,\
- XFetchBuffer ,\
- XFetchBytes ,\
- XFetchName ,\
- XFillArc ,\
- XFillArcs ,\
- XFillPolygon ,\
- XFillRectangle ,\
- XFillRectangles ,\
- XFilterEvent ,\
- XFindContext ,\
- XFindOnExtensionList ,\
- XFlush ,\
- XFlushGC ,\
- XFontsOfFontSet ,\
- XForceScreenSaver ,\
- XFree ,\
- XFreeColormap ,\
- XFreeColors ,\
- XFreeCursor ,\
- XFreeExtensionList ,\
- XFreeFont ,\
- XFreeFontInfo ,\
- XFreeFontNames ,\
- XFreeFontPath ,\
- XFreeFontSet ,\
- XFreeGC ,\
- XFreeModifiermap ,\
- XFreePixmap ,\
- XFreeStringList ,\
- XGContextFromGC ,\
- XGeometry ,\
- XGetAtomName ,\
- XGetAtomNames ,\
- XGetClassHint ,\
- XGetCommand ,\
- XGetDefault ,\
- XGetErrorDatabaseText ,\
- XGetErrorText ,\
- XGetFontPath ,\
- XGetFontProperty ,\
- XGetGCValues ,\
- XGetGeometry ,\
- XGetICValues ,\
- XGetIMValues ,\
- XGetIconName ,\
- XGetIconSizes ,\
- XGetImage ,\
- XGetInputFocus ,\
- XGetKeyboardControl ,\
- XGetKeyboardMapping ,\
- XGetModifierMapping ,\
- XGetMotionEvents ,\
- XGetNormalHints ,\
- XGetOCValues ,\
- XGetOMValues ,\
- XGetPixel ,\
- XGetPointerControl ,\
- XGetPointerMapping ,\
- XGetRGBColormaps ,\
- XGetScreenSaver ,\
- XGetSelectionOwner ,\
- XGetSizeHints ,\
- XGetStandardColormap ,\
- XGetSubImage ,\
- XGetTextProperty ,\
- XGetTransientForHint ,\
- XGetVisualInfo ,\
- XGetWMClientMachine ,\
- XGetWMColormapWindows ,\
- XGetWMHints ,\
- XGetWMIconName ,\
- XGetWMName ,\
- XGetWMNormalHints ,\
- XGetWMProtocols ,\
- XGetWMSizeHints ,\
- XGetWindowAttributes ,\
- XGetWindowProperty ,\
- XGetZoomHints ,\
- XGrabButton ,\
- XGrabKey ,\
- XGrabKeyboard ,\
- XGrabPointer ,\
- XGrabServer ,\
- XHeightMMOfScreen ,\
- XHeightOfScreen ,\
- XIMOfIC ,\
- XIconifyWindow ,\
- XIfEvent ,\
- XImageByteOrder ,\
- XInitExtension ,\
- XInitImage ,\
- XInitThreads ,\
- XInsertModifiermapEntry ,\
- XInstallColormap ,\
- XInternAtom ,\
- XInternAtoms ,\
- XInternalConnectionNumbers ,\
- XIntersectRegion ,\
- XKeycodeToKeysym ,\
- XKeysymToKeycode ,\
- XKeysymToString ,\
- XKillClient ,\
- XLastKnownRequestProcessed ,\
- XListDepths ,\
- XListExtensions ,\
- XListFonts ,\
- XListFontsWithInfo ,\
- XListHosts ,\
- XListInstalledColormaps ,\
- XListPixmapFormats ,\
- XListProperties ,\
- XLoadFont ,\
- XLoadQueryFont ,\
- XLocaleOfFontSet ,\
- XLocaleOfIM ,\
- XLocaleOfOM ,\
- XLockDisplay ,\
- XLookupColor ,\
- XLookupKeysym ,\
- XLookupString ,\
- XLowerWindow ,\
- XMapRaised ,\
- XMapSubwindows ,\
- XMapWindow ,\
- XMaskEvent ,\
- XMatchVisualInfo ,\
- XMaxCmapsOfScreen ,\
- XMaxRequestSize ,\
- XMinCmapsOfScreen ,\
- XMoveResizeWindow ,\
- XMoveWindow ,\
- XNewModifiermap ,\
- XNextEvent ,\
- XNextRequest ,\
- XNoOp ,\
- XOMOfOC ,\
- XOffsetRegion ,\
- XOpenDisplay ,\
- XOpenIM ,\
- XOpenOM ,\
- XParseColor ,\
- XParseGeometry ,\
- XPeekEvent ,\
- XPeekIfEvent ,\
- XPending ,\
- XPlanesOfScreen ,\
- XPointInRegion ,\
- XPolygonRegion ,\
- XProcessInternalConnection ,\
- XProtocolRevision ,\
- XProtocolVersion ,\
- XPutBackEvent ,\
- XPutImage ,\
- XPutPixel ,\
- XQLength ,\
- XQueryBestCursor ,\
- XQueryBestSize ,\
- XQueryBestStipple ,\
- XQueryBestTile ,\
- XQueryColor ,\
- XQueryColors ,\
- XQueryExtension ,\
- XQueryFont ,\
- XQueryKeymap ,\
- XQueryPointer ,\
- XQueryTextExtents ,\
- XQueryTextExtents16 ,\
- XQueryTree ,\
- XRaiseWindow ,\
- XReadBitmapFile ,\
- XReadBitmapFileData ,\
- XRebindKeysym ,\
- XRecolorCursor ,\
- XReconfigureWMWindow ,\
- XRectInRegion ,\
- XRefreshKeyboardMapping ,\
- XRegisterIMInstantiateCallback ,\
- XRemoveConnectionWatch ,\
- XRemoveFromSaveSet ,\
- XRemoveHost ,\
- XRemoveHosts ,\
- XReparentWindow ,\
- XResetScreenSaver ,\
- XResizeWindow ,\
- XResourceManagerString ,\
- XRestackWindows ,\
- XRootWindow ,\
- XRootWindowOfScreen ,\
- XRotateBuffers ,\
- XRotateWindowProperties ,\
- XSaveContext ,\
- XScreenCount ,\
- XScreenNumberOfScreen ,\
- XScreenOfDisplay ,\
- XScreenResourceString ,\
- XSelectInput ,\
- XSendEvent ,\
- XServerVendor ,\
- XSetAccessControl ,\
- XSetAfterFunction ,\
- XSetArcMode ,\
- XSetAuthorization ,\
- XSetBackground ,\
- XSetClassHint ,\
- XSetClipMask ,\
- XSetClipOrigin ,\
- XSetClipRectangles ,\
- XSetCloseDownMode ,\
- XSetCommand ,\
- XSetDashes ,\
- XSetErrorHandler ,\
- XSetFillRule ,\
- XSetFillStyle ,\
- XSetFont ,\
- XSetFontPath ,\
- XSetForeground ,\
- XSetFunction ,\
- XSetGraphicsExposures ,\
- XSetICFocus ,\
- XSetICValues ,\
- XSetIMValues ,\
- XSetIOErrorHandler ,\
- XSetIconName ,\
- XSetIconSizes ,\
- XSetInputFocus ,\
- XSetLineAttributes ,\
- XSetLocaleModifiers ,\
- XSetModifierMapping ,\
- XSetNormalHints ,\
- XSetOCValues ,\
- XSetOMValues ,\
- XSetPlaneMask ,\
- XSetPointerMapping ,\
- XSetRGBColormaps ,\
- XSetRegion ,\
- XSetScreenSaver ,\
- XSetSelectionOwner ,\
- XSetSizeHints ,\
- XSetStandardColormap ,\
- XSetStandardProperties ,\
- XSetState ,\
- XSetStipple ,\
- XSetSubwindowMode ,\
- XSetTSOrigin ,\
- XSetTextProperty ,\
- XSetTile ,\
- XSetTransientForHint ,\
- XSetWMClientMachine ,\
- XSetWMColormapWindows ,\
- XSetWMHints ,\
- XSetWMIconName ,\
- XSetWMName ,\
- XSetWMNormalHints ,\
- XSetWMProperties ,\
- XSetWMProtocols ,\
- XSetWMSizeHints ,\
- XSetWindowBackground ,\
- XSetWindowBackgroundPixmap ,\
- XSetWindowBorder ,\
- XSetWindowBorderPixmap ,\
- XSetWindowBorderWidth ,\
- XSetWindowColormap ,\
- XSetZoomHints ,\
- XShrinkRegion ,\
- XStoreBuffer ,\
- XStoreBytes ,\
- XStoreColor ,\
- XStoreColors ,\
- XStoreName ,\
- XStoreNamedColor ,\
- XStringListToTextProperty ,\
- XStringToKeysym ,\
- XSubImage ,\
- XSubtractRegion ,\
- XSupportsLocale ,\
- XSync ,\
- XSynchronize ,\
- XTextExtents ,\
- XTextExtents16 ,\
- XTextPropertyToStringList ,\
- XTextWidth ,\
- XTextWidth16 ,\
- XTranslateCoordinates ,\
- XUndefineCursor ,\
- XUngrabButton ,\
- XUngrabKey ,\
- XUngrabKeyboard ,\
- XUngrabPointer ,\
- XUngrabServer ,\
- XUninstallColormap ,\
- XUnionRectWithRegion ,\
- XUnionRegion ,\
- XUnloadFont ,\
- XUnlockDisplay ,\
- XUnmapSubwindows ,\
- XUnmapWindow ,\
- XUnregisterIMInstantiateCallback ,\
- XUnsetICFocus ,\
- XVaCreateNestedList ,\
- XVendorRelease ,\
- XVisualIDFromVisual ,\
- XWMGeometry ,\
- XWarpPointer ,\
- XWhitePixel ,\
- XWhitePixelOfScreen ,\
- XWidthMMOfScreen ,\
- XWidthOfScreen ,\
- XWindowEvent ,\
- XWithdrawWindow ,\
- XWriteBitmapFile ,\
- XXorRegion ,\
- XcmsAddColorSpace ,\
- XcmsAddFunctionSet ,\
- XcmsAllocColor ,\
- XcmsAllocNamedColor ,\
- XcmsCCCOfColormap ,\
- XcmsCIELabClipL ,\
- XcmsCIELabClipLab ,\
- XcmsCIELabClipab ,\
- XcmsCIELabColorSpace ,\
- XcmsCIELabQueryMaxC ,\
- XcmsCIELabQueryMaxL ,\
- XcmsCIELabQueryMaxLC ,\
- XcmsCIELabQueryMinL ,\
- XcmsCIELabToCIEXYZ ,\
- XcmsCIELabWhiteShiftColors ,\
- XcmsCIELuvClipL ,\
- XcmsCIELuvClipLuv ,\
- XcmsCIELuvClipuv ,\
- XcmsCIELuvColorSpace ,\
- XcmsCIELuvQueryMaxC ,\
- XcmsCIELuvQueryMaxL ,\
- XcmsCIELuvQueryMaxLC ,\
- XcmsCIELuvQueryMinL ,\
- XcmsCIELuvToCIEuvY ,\
- XcmsCIELuvWhiteShiftColors ,\
- XcmsCIEXYZColorSpace ,\
- XcmsCIEXYZToCIELab ,\
- XcmsCIEXYZToCIEuvY ,\
- XcmsCIEXYZToCIExyY ,\
- XcmsCIEXYZToRGBi ,\
- XcmsCIEuvYColorSpace ,\
- XcmsCIEuvYToCIELuv ,\
- XcmsCIEuvYToCIEXYZ ,\
- XcmsCIEuvYToTekHVC ,\
- XcmsCIExyYColorSpace ,\
- XcmsCIExyYToCIEXYZ ,\
- XcmsClientWhitePointOfCCC ,\
- XcmsConvertColors ,\
- XcmsCreateCCC ,\
- XcmsDefaultCCC ,\
- XcmsDisplayOfCCC ,\
- XcmsFormatOfPrefix ,\
- XcmsFreeCCC ,\
- XcmsLinearRGBFunctionSet ,\
- XcmsLookupColor ,\
- XcmsPrefixOfFormat ,\
- XcmsQueryBlack ,\
- XcmsQueryBlue ,\
- XcmsQueryColor ,\
- XcmsQueryColors ,\
- XcmsQueryGreen ,\
- XcmsQueryRed ,\
- XcmsQueryWhite ,\
- XcmsRGBColorSpace ,\
- XcmsRGBToRGBi ,\
- XcmsRGBiColorSpace ,\
- XcmsRGBiToCIEXYZ ,\
- XcmsRGBiToRGB ,\
- XcmsScreenNumberOfCCC ,\
- XcmsScreenWhitePointOfCCC ,\
- XcmsSetCCCOfColormap ,\
- XcmsSetCompressionProc ,\
- XcmsSetWhiteAdjustProc ,\
- XcmsSetWhitePoint ,\
- XcmsStoreColor ,\
- XcmsStoreColors ,\
- XcmsTekHVCClipC ,\
- XcmsTekHVCClipV ,\
- XcmsTekHVCClipVC ,\
- XcmsTekHVCColorSpace ,\
- XcmsTekHVCQueryMaxC ,\
- XcmsTekHVCQueryMaxV ,\
- XcmsTekHVCQueryMaxVC ,\
- XcmsTekHVCQueryMaxVSamples ,\
- XcmsTekHVCQueryMinV ,\
- XcmsTekHVCToCIEuvY ,\
- XcmsTekHVCWhiteShiftColors ,\
- XcmsUNDEFINEDColorSpace ,\
- XcmsVisualOfCCC ,\
- XkbAddDeviceLedInfo ,\
- XkbAddGeomColor ,\
- XkbAddGeomDoodad ,\
- XkbAddGeomKey ,\
- XkbAddGeomKeyAlias ,\
- XkbAddGeomOutline ,\
- XkbAddGeomOverlay ,\
- XkbAddGeomOverlayKey ,\
- XkbAddGeomOverlayRow ,\
- XkbAddGeomProperty ,\
- XkbAddGeomRow ,\
- XkbAddGeomSection ,\
- XkbAddGeomShape ,\
- XkbAddKeyType ,\
- XkbAllocClientMap ,\
- XkbAllocCompatMap ,\
- XkbAllocControls ,\
- XkbAllocDeviceInfo ,\
- XkbAllocGeomColors ,\
- XkbAllocGeomDoodads ,\
- XkbAllocGeomKeyAliases ,\
- XkbAllocGeomKeys ,\
- XkbAllocGeomOutlines ,\
- XkbAllocGeomOverlayKeys ,\
- XkbAllocGeomOverlayRows ,\
- XkbAllocGeomOverlays ,\
- XkbAllocGeomPoints ,\
- XkbAllocGeomProps ,\
- XkbAllocGeomRows ,\
- XkbAllocGeomSectionDoodads ,\
- XkbAllocGeomSections ,\
- XkbAllocGeomShapes ,\
- XkbAllocGeometry ,\
- XkbAllocIndicatorMaps ,\
- XkbAllocKeyboard ,\
- XkbAllocNames ,\
- XkbAllocServerMap ,\
- XkbApplyCompatMapToKey ,\
- XkbApplyVirtualModChanges ,\
- XkbBell ,\
- XkbBellEvent ,\
- XkbChangeDeviceInfo ,\
- XkbChangeEnabledControls ,\
- XkbChangeKeycodeRange ,\
- XkbChangeMap ,\
- XkbChangeNames ,\
- XkbChangeTypesOfKey ,\
- XkbComputeEffectiveMap ,\
- XkbComputeRowBounds ,\
- XkbComputeSectionBounds ,\
- XkbComputeShapeBounds ,\
- XkbComputeShapeTop ,\
- XkbCopyKeyType ,\
- XkbCopyKeyTypes ,\
- XkbDeviceBell ,\
- XkbDeviceBellEvent ,\
- XkbFindOverlayForKey ,\
- XkbForceBell ,\
- XkbForceDeviceBell ,\
- XkbFreeClientMap ,\
- XkbFreeCompatMap ,\
- XkbFreeComponentList ,\
- XkbFreeControls ,\
- XkbFreeDeviceInfo ,\
- XkbFreeGeomColors ,\
- XkbFreeGeomDoodads ,\
- XkbFreeGeomKeyAliases ,\
- XkbFreeGeomKeys ,\
- XkbFreeGeomOutlines ,\
- XkbFreeGeomOverlayKeys ,\
- XkbFreeGeomOverlayRows ,\
- XkbFreeGeomOverlays ,\
- XkbFreeGeomPoints ,\
- XkbFreeGeomProperties ,\
- XkbFreeGeomRows ,\
- XkbFreeGeomSections ,\
- XkbFreeGeomShapes ,\
- XkbFreeGeometry ,\
- XkbFreeIndicatorMaps ,\
- XkbFreeKeyboard ,\
- XkbFreeNames ,\
- XkbFreeServerMap ,\
- XkbGetAutoRepeatRate ,\
- XkbGetAutoResetControls ,\
- XkbGetCompatMap ,\
- XkbGetControls ,\
- XkbGetDetectableAutoRepeat ,\
- XkbGetDeviceButtonActions ,\
- XkbGetDeviceInfo ,\
- XkbGetDeviceInfoChanges ,\
- XkbGetDeviceLedInfo ,\
- XkbGetGeometry ,\
- XkbGetIndicatorMap ,\
- XkbGetIndicatorState ,\
- XkbGetKeyActions ,\
- XkbGetKeyBehaviors ,\
- XkbGetKeyExplicitComponents ,\
- XkbGetKeyModifierMap ,\
- XkbGetKeySyms ,\
- XkbGetKeyTypes ,\
- XkbGetKeyVirtualModMap ,\
- XkbGetKeyboard ,\
- XkbGetKeyboardByName ,\
- XkbGetMap ,\
- XkbGetMapChanges ,\
- XkbGetNamedDeviceIndicator ,\
- XkbGetNamedGeometry ,\
- XkbGetNamedIndicator ,\
- XkbGetNames ,\
- XkbGetPerClientControls ,\
- XkbGetState ,\
- XkbGetUpdatedMap ,\
- XkbGetVirtualMods ,\
- XkbGetXlibControls ,\
- XkbIgnoreExtension ,\
- XkbInitCanonicalKeyTypes ,\
- XkbKeyTypesForCoreSymbols ,\
- XkbKeycodeToKeysym ,\
- XkbKeysymToModifiers ,\
- XkbLatchGroup ,\
- XkbLatchModifiers ,\
- XkbLibraryVersion ,\
- XkbListComponents ,\
- XkbLockGroup ,\
- XkbLockModifiers ,\
- XkbLookupKeyBinding ,\
- XkbLookupKeySym ,\
- XkbNoteControlsChanges ,\
- XkbNoteDeviceChanges ,\
- XkbNoteMapChanges ,\
- XkbNoteNameChanges ,\
- XkbOpenDisplay ,\
- XkbQueryExtension ,\
- XkbRefreshKeyboardMapping ,\
- XkbResizeDeviceButtonActions ,\
- XkbResizeKeyActions ,\
- XkbResizeKeySyms ,\
- XkbResizeKeyType ,\
- XkbSelectEventDetails ,\
- XkbSelectEvents ,\
- XkbSetAtomFuncs ,\
- XkbSetAutoRepeatRate ,\
- XkbSetAutoResetControls ,\
- XkbSetCompatMap ,\
- XkbSetControls ,\
- XkbSetDebuggingFlags ,\
- XkbSetDetectableAutoRepeat ,\
- XkbSetDeviceButtonActions ,\
- XkbSetDeviceInfo ,\
- XkbSetDeviceLedInfo ,\
- XkbSetGeometry ,\
- XkbSetIgnoreLockMods ,\
- XkbSetIndicatorMap ,\
- XkbSetMap ,\
- XkbSetNamedDeviceIndicator ,\
- XkbSetNamedIndicator ,\
- XkbSetNames ,\
- XkbSetPerClientControls ,\
- XkbSetServerInternalMods ,\
- XkbSetXlibControls ,\
- XkbToControl ,\
- XkbTranslateKey ,\
- XkbTranslateKeyCode ,\
- XkbTranslateKeySym ,\
- XkbUpdateActionVirtualMods ,\
- XkbUpdateKeyTypeVirtualMods ,\
- XkbUpdateMapFromCore ,\
- XkbUseExtension ,\
- XkbVirtualModsToReal ,\
- XkbXlibControlsImplemented ,\
- XmbDrawImageString ,\
- XmbDrawString ,\
- XmbDrawText ,\
- XmbLookupString ,\
- XmbResetIC ,\
- XmbSetWMProperties ,\
- XmbTextEscapement ,\
- XmbTextExtents ,\
- XmbTextListToTextProperty ,\
- XmbTextPerCharExtents ,\
- XmbTextPropertyToTextList ,\
- Xpermalloc ,\
- XrmCombineDatabase ,\
- XrmCombineFileDatabase ,\
- XrmDestroyDatabase ,\
- XrmEnumerateDatabase ,\
- XrmGetDatabase ,\
- XrmGetFileDatabase ,\
- XrmGetResource ,\
- XrmGetStringDatabase ,\
- XrmInitialize ,\
- XrmLocaleOfDatabase ,\
- XrmMergeDatabases ,\
- XrmParseCommand ,\
- XrmPermStringToQuark ,\
- XrmPutFileDatabase ,\
- XrmPutLineResource ,\
- XrmPutResource ,\
- XrmPutStringResource ,\
- XrmQGetResource ,\
- XrmQGetSearchList ,\
- XrmQGetSearchResource ,\
- XrmQPutResource ,\
- XrmQPutStringResource ,\
- XrmQuarkToString ,\
- XrmSetDatabase ,\
- XrmStringToBindingQuarkList ,\
- XrmStringToQuark ,\
- XrmStringToQuarkList ,\
- XrmUniqueQuark ,\
- Xutf8DrawImageString ,\
- Xutf8DrawString ,\
- Xutf8DrawText ,\
- Xutf8LookupString ,\
- Xutf8ResetIC ,\
- Xutf8SetWMProperties ,\
- Xutf8TextEscapement ,\
- Xutf8TextExtents ,\
- Xutf8TextListToTextProperty ,\
- Xutf8TextPerCharExtents ,\
- Xutf8TextPropertyToTextList ,\
- XwcDrawImageString ,\
- XwcDrawString ,\
- XwcDrawText ,\
- XwcFreeStringList ,\
- XwcLookupString ,\
- XwcResetIC ,\
- XwcTextEscapement ,\
- XwcTextExtents ,\
- XwcTextListToTextProperty ,\
- XwcTextPerCharExtents ,\
- XwcTextPropertyToTextList ,\
- XUniqueContext ,\
- puts ,\
- exit ,\
- malloc ,\
- free ,\
- realloc ,\
- stime
-
-
-
-
-DispSize 'ELF Import data:', $-_importdata
DELETED examples/XLib/linux_inc/elf_import.inc
Index: examples/XLib/linux_inc/elf_import.inc
==================================================================
--- examples/XLib/linux_inc/elf_import.inc
+++ /dev/null
@@ -1,215 +0,0 @@
-; macroinstruction for importing functions in Linux
-
-macro Elf32_Sym name,value,size,bind,type,other,shndx
-{
- dd name+0
- dd value+0
- dd size+0
- db (bind+0) shl 4 + (type+0)
- db other+0
- dw shndx+0
-}
-
-virtual at 0
- Elf32_Sym
- sizeof.Elf32_Sym = $
-end virtual
-
-macro Elf32_Rel offset,symbol,type
-{
- dd offset+0
- dd (symbol+0) shl 8 + (type+0)
-}
-
-virtual at 0
- Elf32_Rel
- sizeof.Elf32_Rel = $
-end virtual
-
-macro Elf32_Rela offset,symbol,type,addend
-{
- dd offset+0
- dd (symbol+0) shl 8 + (type+0)
- dd addend+0
-}
-
-virtual at 0
- Elf32_Rela
- sizeof.Elf32_Rela = $
-end virtual
-
-macro Elf64_Sym name,value,size,bind,type,other,shndx
-{
- dd name+0
- db (bind+0) shl 4 + (type+0)
- db other+0
- dw shndx+0
- dq value+0
- dq size+0
-}
-
-virtual at 0
- Elf64_Sym
- sizeof.Elf64_Sym = $
-end virtual
-
-macro Elf64_Rel offset,symbol,type
-{
- dq offset+0
- dq (symbol+0) shl 32 + (type+0)
-}
-
-virtual at 0
- Elf64_Rel
- sizeof.Elf64_Rel = $
-end virtual
-
-macro Elf64_Rela offset,symbol,type,addend
-{
- dq offset+0
- dq (symbol+0) shl 32 + (type+0)
- dq addend+0
-}
-
-virtual at 0
- Elf64_Rela
- sizeof.Elf64_Rela = $
-end virtual
-
-DT_NULL = 0
-DT_NEEDED = 1
-DT_HASH = 4
-DT_STRTAB = 5
-DT_SYMTAB = 6
-DT_RELA = 7
-DT_RELASZ = 8
-DT_RELAENT = 9
-DT_STRSZ = 10
-DT_SYMENT = 11
-DT_REL = 17
-DT_RELSZ = 18
-DT_RELENT = 19
-
-STB_LOCAL = 0
-STB_GLOBAL = 1
-STB_WEAK = 2
-
-STT_NOTYPE = 0
-STT_OBJECT = 1
-STT_FUNC = 2
-STT_SECTION = 3
-STT_FILE = 4
-
-R_386_NONE = 0
-R_386_32 = 1
-R_386_PC32 = 2
-R_386_GOT32 = 3
-R_386_PLT32 = 4
-R_386_COPY = 5
-R_386_GLOB_DAT = 6
-R_386_JMP_SLOT = 7
-R_386_RELATIVE = 8
-R_386_GOTOFF = 9
-R_386_GOTPC = 10
-
-R_X86_64_NONE = 0
-R_X86_64_64 = 1
-R_X86_64_PC32 = 2
-R_X86_64_GOT32 = 3
-R_X86_64_PLT32 = 4
-R_X86_64_COPY = 5
-R_X86_64_GLOB_DAT = 6
-R_X86_64_JUMP_SLOT = 7
-R_X86_64_RELATIVE = 8
-R_X86_64_GOTPCREL = 9
-R_X86_64_32 = 10
-R_X86_64_32S = 11
-R_X86_64_16 = 12
-R_X86_64_PC16 = 13
-R_X86_64_8 = 14
-R_X86_64_PC8 = 15
-R_X86_64_DPTMOD64 = 16
-R_X86_64_DTPOFF64 = 17
-R_X86_64_TPOFF64 = 18
-R_X86_64_TLSGD = 19
-R_X86_64_TLSLD = 20
-R_X86_64_DTPOFF32 = 21
-R_X86_64_GOTTPOFF = 22
-R_X86_64_TPOFF32 = 23
-R_X86_64_PC64 = 24
-R_X86_64_GOTOFF64 = 25
-R_X86_64_GOTPC32 = 26
-
-
-
-macro interpreter [library]
-{
- db library,0
-}
-
-macro needed [library]
-{
- local str
- match needed,needed@dynamic \{ define needed@dynamic needed,str:library \}
- match ,needed@dynamic \{ define needed@dynamic str:library \}
-}
-define needed@dynamic
-
-macro import [name]
-{
- common
- local strtab,strsz,symtab,rel,relsz,hash
- segment dynamic readable
- match needed,needed@dynamic
- \{ irp item,needed \\{ match str:library,item \\\{ dd DT_NEEDED,str-strtab \\\} \\} \}
- dd DT_STRTAB,strtab
- dd DT_STRSZ,strsz
- dd DT_SYMTAB,symtab
- dd DT_SYMENT,sizeof.Elf32_Sym
- dd DT_REL,rel
- dd DT_RELSZ,relsz
- dd DT_RELENT,sizeof.Elf32_Rel
- dd DT_HASH,hash
- dd DT_NULL,0
- segment readable writeable
- symtab: Elf32_Sym
- forward
- if used name
- local fstr
- Elf32_Sym fstr-strtab,0,0,STB_GLOBAL,STT_FUNC,0,0
- end if
- common
- rel:
- local counter
- counter = 1
- forward
- if used name
- Elf32_Rel name,counter,R_386_32
- counter = counter+1
- end if
- common
- relsz = $-rel
- hash:
- dd 1,counter
- dd 0
- repeat counter
- if %=counter
- dd 0
- else
- dd %
- end if
- end repeat
- strtab db 0
- forward
- if used name
- fstr db `name,0
- end if
- common
- match needed,needed@dynamic
- \{ irp item,needed \\{ match str:library,item \\\{ str db library,0 \\\} \\} \}
- strsz = $-strtab
- forward
- if used name
- name dd 0
- end if
-}
DELETED examples/XLib/linux_inc/geometry.inc
Index: examples/XLib/linux_inc/geometry.inc
==================================================================
--- examples/XLib/linux_inc/geometry.inc
+++ /dev/null
@@ -1,11 +0,0 @@
-struct RECT
- .left dd ?
- .top dd ?
- .right dd ?
- .bottom dd ?
-ends
-
-struct POINT
- .x dd ?
- .y dd ?
-ends
DELETED examples/XLib/linux_inc/x.inc
Index: examples/XLib/linux_inc/x.inc
==================================================================
--- examples/XLib/linux_inc/x.inc
+++ /dev/null
@@ -1,1188 +0,0 @@
-
-; X Protocol
- X_PROTOCOL = 11
- X_PROTOCOL_REVISION = 0
-
-;X Constants
-
-None = 0
-ParentRelative = 1
-CopyFromParent = 0
-PointerWindow = 0
-InputFocus = 1
-PointerRoot = 1
-AnyPropertyType = 0
-AnyKey = 0
-AnyButton = 0
-AllTemporary = 0
-CurrentTime = 0
-NoSymbol = 0
-
-;Event Masks
-
-NoEventMask = 0h
-KeyPressMask = 1h
-KeyReleaseMask = 2h
-ButtonPressMask = 4h
-ButtonReleaseMask = 8h
-EnterWindowMask = 10h
-LeaveWindowMask = 20h
-PointerMotionMask = 40h
-PointerMotionHintMask = 80h
-Button1MotionMask = 100h
-Button2MotionMask = 200h
-Button3MotionMask = 400h
-Button4MotionMask = 800h
-Button5MotionMask = 1000h
-ButtonMotionMask = 2000h
-KeymapStateMask = 4000h
-ExposureMask = 8000h
-VisibilityChangeMask = 10000h
-StructureNotifyMask = 20000h
-ResizeRedirectMask = 40000h
-SubstructureNotifyMask = 80000h
-SubstructureRedirectMask = 100000h
-FocusChangeMask = 200000h
-PropertyChangeMask = 400000h
-ColormapChangeMask = 800000h
-OwnerGrabButtonMask = 1000000h
-
-AllEventsMask = 1fbff7fh ;1ffffffh
-
-
-
-
-;Event Names
-
-KeyPress = 2
-KeyRelease = 3
-ButtonPress = 4
-ButtonRelease = 5
-MotionNotify = 6
-EnterNotify = 7
-LeaveNotify = 8
-FocusIn = 9
-FocusOut = 10
-KeymapNotify = 11
-Expose = 12
-GraphicsExpose = 13
-NoExpose = 14
-VisibilityNotify = 15
-CreateNotify = 16
-DestroyNotify = 17
-UnmapNotify = 18
-MapNotify = 19
-MapRequest = 20
-ReparentNotify = 21
-ConfigureNotify = 22
-ConfigureRequest = 23
-GravityNotify = 24
-ResizeRequest = 25
-CirculateNotify = 26
-CirculateRequest = 27
-PropertyNotify = 28
-SelectionClear = 29
-SelectionRequest = 30
-SelectionNotify = 31
-ColormapNotify = 32
-ClientMessage = 33
-MappingNotify = 34
-LASTEvent = 35
-
-;Key Masks
-
-ShiftMask = 1h
-LockMask = 2h
-ControlMask = 4h
-Mod1Mask = 8h
-Mod2Mask = 10h
-Mod3Mask = 20h
-Mod4Mask = 40h
-Mod5Mask = 80h
-
-;Modifier Names
-
-ShiftMapIndex = 0
-LockMapIndex = 1
-ControlMapIndex = 2
-Mod1MapIndex = 3
-Mod2MapIndex = 4
-Mod3MapIndex = 5
-Mod4MapIndex = 6
-Mod5MapIndex = 7
-
-;Button Masks
-
-Button1Mask = 100h
-Button2Mask = 200h
-Button3Mask = 400h
-Button4Mask = 800h
-Button5Mask = 1000h
-AnyModifier = 10000h
-
-;Button Names
-
-Button1 = 1
-Button2 = 2
-Button3 = 3
-Button4 = 4
-Button5 = 5
-
-;Notify Modes
-NotifyNormal = 0
-NotifyGrab = 1
-NotifyUngrab = 2
-NotifyWhileGrabbed = 3
-NotifyHint = 1
-
-;Notify Detail
-
-NotifyAncestor = 0
-NotifyVirtual = 1
-NotifyInferior = 2
-NotifyNonlinear = 3
-NotifyNonlinearVirtual = 4
-NotifyPointer = 5
-NotifyPointerRoot = 6
-NotifyDetailNone = 7
-
-;Visibility Notify
-
-VisibilityUnobscured = 0
-VisibilityPartiallyObscured = 1
-VisibilityFullyObscured = 2
-
-;Circulation request
-
-PlaceOnTop = 0
-PlaceOnBottom = 1
-
-;Protocol Families
-
-FamilyInternet = 0
-FamilyDECnet = 1
-FamilyChaos = 2
-FamilyInternet6 = 6
-
-;Unspecific authentication families
-
-FamilyServerInterpreted = 5
-
-;Property Notification
-
-PropertyNewValue = 0
-PropertyDelete = 1
-
-;Color Map notification
-
-ColormapUninstalled = 0
-ColormapInstalled = 1
-
-;Grab Modes
-GrabModeSync = 0
-GrabModeAsync = 1
-
-;Grab reply status
-GrabSuccess = 0
-AlreadyGrabbed = 1
-GrabInvalidTime = 2
-GrabNotViewable = 3
-GrabFrozen = 4
-
-;AllowEvents modes
-AsyncPointer = 0
-SyncPointer = 1
-ReplayPointer = 2
-AsyncKeyboard = 3
-SyncKeyboard = 4
-ReplayKeyboard = 5
-AsyncBoth = 6
-SyncBoth = 7
-
-;InputFocus specific
-
-RevertToNone = None
-RevertToPointerRoot = PointerRoot
-RevertToParent = 2
-
-;Error Codes
-Success = 0
-BadRequest = 1
-BadValue = 2
-BadWindow = 3
-BadPixmap = 4
-BadAtom = 5
-BadCursor = 6
-BadFont = 7
-BadMatch = 8
-BadDrawable = 9
-BadAccess = 10
-BadAlloc = 11
-BadColor = 12
-BadGC = 13
-BadIDChoice = 14
-BadName = 15
-BadLength = 16
-BadImplementation = 17
-FirstExtensionError = 128
-LastExtensionError = 255
-
-;Window Classes
-
-InputOutput = 1
-InputOnly = 2
-
-;Window Attributes
-CWBackPixmap = 1h
-CWBackPixel = 2h
-CWBorderPixmap = 4h
-CWBorderPixel = 8h
-CWBitGravity = 10h
-CWWinGravity = 20h
-CWBackingStore = 40h
-CWBackingPlanes = 80h
-CWBackingPixel = 100h
-CWOverrideRedirect = 200h
-CWSaveUnder = 400h
-CWEventMask = 800h
-CWDontPropagate = 1000h
-CWColormap = 2000h
-CWCursor = 4000h
-
-;ConfigureWindow Structure
-CWX = 1h
-CWY = 2h
-CWWidth = 4h
-CWHeight = 8h
-CWBorderWidth = 10h
-CWSibling = 20h
-CWStackMode = 40h
-
-;Bit Gravity
-ForgetGravity = 0
-NorthWestGravity = 1
-NorthGravity = 2
-NorthEastGravity = 3
-WestGravity = 4
-CenterGravity = 5
-EastGravity = 6
-SouthWestGravity = 7
-SouthGravity = 8
-SouthEastGravity = 9
-StaticGravity = 10
-
-;Window Gravity
-UnmapGravity = 0
-
-;CreateWindow backing-store hint
-NotUseful = 0
-WhenMapped = 1
-Always = 2
-
-;GetWindowAttributes reply
-IsUnmapped = 0
-IsUnviewable = 1
-IsViewable = 2
-
-;Used in ChangeSaveSet
-SetModeInsert = 0
-SetModeDelete = 1
-
-;Used in ChangeCloseDownMode
-DestroyAll = 0
-RetainPermanent = 1
-RetainTemporary = 2
-
-;Window stacking method (in configureWindow)
-Above = 0
-Below = 1
-TopIf = 2
-BottomIf = 3
-Opposite = 4
-
-;Circulation direction
-RaiseLowest = 0
-LowerHighest = 1
-
-;Property modes
-PropModeReplace = 0
-PropModePrepend = 1
-PropModeAppend = 2
-
-;Graphics Functions
-GXclear = 0h
-GXand = 1h
-GXandReverse = 2h
-GXcopy = 3h
-GXandInverted = 4h
-GXnoop = 5h
-GXxor = 6h
-GXor = 7h
-GXnor = 8h
-GXequiv = 9h
-GXinvert = 10h
-GXorReverse = 11h
-GXcopyInverted = 12h
-GXorInverted = 13h
-GXnand = 14h
-GXset = 15h
-
-;LineStyle
-LineSolid = 0
-LineOnOffDash = 1
-LineDoubleDash = 2
-
-;capStyle
-CapNotLast = 0
-CapButt = 1
-CapRound = 2
-CapProjecting = 3
-
-;joinStyle
-JoinMiter = 0
-JoinRound = 1
-JoinBevel = 2
-
-;fillStyle
-FillSolid = 0
-FillTiled = 1
-FillStippled = 2
-FillOpaqueStippled = 3
-
-;fillRule
-
-EvenOddRule = 0
-WindingRule = 1
-
-;subwindow mode
-
-ClipByChildren = 0
-IncludeInferiors = 1
-
-;SetClipRectangles ordering
-
-Unsorted = 0
-YSorted = 1
-YXSorted = 2
-YXBanded = 3
-
-;CoordinateMode for drawing routines
-
-CoordModeOrigin = 0
-CoordModePrevious = 1
-
-;Polygon shapes
-
-Complex = 0
-Nonconvex = 1
-Convex = 2
-
-;Arc modes for PolyFillArc
-
-ArcChord = 0
-ArcPieSlice = 1
-
-;GC components
-
-GCFunction = 1h
-GCPlaneMask = 2h
-GCForeground = 4h
-GCBackground = 8h
-GCLineWidth = 10h
-GCLineStyle = 20h
-GCCapStyle = 40h
-GCJoinStyle = 80h
-GCFillStyle = 100h
-GCFillRule = 200h
-GCTile = 400h
-GCStipple = 800h
-GCTileStipXOrigin = 1000h
-GCTileStipYOrigin = 2000h
-GCFont = 4000h
-GCSubwindowMode = 8000h
-GCGraphicsExposures = 10000h
-GCClipXOrigin = 20000h
-GCClipYOrigin = 40000h
-GCClipMask = 80000h
-GCDashOffset = 100000h
-GCDashList = 200000h
-GCArcMode = 400000h
-
-GCLastBit = 22
-
-;used in QueryFont -- draw direction
-
-FontLeftToRight = 0
-FontRightToLeft = 1
-
-FontChange = 255
-
-;ImageFormat -- PutImage, GetImage
-
-XYBitmap = 0
-XYPixmap = 1
-ZPixmap = 2
-
-;For CreateColormap
-
-AllocNone = 0
-AllocAll = 1
-
-
-;Flags used in StoreNamedColor, StoreColors
-
-DoRed = 1h
-DoGreen = 2h
-DoBlue = 4h
-
-;QueryBestSize Class
-
-CursorShape = 0
-TileShape = 1
-StippleShape = 2
-
-;Keyboard pointer stuff
-
-AutoRepeatModeOff = 0
-AutoRepeatModeOn = 1
-AutoRepeatModeDefault = 2
-
-LedModeOff = 0
-LedModeOn = 1
-
-;masks for ChangeKeyboardControl
-
-KBKeyClickPercent = 1h
-KBBellPercent = 2h
-KBBellPitch = 4h
-KBBellDuration = 8h
-KBLed = 10h
-KBLedMode = 20h
-KBKey = 40h
-KBAutoRepeatMode = 80h
-
-MappingSuccess = 0
-MappingBusy = 1
-MappingFailed = 2
-
-MappingModifier = 0
-MappingKeyboard = 1
-MappingPointer = 2
-
-;Screensaver stuff
-
-DontPreferBlanking = 0
-PreferBlanking = 1
-DefaultBlanking = 2
-
-DisableScreenSaver = 0
-DisableScreenInterval = 0
-
-DontAllowExposures = 0
-AllowExposures = 1
-DefaultExposures = 2
-
-;for ForceScreenSaver
-
-ScreenSaverReset = 0
-ScreenSaverActive = 1
-
-;for ChangeHosts
-
-HostInsert = 0
-HostDelete = 1
-
-;for ChangeAccessControl
-
-EnableAccess = 1
-DisableAccess = 0
-
-;display classes
-
-StaticGray = 0
-GrayScale = 1
-StaticColor = 2
-PseudoColor = 3
-TrueColor = 4
-DirectColor = 5
-
-
-;Byte order used in imageByteOrder and bitmapBitOrder
-
-LSBFirst = 0
-MSBFirst = 1
-
-;Keyboard and Pointer Event Structures
-
-struct XButtonEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .window rd 1
- .root rd 1
- .subwindow rd 1
- .time rd 1
- .x rd 1
- .y rd 1
- .x_root rd 1
- .y_root rd 1
- .state rd 1
- .button rd 1
- .same_screen rd 1
-ends
-
-
-virtual at 0
-XButtonPressedEvent XButtonEvent
-end virtual
-
-virtual at 0
-XButtonReleasedEvent XButtonEvent
-end virtual
-
-struct XKeyEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .window rd 1
- .root rd 1
- .subwindow rd 1
- .time rd 1
- .x rd 1
- .y rd 1
- .x_root rd 1
- .y_root rd 1
- .state rd 1
- .keycode rd 1
- .same_screen rd 1
-ends
-
-
-virtual at 0
-XKeyPressedEvent XKeyEvent
-end virtual
-
-virtual at 0
-XKeyReleasedEvent XKeyEvent
-end virtual
-
-
-struct XMotionEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .window rd 1
- .root rd 1
- .subwindow rd 1
- .time rd 1
- .x rd 1
- .y rd 1
- .x_root rd 1
- .y_root rd 1
- .state rd 1
- .is_hint rb 1
- .same_screen rd 1
-ends
-
-
-virtual at 0
-XPointerMovedEvent XMotionEvent
-end virtual
-
-;Window Entry/Exit Events
-
-struct XCrossingEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .window rd 1
- .root rd 1
- .subwindow rd 1
- .time rd 1
- .x rd 1
- .y rd 1
- .x_root rd 1
- .y_root rd 1
- .mode rd 1
- .detail rd 1
- .same_screen rd 1
- .focus rd 1
- .state rd 1
-ends
-
-virtual at 0
-XEnterWindowEvent XCrossingEvent
-end virtual
-
-virtual at 0
-XLeaveWindowEvent XCrossingEvent
-end virtual
-
-; Input Focus Events
-
-struct XFocusChangeEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .window rd 1
- .mode rd 1
- .detail rd 1
-ends
-
-
-
-virtual at 0
-XFocusInEvent XFocusChangeEvent
-end virtual
-
-virtual at 0
-XFocusOutEvent XFocusChangeEvent
-end virtual
-
-; Keymap Notification Events
-
-struct XKeymapEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .window rd 1
- .key_vector rb 32
-ends
-
-; Exposure/Update Events
-
-struct XExposeEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .window rd 1
- .x rd 1
- .y rd 1
- .width rd 1
- .height rd 1
- .count rd 1
-ends
-
-
-struct XGraphicsExposeEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .drawable rd 1
- .x rd 1
- .y rd 1
- .width rd 1
- .height rd 1
- .count rd 1
- .major_code rd 1
- .minor_code rd 1
-ends
-
-
-struct XNoExposeEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .drawable rd 1
- .major_code rd 1
- .minor_code rd 1
-ends
-
-
-; CirculateNotify Events
-
-struct XCirculateEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .event rd 1
- .window rd 1
- .place rd 1
-ends
-
-
-struct XCirculateRequestEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .parent rd 1
- .window rd 1
- .place rd 1
-ends
-
-; Configuration Change Events
-
-struct XConfigureEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .event rd 1
- .window rd 1
- .x rd 1
- .y rd 1
- .width rd 1
- .height rd 1
- .border_width rd 1
- .above rd 1
- .override_redirect rd 1
-ends
-
-struct XConfigureRequestEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .parent rd 1
- .window rd 1
- .x rd 1
- .y rd 1
- .width rd 1
- .height rd 1
- .border_width rd 1
- .above rd 1
- .detail rd 1
- .value_mask rd 1
-ends
-
-struct XPropertyEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .window rd 1
- .atom rd 1
- .time rd 1
- .state rd 1
-ends
-
-struct XResizeEvent
- .type rd 1
- .serial rd 1
- .display rd 1
- .window rd 1
- .width rd 1
- .height rd 1
-ends
-
-struct XColormapEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .window rd 1
- .colormap rd 1
- .new rd 1
- .state rd 1
-ends
-
-; Creation/Destruction Notifications
-
-struct XCreateWindowEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .parent rd 1
- .window rd 1
- .x rd 1
- .y rd 1
- .width rd 1
- .heigth rd 1
- .border_width rd 1
- .override_redirect rd 1
-ends
-
-
-struct XDestroyWindowEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .event rd 1
- .window rd 1
-ends
-
-; Parent Movement Events
-
-struct XGravityEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .event rd 1
- .window rd 1
- .x rd 1
- .y rd 1
-ends
-
-; Mapping Events
-
-struct XMapEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .event rd 1
- .window rd 1
- .override_redirect rd 1
-ends
-
-struct XMappingEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .window rd 1
- .request rd 1
- .first_keycode rd 1
- .count rd 1
-ends
-
-
-struct XMapRequestEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .parent rd 1
- .window rd 1
-ends
-
-; Parent Change Events
-
-struct XReparentEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .event rd 1
- .window rd 1
- .parent rd 1
- .x rd 1
- .y rd 1
- .override_redirect rd 1
-ends
-
-struct XSelectionClearEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .window rd 1
- .selection rd 1
- .time rd 1
-ends
-
-struct XSelectionRequestEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .owner rd 1
- .requestor rd 1
- .selection rd 1
- .target rd 1
- .property rd 1
- .time rd 1
-ends
-
-struct XSelectionEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .requestor rd 1
- .selection rd 1
- .target rd 1
- .property rd 1
- .time rd 1
-ends
-
-; Hidden Window Events
-
-struct XUnmapEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .event rd 1
- .window rd 1
- .from_configure rd 1
-ends
-
-struct XVisibilityEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .window rd 1
- .state rd 1
-ends
-
-; Client Messages (XSendEvent)
-
-struct XClientMessageEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .window rd 1
- .message_type rd 1
- .format rd 1
- .data rb 20
-ends
-
-
-struct XErrorEvent
- .type rd 1
- .serial rd 1
- .error_code rd 1
- .request_code rd 1
- .minor_code rd 1
- .resourceid rd 1
-ends
-
-
-
-struct XAnyEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .window rd 1
-ends
-
-
-struct XEvent
- .xany XAnyEvent
- .pad rb 24*4 - sizeof.XAnyEvent
-
- virtual at .xany
- . XAnyEvent
- end virtual
-
-
- virtual at .xany
- .xkey XKeyEvent
- end virtual
-
- virtual at .xany
- .xbutton XButtonEvent
- end virtual
-
- virtual at .xany
- .xmotion XMotionEvent
- end virtual
-
- virtual at .xany
- .xcrossing XCrossingEvent
- end virtual
-
- virtual at .xany
- .xfocus XFocusChangeEvent
- end virtual
-
- virtual at .xany
- .xexpose XExposeEvent
- end virtual
-
- virtual at .xany
- .xgraphicsexpose XGraphicsExposeEvent
- end virtual
-
- virtual at .xany
- .xnoexpose XNoExposeEvent
- end virtual
-
- virtual at .xany
- .xvisibility XVisibilityEvent
- end virtual
-
- virtual at .xany
- .xcreatewindow XCreateWindowEvent
- end virtual
-
- virtual at .xany
- .xdestroywindow XDestroyWindowEvent
- end virtual
-
- virtual at .xany
- .xunmap XUnmapEvent
- end virtual
-
- virtual at .xany
- .xmap XMapEvent
- end virtual
-
- virtual at .xany
- .xmaprequest XMapRequestEvent
- end virtual
-
- virtual at .xany
- .xreparent XReparentEvent
- end virtual
-
- virtual at .xany
- .xconfigure XConfigureEvent
- end virtual
-
- virtual at .xany
- .xgravity XGravityEvent
- end virtual
-
- virtual at .xany
- .xresizerequest XResizeEvent
- end virtual
-
- virtual at .xany
- .xconfigurerequest XConfigureRequestEvent
- end virtual
-
- virtual at .xany
- .xcirculate XCirculateEvent
- end virtual
-
- virtual at .xany
- .xcirculaterequest XCirculateRequestEvent
- end virtual
-
- virtual at .xany
- .xproperty XPropertyEvent
- end virtual
-
- virtual at .xany
- .xselectionclear XSelectionClearEvent
- end virtual
-
- virtual at .xany
- .xselectionrequest XSelectionRequestEvent
- end virtual
-
- virtual at .xany
- .xselection XSelectionEvent
- end virtual
-
- virtual at .xany
- .xcolormap XColormapEvent
- end virtual
-
- virtual at .xany
- .xclient XClientMessageEvent
- end virtual
-
- virtual at .xany
- .xmapping XMappingEvent
- end virtual
-
- virtual at .xany
- .xerror XErrorEvent
- end virtual
-
- virtual at .xany
- .xkeymap XKeymapEvent
- end virtual
-ends
-
-
-; Misc. Structures
-
-struct XKeyboardControl
- .key_click_percent rd 1
- .bell_percent rd 1
- .bell_pitch rd 1
- .bell_duration rd 1
- .led rd 1
- .led_mode rd 1
- .key rd 1
- .auto_repeat_mode rd 1
-ends
-
-
-
-struct XModifierKeymap
- .max_keypermod rd 1
- .modifiermap rd 1
-ends
-
-
-
-
-struct XWindowAttributes
- .x dd ? ; location of window
- .y dd ? ;
- .width dd ? ; width and height of window
- .height dd ? ;
- .border_width dd ? ; border width of window
- .depth dd ? ; depth of window
- .pVisual dd ? ; the associated visual structure
- .root dd ? ; root of screen containing window
- .class dd ? ; InputOutput, InputOnly
- .bit_gravity dd ? ; one of the bit gravity values
- .win_gravity dd ? ; one of the window gravity values
- .backing_store dd ? ; NotUseful, WhenMapped, Always
- .backing_planes dd ? ; planes to be preserved if possible
- .backing_pixel dd ? ; value to be used when restoring planes
- .save_under dd ? ; boolean, should bits under be saved?
- .colormap dd ? ; color map to be associated with window
- .map_installed dd ? ; boolean, is color map currently installed
- .map_state dd ? ; IsUnmapped, IsUnviewable, IsViewable
- .all_event_masks dd ? ; set of events all people have interest in
- .your_event_mask dd ? ; my event mask
- .do_not_propagate_mask dd ? ; set of events that should not propagate
- .override_redirect dd ? ; boolean value for override-redirect
- .pScreen dd ? ; back pointer to correct screen
-ends
-
-
-
-struct XCharStruct
- .lbearing dw ? ; origin to left edge of raster
- .rbearing dw ? ; origin to right edge of raster
- .width dw ? ; advance to next char's origin
- .ascent dw ? ; baseline to top edge of raster
- .descent dw ? ; baseline to bottom edge of raster
- .attributes dw ? ; per char flags (not predefined)
-ends
-
-
-struct XFontStruct
- .ext_data dd ? ; hook for extension to hang data
- .fid dd ? ; Font id for this font
- .direction dd ? ; hint about the direction font is painted
- .min_char_or_byte2 dd ? ; first character
- .max_char_or_byte2 dd ? ; last character
- .min_byte1 dd ? ; first row that exists
- .max_byte1 dd ? ; last row that exists
- .all_chars_exist dd ? ; flag if all characters have nonzero size
- .default_char dd ? ; char to print for undefined character
- .n_properties dd ? ; how many properties there are
- .properties dd ? ; pointer to array of additional properties
- .min_bounds XCharStruct ; minimum bounds over all existing char
- .max_bounds XCharStruct ; maximum bounds over all existing char
- .per_char dd ? ; first_char to last_char information
- .ascent dd ? ; logical extent above baseline for spacing
- .descent dd ? ; logical decent below baseline for spacing
-ends
-
-
-struct XWindowChanges
- .x dd ?
- .y dd ?
- .width dd ?
- .height dd ?
- .border_width dd ?
- .sibling dd ?
- .stack_mode dd ?
-ends
DELETED examples/XLib/test.asm
Index: examples/XLib/test.asm
==================================================================
--- examples/XLib/test.asm
+++ /dev/null
@@ -1,332 +0,0 @@
-proc start, .argc, .argv, .argp
-.fontlist dd ?
-.fontcount dd ?
-begin
- stdcall Xinitialize, strCaption, 10, 20, 400, 200
-
- ;;; Main Event Loop
-
-.msg_pump:
- cinvoke XNextEvent, [hdisplay], event
- stdcall Xeventhandler
- jmp .msg_pump
-
- stdcall Xshutdown
-
-.do_exit: ; Non-Local for XSetErrorHandler
- xor eax, eax
- cinvoke exit, eax
- return
-endp
-
-
-
-
-proc Xshutdown
-begin
- cinvoke XFreeGC, [hdisplay], [hGC]
- cinvoke XDestroyWindow, [hwin], [hdisplay]
- cinvoke XSetErrorHandler, [oError]
-
- xor eax, eax
- return
-endp
-
-
-proc Xinitialize, .txt, .x, .y, .w, .h
- .hscreen rd 1
- .hroot rd 1
-begin
- cinvoke XOpenDisplay, 0
- or eax, eax
- jnz .display_ok
-
- cinvoke puts, strErrorDisplay
- jmp start.do_exit
-
-.display_ok:
- mov [hdisplay], eax
- cinvoke XDefaultScreen, eax
- mov [.hscreen], eax
-
- cinvoke XDefaultRootWindow, [hdisplay]
- mov [.hroot], eax
-
- cinvoke XCreateSimpleWindow, [hdisplay], eax, [.x], [.y], [.w], [.h], 0, $000000, $d4d0c8
- or eax, eax
- jnz .create_ok
-
- cinvoke puts, strErrorCreation
- jmp start.do_exit
-
-.create_ok:
- mov [hwin], eax
- cinvoke XCreateSimpleWindow, [hdisplay], eax, 10, 10, 64, 24, 0, $606060, $d4d0c8
- mov [hwin2], eax
-
- cinvoke XSelectInput, [hdisplay], [hwin], KeyPressMask + KeyReleaseMask + ExposureMask
- cinvoke XSelectInput, [hdisplay], [hwin2], KeyPressMask + KeyReleaseMask + ExposureMask + EnterWindowMask + LeaveWindowMask
- cinvoke XStoreName, [hdisplay], [hwin], [.txt]
- cinvoke XStoreName, [hdisplay], [hwin2], cBtnCaption
- cinvoke XMapRaised, [hdisplay], [hwin]
- cinvoke XMapRaised, [hdisplay], [hwin2]
- or eax, eax
- jnz .show_ok
-
- cinvoke puts, strErrorShow
- jmp start.do_exit
-
-.show_ok:
- cinvoke XCreateGC, [hdisplay], [hwin], 0, 0
- mov [hGC], eax
-
- cinvoke XSetForeground, [hdisplay], [hGC], $000000
- cinvoke XSetBackground, [hdisplay], [hGC], $ffffff
-
- xor eax, eax
- return
-endp
-
-
-
-proc Xdrawscreen
-begin
- cinvoke XDrawLine, [hdisplay], [hwin], [hGC], 0, 110, 400, 110
- cinvoke XDrawLine, [hdisplay], [hwin], [hGC], 0, 80, 400, 80
- cinvoke XDrawString, [hdisplay], [hwin], [hGC], 10, 100, strMessage, lenMessage
- return
-endp
-
-
-proc StrLength, .ptrString
-begin
- push esi
-
- xor eax, eax
-
- mov esi, [.ptrString]
- test esi, esi
- jz .exit
-
- cld
-.loop:
- mov cl, [esi]
- inc esi
- test cl, cl
- jz .exit
-
- inc eax
- jmp .loop
-
-.exit:
- pop esi
- return
-endp
-
-proc DrawBtn, .hwin, .inside
-.attr XWindowAttributes
-.name dd ?
-.font dd ?
-.direction dd ?
-.ascent dd ?
-.descent dd ?
-.overall XCharStruct
-begin
- push ebx ecx esi edi
-
- lea ecx, [.attr]
- cinvoke XGetWindowAttributes, [hdisplay], [.hwin], ecx
- dec [.attr.width]
- dec [.attr.height]
-
- cinvoke XCreateGC, [hdisplay], [.hwin], 0, 0
- mov ebx, eax
-
- cmp [.inside], 0
- jne .border_beveled
-
- cinvoke XSetForeground, [hdisplay], ebx, $606060
- cinvoke XDrawRectangle, [hdisplay], [.hwin], ebx, 0, 0, [.attr.width], [.attr.height]
-
- sub [.attr.width], 2
- sub [.attr.height], 2
-
- cinvoke XSetForeground, [hdisplay], ebx, $d4d0c8
- cinvoke XDrawRectangle, [hdisplay], [.hwin], ebx, 1, 1, [.attr.width], [.attr.height]
- inc [.attr.width]
- inc [.attr.height]
- jmp .border_ok
-
-.border_beveled:
- cinvoke XSetForeground, [hdisplay], ebx, $ffffff
- cinvoke XDrawLine, [hdisplay], [.hwin], ebx, 0, 0, [.attr.width], 0
- cinvoke XDrawLine, [hdisplay], [.hwin], ebx, 0, 0, 0, [.attr.height]
-
- cinvoke XSetForeground, [hdisplay], ebx, $404040
- cinvoke XDrawLine, [hdisplay], [.hwin], ebx, 0, [.attr.height], [.attr.width], [.attr.height]
- cinvoke XDrawLine, [hdisplay], [.hwin], ebx, [.attr.width], 0, [.attr.width], [.attr.height]
-
- dec [.attr.width]
- dec [.attr.height]
-
- cinvoke XSetForeground, [hdisplay], ebx, $808080
- cinvoke XDrawLine, [hdisplay], [.hwin], ebx, 1, [.attr.height], [.attr.width], [.attr.height]
- cinvoke XDrawLine, [hdisplay], [.hwin], ebx, [.attr.width], 1, [.attr.width], [.attr.height]
-
-.border_ok:
- cinvoke XSetForeground, [hdisplay], ebx, $000000
-
- cinvoke XLoadQueryFont, [hdisplay], cGUIfont
- mov [.font], eax
- cinvoke XSetFont, [hdisplay], ebx, [eax+XFontStruct.fid]
-
- lea ecx, [.name]
- cinvoke XFetchName, [hdisplay], [.hwin], ecx
-
- stdcall StrLength, [.name]
- mov edi, eax
- lea ecx, [.direction]
- lea edx, [.ascent]
- lea eax, [.descent]
- lea esi, [.overall]
- cinvoke XTextExtents, [.font], [.name], edi, ecx, edx, eax, esi
-
- xor eax, eax
- mov ax, [.overall.ascent]
- add ax, [.overall.descent]
- movsx eax, ax
- sub eax, [.attr.height]
- add eax, 1
- neg eax
- sar eax, 1
- movsx ecx, [.overall.ascent]
- lea eax, [eax+ecx+1] ; this is the baseline.
- mov [.attr.y], eax
-
- mov ax, [.overall.width]
- movsx eax, ax
- sub eax, [.attr.width]
- add eax, 1
- neg eax
- sar eax, 1
- add eax, 1
- cmp eax, 1
- jge @f
- mov eax, 1
-@@:
- mov [.attr.x], eax
-
- stdcall StrLength, [.name]
- cinvoke XDrawString, [hdisplay], [.hwin], ebx, [.attr.x], [.attr.y], [.name], eax
-
- cinvoke XFree, [.name]
- cinvoke XFreeFont, [hdisplay], [.font]
- cinvoke XFreeGC, [hdisplay], ebx
-
- pop edi esi ecx ebx
- return
-endp
-
-
-
-proc Xeventhandler
-begin
- mov eax, [event]
-
- cmp eax, Expose
- je .on_expose
-
- cmp eax, KeyPress
- je .on_keypress
-
- cmp eax, EnterNotify
- je .on_enter
-
- cmp eax, LeaveNotify
- je .on_leave
-
- return
-
-.on_leave:
- mov eax, [event+XEnterWindowEvent.window]
- cmp eax, [hwin2]
- je .button_leave
-
- return
-
-.button_leave:
- stdcall DrawBtn, [event+XEnterWindowEvent.window], 0
- return
-
-
-.on_enter:
- mov eax, [event+XEnterWindowEvent.window]
- cmp eax, [hwin2]
- je .button_enter
- return
-
-.button_enter:
- stdcall DrawBtn, [event+XEnterWindowEvent.window], 1
- return
-
-.on_expose:
- mov eax, [event+XExposeEvent.window]
-
- cmp eax, [hwin]
- je .mainwin
-
- cmp eax, [hwin2]
- je .button
-
- return
-
-.button:
- stdcall DrawBtn, [hwin2], 0
- return
-
-
-.mainwin:
- stdcall Xdrawscreen
- return
-
-
-.on_keypress:
- cinvoke XLookupKeysym, event, 0
- cmp eax, 'q'
- je .terminate
-
- return
-
-.terminate:
-; keypress exits the application
- jmp start.do_exit
-endp
-
-
-
-
-
-
-iglobal
- strCaption db 'Xlib Fresh!', 0
- strMessage db "This is native assembly language Linux program."
- lenMessage = ($-strMessage)
-
- cBtnCaption db 'Button',0
-
- oError dd 0
- strErrorDisplay db 'XOpenDisplay: could not open connection to X server.', 0
- strErrorCreation db 'XCreateSimpleWindow: could not create window.', 0
- strErrorShow db 'XMapRaised: could not display window.', 0
-
- strAll db '*helvetica-medium-r*--12*', 0
- cGUIfont db '*helvetica-medium-r*--12*', 0 ;'*lucida-medium-r*-sans-12*',0
-
- cNewLine db $0a, 0
-
- hGC dd 0
- hwin dd 0
- hwin2 dd 0
- hdisplay dd 0
- event rd 132
-endg
DELETED examples/toolpanel/Main.asm
Index: examples/toolpanel/Main.asm
==================================================================
--- examples/toolpanel/Main.asm
+++ /dev/null
@@ -1,62 +0,0 @@
-format PE GUI 4.0
-entry Start
-
-include '%finc%/win32/win32a.inc'
-
-include "%finc%/libs/msgutils.inc"
-include "%finc%/libs/tform.inc"
-include "%finc%/libs/parents.inc"
-include "%finc%/libs/templates.inc"
-
-include "%finc%/libs/msgutils.asm"
-include "%finc%/libs/tform.asm"
-include "%finc%/libs/parents.asm"
-include "%finc%/libs/templates.asm"
-
-include "MainForm.frm"
-
-options.ShowSizes = 1
-
-
-uglobal
- hInstance dd ?
- hHeap dd ?
- hMainForm dd ?
-endg
-
-
-
-Start:
- invoke GetModuleHandleA,0
- mov [hInstance],eax
- invoke GetProcessHeap
- mov [hHeap], eax
-
- InitializeAll
-
- invoke InitCommonControls
-
- stdcall CreateForm, frmMain, NULL
- xor eax, eax
- test ebx, ebx
- jz .terminate
-
- mov [hMainForm], ebx
-
-.run:
- call ProcessMessages
- jc .terminate
-
- invoke WaitMessage
- jmp .run
-
-.terminate:
- push eax
- FinalizeAll
- invoke ExitProcess ; exit code from the stack.
-
-data import
- include "%finc%/win32/allimports.asm"
-end data
-
-IncludeAllGlobals
DELETED examples/toolpanel/MainForm.frm
Index: examples/toolpanel/MainForm.frm
==================================================================
--- examples/toolpanel/MainForm.frm
+++ /dev/null
@@ -1,104 +0,0 @@
-;
-uglobal
- timerID dd ?
- outsideCNT dd ?
-endg
-
-
-
-winproc MainFormProc
- .rect RECT
- .rect2 RECT
-begin
-
-ondefault
- stc
- return
-
-
-onmessage WM_TIMER
-
- cmp [.wparam], 1234
- je .mousetimer
-
- clc
- return
-
-.mousetimer:
- invoke SendDlgItemMessageA, [.hwnd], 100, BM_GETCHECK, 0, 0
- test eax, eax
- jnz .autohide
-
- invoke KillTimer, [.hwnd], 1234
- mov [timerID], 0
- clc
- return
-
-.autohide:
- lea esi, [.rect]
- invoke GetWindowRect, [.hwnd], esi
-
- lea eax, [.rect2]
- invoke GetCursorPos, eax
-
- invoke PtInRect, esi, [.rect2.left], [.rect2.top]
- test eax, eax
- jz .outside
-
- mov [outsideCNT], 6
-
- clc
- return
-
-.outside:
- dec [outsideCNT]
- jz .mouseleave
-
- clc
- return
-
-.mouseleave:
- invoke KillTimer, [.hwnd], 1234
- mov [timerID], 0
-
-.hidewindow:
- lea eax, [.rect2]
- invoke GetWindowRect, [.hwnd], eax
-
- mov eax, [.rect2.right]
- sub eax, [.rect2.left]
- neg eax
- add eax, 4
-
- invoke SetWindowPos, [.hwnd], 0, eax, [.rect2.top], 0, 0, SWP_NOSIZE or SWP_NOZORDER or SWP_SHOWWINDOW
-
- clc
- return
-
-
-onmessage WM_NCMOUSEMOVE
-onmessage WM_MOUSEMOVE
- cmp [timerID], 0
- jne .endmove
-
-; mouse enter
- lea eax, [.rect2]
- invoke GetWindowRect, [.hwnd], eax
- invoke SetWindowPos, [.hwnd], HWND_TOPMOST, 0,[.rect2.top], 0, 0, SWP_NOSIZE or SWP_SHOWWINDOW
- invoke SetTimer, [.hwnd], 1234, 50, 0
- mov [timerID], 1
- mov [outsideCNT], 10
-
-.endmove:
- clc
- return
-
-
-onmessage FM_AFTERCREATE
-; invoke SetProp, [.hwnd], [propColor], $0000ff
-
- jmp .hidewindow
-endwp
DELETED examples/toolpanel/ToolPanel.fpr
Index: examples/toolpanel/ToolPanel.fpr
==================================================================
--- examples/toolpanel/ToolPanel.fpr
+++ /dev/null
cannot compute difference between binary files
DELETED examples/toolpanel/readme.txt
Index: examples/toolpanel/readme.txt
==================================================================
--- examples/toolpanel/readme.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-This example creates some simple tool window that auto hides itself to the left edge of the screen.
-When the user points to the panel it pops out.
-Something like autohide Windows task bar.
DELETED freshlib/FreshEdit/FreshEdit.asm
Index: freshlib/FreshEdit/FreshEdit.asm
==================================================================
--- freshlib/FreshEdit/FreshEdit.asm
+++ /dev/null
@@ -1,4099 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: TFreshEdit object class; Advanced visual programming editor.
-;
-; Target OS: Any
-;
-; Dependencies: strlib, memory, arrays, GUI
-;
-; Notes:
-; FreshEdit features:
-; - Unicode (UTF-8)
-; - Word wrap
-; - Code folding
-; - Associated debug information
-; - save with format information (bookmarks and breakpoints)
-; - Read-only lines
-; - Undo and Redo functions.
-; - Adjustable colors, keyboard and behavior.
-; - Char, Block and Line selections.
-; - Syntax highlighters interface for different languages.
-; - Interface to visual programming tools and auto source generators.
-;_________________________________________________________________________________________
-include "FreshEditThemes.asm"
-
-module "TFreshEdit library"
-
-ObjectClass FreshEdit, \
- ScrollWindow, \
- TFreshEdit.Create, \
- TFreshEdit.Destroy, \
- TFreshEdit.Get, \
- TFreshEdit.Set, \
- TFreshEdit.ExecCmd, \
- TFreshEdit.SysEventHandler
-
-; Line flags
-
-lfBookmark = 1 ; the line have bookmark set.
-lfFocused = 2 ; the line is focused until the user press some key.
-lfProtected = 4 ; the line can not be edited.
-lfWordWrap = 8 ; the line must be word wrapped. After changes, the format have to be updated.
-lfBreakpoint = 16 ; set breakpoint in debug mode.
-lfFoldHeader = 32 ; this is the first line of foldable part of the text.
-
-
-struct TEditorLine
- .Data dd ? ; pointer to line data.
- .flags dd ? ; line flags
-
- .syn_context dd ? ; flags about current syntax highlighter context.
- .debugdata dd ? ; pointer to debug data, associated to this line
- .fold_level dd ? ; the level of folding.
-
- .width dd ? ; width of the line text in chars. It is the length of the string for non wrapped lines and maximal subline for wrapped.
- align 32
- .shift = 5
-ends
-
-
-undoInsertText = 0
-undoDeleteText = 1
-
-
-struct TUndoInfo
- .operation db ? ; what was changed???
- .selMode db ?
- align 4
- .caretX dd ?
- .caretY dd ?
- .selectionX dd ?
- .selectionY dd ?
- .data dd ?
- align 32
- .shift = 5
-ends
-
-; About TEditorLine.syn_context:
-;
-; This context flags depend on the current syntax highlighter active.
-; The purpose of the context is to follow syntax constructions that
-; spreads on several lines. Such as multiline comments, markup tags, etc.
-; Also, some of the flags could be used for other purposes - code folding
-; is one of the options.
-
-
-
-; Flags that indicates what is changed in the editor window after some operation
-; Indicate what update should be processed
-
-chgfNoClearSelection = 1
-chgfNeedRefresh = 2
-chgfFinished = 4
-
-; insert modes
-
-modeInsert = 0
-modeOverwrite = 1
-
-; selection modes
-
-selmChar = 0
-selmBlock = 1
-
-; flag ReadOnly values
-froReadWrite = 0
-froReadOnlyWithCaret = 1
-froReadOnlyNoCaret = 2
-
-
-object TFreshEdit, TScrollWindow
- ._Font dd ? ; font of the editor.
-
-; main editor font sizes
- ._fontheight dd ? ; in pixels.
- ._fontwidth dd ? ; in pixels.
- ._fontdescent dd ? ; in pixels.
-
-; system font sizes (used for additional texts and line numbers)
- ._fontheight2 dd ? ; in pixels.
- ._fontwidth2 dd ? ; in pixels.
- ._fontdescent2 dd ? ; in pixels.
-
- .__LeftMargin dd ? ; width of the left margin field. Auto computed.
- .__NumberMargin dd ? ; width of the field for the line number. Auto computed.
- ._ExtraFont dd ? ;
-
- ._cols dd ? ; width of the window in text columns.
- ._rows dd ? ; height of the window in text rows.
- ; must to be update on resize and on font change.
-
- ._pLines dd ? ; pointer to TArray of TEditorLine items.
- ._pIndex dd ? ; pointer to TArray of dword that contains numbers of TEditorLine for the screen.
- ._pLengths dd ? ; pointer to TArray with counts of the lines with given length.
-
- ._pUndoList dd ? ; pointer to TArray of TUndoInfo
- ._pRedoList dd ? ; pointer to TArray of TUndoInfo
-
- ._pShadow dd ? ; double buffer pointer to TBackBuffer object.
- ._fShadowValid dd ? ;
-
-; view change fields
-
- ._TopLine dd ? ; number of the line that is at the topmost line of the window.
- ._LeftColumn dd ? ; the column of the text at the leftmost side of the window.
-
- ._xCaret dd ? ; horizontal position of the caret inside the current line.
- ._yCaret dd ? ; vertical position of the caret inside the text.
-
- ._xSelection dd ?
- ._ySelection dd ?
-
- ._fReadOnly dd ?
- ._SelMode dd ?
- ._InsMode dd ?
- ._TabStop dd ?
-
-; end change fields
-
- ._prevTopLine dd ?
- ._prevLeftColumn dd ?
-
- ._prevxCaret dd ?
- ._prevyCaret dd ?
-
- ._prevxDelta dd ?
- ._prevyDelta dd ?
-
- ._prevSelMode dd ?
- ._prevInsMode dd ?
-
-; end backup fields
-
- ._DragButton dd ?
-
-; ._Theme TFETheme
-
- ._procSyntax dd ? ; syntax highlighter procedure.
-
- ._iconBreakpointA dd ? ; active breakpoint icon.
- ._iconBreakpointI dd ? ; inactive breakpoint icon.
- ._iconDebugInfo dd ?
- ._maskBreakpointA dd ?
- ._maskBreakpointI dd ?
- ._maskDebugInfo dd ?
-
-
- ._iconUnfold dd ?
- ._iconFold dd ?
-
- ._maskUnfold dd ?
-
-; Event handlers
-
- .OnControlKey dd ?
-
-; Parameters
- param .Selection ; selected text read/write
-
- param .CurrentLine ; TEditorLine where caret resides.
- param .Text
- param .MaxLineLen
-
-; Methods
-
- method .Clear ; clears the text in the editor.
-
-; navigation methods
-
- method .Move, .direction, .count, .force ; moves the caret
-
- method .LineBegin
- method .LineEnd
- method .ScreenBegin
- method .ScreenEnd
- method .FileBegin
- method .FileEnd
-
-; editing methods
-
- method .DeleteSel
- method .InsertLine, .index ; index = -1 inserts at current position of the caret.
- ; index = -2 appends the line at the end of the text.
- method .DeleteLine, .index ; index = -1 deletes the line on the current position of the caret.
-
-; block processing methods.
- method .DeleteText, .indexFrom, .charFrom, .indexTo, .charTo
- method .GetText, .indexFrom, .charFrom, .indexTo, .charTo
-
-; Undo/Redo functions.
-
- method .RegisterForUndo, .operation, .data
-
- method .Undo
- method .Redo
-
- method .ClearUndo
-
-; these two methods are flexible, but very slow. .Text parameter seting is fastest way to change whole text of the editor.
- method .InsertChar, .char
- method .InsertString, .hstring ; inserts a string at the caret position.
- ; If the string contains formating chars they are processed properly.
- method .DelChar ; deletes the char under the caret.
-
-; appearance methods
- method .FormatLine, .index
-
-; themes methods
-
- method LoadTheme, .configdb, .directory
-
-endobj
-
-
-; about .pIndex field:
-;
-; This array contains the number of text lines that have to be displayed on the
-; respective screen lines.
-; Not every text line have screen line representation - it means the count of items of [pIntex]
-; can be smaller than count of items of [pLines]. This case is when some lines are folded and not visible.
-; On the other hand, another variant is also possible - several items of [pIndex] to point to
-; one line in [pLines] - when the text line is wraped and displayed on several lines of the screen.
-;
-;_________________________________________________________________________________________
-
-cDefaultEditorFont text 'Fixedsys Excelsior 3.01'
-;cDefaultEditorFont text 'Droid sans mono'
-
-; left margin icons.
-;iglobal
- getfile iconBreakpointA, 'images/breakpoint.gif'
- getfile iconBreakpointI, 'images/breakpoint_inactive.gif'
- getfile maskBreakpointA, 'images/breakpoint_mask.gif'
- getfile maskBreakpointI, 'images/breakpoint_mask_inactive.gif'
- getfile iconDebugInfo, 'images/debug_icon.gif'
- getfile maskDebugInfo, 'images/debug_mask.gif'
- getfile iconUnfold, 'images/unfold.gif'
- getfile iconFold, 'images/fold.gif'
- getfile maskUnfold, 'images/unfold_mask.gif'
-;endg
-
-
-proc TFreshEdit.Create, .pobj
-begin
- push eax edx
-
- mov ebx, [.pobj]
-
-; Main Font settings.
- stdcall FontCreate, cDefaultEditorFont, 0, 0, ffMonospaced
- mov [ebx+TFreshEdit._Font], eax
- mov [ebx+TFreshEdit._cursor], mcText
-
- stdcall FontGetCharSize, [ebx+TFreshEdit.handle], [ebx+TFreshEdit._Font], __HeightProbeString
- test edx, edx
- jnz @f
- inc edx
-@@:
- mov [ebx+TFreshEdit._fontheight], edx
- mov [ebx+TFreshEdit._fontwidth], eax
- mov [ebx+TFreshEdit._fontdescent], ecx
-
-; System font settings.
- stdcall FontGetCharSize, [ebx+TFreshEdit.handle], 0, __NumberProbeString
- mov [ebx+TFreshEdit._fontheight2], edx
- mov [ebx+TFreshEdit._fontwidth2], eax
- mov [ebx+TFreshEdit._fontdescent2], ecx
-
-; Icons for internal use
-
- stdcall CreateImageGIF, iconBreakpointA, iconBreakpointA.size
- mov [ebx+TFreshEdit._iconBreakpointA], eax
-
- stdcall CreateImageGIF, iconBreakpointI, iconBreakpointI.size
- mov [ebx+TFreshEdit._iconBreakpointI], eax
-
- stdcall CreateImageGIF, iconDebugInfo, iconDebugInfo.size
- mov [ebx+TFreshEdit._iconDebugInfo], eax
-
- stdcall CreateImageGIF, maskBreakpointA, maskBreakpointA.size
- mov [ebx+TFreshEdit._maskBreakpointA], eax
-
- stdcall CreateImageGIF, maskBreakpointI, maskBreakpointI.size
- mov [ebx+TFreshEdit._maskBreakpointI], eax
-
- stdcall CreateImageGIF, maskDebugInfo, maskDebugInfo.size
- mov [ebx+TFreshEdit._maskDebugInfo], eax
-
- stdcall CreateImageGIF, iconUnfold, iconUnfold.size
- mov [ebx+TFreshEdit._iconUnfold], eax
-
- stdcall CreateImageGIF, iconFold, iconFold.size
- mov [ebx+TFreshEdit._iconFold], eax
-
- stdcall CreateImageGIF, maskUnfold, maskUnfold.size
- mov [ebx+TFreshEdit._maskUnfold], eax
-
-; Init some values.
- mov [ebx+TFreshEdit._TabStop], 8
-
- mov [eax+TFETheme.WrapPos], 80
- mov [eax+TFETheme.UndoLevels], 20
-
- mov [ebx+TFreshEdit._DragButton], -1
-
- stdcall CreateArray, sizeof.TEditorLine
- mov [ebx+TFreshEdit._pLines], eax
-
- stdcall CreateArray, 4
- mov [ebx+TFreshEdit._pIndex], eax
-
- stdcall CreateArray, 4
- mov [ebx+TFreshEdit._pLengths], eax
-
- stdcall CreateArray, sizeof.TUndoInfo
- mov [ebx+TFreshEdit._pUndoList], eax
-
- stdcall CreateArray, sizeof.TUndoInfo
- mov [ebx+TFreshEdit._pRedoList], eax
-
- stdcall CreateBackBuffer, [ebx+TFreshEdit.handle], 1, 1
- mov [ebx+TFreshEdit._pShadow], eax
-
- pop edx eax
- clc
- return
-endp
-
-
-
-;_________________________________________________________________________________________
-
-
-proc TFreshEdit.Destroy, .pobj
-begin
- mov ebx, [.pobj]
- execute ebx, TFreshEdit.Clear
- stdcall FreeMem, [ebx+TFreshEdit._pLines]
- stdcall FreeMem, [ebx+TFreshEdit._pIndex]
- stdcall FreeMem, [ebx+TFreshEdit._pLengths]
- stdcall FreeMem, [ebx+TFreshEdit._pUndoList]
- stdcall FreeMem, [ebx+TFreshEdit._pRedoList]
-
- stdcall DestroyBackBuffer, [ebx+TFreshEdit._pShadow]
-
- stdcall DestroyImage, [ebx+TFreshEdit._iconBreakpointA]
- stdcall DestroyImage, [ebx+TFreshEdit._iconBreakpointI]
- stdcall DestroyImage, [ebx+TFreshEdit._iconDebugInfo]
- stdcall DestroyImage, [ebx+TFreshEdit._maskBreakpointA]
- stdcall DestroyImage, [ebx+TFreshEdit._maskBreakpointI]
- stdcall DestroyImage, [ebx+TFreshEdit._maskDebugInfo]
- stdcall DestroyImage, [ebx+TFreshEdit._iconUnfold]
- stdcall DestroyImage, [ebx+TFreshEdit._iconFold]
-
- stdcall DestroyImage, [ebx+TFreshEdit._maskUnfold]
- clc
- return
-endp
-
-
-;_________________________________________________________________________________________
-
-
-proc TFreshEdit.Get, .pobj, .paramID
-begin
- stdcall IsObject, [.pobj], CFreshEdit
- jc .exit
-
- cmp [.paramID], TFreshEdit.MaxLineLen
- je .maxlinelen
-
- cmp [.paramID], TFreshEdit.CurrentLine
- je .currentline
-
- cmp [.paramID], TFreshEdit.Text
- je .gettext
-
- cmp [.paramID], TFreshEdit.Selection
- je .get_selection
-
- stc
-.exit:
- return
-
-;................................................................
-.get_selection:
- push esi
-
- mov esi, [.pobj]
- mov eax, [esi+TFreshEdit._SelMode]
- cmp eax, selmChar
- je .get_sel_char
- cmp eax, selmBlock
- je .get_sel_block
-
- stc
- return
-
-.get_sel_char:
- execute esi, TFreshEdit.GetText, [esi+TFreshEdit._yCaret], [esi+TFreshEdit._xCaret], \
- [esi+TFreshEdit._ySelection], [esi+TFreshEdit._xSelection]
-
- clc
- pop esi
- return
-
-
-.get_sel_block:
- xor eax, eax
- clc
- pop esi
- return
-
-
-;................................................................
-.gettext:
- push ebx ecx edx esi edi
-
-
- stdcall StrNew
- mov ebx, eax
- mov edi, [.pobj]
-
- mov esi, [edi+TFreshEdit._pLines]
- mov ecx, [esi+TArray.count]
-
- jecxz .text_ready
- lea esi, [esi+TArray.array]
-
-.line_loop:
- stdcall TFreshEdit.__AddFormatLine, ebx, [esi+TEditorLine.flags]
-
- stdcall StrDup, [esi+TEditorLine.Data]
- push eax
- push eax
- push eax
- stdcall StrLen, eax
- mov edx, eax
- stdcall StrPtr ; from the stack
-
- test edx, edx
- jz .line_ready
-
-.loop_char:
- cmp byte [eax], 1
- jne .next
- mov byte [eax], $20
-.next:
- inc eax
- dec edx
- jnz .loop_char
-
-.line_ready:
- stdcall StrCat, ebx ; from the stack.
- stdcall StrDel ; from the stack
- stdcall StrCharCat, ebx, $0a0d
-
-.next_line:
- add esi, sizeof.TEditorLine
- loop .line_loop
-
-.text_ready:
- mov eax, ebx
- pop edi esi edx ecx ebx
- clc
- return
-
-;................................................................
-
-.currentline:
- push ebx edx edi
-
- mov edi, [.pobj]
- mov eax, [edi+TFreshEdit._yCaret]
- mov ebx, [edi+TFreshEdit._pIndex]
- cmp eax, [ebx+TArray.count]
- jae .errorcl
-
-.lineloop:
- mov edx, [ebx+TArray.array+4*eax]
- cmp edx, -1
- jne .found
-
- dec eax
- jns .lineloop
-
-.errorcl:
- stc
- pop edi edx ebx
- return
-
-; edx is the number of string in the lines array.
-.found:
- mov ebx, [edi+TFreshEdit._pLines]
- cmp edx, [ebx+TArray.count]
- jae .errorcl
-
- shl edx, TEditorLine.shift
- lea eax, [ebx+TArray.array+edx]
-
- clc
- pop edi edx ebx
- return
-
-;................................................................
-
-.maxlinelen:
- mov eax, [.pobj]
- mov eax, [eax+TFreshEdit._pLengths]
- mov eax, [eax+TArray.count]
- dec eax
- jns @f
- xor eax, eax
-@@:
- clc
- return
-
-endp
-
-
-;_________________________________________________________________________________________
-
-
-proc TFreshEdit.Set, .pobj, .paramID, .value
-begin
- push eax ebx edx esi edi
- mov edi, [.pobj]
-
- mov eax, [.paramID]
- cmp eax, TFreshEdit.Text
- je .settext
-
- cmp eax, TFreshEdit.Selection
- je .set_selection
-
- stc
-
-.finish:
- pop edi esi edx ebx eax
- return
-
-;.........................................................................................
-.set_selection:
-; delete the old selection
- push esi eax edx
- mov esi, [.pobj]
-
- execute esi, TFreshEdit.DeleteSel
- mov [esi+TFreshEdit._yCaret], eax
- mov [esi+TFreshEdit._xCaret], edx
-
-; Insert the specified string on the current caret position.
- execute [.pobj], TFreshEdit.InsertString, [.value]
- pop edx eax esi
- clc
- return
-
-;.........................................................................................
-
-.settext:
-locals
-.pLine dd ?
-.flags dd ?
-endl
- execute edi, TFreshEdit.Clear
-
- stdcall StrPtr, [.value]
- mov esi, eax
-
-.lineloop:
- mov [.flags], 0
-
- stdcall TFreshEdit.__DecodeFormatLine, esi
- jc .line_begin
-
- mov [.flags], eax
- add esi, ecx
-
-.line_begin:
- push esi
-
-.char:
- lodsb
- test al, al
- jz .end_of_line
-
- cmp al, $0a
- je .end_of_line
- cmp al, $0d
- jne .char
-
-.end_of_line:
- mov ebx, esi
- sub ebx, [esp]
- dec ebx
-
- test al, al
- jnz @f
- dec esi
- jmp .lineok
-
-@@:
- xor al, $0a xor $0d
- cmp [esi], al
- jne .lineok
- inc esi
-
-.lineok:
- pop eax
- push ecx esi edi
-
- mov ecx, ebx
- mov esi, eax
-
- stdcall StrNew
- mov ebx, eax
- stdcall StrSetCapacity, ebx, ecx
- mov edi, eax
-
- mov [edi+string.len], ecx
-
- rep movsb
- xor eax, eax ; terminating zero - important for linux sometimes,
- ; because the memory reallocation returns not zero filled memory.
- stosb
-
- pop edi esi ecx
-
-; insert text line.
- stdcall AddArrayItems, [edi+TFreshEdit._pLines], 1
- mov [edi+TFreshEdit._pLines], edx
- mov ecx, [edx+TArray.count]
- mov [.pLine], eax
-
- mov [eax+TEditorLine.Data], ebx
- push [.flags]
- pop [eax+TEditorLine.flags]
- mov [eax+TEditorLine.syn_context], 0
- mov [eax+TEditorLine.debugdata], 0
- mov [eax+TEditorLine.width], -1
-
-; insert index line.
- stdcall AddArrayItems, [edi+TFreshEdit._pIndex], 1
- mov [edi+TFreshEdit._pIndex], edx
-
- dec ecx
- mov [eax], ecx
-
-; format the line
- mov ecx, [edx+TArray.count]
- dec ecx
- execute edi, TFreshEdit.FormatLine, ecx
-
-; goto next line.
- cmp byte [esi], 0
- jne .lineloop
-
- mov [edi+TFreshEdit._TopLine], 0
- mov [edi+TFreshEdit._yCaret], 0
-
- mov eax, [edi+TFreshEdit._pLengths]
-
- stdcall TFreshEdit.__UpdateScrollBars, edi
- mov [edi+TFreshEdit._fShadowValid], 0
-
- clc
- jmp .finish
-endp
-
-
-
-;_________________________________________________________________________________________
-
-; move commands
-mvcMoveX = 1
-mvcMoveY = 2
-mvcScrollX = 4
-mvcScrollY = 8
-
-
-proc TFreshEdit.ExecCmd, .self, .method
-begin
- cmp [.method], TFreshEdit.Refresh
- je .refresh
-
- cmp [.method], TFreshEdit.Clear
- je .clear
-
- cmp [.method], TFreshEdit.Move
- je .movecaret
-
- cmp [.method], TFreshEdit.LineBegin
- je .linebegin
-
- cmp [.method], TFreshEdit.LineEnd
- je .lineend
-
- cmp [.method], TFreshEdit.DeleteSel
- je .delete_selection
-
- cmp [.method], TFreshEdit.DeleteText
- je .delete_text
-
- cmp [.method], TFreshEdit.GetText
- je .get_text
-
- cmp [.method], TFreshEdit.DeleteLine
- je .delete_line
-
- cmp [.method], TFreshEdit.InsertChar
- je .insert_char
-
- cmp [.method], TFreshEdit.InsertString
- je .insert_string
-
- cmp [.method], TFreshEdit.InsertLine
- je .insert_line
-
- cmp [.method], TFreshEdit.FormatLine
- je .format_line
-
- cmp [.method], TFreshEdit.DelChar
- je .del_char
-
- stc
- return
-
-;.........................................................................................
-.refresh:
- mov eax, [.self]
- mov [eax+TFreshEdit._fShadowValid], 0
- stc
- return
-
-;.........................................................................................
-; formats some line of the text, depending on the flags. Also, fix the index items for
-; this line.
-.format_line:
-virtual at ebx
- .index dd ?
-end virtual
-
-; first get the line pointer
-locals
- .imin dd ?
- .imax dd ?
- .start_count dd ?
- .rows dd ?
-
- .caret_ofs dd ?
- .wrap_here dd ?
-
- .retval dd ? ; correction count on tab-expansion
-endl
- push ecx esi edi
-
- mov esi, [.self]
- mov edi, [esi+TFreshEdit._pIndex]
-
- mov ecx, [.index]
- cmp ecx, [edi+TArray.count]
- jae .error_format
-
-.loop_end:
- inc ecx
- cmp ecx, [edi+TArray.count]
- jae .end_found
- cmp [edi+TArray.array+4*ecx], -1
- je .loop_end
-
-.end_found:
- dec ecx
- mov [.imax], ecx
-
- mov ecx, [.index]
- inc ecx
-
-.loop_start:
- dec ecx
- js .error_format
-
- cmp [edi+TArray.array+4*ecx], -1
- je .loop_start
-
- mov [.imin], ecx
- mov [.rows], 1 ; how many lines are withit the line
-
- mov ecx, [edi+TArray.array+4*ecx] ; index in _pLines array.
- shl ecx, TEditorLine.shift
- add ecx, [esi+TFreshEdit._pLines]
- lea edi, [ecx+TArray.array] ; edi points to TEditorLine structure.
-
-; begin of formating
- stdcall StrClipSpacesR, [edi+TEditorLine.Data]
- stdcall ExpandTabs, [edi+TEditorLine.Data], [esi+TFreshEdit._TabStop]
- mov [.retval], eax
- stdcall StrLen, [edi+TEditorLine.Data]
- mov ecx, eax
- mov [.start_count], eax
- jecxz .wrap_ok
-
- stdcall StrPtr, [edi+TEditorLine.Data]
- mov edx, eax
-
-; first replace $01 with $20 (wrap char to space)
- push edx ecx
-.spc_loop:
- cmp byte [edx], $01
- jne @f
- mov byte [edx], $20
-@@:
- inc edx
- loop .spc_loop
- pop ecx edx
-
-; word wrap?
- test [edi+TEditorLine.flags], lfWordWrap
- jz .wrap_ok
-
- push edi
-
- mov edi, edx
-.wrap_outer:
- mov ecx, [FreshEditTheme.WrapPos]
- inc ecx
- mov [.wrap_here], -1
- xor edx, edx
-
-.wrap_loop:
- add edi, edx
- stdcall DecodeUtf8, [edi]
- test eax, eax
- jz .wrap_ready
-
- cmp eax, ' '
- jne @f
- mov [.wrap_here], edi
-@@:
- loop .wrap_loop
-
- cmp [.wrap_here], -1
- jne .do_wrap
-
-.forward:
- add edi, edx
- stdcall DecodeUtf8, [edi]
- test eax, eax
- jz .wrap_ready
-
- cmp eax, ' '
- jne .forward
-
- mov [.wrap_here], edi
-
-.do_wrap:
- mov edi, [.wrap_here]
- mov byte [edi], $01 ; wrap the line.
- inc edi
- inc [.rows]
- jmp .wrap_outer
-
-
-.wrap_ready:
-; ready, so fix the index.
- pop edi
-
-.wrap_ok:
- mov eax, [.imin]
- inc eax
-
- mov ecx, [.imax]
- sub ecx, [.imin]
- inc ecx
- sub ecx, [.rows] ; ecx>0 means some rows from the index must be deleted
- ; ecx<0 means some rows must be added.
- ; ecx=0 means the index is ok
- jz .index_ok
- js .add_more_index
-
- stdcall DeleteArrayItems, [esi+TFreshEdit._pIndex], eax, ecx
- mov [esi+TFreshEdit._pIndex], edx
- jmp .index_ok
-
-.add_more_index:
- neg ecx
- stdcall InsertArrayItems, [esi+TFreshEdit._pIndex], eax, ecx
- mov [esi+TFreshEdit._pIndex], edx
-
-.fill_new_items:
- mov dword [eax], -1
- lea eax, [eax+4]
- loop .fill_new_items
-
-.index_ok:
- stdcall TFreshEdit.__LineWidth, [edi+TEditorLine.Data]
- xchg eax, [edi+TEditorLine.width]
- stdcall TFreshEdit.__FixLength, esi, [edi+TEditorLine.width], eax
-
- clc
- mov eax, [.retval]
- mov edx, [.imin]
- pop edi esi ecx
- return
-
-.error_format:
- int3
- mov eax, -1
- clc
- pop edi esi ecx
- return
-
-;.........................................................................................
-.delete_line:
-virtual at ebx
- .del_index dd ?
-end virtual
-
- push edx esi edi
- mov esi, [.self]
-
- mov eax, [.del_index]
- cmp eax, -1
- jne @f
- mov eax, [esi+TFreshEdit._yCaret]
-@@:
- mov edi, [esi+TFreshEdit._pIndex]
- cmp eax, [edi+TArray.count]
- jae .end_del_line
-
-.beg_search:
- cmp [edi+TArray.array+4*eax], -1 ; word wrap
- jne .do_del
- dec eax
- jnz .beg_search
-
-.do_del:
- mov ecx, [edi+TArray.array+4*eax]
- shl ecx, TEditorLine.shift
- add ecx, TArray.array
- add ecx, [esi+TFreshEdit._pLines]
- stdcall StrDel, [ecx+TEditorLine.Data]
- stdcall TFreshEdit.__FixLength, esi, -1, [ecx+TEditorLine.width]
-
- stdcall DeleteArrayItems, [esi+TFreshEdit._pLines], [edi+TArray.array+4*eax], 1
- mov [esi+TFreshEdit._pLines], edx
-
-.del_index2:
- stdcall DeleteArrayItems, edi, eax, 1
- mov edi, edx
- cmp eax, [edi+TArray.count]
- jae .end_del_index2
-
- cmp [edi+TArray.array+4*eax], -1
- je .del_index2
-
-.end_del_index2:
- mov [esi+TFreshEdit._pIndex], edi
- push eax
-
-; fix the index to the end:
-.fix_index_del:
- cmp eax, [edi+TArray.count]
- jae .end_fix_index
-
- cmp [edi+TArray.array+4*eax], -1
- je @f
- dec [edi+TArray.array+4*eax]
-@@:
- inc eax
- jmp .fix_index_del
-
-.end_fix_index:
- pop eax
-.end_del_line:
- clc
- pop edi esi edx
- return
-
-;.........................................................................................
-.get_text:
-; have the same arguments and local variables as .delete_text
- pushad
- mov [.ret_str], 0
-
-; sort the "from" and "To" in order to have "From" < "To"
- mov eax, [.indexFrom]
- mov ecx, [.charFrom]
- cmp eax, [.indexTo]
- jne @f
- cmp ecx, [.charTo]
-@@:
- je .finish_get ; from == to so nothing to return
- jb @f
- xchg eax, [.indexTo]
- xchg ecx, [.charTo]
- mov [.indexFrom], eax
- mov [.charFrom], ecx
-@@:
-
-; last line processing
- stdcall TFreshEdit.__PosToPointer, [.self], [.charTo], [.indexTo]
- mov [.toline], edx
-
- stdcall StrExtract, [edx+TEditorLine.Data], 0, eax
- mov [.final_str], eax
-
-; first line processing
- stdcall TFreshEdit.__PosToPointer, [.self], [.charFrom], [.indexFrom]
- mov [.fromline], edx
-
- mov edi, [edx+TEditorLine.Data]
- cmp edx, [.toline]
- jne .dup_first
- mov edi, [.final_str]
-.dup_first:
- push eax
- stdcall StrDup, edi
- mov edi, eax
- pop eax
-
- jecxz .get_splitit
- add eax, ecx
-
-.get_addspc:
- stdcall StrCharCat, edi, ' '
- dec ecx
- jnz .get_addspc
-
-.get_splitit:
- stdcall StrSplit, edi, eax
- stdcall StrDel, edi
- mov [.ret_str], eax
-
-; now concatenate all lines to the first.
-
- mov edi, [.toline]
- mov esi, [.fromline]
- cmp esi, edi
- je .end_get2
-
-.get_loop:
- add esi, sizeof.TEditorLine
- cmp esi, edi
- je .end_get
- stdcall StrCharCat, [.ret_str], $0a0d
- stdcall StrCat, [.ret_str], [esi+TEditorLine.Data]
- jmp .get_loop
-
-.end_get:
- stdcall StrCharCat, [.ret_str], $0a0d
- stdcall StrCat, [.ret_str], [.final_str]
-
-.end_get2:
- stdcall StrDel, [.final_str]
-
-; here, format the string - remove word wrap characters if any...
- stdcall StrPtr, [.ret_str]
-
-.get_format:
- cmp byte [eax], 0
- je .finish_get
-
- cmp byte [eax], $01 ; word wrap char
- jne @f
- mov byte [eax], $20
-@@:
- inc eax
- jmp .get_format
-
-.finish_get:
- clc
- popad
- mov eax, [.ret_str]
- return
-
-;.........................................................................................
-.delete_text:
-virtual at ebx ; arguments
- .indexFrom dd ?
- .charFrom dd ?
- .indexTo dd ?
- .charTo dd ?
-end virtual
-locals
- .final_str dd ?
- .final_flags dd ?
- .final_level dd ?
- .fromline dd ?
- .toline dd ?
- .ret_str dd ?
-endl
- pushad
-
-; sort the "from" and "To" in order to have "From" < "To"
- mov eax, [.indexFrom]
- mov ecx, [.charFrom]
- cmp eax, [.indexTo]
- jne @f
- cmp ecx, [.charTo]
-@@:
- je .nothing_to_delete ; from == to so nothing to delete.
- jb @f
- xchg eax, [.indexTo]
- xchg ecx, [.charTo]
- mov [.indexFrom], eax
- mov [.charFrom], ecx
-@@:
-
-; last line processing
- stdcall TFreshEdit.__PosToPointer, [.self], [.charTo], [.indexTo]
-
- stdcall StrSplit, [edx+TEditorLine.Data], eax
- mov [.final_str], eax
-
- mov eax, [edx+TEditorLine.flags]
- mov ecx, [edx+TEditorLine.fold_level]
- mov [.final_flags], eax
- mov [.final_level], ecx
-
-; first line processing
- stdcall TFreshEdit.__PosToPointer, [.self], [.charFrom], [.indexFrom]
- mov [.fromline], edx
-
- jecxz .splitit
- add eax, ecx
-.addspc:
- stdcall StrCharCat, [edx+TEditorLine.Data], ' '
- dec ecx
- jnz .addspc
-
-.splitit:
- stdcall StrSplit, [edx+TEditorLine.Data], eax
- stdcall StrDel, eax
- stdcall StrCat, [edx+TEditorLine.Data], [.final_str]
- stdcall StrDel, [.final_str]
- mov eax, [.final_level]
- mov ecx, [.final_flags]
- mov [edx+TEditorLine.fold_level], eax
- or [edx+TEditorLine.flags], ecx
-
-; now delete all lines except the first.
-
- mov edi, [.indexTo]
-
-.del_loop:
- stdcall TFreshEdit.__PosToPointer, [.self], -1, edi
- cmp edx, [.fromline]
- je .delete_ok
-
- execute [.self], TFreshEdit.DeleteLine, edi
- mov edi, eax
- dec edi
- jmp .del_loop
-
-
-.delete_ok:
- execute [.self], TFreshEdit.FormatLine, [.indexFrom]
-
- clc
- popad
- mov eax, [.indexFrom]
- mov edx, [.charFrom]
- return
-
-.nothing_to_delete:
- clc
- popad
- xor eax, eax
- dec eax
- return
-
-;.........................................................................................
-; delete the selection
-.delete_selection:
- mov esi, [.self]
- mov eax, [esi+TFreshEdit._SelMode]
- cmp eax, selmChar
- je .del_sel_char
- cmp eax, selmBlock
- je .del_sel_block
-
- stc
- return
-
-.del_sel_char:
- execute esi, TFreshEdit.DeleteText, [esi+TFreshEdit._yCaret], [esi+TFreshEdit._xCaret], \
- [esi+TFreshEdit._ySelection], [esi+TFreshEdit._xSelection]
- clc
- return
-
-
-.del_sel_block:
- clc
- return
-
-;.........................................................................................
-.insert_line:
-virtual at ebx
- .ins_index dd ?
-end virtual
- push esi edi
- mov esi, [.self]
-
-; first where to search. The next line is OK, but if the line is wrapped...
- cmp [.ins_index], -1
- jne @f
- mov eax, [esi+TFreshEdit._yCaret]
- mov [.ins_index], eax
-@@:
-
- mov edi, [esi+TFreshEdit._pIndex]
- mov edx, [.ins_index]
-
- cmp edx, [edi+TArray.count]
- jb .search_begin
-
-; insert as a last line
- mov edx, [edi+TArray.count]
- mov ecx, -1
- jmp .ins_here
-
-; if the line is wrapped, search for the begin.
-.search_begin:
- mov ecx, [edi+TArray.array+4*edx]
- cmp ecx, -1 ; wrapped line?
- jne .ins_here
- dec edx
- jns .search_begin
- jmp .err_ins_line
-
-; ...insert index item.
-; edx contains the index in _pIndex where the new line have to be inserted.
-; ecx contains the index in _pLines where the new line have to be inserted.
-.ins_here:
- push edx
- stdcall InsertArrayItems, [esi+TFreshEdit._pIndex], edx, 1
- mov [esi+TFreshEdit._pIndex], edx
- mov edi, edx
- pop edx
- jc .err_ins_line
-
- cmp ecx, -1
- jne .storeline
-
- mov ecx, [esi+TFreshEdit._pLines]
- mov ecx, [ecx+TArray.count]
-
-.storeline:
- mov [eax], ecx
-
-; ...then fix the index to the end.
-
- sub edx, [edi+TArray.count]
- neg edx
- dec edx
- jle .index_fixed
-
-.inc_index:
- lea eax, [eax+4]
- cmp dword [eax], -1
- je @f
- inc dword [eax]
-@@:
- dec edx
- jnz .inc_index
-
-
-.index_fixed:
-; then insert new line
- stdcall InsertArrayItems, [esi+TFreshEdit._pLines], ecx, 1
- mov [esi+TFreshEdit._pLines], edx
- jc .err_ins_line
-
- mov edx, eax
- stdcall StrNew
-
- mov [edx+TEditorLine.Data], eax
- xor eax, eax
- mov [edx+TEditorLine.flags], eax
- mov [edx+TEditorLine.syn_context], eax
- mov [edx+TEditorLine.debugdata], eax
- mov [edx+TEditorLine.width], eax
- mov eax, edx
-
- stdcall TFreshEdit.__FixLength, esi, 0, -1
-
- pop edi esi
- clc
- return
-
-.err_ins_line:
- pop edi esi
- stc
- return
-
-;.........................................................................................
-.del_char:
-locals
- .del_char_line dd ?
- .del_line_index dd ?
- .byte_offs dd ?
-endl
- push ecx edx esi edi
-
- mov esi, [.self]
- stdcall TFreshEdit.__PosToPointer, esi, [esi+TFreshEdit._xCaret], [esi+TFreshEdit._yCaret]
- jc .end_del_char
-
- test [edx+TEditorLine.flags], lfProtected
- jnz .end_del_char
-
- jecxz .do_del_char
-
-.del_pad_spc:
- stdcall StrCharInsert, [edx+TEditorLine.Data], ' ', eax
- inc eax
- loop .del_pad_spc
-
-.do_del_char:
- mov [.byte_offs], eax
- mov [.del_char_line], edx
- mov ebx, eax
- stdcall StrLen, [edx+TEditorLine.Data]
- cmp ebx, eax
- je .join_next_line
-
- mov ecx, eax
- sub ecx, ebx
-
- stdcall StrPtr, [edx+TEditorLine.Data]
- mov edi, eax
- stdcall DecodeUtf8, [edi+ebx]
- lea esi, [edi+edx]
- sub [edi+string.len], edx
- add esi, ebx
- add edi, ebx
- cld
- rep movsb
-
-.end_del_char:
- mov eax, [.byte_offs]
- pop edi esi edx ecx
- clc
- return
-
-.join_next_line:
- mov eax, [.del_char_line]
- mov edx, [esi+TFreshEdit._pLines]
- sub eax, edx
- sub eax, TArray.array
- shr eax, TEditorLine.shift
- inc eax
- cmp eax, [edx+TArray.count]
- jae .end_del_char
-
- mov [.del_line_index], eax
-
- mov edx, [.del_char_line]
- mov ebx, edx
- add edx, sizeof.TEditorLine
- test [edx+TEditorLine.flags], lfProtected
- jz .do_join
-
- stdcall StrLen, [ebx+TEditorLine.Data]
- test eax, eax
- jnz .end_del_char
-
-.do_join:
- stdcall StrCat, [ebx+TEditorLine.Data], [edx+TEditorLine.Data]
- mov eax, [edx+TEditorLine.flags]
- or [ebx+TEditorLine.flags], eax
-
-; now delete the line
- stdcall TFreshEdit.__FixLength, esi, -1, [edx+TEditorLine.width]
- stdcall StrDel, [edx+TEditorLine.Data]
- stdcall DeleteArrayItems, [esi+TFreshEdit._pLines], [.del_line_index], 1
- mov [esi+TFreshEdit._pLines], edx
-
-; then fix the index.
- mov edi, [esi+TFreshEdit._pIndex]
- mov eax, [esi+TFreshEdit._yCaret]
- mov edx, [.del_line_index]
- inc eax
-
-.char_fix_index:
- cmp eax, [edi+TArray.count]
- jae .end_del_char
-
- cmp [edi+TArray.array+4*eax], -1
- je .next_line_fix
- cmp [edi+TArray.array+4*eax], edx
- je .del_index_elements
-
- dec [edi+TArray.array+4*eax]
-
-.next_line_fix:
- inc eax
- jmp .char_fix_index
-
-.del_index_elements:
- mov ecx, eax
-
-.char_scan_loop:
- inc ecx
- cmp ecx, [edi+TArray.count]
- jae .end_char_scan
- cmp [edi+TArray.array+4*ecx], -1
- je .char_scan_loop
-
-.end_char_scan:
- sub ecx, eax
- stdcall DeleteArrayItems, edi, eax, ecx
- mov [esi+TFreshEdit._pIndex], edx
- mov edi, edx
- mov edx, [.del_line_index]
- jmp .char_fix_index
-
-;.........................................................................................
-.insert_char:
-; arguments
-virtual at ebx
- .ins_char dd ?
-end virtual
-
- push ecx edx esi edi
-
- mov esi, [.self]
-.ins_loop:
- stdcall TFreshEdit.__PosToPointer, esi, [esi+TFreshEdit._xCaret], [esi+TFreshEdit._yCaret]
- jnc .line_found
-
- execute [.self], TFreshEdit.InsertLine, -2
- jnc .ins_loop ; possible hang!
-
- xor edx, edx
- jmp .end_ins_char
-
-.line_found:
- test [edx+TEditorLine.flags], lfProtected
- jz .not_protected
-
- lea edx, [eax+ecx]
- jmp .end_ins_char
-
-.not_protected:
- cmp [.ins_char], $0d
- je .split_here
- cmp [.ins_char], $0a
- je .split_here
-
- jecxz .spaces_ok
-
-.addspc2:
- stdcall StrCharInsert, [edx+TEditorLine.Data], ' ', eax
- inc eax
- loop .addspc2
-
-.spaces_ok:
-.do_ins_char:
- stdcall StrCharInsert, [edx+TEditorLine.Data], [.ins_char], eax
- mov esi, eax
- stdcall DecodeUtf8, [.ins_char]
- add edx, esi
- jmp .end_ins_char
-
-.split_here:
- push eax edx
-
- mov eax, [esi+TFreshEdit._yCaret]
- inc eax
- execute [.self], TFreshEdit.InsertLine, eax
- mov edi, eax
-
- pop edx eax
- stdcall StrSplit, [edx+TEditorLine.Data], eax
-
- stdcall StrDel, [edi+TEditorLine.Data]
- mov [edi+TEditorLine.Data], eax
-
- mov eax, [esi+TFreshEdit._yCaret]
- inc eax
- execute esi, TFreshEdit.FormatLine, eax
- execute esi, TFreshEdit.FormatLine, [esi+TFreshEdit._yCaret]
-
-.split_ok:
- execute esi, TFreshEdit.LineBegin
- execute esi, TFreshEdit.Move, mvcMoveY, 1, TRUE
- xor edx, edx
-
-.end_ins_char:
- push edx
- mov esi, [.self]
- stdcall TFreshEdit.__PointerToPos, [.self], [esi+TFreshEdit._yCaret], edx
- mov [esi+TFreshEdit._xCaret], edx
- mov [esi+TFreshEdit._yCaret], eax
- pop eax
- clc
- pop edi esi edx ecx
- return
-;.........................................................................................
-
-.insert_string:
-; arguments
-virtual at ebx
- .hstring dd ?
-end virtual
-
- push ecx edx esi
-
- stdcall StrPtr, [.hstring]
- mov esi, eax
-
-.char_loop:
- stdcall DecodeUtf8, [esi]
- jc .end_ins_str
-
- mov eax, [esi]
- add esi, edx
-
- lea ecx, [8*edx]
- mov edx, 1
- shl edx, cl
- dec edx
- and eax, edx
-
- cmp eax, 0
- je .end_ins_str
-
- cmp eax, $0d
- je .ins_cr
- cmp eax, $0a
- jne .ins_it
-
-.ins_cr:
- xor al, $0d xor $0a
- cmp al, [esi]
- je .char_loop
-
-.ins_it:
- execute [.self], TFreshEdit.InsertChar, eax
- jmp .char_loop
-
-.end_ins_str:
- clc
- pop esi edx ecx
- return
-
-;.........................................................................................
-.linebegin:
- stdcall TFreshEdit.__FitCaretInWindow, [.self]
- jnz .endlb
-
- mov eax, [.self]
- mov [eax+TFreshEdit._xCaret], 0
- mov [eax+TFreshEdit._LeftColumn], 0
-
-.endlb:
- clc
- return
-
-;.........................................................................................
-.lineend:
- push ecx edx esi edi
- mov esi, [.self]
-
- stdcall TFreshEdit.__FitCaretInWindow, esi
- jnz .endle
-
- mov esi, [.self]
- mov ecx, [esi+TFreshEdit._yCaret]
- mov ebx, [esi+TFreshEdit._pIndex]
-
- stdcall TFreshEdit.__PosToPointer, esi, [esi+TFreshEdit._xCaret], [esi+TFreshEdit._yCaret]
- mov ebx, eax
-
- stdcall StrPtr, [edx+TEditorLine.Data]
- mov edi, eax
-
-; search the end of the current line
-.el_loop:
- stdcall DecodeUtf8, [edi+ebx]
- test eax, eax
- jz .el_found
- cmp eax, $01
- je .el_found
-
- add ebx, edx
- jmp .el_loop
-
-.el_found:
- stdcall TFreshEdit.__PointerToPos, esi, [esi+TFreshEdit._yCaret], ebx
- mov [esi+TFreshEdit._yCaret], eax
- mov [esi+TFreshEdit._xCaret], edx
-
-.endle:
- stdcall TFreshEdit.__FitCaretInWindow, esi
- pop edi esi edx ecx
- clc
- return
-
-;.........................................................................................
-; The method TFreshEdit.Move moves the caret towards given direction and on
-; the given count of steps.
-;
-.movecaret:
-virtual at ebx
- .direction dd ?
- .count dd ?
- .force dd ?
-end virtual
-
- push edx esi edi
-
-
- mov esi, [.self]
-
- test [.direction], mvcMoveX or mvcMoveY
- jz .fitok
-
- cmp [.force], 0
- jne .fitok
-
- stdcall TFreshEdit.__FitCaretInWindow, esi
-
- test eax, eax
- jnz .endmove
-
-.fitok:
- test [.direction], mvcMoveX or mvcScrollX
- jnz .move_horizontal
-
- test [.direction], mvcMoveY or mvcScrollY
- jnz .move_vertical
-
-.endmove:
- clc
- pop edi esi edx
- return
-
-
-.move_horizontal:
- test [.direction], mvcMoveX
- jz .xcaretok
-
- mov ecx, [esi+TFreshEdit._xCaret]
- add ecx, [.count]
- jns @f
- xor ecx, ecx
-@@:
- mov [esi+TFreshEdit._xCaret], ecx
-
-.xcaretok:
- test [.direction], mvcScrollX
- jz .leftcolok
-
- mov ecx, [esi+TFreshEdit._LeftColumn]
- add ecx, [.count]
- jns @f
- xor ecx, ecx
-@@:
- mov [esi+TFreshEdit._LeftColumn], ecx
-
-.leftcolok:
-
- mov ecx, [esi+TFreshEdit._xCaret]
- mov edx, [esi+TFreshEdit._LeftColumn]
- cmp ecx, edx
- jb .hscroll
- add edx, [esi+TFreshEdit._cols]
- cmp ecx, edx
- jb .endmove
-
-.hscroll:
- mov ecx, [esi+TFreshEdit._cols]
- mov eax, [.count]
- shr ecx, 2
- cdq
-
- mov eax, [esi+TFreshEdit._xCaret]
- sub eax, ecx
- sub eax, ecx
- sub eax, ecx
- imul edx, ecx
- sub eax, edx
- sub eax, edx
- jns @f
- xor eax, eax
-@@:
- mov [esi+TFreshEdit._LeftColumn], eax
- jmp .endmove
-
-;. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-
-.move_vertical:
- test [.direction], mvcMoveY
- jz .ycaretok
-
- mov ecx, [esi+TFreshEdit._yCaret]
- add ecx, [.count]
- jns @f
- xor ecx, ecx
-@@:
- mov [esi+TFreshEdit._yCaret], ecx
-
-.ycaretok:
- test [.direction], mvcScrollY
- jz .toplineok
-
- mov ecx, [esi+TFreshEdit._TopLine]
- add ecx, [.count]
- jns @f
- xor ecx, ecx
-@@:
- mov edx, [esi+TFreshEdit._pIndex]
- mov edx, [edx+TArray.count]
- sub edx, [esi+TFreshEdit._rows]
- jns @f
- xor edx, edx
-@@:
- cmp ecx, edx
- jl @f
- mov ecx, edx
-@@:
- mov [esi+TFreshEdit._TopLine], ecx
-
-.toplineok:
-
- mov ecx, [esi+TFreshEdit._yCaret]
- mov eax, [esi+TFreshEdit._pIndex]
- mov eax, [eax+TArray.count]
- cmp ecx, eax
- jb @f
- lea ecx, [eax-1]
-@@:
- mov [esi+TFreshEdit._yCaret], ecx
-
- mov edx, [esi+TFreshEdit._TopLine]
- cmp ecx, edx
- jb .vscroll
- add edx, [esi+TFreshEdit._rows]
- cmp ecx, edx
- jb .endmove
-
-.vscroll:
- test [.direction], mvcMoveX or mvcMoveY
- jz .endmove ; it is only scroll, so don't care about caret.
-
-; scrolls the view, in order to fit caret in window.
- mov ecx, [esi+TFreshEdit._rows]
- mov eax, [.count]
- neg eax
- cdq
- mov eax, [esi+TFreshEdit._rows]
- dec eax
- imul edx, eax
-
- mov eax, [esi+TFreshEdit._yCaret]
- add eax, edx
- jns @f
- xor eax, eax
-@@:
- mov [esi+TFreshEdit._TopLine], eax
- jmp .endmove
-
-;.........................................................................................
-; method TFreshEdit.Clear clears the text loaded in the editor.
-;
-.clear:
- mov ebx, [.self]
- mov ebx, [ebx+TFreshEdit._pLines]
- mov ecx, [ebx+TArray.count]
- lea ebx, [ebx+TArray.array]
-
-.clrloop:
- jecxz .endclr
- stdcall StrDel, [ebx+TEditorLine.Data]
- mov [ebx+TEditorLine.Data], 0
- add ebx, sizeof.TEditorLine
- dec ecx
- jmp .clrloop
-
-.endclr:
- mov ebx, [.self]
- stdcall FreeMem, [ebx+TFreshEdit._pIndex]
- stdcall FreeMem, [ebx+TFreshEdit._pLines]
- stdcall FreeMem, [ebx+TFreshEdit._pLengths]
-
- stdcall CreateArray, 4
- mov [ebx+TFreshEdit._pIndex], eax
-
- stdcall CreateArray, sizeof.TEditorLine
- mov [ebx+TFreshEdit._pLines], eax
-
- stdcall CreateArray, 4
- mov [ebx+TFreshEdit._pLengths], eax
-
- xor eax, eax
-
- mov [ebx+TFreshEdit._fShadowValid], eax
- mov [ebx+TFreshEdit._xCaret], eax
- mov [ebx+TFreshEdit._yCaret], eax
- mov [ebx+TFreshEdit._xSelection], eax
- mov [ebx+TFreshEdit._ySelection], eax
-
- execute ebx, TFreshEdit.Refresh
- stdcall TFreshEdit.__UpdateScrollBars, ebx
-
- clc
- return
-endp
-
-
-
-;_________________________________________________________________________________________
-
-
-
-proc TFreshEdit.SysEventHandler, .pobj, .pEvent
-.changes dd ?
-begin
- push eax ebx ecx edx esi edi
-
- mov [.changes], 0
- mov ebx, [.pEvent]
- mov esi, [.pobj]
-
- mov eax, [ebx+TSysEvent.event]
-
- cmp [ebx+TSysEvent.event], seMoveResize
- je .moveresize
-
- cmp [ebx+TSysEvent.event], sePaint
- je .paint
-
- cmp [ebx+TSysEvent.event], seKbdKeyPress
- je .keypress
-
- cmp [ebx+TSysEvent.event], seFocusIn
- je .focusin
-
- cmp [ebx+TSysEvent.event], seFocusOut
- je .focusout
-
- cmp [ebx+TSysEvent.event], seScroll
- je .scroll
-
- cmp [ebx+TSysEvent.event], seMouseBtnPress
- je .mousebtnpress
-
- cmp [ebx+TSysEvent.event], seMouseBtnRelease
- je .mousebtnrelease
-
- cmp [ebx+TSysEvent.event], seMouseMove
- je .mousemove
-
-
-.continue:
- stc
-.finish:
- pop edi esi edx ecx ebx eax
- return
-
-;.........................................................................................
-.mousemove:
- mov ecx, mcText
- mov eax, [ebx+TMouseMoveEvent.x]
- cmp eax, [esi+TFreshEdit.__LeftMargin]
- ja @f
- mov ecx, mcArrow
-@@:
- mov [esi+TFreshEdit._cursor], ecx
-
- cmp [esi+TFreshEdit._DragButton], mbLeft
- jne .continue
-
- stdcall TFreshEdit.__MoveCaretToPixel, esi, [ebx+TMouseMoveEvent.x], [ebx+TMouseMoveEvent.y]
- jc .continue
- jmp .refresh
-
-;.........................................................................................
-.mousebtnrelease:
- mov eax, [ebx+TMouseButtonEvent.Button]
- cmp eax, [esi+TFreshEdit._DragButton]
- jne .continue
-
- stdcall MouseCapture, 0
- mov [esi+TFreshEdit._DragButton], -1
- jmp .continue
-
-;.........................................................................................
-.mousebtnpress:
- mov ecx, [ebx+TMouseButtonEvent.x]
- mov edx, [esi+TFreshEdit._FreeArea.x]
- cmp ecx, edx
- jl .continue
-
- add edx, [esi+TFreshEdit._FreeArea.width]
- cmp ecx, edx
- jge .continue
-
- mov eax, [ebx+TMouseButtonEvent.y]
- mov edx, [esi+TFreshEdit._FreeArea.y]
- cmp eax, edx
- jl .continue
-
- add edx, [esi+TFreshEdit._FreeArea.height]
- cmp eax, edx
- jge .continue
-
- mov edx, [esi+TFreshEdit.__LeftMargin]
- cmp ecx, edx
- jl .left_margin_process
-
- stdcall MouseCapture, [esi+TWindow.handle]
- mov eax, [ebx+TMouseButtonEvent.Button]
- mov [esi+TFreshEdit._DragButton], eax
-
- cmp [ebx+TMouseButtonEvent.Button], mbLeft
- jne .continue
-
- stdcall TFreshEdit.__MoveCaretToPixel, esi, [ebx+TMouseButtonEvent.x], [ebx+TMouseButtonEvent.y]
- jc .continue
- jmp .refresh
-
-.left_margin_process:
- sub edx, 16
- cmp ecx, edx
- jl .continue ; number or breakpoint click
-
-; Fold/unfold click
-; check for the fold/unfold icon under the cursor
- xor edx, edx
- div [esi+TFreshEdit._fontheight]
- add eax, [esi+TFreshEdit._TopLine]
-
- mov edx, [esi+TFreshEdit._pIndex]
- cmp eax, [edx+TArray.count]
- jae .continue
-
- mov ecx, [edx+TArray.array+4*eax]
- cmp ecx, -1
- je .continue ; it is not fold icon row.
-
- shl ecx, TEditorLine.shift
- add ecx, [esi+TFreshEdit._pLines]
- add ecx, TArray.array ; pointer to TEditorLine
-
- test [ecx+TEditorLine.flags], lfFoldHeader
- jz .continue
-
-; determine what is the current state folded or expanded
-locals
- .current dd ?
- .next dd ?
-endl
- mov [.current], eax ; current line index
- mov ecx, [edx+TArray.array+4*eax]
- inc ecx
-
-.next_loop:
- inc eax
- cmp eax, [edx+TArray.count]
- jae .folded
-
- cmp [edx+TArray.array+4*eax], -1
- je .next_loop
-
- mov [.next], eax
- cmp ecx, [edx+TArray.array+4*eax] ; the next index == current+1 -> expanded
- jne .folded
-
-; so, fold it...
- stdcall TFreshEdit.__FoldZoneLen, esi, [.current]
-
- mov ecx, [.next]
- sub ecx, [.current]
- inc ecx
-
- cmp eax, ecx
- jbe .continue ; nothing to fold
-
- sub eax, ecx
- stdcall DeleteArrayItems, [esi+TFreshEdit._pIndex], [.next], eax
- mov [esi+TFreshEdit._pIndex], edx
-
- stdcall TFreshEdit.__UpdateScrollBars, esi
- or [.changes], chgfNeedRefresh
- jmp .refresh
-
-.folded:
-; the zone is folded, so restore the index items.
- stdcall TFreshEdit.__RestoreIndex, esi, [.current], [.next]
- stdcall TFreshEdit.__UpdateScrollBars, esi
- or [.changes], chgfNeedRefresh
- jmp .refresh
-
-;.........................................................................................
-.scroll:
- cmp [ebx+TScrollEvent.ScrollBar], scrollX
- je .xscroll
-
-; yscroll
- xor edx, edx
- mov ecx, [ebx+TScrollEvent.Value]
- cmp [ebx+TScrollEvent.ScrollCmd], scTrack
- je .track
-
- cmp [ebx+TScrollEvent.ScrollCmd], scWheelUp
- je .scrollwheelup
- cmp [ebx+TScrollEvent.ScrollCmd], scWheelDn
- je .scrollwheeldn
-
- cmp [ebx+TScrollEvent.ScrollCmd], scUp
- je .scrollup
- cmp [ebx+TScrollEvent.ScrollCmd], scDown
- je .scrolldn
-
- jmp .continue
-
-; scroll down
-.scrollwheeldn:
- imul ecx, [FreshEditTheme.MouseWheel]
-
-.scrolldn:
- execute esi, TFreshEdit.Move, mvcScrollY, ecx, FALSE
- jmp .refresh
-
-.scrollwheelup:
- imul ecx, [FreshEditTheme.MouseWheel]
- neg ecx
-.scrollup:
- execute esi, TFreshEdit.Move, mvcScrollY, ecx, FALSE
- jmp .refresh
-
-.track:
- mov [esi+TFreshEdit._TopLine], ecx
- jmp .refresh
-
-.xscroll:
- mov eax, [ebx+TScrollEvent.Value]
- mov [esi+TFreshEdit._LeftColumn], eax
- jmp .refresh
-
-
-;.........................................................................................
-
-.focusin:
- cmp [esi+TFreshEdit._fReadOnly], froReadOnlyNoCaret
- je .continue
-
- stdcall CaretAttach, esi
- stdcall CaretShow, TRUE
- stdcall TFreshEdit.__UpdateCaretPosition, esi
- jmp .continue
-
-.focusout:
- stdcall CaretShow, FALSE
- jmp .endmove
-
-;.........................................................................................
-.keypress:
- cmp [ebx+TKeyboardEvent.key], $0d
- je .insert_it
-
- cmp [ebx+TKeyboardEvent.key], $09
- je .insert_it
-
- cmp [ebx+TKeyboardEvent.key], $20
- jb .control
-
- cmp [ebx+TKeyboardEvent.scancode], $ff
- ja .control
-
- test [ebx+TKeyboardEvent.kbdStatus], maskCtrl or maskAlt
- jnz .control
-
-.insert_it:
-; insert typed character
-locals
- .byte_offs dd ?
-endl
- cmp [esi+TFreshEdit._fReadOnly], froReadWrite
- jne .refresh
-
- execute esi, TFreshEdit.DeleteSel
- test eax, eax
- js @f
- mov [esi+TFreshEdit._yCaret], eax
- mov [esi+TFreshEdit._xCaret], edx
-@@:
- execute esi, TFreshEdit.InsertChar, [ebx+TKeyboardEvent.key]
- mov [.byte_offs], eax
-
- execute esi, TFreshEdit.FormatLine, [esi+TFreshEdit._yCaret]
- add [.byte_offs], eax
-
- stdcall TFreshEdit.__PointerToPos, esi, [esi+TFreshEdit._yCaret], [.byte_offs]
-
- mov [esi+TFreshEdit._yCaret], eax
- mov [esi+TFreshEdit._xCaret], edx
-
- stdcall TFreshEdit.__UpdateScrollBars, esi
- stdcall TFreshEdit.__FitCaretInWindow, esi
-
- or [.changes], chgfNeedRefresh
- jmp .refresh
-
-.control:
- test [ebx+TKeyboardEvent.kbdStatus], maskShift
- jz @f
- or [.changes], chgfNoClearSelection
-@@:
-
-; check the keyboard shortcuts
- lea edi, [FreshEditTheme.shortcuts]
- xor ecx, ecx
-
-.shortcut_loop:
- mov eax, [edi+TShortcut.key]
- test eax, eax
- jz .compare_scancode
-
- cmp eax, [ebx+TKeyboardEvent.key]
- je .found_shortcut
-
-.next_shortcut:
- add edi, sizeof.TShortcut
- inc ecx
- cmp ecx, TFETheme.shortcuts.count
- je .external_shortcut
- jmp .shortcut_loop
-
-.compare_scancode:
- mov eax, [edi+TShortcut.scancode]
- mov edx, [edi+TShortcut.maskStatus]
- and edx, [ebx+TKeyboardEvent.kbdStatus]
- cmp edx, [edi+TShortcut.kbdStatus]
- jne .next_shortcut
-
- cmp eax, [ebx+TKeyboardEvent.scancode]
- jne .next_shortcut
-
-.found_shortcut:
- cmp ecx, .shortcut_handlers.count
- jae .external_shortcut
-
- movzx ecx, word [.shortcut_handlers+2*ecx]
- add ecx, .shortcut_handlers
- jmp ecx
-
-.shortcut_handlers:
- dw .handler_up - .shortcut_handlers
- dw .handler_down - .shortcut_handlers
- dw .handler_left - .shortcut_handlers
- dw .handler_right - .shortcut_handlers
- dw .handler_pgup - .shortcut_handlers
- dw .handler_pgdn - .shortcut_handlers
- dw .handler_home - .shortcut_handlers
- dw .handler_end - .shortcut_handlers
- dw .handler_pgbeg - .shortcut_handlers
- dw .handler_pgend - .shortcut_handlers
- dw .handler_txtbeg - .shortcut_handlers
- dw .handler_txtend - .shortcut_handlers
- dw .handler_wordleft - .shortcut_handlers
- dw .handler_wordright - .shortcut_handlers
- dw .handler_delete - .shortcut_handlers
- dw .handler_linedel - .shortcut_handlers
- dw .handler_backspc - .shortcut_handlers
- dw .handler_wordwrap - .shortcut_handlers
- dw .handler_bookmark - .shortcut_handlers
- dw .handler_insmode - .shortcut_handlers
- dw .handler_selmode - .shortcut_handlers
- .shortcut_handlers.count = ($ - .shortcut_handlers)/2
-
-;. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-
-.handler_up:
- mov eax, -1
- mov ecx, mvcMoveY
- jmp .moveit
-
-;. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-
-.handler_down:
- mov eax, 1
- mov ecx, mvcMoveY
- jmp .moveit
-
-;. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-
-.handler_left:
- mov eax, -1
- mov ecx, mvcMoveX
- jmp .moveit
-
-;. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-
-.handler_right:
- mov eax, 1
- mov ecx, mvcMoveX
- jmp .moveit
-
-;. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-
-.handler_pgup:
- mov eax, [esi+TFreshEdit._rows]
- dec eax
- neg eax
- mov ecx, mvcMoveY or mvcScrollY
- jmp .moveit
-
-;. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-
-.handler_pgdn:
- mov eax, [esi+TFreshEdit._rows]
- dec eax
- mov ecx, mvcMoveY or mvcScrollY
- jmp .moveit
-
-
-.moveit:
- test [ebx+TKeyboardEvent.kbdStatus], maskScrLk
- jnz .scroll_override
-
- cmp [esi+TFreshEdit._fReadOnly], froReadOnlyNoCaret
- jne .scroll_override_ok
-
-.scroll_override:
- test ecx, mvcMoveX
- jz @f
- or ecx, mvcScrollX
-@@:
- test ecx, mvcMoveY
- jz @f
- or ecx, mvcScrollY
-@@:
-
-.scroll_override_ok:
- execute esi, TFreshEdit.Move, ecx, eax, FALSE
- jmp .refresh
-
-;. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-
-.handler_home:
- execute esi, TFreshEdit.LineBegin
- jmp .refresh
-
-;. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-
-.handler_end:
- execute esi, TFreshEdit.LineEnd
- jmp .refresh
-
-;. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-
-.handler_pgbeg:
- jmp .refresh
-
-;. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-
-.handler_pgend:
- jmp .refresh
-
-;. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-
-.handler_txtbeg:
- jmp .refresh
-
-;. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-
-.handler_txtend:
- jmp .refresh
-
-;. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-
-.handler_wordleft:
- jmp .refresh
-
-;. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-
-.handler_wordright:
- jmp .refresh
-
-;. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-.handler_delete:
-locals
- .byte_offs2 dd ?
-endl
- cmp [esi+TFreshEdit._fReadOnly], froReadWrite
- jne .refresh
-
- execute esi, TFreshEdit.DeleteSel
- test eax, eax
- jns .deleted
-
- execute esi, TFreshEdit.DelChar
- mov [.byte_offs2], eax
- execute esi, TFreshEdit.FormatLine, [esi+TFreshEdit._yCaret]
- stdcall TFreshEdit.__PointerToPos, esi, edx, [.byte_offs2]
-
-.deleted:
- mov [esi+TFreshEdit._yCaret], eax
- mov [esi+TFreshEdit._xCaret], edx
-
- stdcall TFreshEdit.__FitCaretInWindow, esi
- stdcall TFreshEdit.__UpdateScrollBars, esi
- or [.changes], chgfNeedRefresh
- jmp .refresh
-
-;. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-; BUG: it does not works as expected, but I don't have anough patience to fix it just now.....
-.handler_backspc:
- cmp [esi+TFreshEdit._fReadOnly], froReadWrite
- jne .refresh
-
- push [esi+TFreshEdit._xCaret] [esi+TFreshEdit._yCaret]
- execute esi, TFreshEdit.Move, mvcMoveX, -1, FALSE
- pop edx eax
-
- cmp eax, [esi+TFreshEdit._xCaret]
- jne .do_del
- cmp edx, [esi+TFreshEdit._yCaret]
- je .refresh
-
-.do_del:
- stdcall TFreshEdit.__PosToPointer, esi, [esi+TFreshEdit._xCaret], [esi+TFreshEdit._yCaret]
- test ecx, ecx
- jnz .refresh
-
- stdcall StrLen, [edx+TEditorLine.Data]
- cmp ecx, eax
- jae .refresh
-
- jmp .handler_delete
-
-;. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-.handler_linedel:
- cmp [esi+TFreshEdit._fReadOnly], froReadWrite
- jne .refresh
-
- execute esi, TFreshEdit.DeleteLine, [esi+TFreshEdit._yCaret]
- mov [esi+TFreshEdit._yCaret], eax
- mov [esi+TFreshEdit._xCaret], 0
- stdcall TFreshEdit.__UpdateCaretPosition, esi
- stdcall TFreshEdit.__UpdateScrollBars, esi
- or [.changes], chgfNeedRefresh
- jmp .refresh
-
-;. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-
-.handler_wordwrap:
- cmp [esi+TFreshEdit._fReadOnly], froReadWrite
- jne .refresh
-
- stdcall Get, esi, TFreshEdit.CurrentLine
- jc .refresh
-
- xor [eax+TEditorLine.flags], lfWordWrap
- execute esi, TFreshEdit.FormatLine, [esi+TFreshEdit._yCaret]
- stdcall TFreshEdit.__UpdateScrollBars, esi
- or [.changes], chgfNeedRefresh
- jmp .refresh
-
-;. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-
-.handler_bookmark:
- cmp [esi+TFreshEdit._fReadOnly], froReadWrite
- jne .refresh
-
- stdcall Get, esi, TFreshEdit.CurrentLine
- jc .refresh
-
- xor [eax+TEditorLine.flags], lfBookmark
- or [.changes], chgfNeedRefresh or chgfNoClearSelection
- jmp .refresh
-
-;. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-
-.handler_insmode:
- xor [esi+TFreshEdit._InsMode], $1
- or [.changes], chgfNoClearSelection or chgfNeedRefresh
- jmp .refresh
-
-;. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-
-.handler_selmode:
- mov eax, [esi+TFreshEdit._SelMode]
- inc eax
- cmp eax, selmBlock
- jbe @f
- xor eax, eax
-@@:
- mov [esi+TFreshEdit._SelMode], eax
- or [.changes], chgfNoClearSelection
- jmp .refresh
-
-;. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-
-.external_shortcut:
- cmp [esi+TFreshEdit.OnControlKey], 0
- je .refresh
-
- push ebx ecx edx esi edi
- stdcall [esi+TFreshEdit.OnControlKey], esi, ebx
- pop edi esi edx ecx ebx
-
- or [.changes], eax
-
-.refresh:
- test [.changes], chgfNoClearSelection
- jnz .selectionchanged
-
- cmp [ebx+TSysEvent.event], seScroll
- je .selectionchanged
-
- cmp [ebx+TSysEvent.event], seMouseMove
- je .selectionchanged
-
- cmp [ebx+TSysEvent.event], seMouseBtnPress
- jne .clearsel
-
-
-.clearsel:
- push [esi+TFreshEdit._xCaret] [esi+TFreshEdit._yCaret]
- pop [esi+TFreshEdit._ySelection] [esi+TFreshEdit._xSelection]
- jmp .endmove
-
-.selectionchanged:
-
-.endmove:
-; compare fields with backup fields
- mov eax, [esi+TFreshEdit._TopLine]
- mov ecx, [esi+TFreshEdit._LeftColumn]
- cmp eax, [esi+TFreshEdit._prevTopLine]
- jne .scrolled
- cmp ecx, [esi+TFreshEdit._prevLeftColumn]
- je .scrollerok
-
-.scrolled:
- stdcall TFreshEdit.__UpdateScrollBars, esi
- or [.changes], chgfNeedRefresh
- jmp .caretmoved
-
-.scrollerok:
- mov eax, [esi+TFreshEdit._xCaret]
- mov ecx, [esi+TFreshEdit._yCaret]
- mov edx, [esi+TFreshEdit._InsMode]
- cmp eax, [esi+TFreshEdit._prevxCaret]
- jne .caretmoved
- cmp ecx, [esi+TFreshEdit._prevyCaret]
- jne .caretmoved
- cmp edx, [esi+TFreshEdit._prevInsMode]
- je .caretposok
-
-.caretmoved:
- stdcall TFreshEdit.__UpdateCaretPosition, esi
-
-.caretposok:
- mov eax, [esi+TFreshEdit._xSelection]
- mov ecx, [esi+TFreshEdit._ySelection]
- sub eax, [esi+TFreshEdit._xCaret]
- sub ecx, [esi+TFreshEdit._yCaret]
- mov edx, [esi+TFreshEdit._prevSelMode]
-
- cmp eax, [esi+TFreshEdit._prevxDelta]
- jne .selchanged
- cmp ecx, [esi+TFreshEdit._prevyDelta]
- jne .selchanged
- cmp edx, [esi+TFreshEdit._SelMode]
- je .selok
-
-.selchanged:
- or [.changes], chgfNeedRefresh
-.selok:
-; now save the status fields for the next pass
-
- mov eax, [esi+TFreshEdit._TopLine]
- mov ecx, [esi+TFreshEdit._LeftColumn]
- mov [esi+TFreshEdit._prevTopLine], eax
- mov [esi+TFreshEdit._prevLeftColumn], ecx
-
- mov eax, [esi+TFreshEdit._xCaret]
- mov ecx, [esi+TFreshEdit._yCaret]
- mov edx, [esi+TFreshEdit._InsMode]
- mov [esi+TFreshEdit._prevxCaret], eax
- mov [esi+TFreshEdit._prevyCaret], ecx
- mov [esi+TFreshEdit._prevInsMode], edx
-
- mov eax, [esi+TFreshEdit._xSelection]
- mov ecx, [esi+TFreshEdit._ySelection]
- sub eax, [esi+TFreshEdit._xCaret]
- sub ecx, [esi+TFreshEdit._yCaret]
- mov edx, [esi+TFreshEdit._SelMode]
- mov [esi+TFreshEdit._prevxDelta], eax
- mov [esi+TFreshEdit._prevyDelta], ecx
- mov [esi+TFreshEdit._prevSelMode], edx
-
-
- test [.changes], chgfNeedRefresh
- jz .finish_event
-
- mov [esi+TFreshEdit._fShadowValid], 0
- execute esi, TWindow.Refresh
-
-.finish_event:
- test [.changes], chgfFinished
- jz .continue
- clc
- jmp .finish
-
-;.........................................................................................
-
-.paint:
- cmp [esi+TFreshEdit._fShadowValid], 0
- jne @f
- stdcall TFreshEdit.__DrawShadow, esi
-@@:
- stdcall SetClipRectangle, [ebx+TPaintEvent.context], 0
- stdcall TScrollWindow.SysEventHandler, [.pobj], [.pEvent]
- stdcall DrawBackBuffer, [ebx+TPaintEvent.context], [esi+TFreshEdit._pShadow], 0, 0
-
- clc
- jmp .finish
-
-;.........................................................................................
-
-.moveresize:
- stdcall Get, esi, TFreshEdit.FreeArea
-
- cmp [esi+TFreshEdit._fontwidth], 0
- je .continue
- cmp [esi+TFreshEdit._fontheight], 0
- je .continue
-
- stdcall TFreshEdit.__ComputeLeftMargin, esi
-
- mov eax, [esi+TFreshEdit._FreeArea.width]
- sub eax, [esi+TFreshEdit.__LeftMargin]
- xor edx, edx
- div [esi+TFreshEdit._fontwidth]
- mov [esi+TFreshEdit._cols], eax
-
- mov eax, [esi+TFreshEdit._FreeArea.height]
- xor edx, edx
- div [esi+TFreshEdit._fontheight]
- mov [esi+TFreshEdit._rows], eax
-
- stdcall TFreshEdit.__UpdateScrollBars, esi
-
- stdcall DestroyBackBuffer, [esi+TFreshEdit._pShadow]
- stdcall CreateBackBuffer, [esi+TFreshEdit.handle], [esi+TFreshEdit._FreeArea.width], [esi+TFreshEdit._FreeArea.height]
- mov [esi+TFreshEdit._pShadow], eax
-
- mov [esi+TFreshEdit._fShadowValid], 0
- jmp .continue
-endp
-
-
-
-;_________________________________________________________________________________________
-
-
-
-proc TFreshEdit.__MoveCaretToPixel, .editor, .x, .y
-begin
- push ecx edx esi
-
- xor ecx, ecx
- mov esi, [.editor]
-
-; x
- mov eax, [.y]
- mov edx, [esi+TFreshEdit._FreeArea.y]
- cmp eax, edx
- jl .nomove
-
- add edx, [esi+TFreshEdit._FreeArea.height]
- cmp eax, edx
- jge .nomove
-
- mov eax, [.x]
- mov edx, [esi+TFreshEdit._FreeArea.x]
- cmp eax, edx
- jl .nomove
-
- add edx, [esi+TFreshEdit._FreeArea.width]
- cmp eax, edx
- jge .nomove
-
- sub eax, [esi+TFreshEdit.__LeftMargin]
- jge @f
- xor eax, eax
-@@:
- cdq
- idiv [esi+TFreshEdit._fontwidth]
- add eax, [esi+TFreshEdit._LeftColumn]
-
- cmp [esi+TFreshEdit._xCaret], eax
- je @f
-
- test eax, eax
- js @f
-
- mov [esi+TFreshEdit._xCaret], eax
-@@:
-; y
- mov eax, [.y]
- cdq
- idiv [esi+TFreshEdit._fontheight]
- add eax, [esi+TFreshEdit._TopLine]
-
- cmp [esi+TFreshEdit._yCaret], eax
- je @f
-
- test eax, eax
- js @f
- mov [esi+TFreshEdit._yCaret], eax
-@@:
- mov eax, ecx
- clc
-
-.finish:
- pop esi edx ecx
- return
-
-.nomove:
- stc
- jmp .finish
-endp
-
-
-
-
-proc TFreshEdit.__DrawShadow, .editor
- .context dd ?
- .latest dd ?
- .color dd ?
- .colormask dd ?
-begin
- pushad
-
- mov esi, [.editor]
- mov edi, [esi+TFreshEdit._pShadow]
-
- cmp [edi+TBackBuffer.width], 1
- jle .finish
- cmp [edi+TBackBuffer.height], 1
- jle .finish
-
- cmp [esi+TFreshEdit._fShadowValid], 0
- jne .finish
-
- stdcall AllocateContext, [edi+TBackBuffer.raster]
- mov [.context], eax
-
- stdcall TFreshEdit.__ComputeLeftMargin, esi
-
-; draw left margin field
- mov eax, [esi+TFreshEdit.__LeftMargin]
- sub eax, 4
-
- stdcall DrawFillRect, [.context], 0, 0, eax, [edi+TBackBuffer.height], [FreshEditTheme.clLeftMargin]
-
-; clean the image. How good is to paint in double buffer - no flicker at all. :)
- inc eax
- mov ecx, [edi+TBackBuffer.width]
- sub ecx, eax
- test [FreshEditTheme.Options], eoStripedBackground
- jnz .do_zebra
-
- stdcall DrawFillRect, [.context], eax, 0, ecx, [edi+TBackBuffer.height], [FreshEditTheme.clBackground]
- jmp .leftmargin_ok
-
-.do_zebra:
- xor edx, edx
- mov ebx, [FreshEditTheme.clBackground]
- mov [.color], ebx
- xor ebx, [FreshEditTheme.clAltBack]
-
- test [esi+TFreshEdit._TopLine], 1
- jz .zebra
- xor [.color], ebx
-.zebra:
- stdcall DrawFillRect, [.context], eax, edx, ecx, [esi+TFreshEdit._fontheight], [.color]
- add edx, [esi+TFreshEdit._fontheight]
- xor [.color], ebx
- cmp edx, [edi+TBackBuffer.height]
- jb .zebra
-
-.leftmargin_ok:
-
-; draw the wrap position if visible
-.wrap_position:
- mov eax, [FreshEditTheme.WrapPos]
- sub eax, [esi+TFreshEdit._LeftColumn]
- imul eax, [esi+TFreshEdit._fontwidth]
- add eax, [esi+TFreshEdit.__LeftMargin]
-
- cmp eax, [esi+TFreshEdit.__LeftMargin]
- jl .wrapok
- cmp eax, [edi+TBackBuffer.width]
- jge .wrapok
-
- stdcall SetSimpleLine, [.context], [FreshEditTheme.clWrapColumn]
- stdcall DrawLine, [.context], eax, 0, eax, [edi+TBackBuffer.height]
-
-.wrapok:
-; ebx is pointer to the index array.
- mov ebx, [esi+TFreshEdit._pIndex]
-
-; edx is the number of the line in [pIndex]
- mov edx, [esi+TFreshEdit._TopLine]
-
-; ecx is the y coordinate of the line.
- mov ecx, [esi+TFreshEdit._fontheight]
- sub ecx, [esi+TFreshEdit._fontdescent]
-; sub ecx, 3 ; this is not good.
-
-; check the first line
-.searchbegin:
- cmp [ebx+TArray.array+4*edx], -1
- jne .lineloop
-
- sub ecx, [esi+TFreshEdit._fontheight]
- dec edx
- jnz .searchbegin
-
-; so draw the lines.
-.lineloop:
- mov eax, ecx
- sub eax, [esi+TFreshEdit._fontheight]
- add eax, [esi+TFreshEdit._fontdescent]
- cmp eax, [edi+TBackBuffer.height]
- jge .endlines
-
- cmp edx, [ebx+TArray.count]
- jae .endlines
-
-; call the TFreshEditLineType.procDraw for the current line type.
- stdcall TFreshEdit.__DrawLine, esi, [.context], edx, ecx
- add ecx, [esi+TFreshEdit._fontheight]
-
- inc edx
- jmp .lineloop
-
-.endlines:
-; fix the left line border to the end of the windows.
- add ecx, [esi+TFreshEdit._fontdescent]
- mov eax, [esi+TFreshEdit.__LeftMargin]
- sub ecx, [esi+TFreshEdit._fontheight]
- sub eax, 2
- stdcall SetSimpleLine, [.context], [FreshEditTheme.clLeftMarginBorder]
- stdcall DrawLine, [.context], eax, ecx, eax, [edi+TBackBuffer.height]
- stdcall SetSimpleLine, [.context], [FreshEditTheme.clLeftMargin]
- dec eax
- stdcall DrawLine, [.context], eax, ecx, eax, [edi+TBackBuffer.height]
- dec eax
- stdcall DrawLine, [.context], eax, ecx, eax, [edi+TBackBuffer.height]
-
- stdcall ReleaseContext, [.context]
-
-.finish:
- mov [esi+TFreshEdit._fShadowValid], 1
-
- popad
- return
-endp
-
-
-
-proc TFreshEdit.__DrawLine, .editor, .context, .indexLine, .y
- .line dd ?
- .last_line dd ?
-
- .attr dd ?
- .ysel0 dd ?
- .xsel0 dd ?
- .ysel1 dd ?
- .xsel1 dd ?
-
- .unfold dd ?
-
- .next dd ?
- .markh dd ?
-
- .linenumber dd ?
-
- .fold_icon dd ?
- .fold_line dd ?
-
-begin
- pushad
-
- mov edi, [.editor]
-
- mov [.line], -1
- mov [.unfold], 0
-
- mov eax, [.indexLine]
- lea ecx, [eax+1]
- mov edx, [edi+TFreshEdit._pIndex]
-
-.nextloop:
- cmp ecx, [edx+TArray.count]
- jae .unfoldok
- cmp [edx+TArray.array+4*ecx], -1
- jne @f
- inc ecx
- jmp .nextloop
-@@:
- push ecx
- mov ecx, [edx+TArray.array+4*ecx]
- dec ecx
- cmp ecx, [edx+TArray.array+4*eax]
- pop ecx
- je .unfoldok
-
- mov [.unfold], 1
-
-.unfoldok:
- mov [.next], ecx
-
-; if the line is part of the word-wrapped line, don't draw the text, because it is already OK.
- mov edx, [edx+TArray.array+4*eax] ; index in pLines
- mov [.linenumber], edx
- inc [.linenumber] ; count it from 1
- cmp edx, -1
- je .end_draw_text ; wrapped line.
-
- mov eax, [edi+TFreshEdit._pLines]
- mov [.last_line], 0
- mov eax, [eax+TArray.count]
- dec eax
- cmp eax, edx
- jne @f
- inc [.last_line] ; flag that this line is the last line.
-@@:
- shl edx, TEditorLine.shift
- add edx, [edi+TFreshEdit._pLines]
- add edx, TArray.array
- mov [.line], edx ; pointer to TEditorLines
-
-; draw the text of the line
-;. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
- stdcall StrLen, [edx+TEditorLine.Data]
- test eax, eax
- jz .empty_string
-
- mov ecx, eax
- shl eax, 4 ; sizeof.TCharAttr = 16
-
- stdcall GetMem, eax ; attr array.
- mov [.attr], eax
- mov esi, eax
-
- mov ebx, [FreshEditTheme.clSimpleText]
- test [edx+TEditorLine.flags], lfProtected
- jz @f
- mov ebx, [FreshEditTheme.clProtectedText]
-@@:
- mov edx, [edi+TFreshEdit._Font]
-
-; fill the attribute array with the default values.
-.attrloop:
- mov [esi+TCharAttr.color], ebx
- mov [esi+TCharAttr.font], edx
- lea esi, [esi+sizeof.TCharAttr]
- loop .attrloop
-
- mov edx, [.line]
- test [edx+TEditorLine.flags], lfProtected
- jnz .syntaxok
-
-; Call the syntax highlighter if any:
- xor ecx, ecx
- cmp [.indexLine], ecx
- je @f
- mov ecx, [edx-sizeof.TEditorLine+TEditorLine.syn_context]
-@@:
- cmp [edi+TFreshEdit._procSyntax], 0
- je .syntaxok
-
- push edi edx
- stdcall [edi+TFreshEdit._procSyntax], [edx+TEditorLine.Data], [.attr], ecx
- pop edx edi
- mov [edx+TEditorLine.syn_context], eax
-
-.syntaxok:
- stdcall StrPtr, [edx+TEditorLine.Data]
- cmp byte [eax], 0
- je .end_draw_text
-
- stdcall DrawColoredString, [.context], eax, [.attr], [eax+string.len], [edi+TFreshEdit.__LeftMargin], \
- [.y], [edi+TFreshEdit._LeftColumn], [edi+TFreshEdit._fontwidth], [edi+TFreshEdit._fontheight]
-
- stdcall FreeMem, [.attr]
-
-.end_draw_text:
-
-; draw left margin graphics:
- stdcall TFreshEdit.__DrawLeftMargin, edi, [.context], [.indexLine]
-
-; now draw transparent selection
-
-; selection bounds.
- mov eax, [edi+TFreshEdit._xSelection]
- mov ecx, [edi+TFreshEdit._ySelection]
- mov ebx, [edi+TFreshEdit._xCaret]
- mov edx, [edi+TFreshEdit._yCaret]
-
- cmp ecx, edx
- jl @f
- je .sortx
- xchg ecx, edx
- cmp [edi+TFreshEdit._SelMode], selmChar
- jne @f
- xchg eax, ebx
-@@:
- cmp [edi+TFreshEdit._SelMode], selmChar
- je .endsort
-
-.sortx:
- cmp eax, ebx
- jle @f
- xchg eax, ebx
-@@:
-
-.endsort:
- mov [.xsel0], eax
- mov [.ysel0], ecx
- mov [.xsel1], ebx
- mov [.ysel1], edx
-
- mov eax, [.indexLine]
- cmp eax, [.ysel0]
- jl .end_sel
- cmp eax, [.ysel1]
- jg .end_sel
-
- mov eax, [edi+TFreshEdit._SelMode]
-
- cmp eax, selmChar
- je .selchar
-
-; sel block
- mov eax, [.xsel0]
- cmp eax, [.xsel1]
- je .end_sel
-
- sub eax, [edi+TFreshEdit._LeftColumn]
- jge @f
- xor eax, eax
-@@:
- imul eax, [edi+TFreshEdit._fontwidth]
- add eax, [edi+TFreshEdit.__LeftMargin]
-
- mov ecx, [.xsel1]
- sub ecx, [edi+TFreshEdit._LeftColumn]
- jge @f
- xor ecx, ecx
-@@:
- imul ecx, [edi+TFreshEdit._fontwidth]
- add ecx, [edi+TFreshEdit.__LeftMargin]
- sub ecx, eax
- jmp .drawsel
-
-.selchar:
- xor eax, eax
- mov edx, [.indexLine]
- cmp edx, [.ysel0]
- jne .firstok
-
- mov eax, [.xsel0]
- sub eax, [edi+TFreshEdit._LeftColumn]
- jge .firstok
- xor eax, eax
-
-.firstok:
- imul eax, [edi+TFreshEdit._fontwidth]
- add eax, [edi+TFreshEdit.__LeftMargin]
-
- mov ecx, [edi+TFreshEdit._cols] ; selection is to the end of the line, for the intermediate lines.
- inc ecx
-
- cmp edx, [.ysel1]
- jne .lastok
-
- mov ecx, [.xsel1]
- sub ecx, [edi+TFreshEdit._LeftColumn]
- test ecx, ecx
- jns .lastok
- xor ecx, ecx
-
-.lastok:
- imul ecx, [edi+TFreshEdit._fontwidth]
- add ecx, [edi+TFreshEdit.__LeftMargin]
- sub ecx, eax
-
-.drawsel:
- mov edx, [.y]
- sub edx, [edi+TFreshEdit._fontheight]
- add edx, 3
-
- stdcall SetDrawMode, [.context], [FreshEditTheme.clSelMode]
- stdcall DrawFillRect, [.context], eax, edx, ecx, [edi+TFreshEdit._fontheight], [FreshEditTheme.clSelBack]
- stdcall SetDrawMode, [.context], cmCopy
-
-.end_sel:
- popad
- return
-
-.empty_string:
- mov eax, [.indexLine]
- mov ecx, [FreshEditTheme.clBackground]
- cmp eax, [.ysel0]
- jb .setback
- cmp eax, [.ysel1]
- jae .setback
-
- mov ecx, [FreshEditTheme.clSelBack]
-
-.setback:
- jmp .end_draw_text
-
-endp
-
-
-
-
-
-proc TFreshEdit.__DrawLeftMargin, .editor, .context, .indexLine
-
-.x dd ?
-.y dd ?
-.width dd ?
-.height dd ?
-
-.ytext dd ?
-.yicons dd ?
-
-.unfold dd ? ; is the line folded?
-.indexNext dd ? ; the index of the next line in TFreshEdit._pIndex
-
-.ipLines dd ? ; the index of the current line in pLines array.
-.ptrLine dd ? ; pointer of the current TEditorLine.
-
-.fold_icon dd ?
-.fold_line dd ?
-
-begin
- pushad
-
- mov esi, [.editor]
-
- test [FreshEditTheme.Options], eoLeftMargin
- jz .finish
-
- stdcall SetDrawMode, [.context], cmCopy
-
-; search for the next line index;
- mov ecx, [.indexLine]
- mov edx, [esi+TFreshEdit._pIndex]
- cmp [edx+TArray.array+4*ecx], -1
- je .finish
-
- mov [.unfold], 0
-
- xor eax, eax
- dec eax
-
-.nextloop:
- inc ecx
- cmp ecx, [edx+TArray.count]
- jae .found_next
-
- cmp [edx+TArray.array+4*ecx], eax
- je .nextloop
-
-.found_next:
- mov [.indexNext], ecx
-
- mov eax, [.indexLine]
- mov eax, [edx+TArray.array+4*eax] ; current line - index in pLines
- mov [.ipLines], eax
-
- cmp ecx, [edx+TArray.count]
- jae .unfoldok
-
- mov ecx, [edx+TArray.array+4*ecx] ; next line index in pLines
- dec ecx
- cmp ecx, eax
- setne byte [.unfold]
-
-.unfoldok:
- mov edx, eax
- shl edx, TEditorLine.shift
- add edx, TArray.array
- add edx, [esi+TFreshEdit._pLines]
- mov [.ptrLine], edx
-
-; determine the bounds of the drawing
- mov ecx, [.indexNext]
- sub ecx, [.indexLine]
- mov eax, [esi+TFreshEdit.__LeftMargin]
- imul ecx, [esi+TFreshEdit._fontheight]
- mov [.width], eax
- mov [.height], ecx
-
- xor eax, eax
- mov [.x], eax
-
- mov eax, [.indexLine]
- sub eax, [esi+TFreshEdit._TopLine]
- imul eax, [esi+TFreshEdit._fontheight]
- mov [.y], eax ; it can be negative for the word wrapped lines, partially displayed.
-
- add eax, [esi+TFreshEdit._fontheight]
- sub eax, [esi+TFreshEdit._fontdescent]
- mov [.ytext], eax
-
- mov ecx, [esi+TFreshEdit._iconBreakpointA]
- mov eax, [esi+TFreshEdit._fontheight]
- sub eax, [ecx+TImage.height]
- sar eax, 1
- adc eax, [.y]
- mov [.yicons], eax
-
-; draw the bookmark background.
- test [edx+TEditorLine.flags], lfBookmark
- jz .bookmarkok
- mov eax, [.width]
- sub eax, 4
- stdcall DrawFillRect, [.context], [.x], [.y], eax, [.height], [FreshEditTheme.clBookmarkBack]
-.bookmarkok:
-
-; draw the cutted right border:
- mov eax, [.width]
- mov ecx, [.y]
- sub eax, 2
- add ecx, [.height]
-
- stdcall SetSimpleLine, [.context], [FreshEditTheme.clLeftMarginBorder]
-
- test [edx+TEditorLine.flags], lfWordWrap
- jnz .wrap_border
-
- stdcall DrawLine, [.context], eax, [.y], eax, ecx
-
- mov ebx, [FreshEditTheme.clLeftMargin]
- test [edx+TEditorLine.flags], lfBookmark
- jz @f
- mov ebx, [FreshEditTheme.clBookmarkBack]
-@@:
- stdcall SetSimpleLine, [.context], ebx
- dec eax
- stdcall DrawLine, [.context], eax, [.y], eax, ecx
- dec eax
- stdcall DrawLine, [.context], eax, [.y], eax, ecx
- jmp .borderok
-
-.wrap_border:
- dec ecx
-
- push ecx eax [.y] eax [.context] ; vertical
- push [.y] eax [.y] eax [.context] ; upper edge
- push ecx eax ecx eax [.context] ; down edge
-
- sub dword [esp+12], 2
- sub dword [esp+16], 2
- stdcall DrawLine
-
- sub dword [esp+12], 2
- add dword [esp+16], 2
- stdcall DrawLine
-
- sub dword [esp+4], 2
- add dword [esp+8], 2
- sub dword [esp+12], 2
- sub dword [esp+16], 1
- stdcall DrawLine
-
- mov ebx, [FreshEditTheme.clLeftMargin]
- test [edx+TEditorLine.flags], lfBookmark
- jz @f
- mov ebx, [FreshEditTheme.clBookmarkBack]
-@@:
- stdcall SetSimpleLine, [.context], ebx
-
- push [.y] eax [.y] eax [.context] ; upper edge
- push [.y] eax [.y] eax [.context] ; upper edge
- push ecx eax ecx eax [.context] ; down corner pixels
- push ecx eax ecx eax [.context] ; down corner pixels
-
- sub dword [esp+4], 2
- stdcall DrawLine
-
- sub dword [esp+4], 2
- sub dword [esp+8], 1
- sub dword [esp+12], 2
- stdcall DrawLine
-
- sub dword [esp+4], 2
- stdcall DrawLine
-
- sub dword [esp+4], 2
- add dword [esp+8], 1
- sub dword [esp+12], 2
- stdcall DrawLine
-
-.borderok:
-; Line number draw
- test [FreshEditTheme.Options], eoLineNumbers
- jz .line_numbers_ok
-
- mov ecx, [.ipLines]
- test ecx, ecx
- jl .line_numbers_ok
-
- inc ecx
- stdcall NumToStr, ecx, ntsDec or ntsUnsigned
- push eax eax
- stdcall StrLen, eax
- mov ecx, eax
- stdcall StrPtr ; from the stack
- mov ebx, eax
-
- stdcall GetTextBounds, [.context], eax, ecx, 0 ; [edi+TFreshEdit._Font]
- sub eax, [esi+TFreshEdit.__NumberMargin]
- neg eax
- stdcall DrawString, [.context], ebx, ecx, eax, [.ytext], 0, [FreshEditTheme.clLeftMarginText]
- stdcall StrDel ; from the stack
-
-.line_numbers_ok:
-; draw icons in the middle
-
-; icon breakpoint
- mov edx, [.ptrLine]
- test [edx+TEditorLine.flags], lfBreakpoint
- jnz .draw_breakpoint
-
- cmp [edx+TEditorLine.debugdata], 0
- je .breakpoint_ok
-
-.draw_breakpoint:
- mov eax, [esi+TFreshEdit.__NumberMargin]
- add eax, 3
- push [.yicons] eax ; coordinates
-
- mov eax, [esi+TFreshEdit._maskDebugInfo]
- mov ecx, [esi+TFreshEdit._iconDebugInfo]
- test [edx+TEditorLine.flags], lfBreakpoint
- jz @f
- mov eax, [esi+TFreshEdit._maskBreakpointA]
- mov ecx, [esi+TFreshEdit._iconBreakpointA]
- cmp [edx+TEditorLine.debugdata], 0
- jne @f
- mov eax, [esi+TFreshEdit._maskBreakpointI]
- mov ecx, [esi+TFreshEdit._iconBreakpointI]
-@@:
- stdcall DrawMaskedImage, [.context], eax, ecx
-
-.breakpoint_ok:
-
-; draw fold tree.
-
- mov edx, [.ptrLine]
-
-; first, determine, what icon should be set for fold/unfold icon:
- xor ecx, ecx
- mov ebx, [esi+TFreshEdit._pIndex]
- mov eax, [.indexNext]
- cmp eax, [ebx+TArray.count]
- jae @f
- mov eax, [ebx+TArray.array+4*eax] ; index in pLines of the next visible line.
- shl eax, TEditorLine.shift
- mov ecx, [esi+TFreshEdit._pLines]
- lea ecx, [ecx+TArray.array+eax]
-@@:
- test [edx+TEditorLine.flags], lfFoldHeader
- jnz .fold_fold
-
- jecxz .fold_end
-
- mov eax, [ecx+TEditorLine.fold_level]
- cmp eax, [edx+TEditorLine.fold_level]
- ja .fold_continue
- jb .fold_end
-
- test [ecx+TEditorLine.flags], lfFoldHeader
- jz .fold_continue
-
-.fold_end:
- xor eax, eax
- mov ecx, 2 ; 2 means corner up/right
- jmp .fold_ok
-
-.fold_fold:
- mov ecx, 1 ; 1 means half vertical down
- mov eax, [esi+TFreshEdit._iconUnfold]
- cmp [.unfold], 0
- jne .fold_ok
- mov eax, [esi+TFreshEdit._iconFold]
- jmp .fold_ok
-
-.fold_continue:
- xor eax, eax
- xor ecx, ecx ; 0 means full vertical line
-
-.fold_ok:
- mov [.fold_icon], eax
- mov [.fold_line], ecx
-
-; compute the coordinates.
-.coordinates:
- mov ecx, [.yicons]
- mov eax, [esi+TFreshEdit.__LeftMargin]
- sub eax, 15
-
-; icon unfold
- cmp [edx+TEditorLine.fold_level], 0
- je .tree_ok
-
- push eax ebx ecx
- lea ebx, [ecx+5] ; ebx == Y middle of the icon.
- add eax, 5 ; eax == X middle of the icon.
- mov ecx, [.height]
-
- stdcall SetDrawMode, [.context], cmCopy
- stdcall SetSimpleLine, [.context], [FreshEditTheme.clLeftMarginTree]
-
- push [.y] eax [.y] eax
- add [esp+4], ecx
-
- cmp [.fold_line], 0 ; full vertical.
- je .draw_line
-
- push ebx eax ebx eax
- add dword [esp+8], 9
- stdcall DrawLine, [.context] ; coordinates from the stack
-
- xchg [esp+12], ebx
-
- cmp [.fold_line], 1 ; short vertical
- je .draw_line
-
- xchg [esp+4], ebx
-
-.draw_line:
- stdcall DrawLine, [.context] ; coordinates from the stack.
- pop ecx ebx eax
-
- cmp [.fold_icon], 0
- je .tree_ok
-
- stdcall DrawMaskedImage, [.context], [esi+TFreshEdit._maskUnfold], [.fold_icon], eax, ecx
-
-.tree_ok:
-
-.finish:
- popad
- return
-endp
-
-
-
-
-
-;_________________________________________________________________________________________
-; Moves the caret to the proper pixel position, depending on caret position inside the text.
-proc TFreshEdit.__UpdateCaretPosition, .editor
-.width dd ?
-.height dd ?
-.offset dd ?
-begin
- push eax ebx edx
-
- mov ebx, [.editor]
-
-
- mov eax, [ebx+TFreshEdit._fontheight]
- mov edx, [ebx+TFreshEdit._fontwidth]
-
- mov [.offset], 0
-
- cmp [ebx+TFreshEdit._InsMode], modeInsert
- jne .sizeok
-
- test [FreshEditTheme.Options], eoVerticalCaret
- jz .hcaret
- mov edx, 1
- jmp .sizeok
-
-.hcaret:
- sub eax, 2
- mov [.offset], eax
- mov eax, 2
-
-.sizeok:
- mov [.width], edx
- mov [.height], eax
-
- mov eax, [ebx+TFreshEdit._yCaret]
- sub eax, [ebx+TFreshEdit._TopLine]
- jl .hideit
-
- cmp eax, [ebx+TFreshEdit._rows]
- jg .hideit
-
- imul eax, [ebx+TFreshEdit._fontheight]
- add eax, [.offset]
-
- mov edx, [ebx+TFreshEdit._xCaret]
- sub edx, [ebx+TFreshEdit._LeftColumn]
- imul edx, [ebx+TFreshEdit._fontwidth]
- add edx, [ebx+TFreshEdit.__LeftMargin]
-
- stdcall CaretChange, edx, eax, [.width], [.height]
-
-.finish:
- pop edx ebx eax
- return
-
-.hideit:
- stdcall CaretChange, -1, -1, 1, 1
- jmp .finish
-
-endp
-
-
-
-;_________________________________________________________________________________________
-
-proc TFreshEdit.__UpdateScrollBars, .editor
-begin
- push eax ebx ecx edx
-
- mov ebx, [.editor]
-
-; V scroller
- mov eax, [ebx+TFreshEdit._pIndex]
- mov eax, [eax+TArray.count]
- sub eax, [ebx+TFreshEdit._rows]
- mov [ebx+TFreshEdit._VScroller.Max], eax
-
- mov eax, [ebx+TFreshEdit._TopLine]
- mov [ebx+TFreshEdit._VScroller.Pos], eax
-
- mov eax, [ebx+TFreshEdit._rows]
- mov [ebx+TFreshEdit._VScroller.Page], eax
-
-; H scroller
- stdcall Get, ebx, TFreshEdit.MaxLineLen
-
- mov ecx, [ebx+TFreshEdit._cols]
- sub eax, ecx
- mov [ebx+TFreshEdit._HScroller.Max], eax
-
- mov [ebx+TFreshEdit._HScroller.Page], ecx
- mov eax, [ebx+TFreshEdit._LeftColumn]
- mov [ebx+TFreshEdit._HScroller.Pos], eax
-
- pop edx ecx ebx eax
- return
-endp
-
-
-
-; if the caret is inside the window - does nothing.
-; if the caret is outside the window - scrolls the text to get the caret in the window.
-
-proc TFreshEdit.__FitCaretInWindow, .editor
-begin
- push ebx ecx edx esi
- xor eax, eax
- mov esi, [.editor]
-
-; vertical
- mov ecx, [esi+TFreshEdit._TopLine]
- mov edx, ecx
- add edx, [esi+TFreshEdit._rows]
- dec edx
- mov ebx, [esi+TFreshEdit._yCaret]
-
- cmp ebx, ecx
- jb .updown
- cmp ebx, edx
- jbe .checkx
-
-.updown:
- mov ecx, [esi+TFreshEdit._rows]
- shr ecx, 1
- sub ebx, ecx
- jg @f
- xor ebx, ebx
-@@:
- mov [esi+TFreshEdit._TopLine], ebx
- or eax, $1
-
-.checkx:
- mov ecx, [esi+TFreshEdit._LeftColumn]
- mov edx, ecx
- add edx, [esi+TFreshEdit._cols]
- dec edx
- mov ebx, [esi+TFreshEdit._xCaret]
-
- cmp ebx, ecx
- jb .leftright
- cmp ebx, edx
- jbe .endset
-
-.leftright:
- mov ecx, [esi+TFreshEdit._cols]
- shr ecx, 1
- sub ebx, ecx
- jg @f
- xor ebx, ebx
-@@:
- mov [esi+TFreshEdit._LeftColumn], ebx
- or eax, $2
-
-.endset:
- test eax, eax
- pop esi edx ecx ebx
- return
-endp
-
-; Converts x,y position in the text to memory parameters
-; arguments:
-; .x, .y - x and y coordinates of the position.
-; returns:
-; edx - pointer to the TEditorLine
-; eax - byte offset inside the string that corresponds with the given position.
-; ecx - count of the spaces that have to be inserted on offset eax in the string
-; in order to reach the .x coordinate (when the position is beyond the end of the line)
-proc TFreshEdit.__PosToPointer, .editor, .x, .y
-.pline dd ?
-.start dd ?
-begin
- push ebx esi edi
-
- mov edi, [.editor]
- mov eax, [.y]
- mov ebx, [edi+TFreshEdit._pIndex]
- cmp eax, [ebx+TArray.count]
- jae .error
-
- xor ecx, ecx
-
-.lineloop:
- mov edx, [ebx+TArray.array+4*eax]
- cmp edx, -1
- jne .found
-
- inc ecx
- dec eax
- jns .lineloop
-
-.error:
- stc
- jmp .finish
-
-.crash_error:
- int3
- jmp .error
-
-; ecx is the wrapped line count.
-; edx is the number of string in the lines array.
-.found:
- mov ebx, [edi+TFreshEdit._pLines]
- cmp edx, [ebx+TArray.count]
- jae .crash_error
-
- shl edx, TEditorLine.shift
- lea eax, [ebx+TArray.array+edx]
-
- mov [.pline], eax ; handle of the string.
-
- cmp [.x], -1
- je .only_line
-
- stdcall StrPtr, [eax+TEditorLine.Data]
- mov esi, eax
- mov [.start], eax
- jecxz .wrapok
-
-.wraploop:
- stdcall DecodeUtf8, dword [esi]
- add esi, edx
-
- test eax, eax
- jz .crash_error
-
- cmp eax, $01 ; line wrap char
- jne .wraploop
-
- dec ecx
- jnz .wraploop
-
-.wrapok:
- mov ecx, [.x]
- jecxz .endofstring
-
-.charloop:
- stdcall DecodeUtf8, dword [esi]
- test eax, eax
- jz .endofstring
- cmp eax, $01
- je .endofstring
-
- add esi, edx
- dec ecx
- jnz .charloop
-
-.endofstring:
- sub esi, [.start]
- mov eax, esi
-
-.only_line:
- mov edx, [.pline]
-
- clc
-
-.finish:
- pop edi esi ebx
- return
-endp
-
-
-; Converts the pointer parameters to caret coordinate.
-; arguments:
-; .index - index of the line
-; .offset - byte offset inside the string.
-; returns:
-; eax - y coordinate of the caret
-; edx - x coordinate of the caret
-; ecx - pointer to the current TEditorLine
-
-proc TFreshEdit.__PointerToPos, .editor, .index, .offset
-.base dd ?
-.x dd ?
-begin
- push esi edi
-
- mov esi, [.editor]
- mov edi, [esi+TFreshEdit._pIndex]
- mov ecx, [.index]
-
-.line_loop:
- cmp [edi+TArray.array+4*ecx], -1
- jne .found
- dec ecx
- jns .line_loop
-
-.error:
- stc
- jmp .finish
-
-.found:
- mov [.base], ecx ; base index
- mov [.x], 0
-
- mov ecx, [edi+TArray.array+4*ecx] ; index in pLines
- shl ecx, TEditorLine.shift
- add ecx, [esi+TFreshEdit._pLines]
- add ecx, TArray.array
-
- cmp [.offset], 0
- je .ready
-
- stdcall StrPtr, [ecx+TEditorLine.Data]
- mov esi, eax
-
-.char_loop:
- stdcall DecodeUtf8, [esi]
- jc .error
- add esi, edx
-
- cmp eax, 1 ; wrap char
- jne .no_wrap
-
- inc [.base]
- mov [.x], -1
-
-.no_wrap:
- inc [.x]
- sub [.offset], edx
- ja .char_loop
-
-.ready:
- mov eax, [.base]
- mov edx, [.x]
- clc
-
-.finish:
- pop edi esi
- return
-endp
-
-
-
-; .hString - the string containing the line.
-;
-; returns:
-; eax - the width of the line in chars.
-; if the line contains wrapped sublines,
-; the maximal length will be returned.
-
-proc TFreshEdit.__LineWidth, .hString
-.maxlen dd ?
-begin
- push esi ecx edx
-
- mov [.maxlen], 0
- stdcall StrPtr, [.hString]
- mov esi, eax
-
-.outer:
- xor ecx, ecx
-
-.loop:
- stdcall DecodeUtf8, [esi]
- jc .error
-
- add esi, edx
-
- test eax, eax
- jz .endofline
-
- cmp eax, $01 ; wrap char
- je .endofline
-
- inc ecx
- jmp .loop
-
-.endofline:
- cmp ecx, [.maxlen]
- jbe .maxok
- mov [.maxlen], ecx
-.maxok:
- test eax, eax
- jnz .outer
-
- mov eax, [.maxlen]
- clc
-
-.error:
- pop edx ecx esi
- return
-endp
-
-
-
-
-proc TFreshEdit.__FixLength, .editor, .newlen, .oldlen
-begin
- push eax ecx edx esi edi
-
- mov esi, [.editor]
- mov edx, [esi+TFreshEdit._pLengths]
-
- mov eax, [.oldlen]
-
- cmp eax, -1
- je .oldok
-
- cmp eax, [edx+TArray.count]
- jae .oldok ; wrong arguments???
-
- cmp [edx+TArray.array+4*eax], 0
- je .oldok ; wrong count.
-
- dec dword [edx+TArray.array+4*eax]
-
-.oldok:
- mov ecx, [.newlen]
-
- cmp ecx, -1
- je .newok
-
- cmp ecx, [edx+TArray.count]
- jb .incr
-
- sub ecx, [edx+TArray.count]
- inc ecx
-
- stdcall AddArrayItems, edx, ecx
- mov [esi+TFreshEdit._pLengths], edx
- mov edi, eax
- xor eax, eax
- rep stosd
- mov ecx, [.newlen]
-
-.incr:
- inc dword [edx+TArray.array+4*ecx]
-
-; then, shrink the array.
-.newok:
- mov ecx, [edx+TArray.count]
-
-.searchloop:
- dec ecx
- jz .endsearch
-
- cmp [edx+TArray.array+4*ecx], 0
- je .searchloop
-
-.endsearch:
- lea eax, [ecx+1]
- sub ecx, [edx+TArray.count]
- neg ecx
- stdcall DeleteArrayItems, edx, eax, ecx
- mov [esi+TFreshEdit._pLengths], edx
-
- pop edi esi edx ecx eax
- return
-endp
-
-
-
-proc TFreshEdit.__ComputeLeftMargin, .editor
-begin
- pushad
- mov esi, [.editor]
- xor ebx, ebx
- mov [esi+TFreshEdit.__NumberMargin], ebx
-
- test [FreshEditTheme.Options], eoLeftMargin
- jz .marginok
-
- test [FreshEditTheme.Options], eoLineNumbers
- jz .marginok1
-
- mov eax, [esi+TFreshEdit._pLines]
- mov eax, [eax+TArray.count]
- test eax, eax
- jz .marginok1
- mov ecx, 10
-
-.digits:
- add ebx, [esi+TFreshEdit._fontwidth2]
- cdq
- div ecx
- test eax, eax
- jnz .digits
-
- mov [esi+TFreshEdit.__NumberMargin], ebx
-
-.marginok1:
- add ebx, 17+11+3+1 ; 17px breakpoints and other icons; 11px fold tree; 3px word-wrap cut; 1px whitespace at the begining of the line.
-
-.marginok:
- xchg [esi+TFreshEdit.__LeftMargin], ebx
- cmp ebx, [esi+TFreshEdit.__LeftMargin]
- je .finish
-
- stdcall TFreshEdit.__UpdateCaretPosition, esi
-
-.finish:
- popad
- return
-endp
-
-
-
-proc TFreshEdit.__FoldZoneLen, .editor, .index
-.result dd ?
-begin
- pushad
-
- mov [.result], 0
-
- mov esi, [.editor]
- mov edi, [esi+TFreshEdit._pLines]
- mov edx, [esi+TFreshEdit._pIndex]
-
- mov eax, [.index]
- cmp eax, [edx+TArray.count]
- jae .finish
-
- mov ecx, [edx+TArray.array+4*eax] ; index of the first element.
- shl ecx, TEditorLine.shift
- mov ebx, [edi+TArray.array+ecx+TEditorLine.fold_level]
-
-.loop:
- inc [.result]
- inc eax
- cmp eax, [edx+TArray.count]
- je .finish
-
- mov ecx, [edx+TArray.array+4*eax]
- cmp ecx, -1
- je .loop
-
- shl ecx, TEditorLine.shift
-
- cmp [edi+TArray.array+ecx+TEditorLine.fold_level], ebx
- jb .finish
- ja .loop
-
- test [edi+TArray.array+ecx+TEditorLine.flags], lfFoldHeader
- jz .loop
-
-.finish:
- popad
- mov eax, [.result]
- return
-endp
-
-
-proc TFreshEdit.__RestoreIndex, .editor, .start_index, .end_index
-begin
- pushad
-
- mov esi, [.editor]
- mov edi, [esi+TFreshEdit._pIndex]
-
- mov eax, [.start_index]
- mov edx, [.end_index]
-
- mov ebx, [edi+TArray.array+4*edx]
- mov ecx, [edi+TArray.array+4*eax] ; index of the first element
- sub ebx, ecx
- dec ebx
- jz .finish
-
- stdcall InsertArrayItems, [esi+TFreshEdit._pIndex], edx, ebx
- mov [esi+TFreshEdit._pIndex], edx
-
- add [.end_index], ebx
-
-.fill_loop:
- inc ecx
- mov [eax], ecx
- add eax, 4
- dec ebx
- jnz .fill_loop
-
- mov ecx, [.end_index]
-
-.format_loop:
- execute esi, TFreshEdit.FormatLine, ecx
- dec ecx
- cmp ecx, [.start_index]
- jne .format_loop
-
-.finish:
- popad
- return
-endp
-
-
-proc TFreshEdit.__AddFormatLine, .hstring, .format
-begin
- test [.format], lfBookmark or lfWordWrap or lfProtected
- jz .format_ok
-
- stdcall StrCharCat, [.hstring], ';#F:'
-
- test [.format], lfBookmark
- jz @f
- stdcall StrCharCat, [.hstring], 'b' ; ctrl-B == Bookmark
-@@:
- test [.format], lfWordWrap
- jz @f
- stdcall StrCharCat, [.hstring], 'w' ; ctrl-A == Word wrap
-@@:
- test [.format], lfProtected
- jz @f
- stdcall StrCharCat, [.hstring], 'p' ; ctrl-D == Protected
-@@:
- stdcall StrCharCat, [.hstring], $0a0d
-
-.format_ok:
- return
-endp
-
-
-; decodes format line (begining with ';#F:')
-; returns:
-; CF=0 if the line contains format information.
-; eax - format flags
-; ecx - format line length;
-;
-
-proc TFreshEdit.__DecodeFormatLine, .pString
-begin
- push ebx esi
-
- mov esi, [.pString]
-
- lodsb
- cmp al, ';'
- jne .not_format
- lodsb
- cmp al, '#'
- jne .not_format
- lodsb
- cmp al, 'F'
- jne .not_format
- lodsb
- cmp al, ':'
- jne .not_format
-
- xor ebx, ebx
-
-.format_loop:
- lodsb
- test al, al
- jz .not_format
-
- cmp al, $0d
- je .eol
- cmp al, $0a
- je .eol
-
- cmp al, 'b'
- jne @f
- or ebx, lfBookmark
- jmp .format_loop
-@@:
- cmp al, 'w'
- jne @f
- or ebx, lfWordWrap
- jmp .format_loop
-@@:
- cmp al, 'p'
- jne @f
- or ebx, lfProtected
- jmp .format_loop
-@@:
-
-.not_format:
- xor eax, eax
- pop esi ebx
- stc
- return
-
-.eol:
- mov ah, al
- xor ah, $0a xor $0d
- lodsb
- cmp al, ah
- je .format_ok
- dec esi
-
-.format_ok:
- sub esi, [.pString]
- mov ecx, esi
- mov eax, ebx
- pop esi ebx
- clc
- return
-endp
-
-
-endmodule
-
DELETED freshlib/FreshEdit/FreshEditThemes.asm
Index: freshlib/FreshEdit/FreshEditThemes.asm
==================================================================
--- freshlib/FreshEdit/FreshEditThemes.asm
+++ /dev/null
@@ -1,276 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: TFreshEdit themes library.
-;
-; Target OS: Any
-;
-; Dependencies: None
-;
-; Notes:
-;_________________________________________________________________________________________
-
-module "TFreshEdit default theme"
-
-
-struct TShortcut
- .key dd ? ; if .key is <> 0 the scancode and .kbdStatus are not used.
- .scancode dd ?
- .kbdStatus dd ?
- .maskStatus dd ? ; what bits from the kbdStatus to be compared
-ends
-
-
-macro Shortcut .key, .scancode, .kbdstatus, .maskstatus {
- dd .key
- dd .scancode
- dd .kbdstatus
- dd .maskstatus
-}
-
-
-eoAutoIndents = 1
-eoSaveWithTabs = 2
-eoVerticalCaret = 4
-eoStripedBackground = 8
-eoLeftMargin = 16
-eoLineNumbers = 32
-
-
-struct TFETheme
-; colors
- .clBackground dd ? ; background color of the editor field.
- .clAltBack dd ? ; althernative background (when eoStripedBackground is true)
- .clSimpleText dd ? ; The default color of the text, when no syntax highlighter is attached.
- .clProtectedText dd ? ; the color of the protected line text.
-
- .clSelBack dd ? ;
- .clSelMode dd ? ;
-
- .clLeftMargin dd ? ; the color of the left margin field.
- .clLeftMarginBorder dd ? ; left margin border color.
- .clLeftMarginText dd ?
- .clLeftMarginTree dd ?
-
- .clBookmarkBack dd ? ; background of the left margin when the bookmark is set.
- .clWrapColumn dd ? ; color of the line that marks word wrap column.
-
-; options and behavior
- .Options dd ? ; flags eoLineSeparator, eoAutoIndents, eoSaveWithTabs, eoVerticalCaret
- .MouseWheel dd ? ; the count of the lines, one mouse wheel event scrolls.
- .WrapPos dd ? ; word wrap position for the lines that have lfWordWrap flag set.
- .UndoLevels dd ? ; how many levels of undo/redo to be remembered.
-
-; keyboard shortcuts:
-
-; navigation
- .shortcuts:
- .keyUp TShortcut
- .keyDown TShortcut
- .keyLeft TShortcut
- .keyRight TShortcut
- .keyPgUp TShortcut
- .keyPgDn TShortcut
- .keyHome TShortcut
- .keyEnd TShortcut
- .keyPageBegin TShortcut
- .keyPageEnd TShortcut
- .keyTextBegin TShortcut
- .keyTextEnd TShortcut
- .keyWordLeft TShortcut
- .keyWordRight TShortcut
-
-; Edit
- .Delete TShortcut
- .DelLine TShortcut
- .Backspace TShortcut
-
-; Formating
- .ToggleWordWrap TShortcut
- .ToggleBookmark TShortcut
-
-; Control
- .ToggleInsMode TShortcut
- .ToggleSelMode TShortcut
- .shortcuts.count = ($ - .shortcuts)/sizeof.TShortcut
-ends
-
-
-iglobal
- if used FreshEditThemeKeys
- FreshEditThemeKeys:
- ; colors
- dd TFETheme.clBackground, 'cBKG'
- dd TFETheme.clAltBack, 'cABK'
- dd TFETheme.clSimpleText, 'cTXT'
- dd TFETheme.clProtectedText, 'cPRT'
- dd TFETheme.clSelBack, 'cSBK'
- dd TFETheme.clSelMode, 'cSMD'
- dd TFETheme.clLeftMargin, 'cMrg'
- dd TFETheme.clLeftMarginBorder, 'cMBr'
- dd TFETheme.clLeftMarginText, 'cMTx'
- dd TFETheme.clLeftMarginTree, 'cMTr'
- dd TFETheme.clBookmarkBack, 'cBMB'
- dd TFETheme.clWrapColumn, 'cWrC'
-
- dd TFETheme.Options, 'Opts'
- dd TFETheme.MouseWheel 'nWhl'
- dd TFETheme.WrapPos, 'WrPs'
- dd TFETheme.UndoLevels, 'UdLv'
-
- ; keyboard shortcuts:
- ; navigation
- dd TFETheme.keyUp, 'kkUp'
- dd TFETheme.keyDown, 'kkDn'
- dd TFETheme.keyLeft, 'kLft'
- dd TFETheme.keyRight, 'kRgt'
- dd TFETheme.keyPgUp, 'kPUp'
- dd TFETheme.keyPgDn, 'kPDn'
- dd TFETheme.keyHome, 'kHom'
- dd TFETheme.keyEnd, 'kEnd'
- dd TFETheme.keyPageBegin, 'kPgB'
- dd TFETheme.keyPageEnd, 'kPgE'
- dd TFETheme.keyTextBegin, 'kTxB'
- dd TFETheme.keyTextEnd, 'kTxE'
- dd TFETheme.keyWordLeft, 'kWdL'
- dd TFETheme.keyWordRight, 'kWdR'
-
- ; Edit
- dd TFETheme.Delete, 'kDel'
- dd TFETheme.DelLine, 'kDLn'
- dd TFETheme.Backspace, 'kBkS'
-
- ; Formating
- dd TFETheme.ToggleWordWrap, 'kWWr'
- dd TFETheme.ToggleBookmark, 'kBkm'
- dd TFETheme.ToggleInsMode, 'kIMd'
- dd TFETheme.ToggleSelMode, 'kSMd'
- dd 0
- end if
-endg
-
-
-
-iglobal
- if used TFETheme.DefaultShortcuts
- TFETheme.DefaultShortcuts:
- Shortcut 0, keyUp, 0, maskCtrl or maskAlt ; up
- Shortcut 0, keyDown, 0, maskCtrl or maskAlt ; down
- Shortcut 0, keyLeft, 0, maskCtrl or maskAlt ; left
- Shortcut 0, keyRight, 0, maskCtrl or maskAlt ; right
- Shortcut 0, keyPgUp, 0, maskCtrl or maskAlt ; pg up
- Shortcut 0, keyPgDown, 0, maskCtrl or maskAlt ; pg dn
- Shortcut 0, keyHome, 0, maskCtrl or maskAlt ; home
- Shortcut 0, keyEnd, 0, maskCtrl or maskAlt ; end
- Shortcut 0, keyHome, maskCtrl, maskCtrl or maskAlt ; page begin
- Shortcut 0, keyEnd, maskCtrl, maskCtrl or maskAlt ; page end
- Shortcut 0, keyPgUp, maskCtrl, maskCtrl or maskAlt ; text begin
- Shortcut 0, keyPgDown, maskCtrl, maskCtrl or maskAlt ; text end
- Shortcut 0, keyLeft, maskCtrl, maskCtrl or maskAlt ; word left
- Shortcut 0, keyRight, maskCtrl, maskCtrl or maskAlt ; word right
- Shortcut 0, keyDelete, 0, maskCtrl or maskAlt ; delete
- Shortcut $19, 0, 0, 0 ; del line = ctrl+Y
- Shortcut $08, 0, 0, 0 ; back space = ctrl+H = backspace
- Shortcut $17, 0, 0, 0 ; Toggle word wrap = ctrl+W
- Shortcut $02, 0, 0, 0 ; Toggle bookmark = ctrl+B
- Shortcut 0, keyInsert, 0, maskAlt ; Toggle insert mode
- Shortcut 0, keyInsert, maskAlt, maskAlt ; Toggle selection mode
- TFETheme.DefaultShortcuts.size = ($ - TFETheme.DefaultShortcuts)/4
- end if
-endg
-
-uglobal
- FreshEditTheme TFETheme
-endg
-
-if used CFreshEdit
-initialize InitFreshEditTheme
-begin
- stdcall TFETheme.SetDefaultThemeWindows, FreshEditTheme
- return
-endp
-end if
-
-
-proc TFETheme.SetDefaultThemeWindows, .ptrTheme
-begin
- push ebx ecx esi edi
- mov ebx, [.ptrTheme]
-
-; colors
- mov [ebx+TFETheme.clBackground], $ffffff
- mov [ebx+TFETheme.clAltBack], $e8e8e8
-
- mov [ebx+TFETheme.clSimpleText], $000000
- mov [ebx+TFETheme.clProtectedText], $a0a000
-
- mov [ebx+TFETheme.clSelBack], $ffff7f
- mov [ebx+TFETheme.clSelMode], cmXor
-
- mov [ebx+TFETheme.clLeftMargin], $d0d0d8
- mov [ebx+TFETheme.clLeftMarginBorder], $606060
- mov [ebx+TFETheme.clLeftMarginText], $000000
- mov [ebx+TFETheme.clLeftMarginTree], $9000ff
- mov [ebx+TFETheme.clBookmarkBack], $ffd000
-
- mov [ebx+TFETheme.clWrapColumn], $c0c0ff
- mov [ebx+TFETheme.Options], eoLeftMargin or eoLineNumbers
-
- mov [ebx+TFETheme.WrapPos], 70
- mov [ebx+TFETheme.MouseWheel], 3
-
- mov esi, TFETheme.DefaultShortcuts
- lea edi, [ebx+TFETheme.shortcuts]
- mov ecx, TFETheme.DefaultShortcuts.size
- rep movsd
-
- pop edi esi ecx ebx
- return
-endp
-
-
-
-
-proc TFETheme.SetDefaultThemeClassic, .ptrTheme
-begin
- push ebx ecx esi edi
- mov ebx, [.ptrTheme]
-
-; colors
- mov [ebx+TFETheme.clBackground], $000080
- mov [ebx+TFETheme.clAltBack], $000090
-
- mov [ebx+TFETheme.clSimpleText], $ffffff
- mov [ebx+TFETheme.clProtectedText], $a0a000
-
- mov [ebx+TFETheme.clSelBack], $0000ff
- mov [ebx+TFETheme.clSelMode], cmOr
-
- mov [ebx+TFETheme.clLeftMargin], $c0c0c0
- mov [ebx+TFETheme.clLeftMarginBorder], $ffffff
- mov [ebx+TFETheme.clLeftMarginText], $000000
- mov [ebx+TFETheme.clLeftMarginTree], $ff0000
- mov [ebx+TFETheme.clBookmarkBack], $ffd000
-
- mov [ebx+TFETheme.clWrapColumn], $0000ff
- mov [ebx+TFETheme.Options], eoLeftMargin or eoLineNumbers
-
- mov [ebx+TFETheme.WrapPos], 70
- mov [ebx+TFETheme.MouseWheel], 3
-
- mov esi, TFETheme.DefaultShortcuts
- lea edi, [ebx+TFETheme.shortcuts]
- mov ecx, TFETheme.DefaultShortcuts.size
- rep movsd
-
- pop edi esi ecx ebx
- return
-endp
-
-
-
-
-
-endmodule
DELETED freshlib/FreshEdit/fasm_syntax.asm
Index: freshlib/FreshEdit/fasm_syntax.asm
==================================================================
--- freshlib/FreshEdit/fasm_syntax.asm
+++ /dev/null
@@ -1,208 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Syntax highlighter procedure for FASM syntax.
-;
-; Target OS:
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-module "FASM syntax highlighter"
-
-ttText = 0
-ttRem = 1
-ttStr = 2
-ttNum = 3
-ttChar = 4
-
-
-
-iglobal
-
- var SynTheme = fasm_colors_windows
-
-; Windows theme.
-
- if used fasm_colors_windows
- label fasm_colors_windows dword
- .comment dd $808080
- .string dd $ff0080
- .number dd $0080ff
- .symbol dd $000000
- .register dd $008080
- .instruction dd $0080ff
- .directive dd $000080
- .preprocessor dd $008000
- .macro dd $ff00ff
- end if
-
-; Classic theme.
-
- if used fasm_colors_classic
- label fasm_colors_classic dword
- .comment dd $a0a0a0
- .string dd $00ffff
- .number dd $00ffff
- .symbol dd $d0d0d0
- .register dd $00ff00
- .instruction dd $ffff00
- .directive dd $ff00ff
- .preprocessor dd $ff00ff
- .macro dd $ff00ff
- end if
-endg
-
-
-;_________________________________________________________________________________________
-;
-; Arguments:
-; .hString - handle to the line string.
-; .pAttr - pointer to the array of TCharAttributes for the characters of the string.
-; .SynContext - input context of the highligher.
-;
-; Returns:
-; eax - output context of the highligher.
-;
-proc SyntaxFASM, .hString, .pAttr, .SynContext
-.Quo rb 4
-.start dd ?
-begin
-
- mov edi, [.pAttr]
- mov ebx, [SynTheme]
-
- stdcall StrPtr, [.hString]
- mov esi, eax
- mov [.start], eax
-
-.loop:
- mov al, [esi]
- test al,al
- jz .end_of_line
-
- cmp [.SynContext], ttRem
- je .endif
-
- cmp [.SynContext], ttStr
- jne .ifnotstr
-
- cmp al,[.Quo]
- jne .endif
-
- mov [.SynContext], ttText
- mov eax, ttStr
- jmp .setcolor
-
-.ifnotstr:
- cmp al, ';'
- jne .notrem
-
- mov [.SynContext], ttRem
- jmp .endif
-
-.notrem:
- cmp al, '"'
- je .str
- cmp al, "'"
- jne .notstr
-
-.str:
- mov [.SynContext], ttStr
- mov [.Quo], al
- jmp .endif
-
-.notstr:
- call .CharInSymbols
- jnc .notsym
-
- mov [.SynContext], ttChar
- jmp .endif
-
-.notsym:
- cmp [.SynContext], ttNum
- je .endif
-
- cmp esi, [.start]
- je .maybenum
-
- cmp [.SynContext], ttChar
- jne .endif
-
-; The number begins only after ttChar or at the begining of the line.
-.maybenum:
- call .CharInNum
- jnc .notnum
-
- mov [.SynContext], ttNum
- jmp .endif
-
-.notnum:
- mov [.SynContext], ttText
-
-.endif:
- mov eax, [.SynContext]
- cmp eax, ttText
- je .next
-
-.setcolor:
- cmp [edi+TCharAttr.flags], 0
- jne .next ; the char have protected attributes.
-
- mov ecx, [ebx+4*eax-4]
- mov [edi+TCharAttr.color], ecx
-
-.next:
- add edi, sizeof.TCharAttr
- inc esi
- stdcall ScanForwardUtf8
- jmp .loop
-
-.end_of_line:
- mov eax, ttText
- return
-endp
-
-
-.CharInSymbols:
- push edi ecx
-
- mov edi, symbol_characters+1
- movzx ecx, byte [edi-1]
-
- repne scasb
- jne @f
- stc
- pop ecx edi
- ret
-@@:
- clc
- pop ecx edi
- retn
-
-
-.CharInNum:
- cmp al, '$'
- jne @f
- stc
- retn
-
-@@:
- cmp al, '0'
- jb @f
- cmp al, '9'
- ja @f
- stc
- retn
-@@:
- clc
- retn
-
-
-symbol_characters db 27
- db 9,0Ah,0Dh,1Ah,20h,'+-/*=<>()[]{}:,|&~#`;\'
-
-endmodule
DELETED freshlib/FreshEdit/images/breakpoint.gif
Index: freshlib/FreshEdit/images/breakpoint.gif
==================================================================
--- freshlib/FreshEdit/images/breakpoint.gif
+++ /dev/null
cannot compute difference between binary files
DELETED freshlib/FreshEdit/images/breakpoint_inactive.gif
Index: freshlib/FreshEdit/images/breakpoint_inactive.gif
==================================================================
--- freshlib/FreshEdit/images/breakpoint_inactive.gif
+++ /dev/null
cannot compute difference between binary files
DELETED freshlib/FreshEdit/images/breakpoint_mask.gif
Index: freshlib/FreshEdit/images/breakpoint_mask.gif
==================================================================
--- freshlib/FreshEdit/images/breakpoint_mask.gif
+++ /dev/null
cannot compute difference between binary files
DELETED freshlib/FreshEdit/images/breakpoint_mask_inactive.gif
Index: freshlib/FreshEdit/images/breakpoint_mask_inactive.gif
==================================================================
--- freshlib/FreshEdit/images/breakpoint_mask_inactive.gif
+++ /dev/null
cannot compute difference between binary files
DELETED freshlib/FreshEdit/images/debug_icon.gif
Index: freshlib/FreshEdit/images/debug_icon.gif
==================================================================
--- freshlib/FreshEdit/images/debug_icon.gif
+++ /dev/null
cannot compute difference between binary files
DELETED freshlib/FreshEdit/images/debug_mask.gif
Index: freshlib/FreshEdit/images/debug_mask.gif
==================================================================
--- freshlib/FreshEdit/images/debug_mask.gif
+++ /dev/null
cannot compute difference between binary files
DELETED freshlib/FreshEdit/images/fold.gif
Index: freshlib/FreshEdit/images/fold.gif
==================================================================
--- freshlib/FreshEdit/images/fold.gif
+++ /dev/null
cannot compute difference between binary files
DELETED freshlib/FreshEdit/images/unfold.gif
Index: freshlib/FreshEdit/images/unfold.gif
==================================================================
--- freshlib/FreshEdit/images/unfold.gif
+++ /dev/null
cannot compute difference between binary files
DELETED freshlib/FreshEdit/images/unfold_mask.gif
Index: freshlib/FreshEdit/images/unfold_mask.gif
==================================================================
--- freshlib/FreshEdit/images/unfold_mask.gif
+++ /dev/null
cannot compute difference between binary files
DELETED freshlib/License.txt
Index: freshlib/License.txt
==================================================================
--- freshlib/License.txt
+++ /dev/null
@@ -1,117 +0,0 @@
-The Fresh Artistic License
-
-Preamble
-
-The intent of this document is to state the conditions under which a
-Package may be copied, such that the Copyright Holder maintains some
-semblance of artistic control over the development of the package,
-while giving the users of the package the right to use and distribute
-the Package in a more-or-less customary fashion, plus the right to make
-reasonable modifications.
-
-Definitions:
-
- * "Package" refers to the collection of files distributed by the
- Copyright Holder, and derivatives of that collection of files
- created through textual modification.
- * "Standard Version" refers to such a Package if it has not been
- modified, or has been modified in accordance with the wishes of
- the Copyright Holder.
- * "Copyright Holder" is whoever is named in the copyright or
- copyrights for the package.
- * "You" is you, if you're thinking about copying or distributing
- this Package.
- * "Reasonable copying fee" is whatever you can justify on the basis
- of media cost, duplication charges, time of people involved, and
- so on. (You will not be required to justify it to the Copyright
- Holder, but only to the computing community at large as a market
- that must bear the fee.)
- * "Freely Available" means that no fee is charged for the item
- itself, though there may be fees involved in handling the item.
- It also means that recipients of the item may redistribute it
- under the same conditions they received it.
-
-IMPORTANT NOTE:
- FASM compiler itself, which is integral part of this package is
- distributed under different license. All source files of FASM
- compiler are separated in "source\fasm\" directory. Please read and
- apply "source\fasm\license.txt" for FASM license.
-
-1. You may make and give away verbatim copies of the source form of the
- Standard Version of this Package without restriction, provided that
- you duplicate all of the original copyright notices and associated
- disclaimers.
-
-2. You may apply bug fixes, portability fixes and other modifications
- from the Copyright Holder or those derived from the Public Domain
- and approved by the Copyright Holder. A Package modified in such a
- way shall still be considered the Standard Version.
-
-3. You may otherwise modify your copy of this Package in any way,
- provided that you insert a prominent notice in each changed file
- stating how and when you changed that file, and provided that you do
- at least ONE of the following:
-
- a) place your modifications in the Public Domain or otherwise make
- them Freely Available, such as by posting said modifications to
- Usenet or an equivalent medium, or placing the modifications on
- a major archive site such as ftp.uu.net, or by allowing the
- Copyright Holder to include your modifications in the Standard
- Version of the Package.
-
- b) use the modified Package only within your corporation or
- organization.
-
- c) rename any non-standard executables so the names do not conflict
- with standard executables, which must also be provided, and
- provide a separate manual page for each non-standard executable
- that clearly documents how it differs from the Standard Version.
-
- d) make other distribution arrangements with the Copyright Holder.
-
-4. You may distribute the programs of this Package in object code or
- executable form, provided that you do at least ONE of the following:
-
- a) distribute a Standard Version of the executables and library
- files, together with instructions ( in the manual page or
- equivalent) on where to get the Standard Version.
-
- b) accompany the distribution with the machine-readable source of
- the Package with your modifications.
-
- c) accompany any non-standard executables with their corresponding
- Standard Version executables, giving the non-standard
- executables non-standard names, and clearly documenting the
- differences in manual pages (or equivalent), together with
- instructions on where to get the Standard Version.
-
- d) make other distribution arrangements with the Copyright Holder.
-
-5. You may charge a reasonable copying fee for any distribution of this
- Package. You may charge any fee you choose for support of this
- Package. You may not charge a fee for this Package itself. However,
- you may distribute this Package in aggregate with other (possibly
- commercial) programs as part of a larger (possibly commercial)
- software distribution provided that you do not advertise this
- Package as a product of your own.
-
-6. The executable and library files supplied as input to or produced as
- output from the programs of this Package do not automatically fall
- under the copyright of this Package, but belong to whomever
- generated them, and may be sold commercially, and may be aggregated
- with this Package.
-
-7. You may not use this package, nor files created as output from this
- package, nor products derived from this package for producing,
- distrubuting or in any way contribute to the creation or
- distribution of "unwanted advertisement" (known as SPAM).
-
-8. The name of the Copyright Holder may not be used to endorse or
- promote products derived from this software without specific prior
- written permission.
-
-9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-
-The End
DELETED freshlib/TestFreshLib.fpr
Index: freshlib/TestFreshLib.fpr
==================================================================
--- freshlib/TestFreshLib.fpr
+++ /dev/null
cannot compute difference between binary files
DELETED freshlib/_doc/FreshLibRefMan.odt
Index: freshlib/_doc/FreshLibRefMan.odt
==================================================================
--- freshlib/_doc/FreshLibRefMan.odt
+++ /dev/null
cannot compute difference between binary files
DELETED freshlib/_doc/Fresh_IDE.wiki
Index: freshlib/_doc/Fresh_IDE.wiki
==================================================================
--- freshlib/_doc/Fresh_IDE.wiki
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-Index
-[http://fresh.flatassembler.net | Fresh home]
-[FreshLib reference | FreshLib reference]
-[Fresh user guide | Fresh tips&tricks]
- |
-
-
-Fresh is a visual assembly language IDE with built-in FASM assembler.
-
-The main goal of Fresh is to make programming in assembly as fast and
-efficient as in other visual languages, without sacrificing the small
-application size and the raw power of assembly language.
-
-Because Fresh is the logical continuation of the FASM project in the
-area of visual programming, it is perfectly compatible with FASM and you
-can use all your knowledge about FASM to program in Fresh.
-
-Of course, you can use Fresh not only for Windows programming, but also
-to create programs for any OS that FASM supports - DOS, Linux, FreeBSD,
-BeOS, MenuetOS - the same way as you do this in FASM.
-
-Now, the main direction of Fresh development is towards creating FreshLib - freely portable library, that to
-provide portability for Fresh and programs created with Fresh to number of different OSes.
-Initially for Win32 and Linux.
-
-This site is [http://www.fossil-scm.org|fossil] repository of Fresh sources.
-You can clone the repository with following fossil command:
-fossil clone http://chiselapp.com/user/johnfound/repository/FreshIDE/ Fresh.fossil
-
-In order to use more functionality in this site, please [/login|login] as "anonimous" user.
-Particularly you will be able to follow the links in the source tree, to download code and to fill bug reports and feature requests.
-
-If you want to contribute to the project, please contact me (johnfound) on [http://board.flatassembler.net|FASM message board]
-
-In order to download compiled FreshIDE, visit [http://fresh.flatassembler.net|Fresh IDE home page.]
-
-You can report bugs, or make some feature requests here, in the [/reportlist|Tickets system]
DELETED freshlib/_doc/Fresh_and_Linux.wiki
Index: freshlib/_doc/Fresh_and_Linux.wiki
==================================================================
--- freshlib/_doc/Fresh_and_Linux.wiki
+++ /dev/null
@@ -1,93 +0,0 @@
-Running and debugging Linux applications in Windows with Fresh IDE
-
-Fresh can compile applications for Linux. But how to run and debug these applications?
-
-There are different approaches, including virtual machines, second computer, running Linux, or rebooting every time you want to test compiled project.
-
-Fresh provides one very simple way of testing Linux applications. This method is to use [http://andlinux.org|andLinux]. andLinux is complete Ubuntu distribution, that uses coLinux kernel in order to allow running of Linux inside Windows OS.
-
-How to setup andLinux to work with Fresh?
-
- Step 1. Download andLinux package from [http://andlinux.org/downloads.php|andLinux download page].
-
- There are two packages: "KDE version" and "minimal/XFCE version" available. For using with Fresh IDE, it is not important what version you will choose.
-
- KDE package is very big and very slow distribution that contains many bundled programs and tools, but in general you will not need them. The size of KDE package is 500MB download and 5GB installed.
-
- The XFCE package is relatively smaller and faster. Relatively means 200MB downloaded file and 2GB installed on the disk.
-
- It is obvious that the right choice is to use XFCE package.
-
- Step 2. Run the downloaded setup file and answer to the different questions of the setup wizard.
-
- The important features that we need are:
-
- * coLinux version - choose the stable version (0.7.4 in my case) instead of latest (0.8.0) - we shall work with andLinux, not to play.
-
- * Memory size - 256MB RAM (or maybe more - if you can afford it).
-
- * Install XMing server on your primary screen.
-
- * Sound - you can enable or disable sound in Linux option - it is harmless although it is one more running server.
-
- * Startup type + Panel - select "run andLinux automatically as a NT service + use Windows shortcuts"; It is not very important, but can save you a little manual work and troubles later.
-
- * andLinux login - just select your user name and password for Linux root.
-
- * Windows File Access - it is important! - select "using CoFS", no matter it is not recommended.
-
- * File Access Using CoFS - important! - create one new directory somewhere and select it to be mount via CoFS. This will be the shared directory, visible from Windows and from Linux in the same time.
-
- All other features you can choose freely or simply leave them to default state.
-
- When you start installation, the installer will try to install network driver. It is possible Windows will protest and will atempt to mislead you by asking to not install not certified driver. You must ignore these attempts and firmly click "install".
-
- After installation of andLinux you have to restart Windows and probably andLinux will not run. :D It is because of the Windows firewall. All new network adapters are firewalled by default. As long as installed adapter (named TAP-Colinux) is virtual and local, you will not need any firewall so, go to control panel/Windows firewall/Advanced and uncheck "TAP-Colinux" adapter from the list of adapters.
-
- Then you can run some Linux program - in the Windows tray, there is a andLinux menu icon that have shortcuts to several Linux programs.
-
- Step 3. Install several additional Linux tools. You will need additionally debugger and come decent terminal emulator. I choose xterm for terminal, because it is small and white by default. ;) You can choose to use the built-in terminal named in the simple Linux manner: "xfce4-terminal" and console debugger "gdb". In this case you have skip this step.
-
- Start "Synaptic" - package manager for Ubuntu from the tray menu. You have to enter root password you choose on install.
-
- When Synaptic is started, click "Reload" to refresh the package list from the network and then use search to locate needed programs. I personally recommend "xterm" as terminal and "ddd" as a GUI front end to "gdb".
-
- Well, I recommend "ddd" only because it is only Linux debugger that I was able to run under andLinux and able to show disassembled code of the program.
-
- Mark selected programs for install, click on Apply button and wait until downloading and installation.
-
- Here you can encounter only one problem - your computer is behind a proxy server.
-
- If the proxy is normal proxy, you simply have to set its address and port in the Synaptic preferences and it should work.
-
- Completely another story is when the proxy is MS ISA server configured with NTLM user authorization.
-
- Most Linux programs can't work with such authorization and Synaptic is not an exception.
-
- Fortunately, there is a workaround of this situation. You need [http://ntlmaps.sourceforge.net/|ntlmaps] authorization proxy server.
-
- Setting up of this server is out of the scope of this article. On the ntlmaps home page you can read complete documentation and explanations.
-
- OK, we are ready with andLinux. Now you have working copy of Ubuntu inside your Windows box.
-
- It's time to configure Fresh to run Linux applications inside andLinux. Continue with:
-
- Step 4. Fresh IDE configuration.
-
- Run Fresh and open "Options|IDE options" dialog. Select "Debuggers and Emulators" page.
-
- Then select following directories and commands:
-
- * "andLinux directory" - the directory where you installed andLinux.
-
- * "andLinux shared directory" - shared directory you selected during andLinux installation.
-
- * "Linux debugger" - Enter "ddd" (or whatever debugger you choose).
-
- * "Linux terminal" - Enter "xterm -hold +mesg -e" - note the options.
-
- And voila! You finished the configuration!
-
- Now you can load the source of some Linux program (look at Fresh examples) and run it with shift+F9 or load it in the debugger with shift+F8.
-
- Fresh will detect when you compiled ELF executable and will run it in andLinux instead of Windows.
DELETED freshlib/_doc/GUI.wiki
Index: freshlib/_doc/GUI.wiki
==================================================================
--- freshlib/_doc/GUI.wiki
+++ /dev/null
@@ -1,433 +0,0 @@
-
-
-FreshLib directory: GUI
-
-GUI library defines many data structures and procedures that together form
-something that conditionally can be called "OOP". It is object oriented, as
-long as it deals with GUI "objects" - forms, controls, menus etc.
-All these objects are in fact structures of data. For every created object,
-the library allocates some memory and fills this memory with object parameters
-data.
-
-There are two types of data structures that describe GUI objects - classes
-and instances.
-
-The class is a structure that contains data commonly used by all objects of given type - for example all buttons use one class structure CButton.
-
-The instance is data structure that describes the properties and behavior of particular GUI object - for example button with icon "open file" that opens a file when the user click on it.
-
-Classes
-
-"Class" in FreshLib is a data structure, that have the following definition:
-
-
-struct TObjectClass
- .ptrParent dd 0
- .dataSize dd 0
- .procCreate dd 0
- .procDestroy dd 0
- .procGetParam dd 0
- .procSetParam dd 0
- .procExecCmd dd 0
- .procSysEventHandler dd 0
-ends
-
-
-.ptrParent is a pointer to other TObjectClass structure, that appears as a parent class for the given class.
-.dataSize contains the size of the object instance structure.
-
-The following fields are the pointers to procedures that provides the "work" of the object. All of these pointers as a rule can be NULL, if there is no need for such processing.
-
-Create
-.procCreate is a procedure that creates instance object of the given class. This
-field can be NULL. It has the following definition:
-
-proc Create, .obj
-
-This procedure sets needed values in the object instance data structure.
-
-Destroy
-.procDestroy is a procedure that destroys an instance of the given class.
-
-proc Destroy, .obj
-
-Destroys the object passed in [.obj] and frees all memory allocated for this object.
-
-GetParam
-.procGetParam is a pointer to the procedure that retrieves and returns the properties of the object.
-
-proc GetParam, .obj, .paramID
-
-Returns the value of the object [.obj] parameter with ID=[.paramID]
-
-Set
-.procSetParam is a pointer to the procedure that set the properties of the object.
-
-proc Set, .obj, .paramID, .value
-
-For object [.obj], set the value of the parameter with ID=[.paramID]
-
-ExecCmd
-.procExecCmd is a pointer to the procedure that executes object method.
-
-proc ExecCmd, .obj, .method
-
-For the object [.obj] this procedure executes the method with method ID in [.method].
-The methods can have arbitrary number of arguments, that are defined in the "object" definition (see below).
-When the method is executed, the procedure [.procExecCmd] accepts pointer to the arguments array in [ebx]
-The user is supposed to call methods of the object with the macro "execute"
-The macro is defined following way:
-
-macro execute obj*, meth*, [arg]
-
-
-
-SysEventHandler
-.procSysEventHandler is a pointer to the procedure that process the system events that are send to the object, i.e. mouse events, keyboard events etc.
-
-proc SysEventHandler, .obj, .pEvent
-
-Process one system event for object [.obj]. [.pEvent] contains pointer to the system event.
-
-All of these procedures are called internally and should not be used by the user of the library.
-How these procedure are called will be described later.
-
-TObjectClass structure is defined statically in memory in compile time, only once for every object class. Its definition is located in the library for the respective GUI element. For example CButton class structure is defined in the file TButton.asm that contains the code and data of the object class Button.
-
-In order to make construction of such structures easy, macro with name ObjectClass is defined in objects.asm
-
-ObjectClass Macro
-
-macro ObjectClass name*, parent*, procCreate*, procDestroy*, procGetParam*, procSetParam*, procExecCmd*, procSysEvents*
-
-
-Every defined ObjectClass have a label that points to the begin of the structure. The name of this label is the name of the class, prefixed with "C".
-
-One example of ObjectClass definition is the definition of Window object class:
-
-ObjectClass Window, \
- Object, \
- TWindow.Create, \
- TWindow.Destroy, \
- TWindow.Get, \
- TWindow.Set, \
- TWindow.ExecCmd, \
- TWindow.SysEventHandler
-
-
-This definition creates following data structure:
-
-CWindow:
- dd CObject
- dd sizeof.TWindow
- dd TWindow.Create
- dd TWindow.Destroy
- dd TWindow.Get
- dd TWindow.Set,
- dd TWindow.ExecCmd
- dd TWindow.SysEventHandler
-
-
-
-
-Object structure
-Object instance is data structure that contains different fields. By that it is very similar to the normal FASM structures. As structures, the object is only description of the data but not the data itself.
-Objects can inherit field definitions by its parent objects.
-The memory instance of the object is allocated dynamically in runtime, when the object is created by call to the respective FreshLib functions.
-The definition of the object looks like following:
-
-
-object TObject
- .ptrClass dd ?
-
- .OnCreate dd ?
- .OnDestroy dd ?
-
- method .AddChild, .objchild
-endobj
-
-
-object TWindow, TObject
- .handle dd ?
- .Fcaption dd ?
- .Fcursor dd ?
-
- param .x
- param .y
- param .width
- param .height
- param .visible
- param .caption
- param .parent
- param .cursor
-
- method .Refresh
-endobj
-
-
-object TButton, TWindow
- .state dd ?
- .Ficon dd ?
- .FiconAlign dd ?
- .Ftextalign dd ?
-
- .OnClick dd ?
-
- param .TextAlign
- param .Icon
- param .IconPosition
-endobj
-
-
-By convention the names of the objects begin with "T".
-You can see that the object TWindow contains data fields, parameters and methods.
-The parameters defined by "param" macro are compile time constants which values are assigned automatically.
-There constants are local labels for the object structure. They are also inherited from the parent structure.
-The methods are very similar to parameters, in that they are constants, defined in compile time.
-But besides the constant, the method also have list of arguments, passed to the method, when executed.
-
-
-In the above example, TButton.width parameter is inherited from TWindow and have the same value as TWindow.width parameter.
-Also, TWindow have all fields of TObject defined as well.
-If we have to translate TWindow definition in plain FASM syntax it will looks like this:
-
-
-struc TWindow {
- .ptrClass dd ?
-
- .OnCreate dd ?
- .OnDestroy dd ?
-
- .handle dd ?
- .Fcaption dd ?
- .Fcursor dd ?
-
- .x = $80000000
- .y = $80000001
- .width = $80000002
- .height = $80000003
- .visible = $80000004
- .caption = $80000005
- .parent = $80000006
- .cursor = $80000007
-}
-virtual at 0
- TWindow TWindow
- sizeof.TWindow = $
-end virtual
-
-
-This directory contains the libraries providing portable GUI for assembly programming.
-Note that this libraries are in very early stage of development, so the description in this chapter is preliminary and probably will be changed in one or another way in the near future.
-Later in this text, the whole GUI subsystem of FreshLib will be called FreshGUI
-
-FreshGUI structure
-The main idea behind the FreshGUI is to make one small OS dependent layer of functions, that to serve as an interface between the OS and the OS independent layer of the library.
-The first will translate OS events, such as mouse, keyboard, timers etc to one common standard of OS independent event handlers of the user interface objects – windows, buttons and other widgets.
-The biggest advantage of this approach is that the portability of the library is very easy – most of the code is OS independent and only little part of it have to be write in order to port the whole library to a new OS.
-The biggest drawback of this approach is the bigger size of the library, because, with this architecture, all controls in the library have to be created from scratch. It is impossible to use graphic controls that the OS provides – particularly Win32 controls - buttons, simple text editors, labels, combo boxes list and tree view controls etc.
-FreshGUI is not aimed to use all complex GUI system of the target OS. At first time, the goal of FreshGUI is to provide minimal but decent functionality that will do the job – writing portable applications in assembly language.
-Graphics library
-The graphics library provides procedures that draw graphics images and text on the screen. The library is OS dependent and is placed in the directory "graphics" in the root directory of FreshLib. The main conception of this library is ".raster" - represented by handle, object where the drawing happens. The exact meaning for this object is different for the different OS – in Win32 it is named "device context", in Linux it is "drawable" - window or pixmap.
-
-Event translation layer
-
-Library "sysevents.asm"
-This library contains event codes and data structures for FreshGUI OS independent events. For now only several events are defined:
-
-seMouseMove
-seMouseEnter
-seMouseLeave
-seMouseBtnPress
-seMouseBtnRelease
-seMouseBtnClick
-seMouseBtnDblClick
-
-seTimer
-
-seKbdKeyPress
-seKbdKeyRelease
-seKbdStatusChanged
-seKbdChar
-
-sePaint
-
-These events cover mouse, keyboard, timers and paint events.
-Every event have some arguments that have to be sent to the recipient event handler. The event code and the event arguments are contained in data structure, defined for every kind of events.
-The first dword of the event structure is the field .event that contains the event code.
-Here are the structures defined in sysevents.asm
-
-struct TSysEvent
- .event dd ?
-ends
-
-The base event structure.
-
-
-struct TMouseMoveEvent
- . TSysEvent
- .x dd ?
- .y dd ?
-ends
-
-The event is generated when the mouse cursor moves over some window or control. .x and .y contains the coordinates of the mouse cursor relative to the control this message is sent to.
-
-
- struct TMouseButtonEvent
- . TSysEvent
- .Button dd ?
- .kbdStatus dd ?
-ends
-
-This event is generated when some of the mouse buttons changes its state. The button that changes its state is specified in the field .Button
-This field can accept following values:
-
- mbLeft | = 0 |
- mbMiddle | = 1 |
- mbRight | = 2 |
-
-The field .kbdStatus contains the status of remaining mouse buttons and keyboard modifying buttons. These buttons are represented by bits in the field:
-
- maskBtnLeft | = $01 |
- maskBtnMiddle | = $02 |
- maskBtnRight | = $04 |
- maskCtrl | = $08 |
- maskShift | = $10 |
-
-
-struct TMouseEnterEvent
- . TSysEvent
-ends
-
-This event is generated when the mouse cursor enters or leaves some control. There is no additional parameters besides the event code.
-
-
-struct TKeyboardEvent
- . TSysEvent
- .key dd ?
- .kbdStatus dd ?
-ends
-
-This event is generated on keyboard button press/release. The field .key contains the code of the pressed button. .kbdStatus have the same meaning and the same values as in TMouseButtonEvent.
-
-
-struct TTimerEvent
- . TSysEvent
-ends
-
-TTimerEvent is generated on timer events. :)
-
-
-struct TPaintEvent
- . TSysEvent
- .raster dd ? ; ID of the raster where you should paint.
- .rect RECT
-ends
-
-TPaintEvent is generated when given control have to be repainted. The field .raster contains the handle to the graphic surface where the program have to draw. This handle have different meanings in the different target OS, but it simply need to be understandable by the graphics procedures from the OS dependent library graphics.asm.
-The field .rect is the rectangle of the control that needs to be repainted.
-
-Library "main.asm"
-
-proc Run
-This procedure is the main program loop of the GUI application.
-The procedure Run process all pending system events, then calls once the OnIdle event handler of the application object and then sleeps until new events are sent by the OS.
-When the OS terminates the application – the procedure returns an exit code.
-The user uses this procedure following way:
-
- stdcall Run
- jmp ExitApplication
-
-
-proc ProcessSystemEvents
-This procedure process the events generated by the OS. If there are waiting events in the queue, the procedure reads them, translates them to FreshGUI event data structures and calls the event handlers of the respective controls.
-If there is no pending events in the queue, ProcessSystemEvents ends with CF=0
-The second task this procedure serves is to detect the end of the application. In this case it ends with CF=1.
-This procedure is call from the main event loop of the application. Also, the user can periodically call this procedure in order to not allow hanging of the user interface during long processing of some data.
-
-proc WaitForSystemEvent
-This procedure waits until some system message is posted to the application event queue. Then it exits. During the wait, very low CPU power is consumed by the application.
-
-proc Terminate
-It provides all finalization tasks and ends the application. The exit code is provided in EAX.
-
-Template engine
-The template engine provides creation of complex window structures with tree layout from memory data structure, called template. The templates makes creation of dialog windows containing children windows and non visual objects.
-Templates can be visually created and edited. The template format used by FreshLib is flexible and allows all parameters and fields of the objects to be set to needed values during creation of the window.
-The template engine is located in the file ObjTemplates.asm
-
-Template data structure
-The template is consisted from one or more data structures of type TObjTemplate, defined following way:
-
-struct TObjTemplate
- .flags dd ?
- .class dd ?
- .ptrVar dd ?
- .paramsize dd ?
- .params:
-ends
-
-.flags – controls what is the place of the object in the whole tree structure.
-Can accept one or both of the following values, combined with OR:
-
- tfChild | =0 | means the object is child of the last object with tfParent set. |
- tfParent | =1 | means the given object is parent and there will be next TObjTemplate structure that will be a child object. |
- tfEnd | =2 | means the given object is the last child of its parent. Note, that one object can be parent and child in the same time. If the current template is at root level – the processing of template stops, after creating the current element and all its children. |
-
-
-.class – pointer to TObjectClass data structure for the created object.
-.ptrVar – pointer to dword variable that to accept the pointer to the created object.
-.paramsize – the size of the additional data to the end of the template. Note, that TObjTemplate is variable length structure, not fixed. sizeof.TObjTemplate contains the size of the header part of the structure.
-.params: after the header fields there can be arbitrary count of dword pairs: (paramID, Value) that to be set the the object during creation. This sequence ends with dword $FFFFFF (-1) value for paramID.
-
-Easy creation of templates is provided with macro ObjTemplate:
-
-macro ObjTemplate flags, class, name, [id, param]
-
-This macro allows use of string values for params and computes automatically the values for TObjTemplate.paramsize
-flags – set of (tfParent, tfEnd) constants.
-class – the base name of the object class (without prefix C) – i.e. Form, Window, Button, etc.
-name – label of the variable to receive the pointer to the created object.
-id – parameter ID or offset in the object structure.
-param – value of the parameter. Can be dword number or string constant. In the case the parameter value is string, it will be automatically created in the memory and the pointer to this string will be placed as a param value.
-One simple example of template structure:
-
-ObjTemplate tfParent or tfEnd, Form, frmMain, \
- visible, TRUE, \
- x, 100, \
- y, 50, \
- width, 640, \
- height, 480, \
- caption, 'Fresh portable Win32/Linux application test.'
-
- ObjTemplate tfChild, Button, btnChild1, \
- visible, TRUE, \
- x, 64, \
- y, 48, \
- width, 64, \
- height, 24, \
- caption, 'Button1', \
- OnClick, Button1Click
-
- ObjTemplate tfChild or tfEnd, Button, btnChild2, \
- x, 136, \
- y, 48, \
- width, 64, \
- height, 24, \
- caption, 'Button2' ,\
- visible, TRUE
-
-
-Template engine procedures
-Actually the procedure is one:
-
-proc CreateFromTemplate, .ptrTemplate, .parent
-
-
-This procedure creates all objects from the template, pointed by [.ptrTemplate] as a parent of [.parent] argument.
-.ptrTemplate points to TObjTemplate structure.
-.parent points to TObject descendant structure. In most cases it will be actually descendant of TWindow or NULL if the created object is not a child of any window.
-Returns: EBX contains a pointer to the topmost of the created object (it is first of the created objects)
-All pointers of the objects are stored in the specified in the template variables ( i.e. [TObjTemplate.ptrVar])
-
-
DELETED freshlib/_doc/compiler.wiki
Index: freshlib/_doc/compiler.wiki
==================================================================
--- freshlib/_doc/compiler.wiki
+++ /dev/null
@@ -1,34 +0,0 @@
-
-FreshLib directory: compiler
-This directory contains only one macro library: "executable.inc"
-This library defines the macros that are going to be used for creating the main structure of the program. These macros are OS dependent as long as the type of the executable file is OS dependent: PE for Win32 and ELF for Linux.
-Every one of the macros from this library should be used only once in the program.
-
-FreshLib Executable macros
-This macro library contains:
-_BinaryType
-macro _BinaryType type
-This macro sets the type of the executable. The argument type can accept one of the following values: GUI, console or DLL.
-This macro defines also the entry label of the program. This label is fixed to start:
-For example, following code will tell the compiler to compile the program as a GUI application:
-
-include 'compiler/executable.inc'
-_BinaryType GUI
-
-
-_CodeSection
-macro _CodeSection
-This macro defines the section where the code of the program to be placed.
-Actually this section is the main section of the project. Here should be included all used libraries and other project files.
-
-_DataSection
-macro _DataSection
-
-This macro defines the section where the data of the program to be placed. The common way to use this section is to use inside the macro IncludeAllGlobals that will allow you to use data defining macros from every place inside the source and leave the compiler to order this data properly for you.
-For details on using global data definition macros see: _globals.inc
-
-_ImportSection
-macro _ImportSection
-This macro defines the section where to be inserted the list with functions dynamically imported from external libraries.
-Usually you only have to include here the library "allimports.asm" and the compiler will import for you only those functions that are used in the project.
-
DELETED freshlib/_doc/data.wiki
Index: freshlib/_doc/data.wiki
==================================================================
--- freshlib/_doc/data.wiki
+++ /dev/null
@@ -1,286 +0,0 @@
-
-
-FreshLib directory: data
-This directory contains data handling routines and useful data structures. Actually it contains two abstract data structures: Arrays and Strings.
-Current implementation is fully portable: it does not contain any OS dependent code.
-FreshLib Arrays
-The FreshLib Arrays data structure handles dynamic arrays that contain elements of arbitrary size.
-Structure
-The following structure represents the header of the array. The actual array will have arbitrary size, depending on the element count and size.
-
-struct TArray
- .count dd ?
- .capacity dd ?
- .itemsize dd ?
- .lparam dd ?
- label .array dword
-ends
-
-
-The first element of the array begins on offset TArray.array from the begining of the memory block.
-The field TArray.count contains the current element count of the array.
-The field TArray.capacity contains the current capacity of the array. It is because the library usually allocates more memory than is needed for the array element count. This approach reduces memory allocations and reallocations and thus increases the speed of inserting and deleting elements in the array. How many memory will be allocated depends on the user setting of the variable ResizeIt (defined in memory.asm). This variable contains a pointer to the procedure that simply increases the value of ECX to the next suitable value.
-The field TArray.itemsize contains the size in bytes of one array element. Changing of this value is not recommended.
-The field TArray.lparam is for user defined parameter, associated with the array.
-
-Procedures
-
-CreateArray
-
-proc CreateArray, .itemSize
-
-This procedure creates new array with item size [.ItemSize]
-The procedure returns CF=0 if the array is properly created and pointer to the array is placed in EAX.
-In case the memory cannot be allocated, the procedure returns CF=1.
-The array must be freed after use. There is no special procedure for array free. Use FreeMem procedure to free array memory after use.
-
-AddArrayItems
-
-proc AddArrayItems, .ptrArray, .count
-
-This procedure adds new array items at the end of the array pointed by [.ptrArray]
-The procedure returns two values:
-EAX contains pointer to the first of the new appended elements.
-EDX contains pointer to the array (in the process of appending of the new element, it is possible the whole array to be moved to the new address in memory, so the programmer should store the value of EDX for the future reference to the array.
-In case, the new memory can not be allocated, the procedure returns CF=1 and EDX contains the proper pointer to the original array.
-
-InsertArrayItems
-
-proc InsertArrayItems, .ptrArray, .iElement, .count
-
-This procedure inserts [.count] new elements at the [.iElement] position of the array pointed by [.ptrArray]
-If [.iElement] is larger or equal to [TArray.count] the elements are appended at the end of the array. (Just like AddArrayItems) Otherwise, all elements are moved to make room for the new elements.
-The procedure returns exactly the same results as AddArrayItems procedure EDX points to the array and EAX points to the first of the new inserted elements.
-CF is error flag.
-
-DeleteArrayItems
-
-proc DeleteArrayItems, .ptrArray, .iElement, .count
-
-This procedure deletes [.count] items with begin index [.iElement] the [.ptrArray] dynamic array. If the capacity of the array is bigger than the recommended for the new count, then the array is resized. The recommended size is calculated using ResizeIt procedure from memory library.
-Returns EDX - pointer to the TArray. In the most cases this pointer will not be changed, but this also depends on the current OS memory allocation API, so it is safer to store the pointer for future use, instead of one passed to the procedure.
-This procedure can not fail, because deleting element is always possible. In some rare cases it can fail to reallocate smaller memory block, but this is not a problem for the array consistency.
-
-VacuumArray
-
-proc VacuumArray, .ptrArray
-
-This procedure removes the reserved memory from the array in order to make it as small as possible. This operation should be executed only if there will be no more inserts in the array. The memory economized this way depends on reallocation strategy and can be from 25 to 100% in some cases.
-
-ListIndexOf
-
-proc ListIndexOf, .ptrList, .Item
-
-The list is a special case of array with item size equal to 4 bytes (dword). This procedure searches the list [.ptrList] for item equal to [.Item] and returns the index of the element in EAX. In case of error CF=1.
-
-ListFree
-
-proc ListFree, .ptrList, .FreeProc
-
-Frees all elements of the list [.ptrList], calling [.FreeProc] for every element of the list.
-FreeProc callback procedure have one argument of type dword that is the value of the current list element. The definition of the callback procedure is similar to following:
-
-proc FreeMyListItem, .ptrItem
-begin
- ;do something with the item being freed
- return
-endp
-
-
-FreshLib Strings
-Using strings in assembler was often problematic for programmers - static strings can't be resized, so they had to reserve as many bytes as they thought user could need, and it still could be not enough. Thus we created StrLib - a library that operates on dynamic strings, that are automatically resized when needed. Also, StrLib contains many functions that perform string comparison, inserting one string into another, and more. And most of this functions can operate on static strings too. StrLib uses "memory.asm" library for memory allocations and does not contains any OS dependent code.
-FreshLib Strings uses FreshLib Arrays to handle the list with pointers to allocated string memory.
-
-StrLib string format
-The strings used in StrLib are implemented using a specific structure, compatible but not equal to AsciiZ, used by Windows API. The string structure is defined in the following way:
-
-struc string {
- .capacity dd ?
- .len dd ?
- label .data byte
-}
-
-virtual at -(sizeof.string)
- string string
- sizeof.string = $-string
-end virtual
-
-
-The string data is placed on offset 0 to the pointer of the string. Its label is "string.data". The string data always is terminated by at least one zero byte and the length of the memory buffer is always dword aligned.
-It is safe to process the string data by dword instructions.
-On offset [string-4] is located a dword field, that contains the length of the string data, not including the terminating zero bytes.
-On offset [string-8] is located a dword with the capacity of the memory allocated for the string.
-These fields are accessible by its symbolic names: string.len and string.capacity; This fields are for internal use only it is not safe for the user to change the values of these fields.
-Using special field that to keep the length of the string makes some of the string operations extremely fast, because searching for the terminating zero is very slow operation.
-All procedures in StrLib compute the proper value for [.len] field and never search for the terminating zeros, except for the AsciiZ strings that are external towards StrLib those returned from the OS API functions or by string constants in memory.
-
-StrLib string handles
-The string in StrLib is identified not with its pointer, but by a handle. While the pointer can be changed when the string memory is reallocated, the handle is always a constant for the whole life cycle of the string.
-There is a procedure that extracts the current pointer of the string by its handle.
- Because handle values never collides with memory addresses, almost all StrLib procedures can work with handles and with memory pointers at the same time.
-For the strings passed to the procedures with memory pointer, StrLib assumes they are static strings from memory, or returned from the OS.
-Because of this assumption, StrLib process these strings safely and slowly scans the string to determine the length, assumes it is byte aligned etc. In other words it process it as a standard AsciiZ string.
-
-StrLib procedures
-StrNew
-proc StrNew
-Creates new string and returns handle in EAX.
-
-StrPtr
-proc StrPtr, .hString
-Returns the current pointer to the string with handle [.hString].
-If [.hString] looks like a valid handle, but it is not found in the strings table, the procedure returns CF=1.
-
-StrDel
-proc StrDel, .hString
-Deletes the string with handle [.hString] and frees all allocated memory. If [.hString] is a pointer, it tries to search the strings table for the given handle and deletes it.
-If a string is not found, the procedure does not return an error.
-
-StrDup
-proc StrDup, .hSource
-Creates a duplicate of the string .hSource. Returns a handle to the new created string in EAX.
-
-StrLen
-proc StrLen, .hString
-Returns the length of the string [.hString]. If the handle is valid, it returns the value of the field [string.len]. If [.hString] is a pointer, it computes the length by scanning the string up to the zero terminator.
-
-StrFixLen
-proc StrFixLen, .hString
-This procedure scans the length of zero terminated string and "fixes" [string.len] field. StrFixLen should be call when the content of the string is created by an external call, for example a Win32 API function.
-
-StrSetCapacity
-proc StrSetCapacity, .hString, .capacity
-If the capacity of [.hString] is larger than the requested capacity it does nothing.
-If the capacity of [.hString] is smaller than the requested capacity, it sets the capacity of the string to the requested value.
-Returns a pointer to the string after reallocation in EAX.
-.hString is a handle to the string that have to be resized. Pointers are not acceptable here.
-.capacity contains requested capacity for the string.
-If returns CF=1 the reallocation failed. EAX still contains the pointer to the string, but the string was not resized.
-
-StrCopy
-proc StrCopy, .dest, .source
-Copies the content of [.source] string to [.destination] string.
-
-StrCompCase
-proc StrCompCase, .str1, .str2
-Compares the content of two strings [.str1] and [.str2] case sensitive.
-Returns:
-CF=1 if the strings are EQUAL.
-CF=0 if the strings are NOT equal.
-
-StrCompNoCase
-proc StrCompNoCase, .str1, .str2
-Compares the content of two strings [.str1] and [.str2] case NOT sensitive.
-Returns:
-CF=1 if the strings are EQUAL
-CF=0 if the strings are NOT equal.
-
-SetString
-proc SetString, .ptrHString, .ptrSource
-Creates string and assigns it to variable. If the variable already contains string handle, the old string will be reused. Copies the content of [.ptrSource] to the string variable.
-Arguments:
-.ptrHString pointer to the variable that contains string handle.
-.ptrSource pointer to the source for string.
-
-StrCat
-proc StrCat, .dest, .source
-Concatenates two strings. The operation is: destination = destination + source.
-The destination string [.dest] can be only handle. [.source] can be handle or pointer.
-
-StrCharPos
-proc StrCharPos, .hString, .char
-StrCharPos returns a pointer to the first occurrence of a given char in specified string.
-Arguments:
-.hString - string to search
-.char - char to look for
-Returns:
-A pointer to the char in source, or NULL if char doesn't occur in the given string.
-
-StrPos
-proc StrPos, .hString, .hPattern
-StrPos returns a pointer to the first occurrence of a .hPattern string in .hString.
-
Arguments:
-hPattern - 'pattern' string
-hString - string to search
-Returns:
-Pointer to the pattern string in source, or NULL if pattern string doesn't occur in the string to search.
-
-StrCopyPart
-proc StrCopyPart, .dest, .source, .pos, .len
-Copies part of the source string to the destination string.
-Arguments:
-.dest handle to destination string.
-.source handle or pointer to the source string.
-.pos Source part start position.
-.len length of the copied part.
-Returns nothing.
-
-StrExtract
-proc StrExtract, .string, .pos, .len
-The same as StrCopyPart, but creates and returns new string with extracted part of the source [.string]
-Returns the new created string in EAX.
-
-StrSplit
-proc StrSplit, .hString, .pos
-Splits the string on two strings, at position [.pos]
-Arguments:
-
.hString handle of the string to be split.
-.pos - position where to split the string.
-Returns:
-
EAX - handle to the new created string with second part of the string. The original string does not reallocate memory and it's capacity and the pointer will remains the same.
-
-StrInsert
-proc StrInsert, .dest, .source, .pos
-Inserts the string [.source] into the string [.dest] at position [.pos]
-
-StrLCase
-proc StrLCase, .hString
-Converts [.hString] to lower case.
-
-
-StrUCase
-proc StrUCase, .hString
-Converts [.hString] to upper case.
-
-NumToStr
-proc NumToStr, .num, .flags
-Converts the given number to a string representing it.
-[.flags] controls how the number to be converted.
-The procedure returns a handle to the string in EAX and direct pointer to the string in EAX.
-The [.flags] is a dword with following format:
-The LSB contains the number of digits, the number must have, if ntsFixedWidth flag is specified.
-Second byte of [.flags] contains the radix that to be used for conversion.
-The third and the fourth bytes are reserved for bit flags.
-Following constants are predefined in StrLib in order to set the value for [.flags]:
-
-ntsSigned | converts number in signed format. | $00000 |
-ntsUnsigned | converts number in unsigned format. | $10000 |
-ntsFixedWidth | the count of the digits is fixed. | $20000 |
-ntsBin | for binary number | $0200 |
-ntsQuad | for quad number | $0400 |
-ntsOct | for octal number | $0800 |
-ntsDec | for decimal number | $0a00 |
-ntsHex | for hexadecimal number | $1000 |
-
-Example:
-stdcall NumToStr,EAX, ntsDec or ntsFixedWidth or 8
-This example will convert the number in EAX to a signed decimal number with exactly 8 digits. If EAX contains $00000080, the result string will be '00000128'.
-
-StrCharCat
-proc StrCharCat, .hString, .char
-This procedure appends up to 4 characters at the end of the string [.hString]. The characters are contained in the dword argument [.char]
-
-StrCharInsert
-proc StrCharInsert, .hString, .char, .pos
-Inserts up to 4 characters [.char] at position [.pos] in the string [.hString]
-
-StrHash
-proc StrHash, .hString
-Computes 32 bit hash value from the string [.hString]. This procedure implements the hash algorithm FNV-1b. Returns the result in EAX.
-
DELETED freshlib/_doc/equates.wiki
Index: freshlib/_doc/equates.wiki
==================================================================
--- freshlib/_doc/equates.wiki
+++ /dev/null
@@ -1,5 +0,0 @@
-
-FreshLib directory: equates
-This directory contains the equates library "allequates.inc". This library defines all constants and structures needed for OS dependent parts of FreshLib.
-The user should never use these constants and structures in the portable program.
-
DELETED freshlib/_doc/freshlib.css
Index: freshlib/_doc/freshlib.css
==================================================================
--- freshlib/_doc/freshlib.css
+++ /dev/null
@@ -1,218 +0,0 @@
-body {
- margin: 0px auto 0px auto;
- padding: 2px;
- text-align: justify;
-}
-
-p {
- padding-left: 20px;
-}
-
-td {
- padding: 2px 8px 2px 8px;
-}
-
-span.register {
- margin: 0px;
- padding: 2px;
-}
-
-span.variable {
- margin: 0px;
- padding: 2px;
-}
-
-span.flag {
- margin: 0px;
- padding: 2px 2px 2px 2px;
-}
-
-span.constant {
- margin: 0px;
- padding: 2px 2px 2px 2px;
-}
-
-span.procedure {
- margin: 0px;
- padding: 2px 2px 2px 2px;
- font-weight: bold;
-}
-
-p.note {
- margin: 0px;
- padding: 2px 2px 2px 26px;
-}
-
-p.todo {
- margin: 0px;
- padding: 2px 2px 2px 26px;
-}
-
-pre.fasm-code {
- margin: 4px 4px 4px 20px;
- padding: 2px 6px 2px 6px;
-}
-
-@media screen {
- body {
- background-color: #ffffe8;
- max-width: 1024px;
- font: "fresh";
- font-family: FreeSans, Verdana, sans-serif;
- font-size: 10pt;
- }
-
- /* The project logo in the upper left-hand corner of each page */
- div.logo {
- display: table-cell;
- text-align: center;
- vertical-align: bottom;
- font-weight: bold;
- color: #000000;
- min-width: 100px;
- }
-
- /* The page title centered at the top of each page */
- div.title {
- display: table-cell;
- font-size: 20px;
- font-weight: bold;
- text-align: left;
- padding: 0 0 0 1em;
- color: black;
- vertical-align: middle;
- width: 100% ;
- }
-
- /* The main menu bar that appears at the top of the page beneath
- ** the header */
- div.mainmenu {
- padding: 5px 10px 5px 10px;
- font-size: 12px;
- font-weight: bold;
- text-align: center;
- letter-spacing: 1px;
- background-color: #ff7000;
- border: 1px solid red;
- color: white;
- }
-
- /* The submenu bar that *sometimes* appears below the main menu */
- div.submenu {
- padding: 2px 10px 2px 10px;
- margin: 3px 0px 3px 0px;
- font-size: 12px;
- text-align: center;
- background-color: #ffff70;
- color: #000080;
- border: 1px solid red;
- }
- div.mainmenu a, div.mainmenu a:visited {
- padding: 3px 10px 3px 10px;
- color: white;
- text-decoration: none;
- }
-
- div.submenu a, div.submenu a:visited {
- padding: 1px 10px 1px 10px;
- color: black;
- text-decoration: none;
- }
-
-
- div.mainmenu a:hover {
- color: #558195;
- background-color: white;
- }
-
-
- div.submenu a:hover {
- color: black;
- background-color: #40ffa0;
- }
-
- /* All page content from the bottom of the menu or submenu down to
- ** the footer */
- div.content {
- padding: 8px 8px 8px 8px;
- font-size: 12px;
- max-width: 800px;
- margin: 4px auto 4px auto;
- background-color: white;
- border: 1px #a0a0a0 solid;
- }
-
- /* The footer at the very bottom of the page */
- div.footer {
- font-size: 12px;
- margin-top: 2px;
- padding: 5px 10px 5px 10px;
- text-align: right;
- background-color: #ff7000;
- border: 1px solid red;
- color: white;
- }
-
- td {
- font: "fresh";
- font-family: "helvetica";
- font-size: 10pt;
- }
-
- span.register {
- background-color: #FFCCFF;
- }
-
- span.variable {
- background-color: #CCFFFF;
- }
-
- span.flag {
- background-color: #FFFFCC;
- }
-
- span.constant {
- background-color: #CCFFCC;
- }
-
- span.procedure {
- font-weight: bold;
- }
-
- p.note {
- background-color: #FFFFCC;
- border: 1px solid #FFCCCC;
- }
-
- p.todo {
- background-color: #FFCCCC;
- border: 1px solid #FF9999;
- }
-
- pre.fasm-code {
- max-width: 700px;
- background-color: #F3F3F3;
- border: 1px dashed #C0C0C0;
- font-size: 9pt;
- }
-
-}
-
-@media print {
- body {
- background-color: none;
- font-family: FreeSans, Verdana, sans-serif;
- }
- div.mainmenu {
- visibility: hidden;
- }
-
- div.submenu {
- visibility: hidden;
- }
-
- a {
- text-decoration: none;
- }
-
-}
DELETED freshlib/_doc/freshlib_reference.wiki
Index: freshlib/_doc/freshlib_reference.wiki
==================================================================
--- freshlib/_doc/freshlib_reference.wiki
+++ /dev/null
@@ -1,61 +0,0 @@
-
-
-Overview
-
-FreshLib is an assembly library aimed to ease the development of rapid assembly language applications, freely portable between different platforms, such as Win32 or Linux.
-The library is coded in flat assembler syntax (fasm) and is intended to be easily used within Fresh IDE although it could be used for plain fasm development.
-
-The library consists of two layers: one that is OS dependent and a second one that is OS independent. The OS dependent layer is very small, in order to help porting it for different OS. This layer only makes interface to the core OS functions, such as memory allocations, file access, drawing functions, simple window management etc.
-
-The OS independent layer is responsible for the main application functionality allowing creation of different kind of windows and controls, user interaction with the program and interaction between particular windows and other GUI elements.
-FreshLib is mainly intended for developing GUI applications, as they are the most challenging to be ported across different platforms. FreshLib is also created with visual programming in mind, so it contains a flexible, event driven and OS independent template engine allowing visual creation of application user interfaces.
-FreshLib is in early development stage and probably will be changed many times in order to reach their objectives: to be small, fast and easy to use.
-
-The main intention is to keep the bloat off the library, but containing all necessary accessories for comfortable programming of a very wide range of applications.
-
-The architecture of FreshLib is open and it can be freely expanded with other libraries without increasing the size of applications. In other words, only those parts of the library that are effectively used will be compiled on the final executable.
-
-About this manual
-
-This manual is a "work in progress". Any part of it can be changed at any time.
-Of course, some of the libraries described in this document are more stable and finished like the macro, system and data libraries. Therefore, the chapters about these libraries are less likely to be changed. Other libraries (like graphics and GUI), will be heavily modified so the manual will be changed accordingly.
-
-Structure of the library
-FreshLib contains many code and macros libraries, structured hierarchically and depending on each other. Here is the directory tree of the library:
-
-The library is structured to support different platforms transparently. The platform dependient code is contained in a subdirectory of each library component. For example, "system" subdirectory contains libraries for accessing system resources such as memory, files, etc. Inside "system" there several subdirectories that contain OS dependent code these directories are named after the platform they serve.
-Currently, only Win32 and Linux platforms are supported.
-Getting started
-FreshLib main scope is to provide a fast and easy framework to start programming multiplatform assembly applications. Now, what is needed to start writing applications?
-Tutorials
-
-
DELETED freshlib/_doc/imports.wiki
Index: freshlib/_doc/imports.wiki
==================================================================
--- freshlib/_doc/imports.wiki
+++ /dev/null
@@ -1,6 +0,0 @@
-
-FreshLib directory: imports
-Another directory that contains only OS dependent definitions is "imports" with a library file to be included in the project: "allimports.asm"
-This file have to be included in the _IncludeSection of the application. Then it will generate the proper import section, depending on the target platform and functions used by the OS dependent parts of FreshLib.
-The user should never call directly imported functions from inside the portable application.
-
DELETED freshlib/_doc/index.wiki
Index: freshlib/_doc/index.wiki
==================================================================
--- freshlib/_doc/index.wiki
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
-
-Fresh is a visual assembly language IDE with built-in FASM assembler.
-
-
-The main goal of Fresh is to make programming in assembly as fast and
-efficient as in other visual languages, without sacrificing the small
-application size and the raw power of assembly language.
-
-
-Because Fresh is the logical continuation of the FASM project in the
-area of visual programming, it is perfectly compatible with FASM and you
-can use all your knowledge about FASM to program in Fresh.
-
-
-Of course, you can use Fresh not only for Windows programming, but also
-to create programs for any OS that FASM supports - DOS, Linux, FreeBSD,
-BeOS, MenuetOS - the same way as you do this in FASM.
-
-
-This site is fossil repository of Fresh sources.
-You can clone the repository with following fossil command:
-
fossil clone http://chiselapp.com/user/johnfound/repository/FreshIDE/ Fresh.fossil
-
-
-In order to use more functionality in this site, please login as "anonimous" user.
-Particularly you will be able to follow the links in the source tree, to download code and to fill bug reports and feature requests.
-
-
-If you want to contribute to the project, please contact me (johnfound) on FASM message board
-
-
-In order to download compiled FreshIDE, visit Fresh IDE home page.
-
-
-You can report bugs, or make some feature requests here, in the Tickets system
-
-
DELETED freshlib/_doc/macros.wiki
Index: freshlib/_doc/macros.wiki
==================================================================
--- freshlib/_doc/macros.wiki
+++ /dev/null
@@ -1,217 +0,0 @@
-
-
-FreshLib directory: macros
-This directory contains several libraries that provides common convenience functions to be used with big assembly projects. All libraries can be included in the project at once from the file "allmacros.inc".
-There is no overhead at including all those libraries because there is no code to be generated, just macros. There is a little delay in compile time but thanks to fasm's speed, it is barely noticeable.
-Lets examine each one of these libraries.
-FreshLib _stdcall.inc
-In general this library provides ways of definition and invoking of the procedures with argument passing through the stack. It supports STDCALL and CCALL calling conventions.
-
-macro proc name, [arg]
-macro begin
-macro endp
-macro return
-macro cret
-macro locals
-macro endl
-
-These macros define a procedure, creates a stack frame for the local variables and defines symbolic names for the arguments. The macro "proc" defines the global label "name" as a name for the procedure. All arguments and local variables are defined as a local labels with regard to the name of the procedure. That is why all arguments and local variables must have names beginning with dot.
-Between the line with "proc" and "begin", any number of local variables can be defined. The macro "begin" marks the begining of the procedural code.
-The macro "endp" marks the end of the procedural code.
-The return from procedure instruction is provided by macros "return" or "cret" depending on the calling convention we want to use: "return" clears the arguments from the stack and "cret" do not.
-Inside the procedure, a secondary stack frame can be allocated with the pair "locals" and "endl". All data definitions, enclosed between these macros will define a secondary stack frame that is a continuation of the stack frame defined between "proc" and "begin".
-
-Any number of "locals" and "endl" pairs can be used, but all of these secondary stack frames will overlap between each other. This feature is specially intended to provide savings of stack space and at the same time, to provide talking variable names for the different parts of more complex procedures.
-For example (in Win32) if we have complex window procedure that have to process multiple messages: One of the message handlers may need one variable .rect. Another message handler may need two variables called .point1 and .point2. But the procedure as a whole is never going to need all those variables at the same time, because it process only one message at a time. On the other hand it may need the variable .ctrldata for every message processed. The optimal solution is to define the variables in the following way:
-
-proc CtrlWinProc,.hwnd,.wmsg,.wparam,.lparam
-.ctrldata dd ?
-begin
- invoke GetWindowLong, [.hwnd], GWL_USERDATA
- mov [.ctrldata], eax
-
- cmp [.wmsg], WM_MESSAGE1
- je .message1
- cmp [.wmsg], WM_MESSAGE2
- je .message2
- return
-
-.message1:
-locals
- .rect RECT
-endl
- return
-
-.message2:
-locals
- .point1 POINT
- .point2 POINT
-endl
- return
-endp
-
-In the above example, .ctrldata is defined on [EBP-4]; .rect is defined on [EBP-20]; .point1 is also defined on [EBP-20] and .point2 is defined on [EBP-12].
-
- [EBP-04] | .ctrldata |
- [EBP-08] | .rect.bottom | .point2.y |
- [EBP-12] | .rect.right | .point2.x |
- [EBP-16] | .rect.top | .point1.y |
- [EBP-20] | .rect.left | .point1.x |
-
-As you can see, .rect occupies the same memory as .point1 and .point2, but .ctrldata is never overlapped and exists independently.
-
As a general rule, you have to use the definitions between "proc" and "begin" for local variables that are used in every call of the procedure and separate locals/endl definitions for variables needed for the particular branches inside the procedure.
-
This approach will always provide the optimal size for the locals stack frame.
-
-
-macro initialize
-macro finalize
-
-The macros "initialize" and "finalize" defines one special type of procedures that during compilation are registered in a two separate lists - one for "initialize" and one for "finalize" procedures.
-After that using the macros "InitializeAll" and "FinalizeAll", all these procedures can be call at once. "initialize" procedures are call in the order of their definition and "finalize" procedures in reverse order.
-These macros provides standard and consistent way to process the initialization and the finalization of the libraries and modules of the application.
-Procedures defined with "initialize" and "finalize" must have no any arguments.
-FreshLib uses this mechanism and the user is free to use it also.
-
-macro stdcall proc, [arg]
-macro ccall proc, [arg]
-macro invoke proc, [arg]
-macro cinvoke proc, [arg]
-
-This macros call the procedures with STDCALL and CCALL calling convention.
-"stdcall" macro pushes the arguments to the stack in reverse order and then call the procedure with label "proc". As long as the macro "stdcall" does not provide any stack cleanup (this duty is assigned to the procedure) the arguments can be pushed in free manner using, for example, separate push instructions for part of the arguments and arguments in the stdcall line for the remaining arguments. This can be very convenient in some cases. For example see the following source:
-
- stdcall CreateSomeObject
- push eax
- stdcall DoSomething
- stdcall DeleteSomeObject
-
-Here, the procedure DoSomething changes the value of eax, so the handle is saved in the stack. The procedure DeleteSomeObject needs one argument - a handle of the object. But as long as the proper value is already in the stack, it is mindless to pop the value and then to push it again. So the source calls DeleteSomeObject without any arguments. The procedure knows the proper number of arguments (one in this example) and clean the stack properly.
-The standard (and wrong) approach is to pop the argument from the stack and then to pass it to the procedure explicitly is the stdcall statement:
-
- stdcall CreateSomeObject
- push eax ; save the handle.
- stdcall DoSomething
- pop eax ; ??? Why ???
- stdcall DeleteSomeObject, eax
-
-This source will generate the meaningless instructions sequence:
-
- pop eax
- push eax
-
-"invoke" macro is the same as "stdcall" with the only difference - it calls the procedure indirectly (call [proc] instead of call proc).
-This mechanism is used to call the functions imported from external dynamic linked libraries.
-"ccall" macro calls a procedure with CCALL convention. This means that the procedure returns with simple "retn", without cleaning the parameters from the stack. Then "ccall" macro provides instructions that remove the arguments from the stack.
-Because ccall have to know the exact count of passed arguments, all arguments have to be passed explicitly as a values in the ccall statement.
-Tricks as described above will not work properly and leads to stack not properly cleaned after the call.
-"cinvoke" is the same as ccall, but using indirect call. The reason is the same as with "invoke" macro.
-About the calling conventions: While all Win32 dynamic linked libraries uses STDCALL convention, most (if not all) of Linux libraries uses CCALL convention.
-All code libraries of Fresh use STDCALL calling convention and it is platform independient.
-
-FreshLib _globals.inc
-This library defines several macros intended to deal with data definitions.
-Usually all data definitions have to be placed in special section of the executable file. This is not very convenient, because the code that process this data and the data definitions must reside in separate places of the source code, and in most cases even in different files.
-The idea of globals.inc macro library is to allow the data definition to be described anywhere in the source code, but these definitions to be defined at once, at the place the programmer wants - usually in the data section of the program.
-
-macro uglobal
-macro iglobal
-macro endg
-macro IncludeAllGlobals
-
-"uglobal" begins block for undefined data definition. The block ends with "endg" macro. Between "uglobal" and "endg" macro any count of data definitions can be inserted.
-Note that because uglobal block defines undefined data, it is only the labels and the size of data that have meaning inside this block. Any data defined with data definition directive will not be included in the binary file.
-The undefined data will be defined later at the place where "IncludeAllGlobals" macro resides.
-The undefined data is always placed at the end of all data definitions, so it will never increase the size of the executable file.
-
-"iglobal" macro, again combined with "endg" defines initialized data. The data defined in the block will be created at "IncludeAllGlobals" statement.
-This block increases the size of the executable file, because it contains sensible data, that have to be included in the file.
-Actually, neither uglobal, nor iglobal blocks defines any data immediately.
-Instead, the data definitions are stored in a list. The real definition occurs later, when IncludeAllGlobals macro is invoked.
-For this reason, IncludeAllGlobals must be placed in the source after all used global data blocks.
-
-struc text [val]
-
-The macro "text" is actually a structure. It needs to be preceded by some label name.
-This macro defines a zero terminated string constant, and also a local label for this string in the "sizeof" global label.
-The "text" macro, similar to iglobal and uglobal simply stores string data for defer definition.
-This definition, as for all global data macros, occur in IncludeAllGlobals invocation.
-Why to define separate macro for the strings and not to use the normal iglobal block? The thing is that the macro "text" was planned to check the strings and to not define any string more than once. In the case of repetitive strings, this macro should return the pointer to the already defined string constant.
-In that case, it would be very convenient and harmless to use string constants in the function calling macros - stdcall, ccall etc.
-Unfortunately, regardless of the power of fasm macro language, this functionality cannot be implemented. Or, more precisely, it can be implemented, but the implementation is too slow for any real project use.
-This ineffective implementation is still leaved inside the file _globals.inc - commented block that defines macro with name "InitStringList". If someone have ideas about fixing this problem, please send it to me!
-
-FreshLib _struct.inc
-This library contains only one simple macro:
-
-
-macro struct name
-ends
-
-This macro is aimed to provide easy creation of data structures. The "struc" directive in FASM is known to not create actual labels, but only the template for the label definitions. So, we need to create an instance of the data structure in order to have addresses and offsets of its fields.
-But very often we don't have static data structure of the given type, but data structure, pointed by some of the registers. In this case in order to use offsets to the fields of the data structure, we need to define at least one virtual instance of the structure at address 0. Then we can use the values of the fields as an offsets in the instructions - for example: mov eax, [esi+RECT.right].
-So, this is exactly what "struct" macro does. Besides it defines the "struc" structure with the given fields, it creates a single virtual instance of this structure, in order to be used later for register addressing. In all remaining functionality it behaves exactly as the struc directive.
-The syntax of struct macro is the following:
-
-struct StructureName
- .field1 dd ?
- .field2 RECT
- .fieldN:
-ends
-
-The definition begins with "struct" followed by the structure name. The definition ends with "ends" directive. Between both, any local label definition becomes a member of the structure.
-
-FreshLib _display.inc
-This library contains macros that enhance the functionality of standard FASM "display" directive.
-
-macro disp [arg]
-The macro "disp" displays the strings given in the arguments, just as "display" FASM directive does
-disp <number, radix>
-The macro here is used to display numbers in any radix.
-
-macro DispSize Text, Sz
-"DispSize" macro is very specialized macro, that displays the text and number in the following form:
-
-Size of [Text] is: Sz bytes
-
-The size number is automatically scaled to bytes or kbytes, depending on the value of Sz.
-This macro allows easy display and control of the sizes of particular areas of the program - data structures, subroutines etc.
-
-How Fresh implements "display" directive
-There are some specifics in Fresh, concerning message displaying. The "display" directive in Fresh works in a different way than original FASM directive. It outputs text in Fresh message window. Each message can have one of six icons, or it can have no icon at all. And because message window is implemented as a TreeView control, you can organize your messages into groups (directories). Implementation is a bit "tricky" - when you display a character whose code is less than 16, it is interpreted in a special way. Characters from 1 to 6 set an icon of current message. It sounds complicated, but it is quite simple. Try:
-
- display 2, "some message"
-
-It will display "some message" with an error icon. Another codes are used for controlling directory structure. Try to type following lines and see what would happen:
-
- display 3, "message at root", 0x09
- display 3, "child message1", 0x0a
- display 3, "child message2", 0x0d
- display 3, "again at root", 0x0a
-
-Of course you don't have to put each message in separate display directive, you can, with the same result write:
-
-display 3, "at root",$09,3,"child1",$0a,3,"child2", $0d,3,"again at root",$0a
-
-Here is the complete list of all special characters and their meanings:
-
- $01 | set current icon to "warning" |
- $02 | set current icon to "error" |
- $03 | set current icon to "info" |
- $04 | set current icon to "find" |
- $05 | set current icon to "none" |
- $06 | set current icon to "debug" |
- $08 | end current row and set one level back. |
- $09 | end current row and set it as new directory. |
- $0a | end current row and keep current level |
- $0d | end current row and set current level to root level |
-
-
-
DELETED freshlib/_doc/porting.wiki
Index: freshlib/_doc/porting.wiki
==================================================================
--- freshlib/_doc/porting.wiki
+++ /dev/null
@@ -1,37 +0,0 @@
-Porting FreshLib to other platforms.
-
-Minimal system requirements
-
- * Some kind of heap management. Currently FreshLib uses heap functions in Win32 and libc functions
-in Linux.
-
-Although, if it is impossible for the OS to provide dynamic memory allocation, it can be implemented
-using some other heap manager - for example vid's one from FASMLIB. In this case, the OS should provide only
-one big memory block.
-
-However, this solution can greatly complicate the porting process.
-
- * Some kind of process management. Threads.
-
- * Timer - FreshLib needs one timer that to be able to interrupt the main program loop.
-
- * Graphics - FreshLib needs basic graphics functions in order to work. Lines, Rectangles and text drawing
-should be enough.
-
- * Graphics Text rendering - FreshLib needs UTF-8 support at least on level of conversion of UTF-8 to
-the OS internal format (as is with Win32). As long as ASCII (0..$7f) is valid UTF-8 code, if the OS uses
-only plain ASCII it is possible for text rendering to provide only ASCII text drawing.
-
-In Win32 FreshLib uses Windows unicode support with conversion. In Linux it uses XFT library, that supports
-direct use of UTF-8 strings.
-
- * Console text output - FreshLib needs output to the console window - (native or emulated) for debuging
-purposes.
-
- * Windows - FreshLib uses only one base type of window, able to accept the system events and to be displayed
-on the screen. This window should be able to appear on the screen and to be able to have children of the same type.
-
-In Win32 FreshLib uses its own window class "FreshWin". In Linux (XLib) uses usual XLib window.
-
-
-
DELETED freshlib/_doc/simpledebug.wiki
Index: freshlib/_doc/simpledebug.wiki
==================================================================
--- freshlib/_doc/simpledebug.wiki
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-FreshLib directory: simpledebug
-This directory contains debugging utilities.
-
-
DELETED freshlib/_doc/starting.wiki
Index: freshlib/_doc/starting.wiki
==================================================================
--- freshlib/_doc/starting.wiki
+++ /dev/null
@@ -1,144 +0,0 @@
-
-Setting Up
-
-The first thing to do is to download fasm in your platform of choice.
- Fasm does not require installation nor do you need special administrative privileges or a root account in order to start using it.
-The second thing is to get a copy of FreshLib. FreshLib is just fasm source code, simply save it in a directory of choice.
-FreshLib needs an environment variable called TargetOS
-in order to know the target platform of the generated application.
- Currently, the allowed values are: Win32 and Linux.
-A second environment variable is suggested called lib having the full path to FreshLib. The library does not need this, but it will make your own sources more portable.
-From Linux:
-
-export TargetOS=Linux
-export lib=/home/test/freshlib
-
-From Windows:
-
-set TargetOS=Win32
-set lib=c:\projects\freshlib
-
-
-That's all. Now it is time to produce the first FreshLib application using just Fasm.
-
-Hello World
-
-
-include '%lib%/compiler/executable.inc'
-include '%lib%/macros/allmacros.inc'
-include '%lib%/equates/allequates.inc'
-
-_BinaryType console
-
-include '%lib%/system/process.asm'
-include '%lib%/simpledebug/debug.asm'
-
-_CodeSection
-
-start:
-
- InitializeAll
-
- DebugMsg 'Hello world!'
-
- FinalizeAll
- call Terminate
-
-_ImportSection
-
-include '%lib%/imports/allimports.asm'
-
-_DataSection
-
-IncludeAllGlobals
-
-
-The most important thing to note is that regardless the platform you have chosen, the code is exactly the same.
-In other words, if you change the value of your environment variable TargetOS,
-the same code will produce a different executable file targeting that platform.
-This is the main characteristic of the FreshLib and this is the first design criteria that you will
-want to follow to have a truly platform independent application.
-
-This is a highly portable development environment, perhaps the most portable
-among non interpreted languages. The entire development process could run from removable media
-and the same set of source code files could be used from Win32 and Linux to produce binaries for either of them.
-
-Creating Files
-
-
-include '%lib%/compiler/executable.inc'
-include '%lib%/macros/allmacros.inc'
-include '%lib%/equates/allequates.inc'
-
-_BinaryType console
-
-include '%lib%/simpledebug/debug.asm'
-include '%lib%/system/files.asm'
-include '%lib%/system/process.asm'
-
-_CodeSection
-
-start:
-
- InitializeAll
-
- DebugMsg 'FreshLib Tutorials - Module: Files'
-
-iglobal
- filename db './tut01.txt',0
- sizeof.filename = $-filename
-endg
-
-uglobal
- hFile dd ?
-endg
-
- stdcall FileCreate, filename
- jc .error
- mov [hFile], eax
- DebugMsg "A new file was created:"
- stdcall OutputNumber, [hFile], 16, 2
- DebugMsg " is the handle of the file"
-
- stdcall FileWrite, [hFile], filename, sizeof.filename
- jc .error
- stdcall OutputNumber, eax, 10, 2
- DebugMsg " bytes were written into the file"
-
- stdcall FileClose, [hFile]
- jc .error
- DebugMsg "The file was properly closed"
-
- stdcall FileDelete, filename
- jc .error
- DebugMsg "The file was finally deleted"
- jmp .exit
-
-.error:
- DebugMsg "Sorry, an error occurred"
-
-.exit:
- FinalizeAll
- stdcall Terminate, 0
-
-_ImportSection
-
-include '%lib%/imports/allimports.asm'
-
-_DataSection
-
-IncludeAllGlobals
-
-
-Simple Console
-
-
-
-
-Basic GUI
-
-
-
-
-
-
DELETED freshlib/_doc/system.wiki
Index: freshlib/_doc/system.wiki
==================================================================
--- freshlib/_doc/system.wiki
+++ /dev/null
@@ -1,121 +0,0 @@
-
-FreshLib directory: system
-This directory contains two libraries: "memory.asm" and "files.asm". They constitute the interface to the overlaying system for the rest of the FreshLib modules.
-FreshLib Memory
-This library contains simple but pretty complete functions for dynamic memory allocation, reallocation and release.
-The Win32 implementation of the library uses the process heap, returned by GetProcessHeap to manage the memory allocations. Linux implementation uses libc functions: "malloc", "free" and "realloc".
-
-GetMem
-
-proc GetMem, .size
-
-This procedure allocates dynamic memory block with size in bytes in the argument [.size]
-If there is no error the procedure returns CF=0 and pointer to the requested memory in EAX. If the memory cannot be allocated, the procedure returns CF=1
-
-FreeMem
-
-proc FreeMem, .ptr
-
-This procedure frees the memory block pointed by [.ptr] argument.
-
-ResizeMem
-
-proc ResizeMem, .ptr, .newsize
-
-This procedure tries to resize the memory block pointed by [.ptr] to the new size, given by [.newsize] argument.
-
-
-FreshLib Files
-This library provides simple file access procedures.
-
-FileOpen
-
-proc FileOpen, .filename
-
-This procedure opens the file with a filename in the string pointed by [.filename] argument.
-On success (CF=0) FileOpen returns a handle of the open file. On error (CF=1) returns error code.
-
-FileCreate
-
-proc FileCreate, .filename
-
-This procedure creates new empty file with a filename in the string pointed by [.filename] argument.
-On success (CF=0) FileCreate returns a handle of the open file. On error (CF=1) returns error code in EAX.
-
-FileClose
-
-proc FileClose, .handle
-
-This procedure closes the open file with a handle in [.handle] argument.
-On success (CF=0) does not return any value and preserves EAX.
-On error (CF=1) returns error code in EAX.
-
-FileRead
-
-proc FileRead, .handle, .buffer, .count
-
-This procedure reads [.count] bytes from the file [.handle] in the buffer pointed by [.buffer] arguments.
-On success (CF=0) returns the count of actually read bytes in EAX.
-On error (CF=1) returns error code in EAX.
-
-FileWrite
-
-proc FileWrite, .handle, .buffer, .count
-
-This procedure writes [.count] bytes from the buffer pointed by [.buffer] argument to the file [.handle] that have to be open for write.
-On success (CF=0) returns the count of actually read bytes in EAX.
-On error (CF=1) returns error code in EAX.
-
-FileSeek
-
-proc FileSeek, .handle, .dist, .direction
-
-This procedure moves the file pointer to the some position. The handle of the file is in [.handle], the target position is in [.dist] and the direction of the move is in [.direction] arguments.
-[.direction] accept one of the following values: fsFromBegin, fsFromEnd and fsFromCurrent.
-The exact values of these constants may vary between different OSes, so the programmer have to use the symbolic names, predefined in "files.asm" library.
-On success (CF=0) returns the new position of the file in EAX.
-On error (CF=1) returns error code in EAX.
-
-FileDelete
-
-proc FileDelete, .filename
-
-This procedure deletes a file with name in pointed by [.filename] argument.
-On success (CF=0) no value.
-On error (CF=1) returns error code in EAX.
-
-GetErrorString
-
-proc GetErrorString, .code
-
-This procedure returns in EAX a pointer to a human readable error string for the error code passed in [.code]. The string is dynamically allocated by the OS and should be released after use with the procedure FreeErrorString.
-
-FreeErrorString
-
-proc FreeErrorString, .ptrString
-
-This procedure frees the memory allocated for error string from the procedure GetErrorString.
-
-LoadBinaryFile
-
-proc LoadBinaryFile, .ptrFileName
-
-This procedure allocates needed memory and loads the whole file with filename pointed by [.ptrFileName] to the allocated buffer.
-The memory is allocated with the library memory.asm, so the user have to free the memory after use with the procedure FreeMem.
-
On success (CF=0) the procedure returns a pointer to the allocated memory in EAX and the count of bytes read in ECX.
-On error (CF=1) the procedure returns nothing.
-
-SaveBinaryFile
-
-proc SaveBinaryFile, .ptrFileName, .aptr, .size
-
-This procedure creates new file with the name pointed by [.ptrFileName] and saves [.size] bytes from the buffer pointed by [.aptr].
-The procedure returns error flag in CF.
-
-FileExists
-
-proc FileExists, .ptrFileName
-
-This procedure checks whether the file with name pointed by [.ptrFileName] exists on disk.
-The procedure returns CF=0 if the file exists, otherwise it returnsCF=1.
-
DELETED freshlib/_pending/FBasDx01/FASMBas.txt
Index: freshlib/_pending/FBasDx01/FASMBas.txt
==================================================================
--- freshlib/_pending/FBasDx01/FASMBas.txt
+++ /dev/null
@@ -1,214 +0,0 @@
- Well it's something like qbasic, meaning that it's a lot like most basic's...
-
- You can only have one basic command per line. The exception is a comment / remark starts with a semi colon and can be at the end of a line
-
-Print "example" ;This is an example
-
- Basic commands can be all caps, all small or start with a cap.
-
-PRINT
-print
-Print
-
- FASM Basic does not use line numbers.
-
- Right now FASM Basic only supports a few variable types.
-
-Short = 8 bit number
-Integer = 16 bit number
-Long = 32 bit number
-String = text
-
- All variables must be defined. They are case sensitive.
-
-DEF A, Short ,32
-DEF B, Integer ,12312
-DEF C, Long ,2000000
-DEF D, String ,"String variable"
-
- INPUT, only works with strings right now, but you can also print text with the input command.
-
-Input D ; Waits for the user to type in text and hit enter, The text is stored in D
-Input "Enter: ",D ; Prints 'Enter: ' then waits for user input
-Input D,E,F ; Would wait for user to enter text 3 times, hitting enter after each
-Input "Text" ; Will just print the word 'Text'
-Input "Enter1: ",D," Enter2: ",E," Enter3: ",F
- ; Puts up the text and inputs 3 entries
-
- PRINT, puts text or variables on the screen. /n causes a print command to start a new line.
-
-Print "text" ; Puts the word 'text' on the screen
-Print A ; Puts the value stored in A on the screen at the current location
-Print A,B ; Puts the value of A then the B on the screen, with no space between them
-Print "Numbers 1 & 2 : ",A," ",B
- ; puts the text in quotes on the screen, then A, then a space, then B
-Print "Line1",/n,"Line2"; puts text on 2 lines
-
- BEEP, makes the computer beep once
-
- CLS, clears the screen, 0 the entire screen, 2 a line at bottom is left, 3 three lines at bottom
- 4 a line at top is left, 5 three lines at the top are left
- the second and third numbers set the text color
-
-Cls ; clears the screen
-cls 0 ; clears the screen
-Cls 2 ; clears everything except a line of text at the bottom
-Cls 3 ; clears everything except three lines at the bottom
-Cls 4 ; clears everything except a line of text at the top
-cls 5 ; clears everything except three lines at the top
-cls 0, 8, 4 ; clears everything, sets the text color to gray and background to red
-
- COLOR, First number sets text color. Second sets the background color
- (new text, what's on the screen stays the same Color )
- Last number sets the color for the border / over scan area
- Add 16 to the text number to make it blink
- | Text | Text
- | Background | Background | Text | Text
- | Border | Border | |
- |-------------|-------------|------------------|-------------------
- | 0 = black | 4 = red | 8 = grey | 12 = light red
- | 1 = blue | 5 = magenta | 9 = light blue | 13 = light magenta
- | 2 = green | 6 = brown | 10 = light green | 14 = yellow
- | 3 = cyan | 7 = white | 11 = light cyan | 15 = bright white
-
-Color 7 ; white text, black background, black border
-Color 14, 1 ; yellow test on a blue background with a black border
-Color 8, 4, 4 ; gray text on a red background with a red border
-Color 24, 4, 4 ; blinking gray text on a red background with a red border
-
- END_PROGRAM, must be the last line of your program
-
- GOTO, takes the program from where it is and continues execution at a label.
-
-... ; some random program lines
-...
-Goto NewStuff ; tells program to go to the label 'NewStuff'
-Print "Text that will never get printed"; so this line gets skipped
-NewStuff: ; and the program keeps going here
-...
-...
-
- GOSUB, goes to a label, but returns
-...
-...
-Gosub New stuff
-Print "This gets printed second",/n
-...
-...
-New stuff:
-Print "This line gets printed first",/n
-Return
-...
-...
-
- RETURN, returns from a gosub command
-
- LET, well it doesn't do any thing right now....
-
- LOCATE, the screen location to put text at
-
-Locate 0,0 ; text will start printing on the screen in the upper left corner
-
- PEEK, puts the value of a memory location into register al
-
-Peek 123456
-
- POKE, puts a value to a memory location
-
-Poke 123456,255
-
- REBOOT, reboots the computer
-
- IN_PORT, puts the value of a port into register al
-
-In_port 245
-
- OUT_PORT, outputs a value to a port
-
-Out_port 245,128
-
- SLEEP, the computer waits until a key is pressed to do any thing, the key pressed ends up in reg AX
- or if a number is given it waits that many clock ticks.
-
-Sleep ; waits for a key press
-Sleep 37 ; waits 37 clock ticks, about 2 seconds
-
- SCREEN, sets the screen mode
- 0 = Standard Dos text mode
- 1 = 320 x 200 4 color
- 2 = 640 x 200 2 color
- 7 = 320 x 200 16 color
- 8 = 640 x 200 16 color
- 9 = 640 x 350 4 color
- 11 = 640 x 480 2 color
- 12 = 640 x 480 16 color
- 13 = 320 x 200 256 color
- 14 = DexOS Text mode
- 15 = Vesa text mode 132 x 60
- 100 = 640 x 400 256 color ; only 0-15 fully working right now
- 101 = 640 x 480 256 color
- 103 = 800 x 600 256 color
- 105 = 1024 x 768 256 color
- 107 = 1280 x 1024 256 color
- 110 = 320 x 200 16m color
- 112 = 640 x 480 16m color
- 115 = 800 x 600 16m color
- 118 = 1024 x 768 16m color
- 119 - 1280 x 1024 16m color
-
-Screen 14 ; puts you in DexOS text mode
-
- SOUND, makes a tone, the frequency of the tone is the first number and the duration is the second
-
-Sound 45,18 ; 45 hrz tone for about one second
-
- CURSORON, turns the cursor on
-
- CURSOROFF, turns the cursor off
-
- CURSOR, turns the cursor off or on
-
-Cursor TRUE ; turns on the cursor
-Cursor FALSE ; turns the cursor off
-
- PAUSE, pauses the computer for a given time, 18.5 is about one second (you can only use integers)
-
-Pause 37 ; pauses for about 2 seconds
-
-
-Reserved words:
- Other then the asm and basic command words any thing starting with "_grfx" should be avoided, unless you intend to mess with the basic macro functions.
-
-_grfxMode: read only, is set to what ever graphics mode you are in
- needs to be set by the macro and be right
-
-_grfxScreen: Should probably only be read, unless you want to do some sort of double buffer
- This is the start of memory for the screen
-
-_grfxCls: This is the screen size (in dword) for the mode you are in
-
-_grfxLL: line length (dword) for the mode you are in
-
-_grfxScreen_x Cursor location
-_grfxScreen_y Cursor location, or if changed, where the macros assume the cursor to be
-
-_grfxColor The color all new text will be displayed with,
- byte format = BBBCTTTT,
- B = Background color, C = Blinking or not, T = Text color
-
-Added asm functions: (use instead of the dex functions when using the basic macros)
-
-_grfxPrintString: Prints a 0 terminated string pointed to by ESI
-
-_grfxPrint_char: Prints the ASCII char in al
-
-_grfxLocate: moves the cursor to location al, ah
-
-
-Thanks to rCX for starting this project, TonyMac and Dex for starting it in DexOS. A really big thanks to every one at the FASM board for endless great info on FASM and to Tomasz Grysztar for the great toy, um I mean tool :)
-
-Steve
-http://home.comcast.net/~dexos/
-
-DexOS home page:
-http://www.dex4u.com/
DELETED freshlib/_pending/FBasDx01/fbasic.inc
Index: freshlib/_pending/FBasDx01/fbasic.inc
==================================================================
--- freshlib/_pending/FBasDx01/fbasic.inc
+++ /dev/null
@@ -1,820 +0,0 @@
-; ====================================
-; | Fasm Basic ver 0.10 Beta oct 09 |
-; ====================================
-
-; QBASIC.inc was written by rCX (converted to run on DexOS, by Dex)
-; added to by TonyMac & now added to by Steve, who also changed the name
-
-Beep fix BEEP ; Done
-beep fix BEEP
-cls fix CLS ; Done for text mode, oops need to put cursor in right spot
-Cls fix CLS
-color fix COLOR ; Done in text mode
-Color fix COLOR
-end_program fix END_PROGRAM ; Done
-End_program fix END_PROGRAM
-End_Program fix END_PROGRAM
-gosub fix GOSUB ; Done
-Gosub fix GOSUB
-GoTo fix GOTO ; Done
-Goto fix GOTO
-goto fix GOTO
-input fix INPUT ; Done (just does strings, at this time)
-Input fix INPUT
-let fix LET ; Needs lots of work, not included at this time
-Let fix LET
-locate fix LOCATE ; Done
-Locate fix LOCATE
-peek fix PEEK ; Done
-Peek fix PEEK
-poke fix POKE ; Done
-Poke fix POKE
-print fix PRINT ; Done
-Print fix PRINT
-return fix RETURN ; Done
-Return fix RETURN
-reboot fix REBOOT ; Done
-Reboot fix REBOOT
-In_Port fix IN_PORT ; Done (need to redo so it works with 8, 16 & 32)
-In_port fix IN_PORT
-in_port fix IN_PORT
-Out_Port fix OUT_PORT : Done ( need to redo so it works with 8, 16 & 32)
-Out_port fix OUT_PORT
-out_port fix OUT_PORT
-Sleep fix SLEEP ; Done
-sleep fix SLEEP
-Screen fix SCREEN ; Done in text. enters graphics modes
-screen fix SCREEN
-Sound fix SOUND ; done (crash if below min, need to add a minimum check)
-sound fix SOUND
-def fix DEF ; need to work on strings, make definable size and pad out
-Def fix DEF
-cursoron fix CURSORON ; done
-Cursoron fix CURSORON
-CursorOn fix CURSORON
-cursoroff fix CURSOROFF ; done
-Cursoroff fix CURSOROFF
-CursorOff fix CURSOROFF
-pause fix PAUSE ; done
-Pause fix PAUSE
-cursor fix CURSOR ; done
-Cursor fix CURSOR
-
- ;--------------------;
- ; Set up DexOS stuff ;
- ;--------------------;
-
-use32
- ORG 0x400000 ; where our program gets loaded
- jmp @f ; jump over ver tag
- db 'DEX2' ; Mark it a DexOS ver3 file.
-@@:
- mov ax,18h ; set ax to nonlinear base
- mov ds,ax ; set ds to nonlinear base
- mov es,ax ; set es to nonlinear base.
- mov edi,Functions ; address of jump table (in dex.inc)
- mov ax,0x0a00 ; load table wih DexOS function addresses
- int 40h
-
- jmp SkipQBASIC ; jump over all the macros
-
- ;---------------------------------;
- ; Dam, a run time lib ;
- ; not sure how to get around this ;
- ;---------------------------------;
-_grfxLocate:
- cmp [_grfxMode],byte 15
- je @f
- cmp al,80 ; did they put in to high a x for mode 0,14
- jb @f
- ret ; out of range do nothing
-@@:
- cmp al,132 ; is the x to high for mode 15
- jb @f
- ret ; out of range do nothing
-@@:
- cmp [_grfxMode],byte 14
- je @f
- cmp ah,25 ; y to high for mode 0
- jb @f
- ret ; out of range do nothing
-@@:
- cmp [_grfxMode],byte 15
- je @f
- cmp ah,50 ; y to high for mode 14
- jb @f
- ret ; out of range do nothing
-@@:
- cmp ah,60 ; y to high for mode 15
- jb @f
- ret ; out of range do nothing
-@@:
- mov [_grfxScreen_x],al
- mov [_grfxScreen_y],ah
-_grfxLocate2:
- pushad
- xor ebx,ebx
- mov bl,[_grfxScreen_x]; figure out where the cursor is now
- mov ecx,ebx
- mov bl,[_grfxScreen_y]
- mov eax,[_grfxLL] ; line length (dword, half color half char)
- shl eax,1 ; line length (in bytes of char)
- mul bx
- add eax,ecx
- mov edx,0x3d4 ; video card register index port
- mov ecx,eax
- mov al,0x0f ; set for cursor register (lsb)
- out dx,al
- mov eax,ecx ; cursor location
- add edx,1 ; video card register port
- out dx,al
- mov al,0x0e ; set for cursor register (msb)
- sub edx,1 ; video card registr index port
- out dx,al
- mov al,ch ; cursor location
- add edx,1 ; video card reg port
- out dx,al
- popad
- ret
-
-_grfxPrintString:
- pop esi ; get address of data off the stack
- push eax
-_grfxPrintString_Loop:
- lodsb ; load al, inc esi to next char
- cmp al,0 ; 0x00 = end of string
- jne @f
- call _grfxLocate2 ; End of string so place cursor and leave
- pop eax
- jmp esi ; out of data so this address should be next instruction
-@@:
- cmp al,0x0d ; 0x0d = CR ( = \n )
- je @f
- call _grfxPrintChar ; not a control, so must need printing
- jmp _grfxPrintString_Loop
-@@:
- call _grfxCR ; do the CR (next line)
- jmp _grfxPrintString_Loop
-
-_grfxCR:
- push eax
- mov [_grfxScreen_x],byte 0
- mov ah,[_grfxScreen_y]
- cmp ah,24 ; no reason to scroll if less then 24th line
- jb _grfxCR_NoScroll
- cmp [_grfxMode],byte 0
- je @f
- cmp ah,49 ; less then line 49 and mode 14 or 15, no reason to scroll
- jb _grfxCR_NoScroll
- cmp [_grfxMode],byte 14
- je @f
- cmp ah,59 ; mode 15 and less then 59, no reason to scroll
- jb _grfxCR_NoScroll
-@@:
- push ecx
- push esi
- push edi
- mov edi,[_grfxScreen] ; Address of the screen
- mov esi,edi
- movzx eax,byte [_grfxLL] ; line size (in dword)
- shl eax,2 ; make it bytes
- add esi,eax ; address of 2nd line to be new 1st line
- movzx ecx,word [_grfxCls] ; screen size
- cli ; can't have something writing to screen during a scroll
- rep movsd ; move the text
- sti
- pop edi
- pop esi
- pop ecx
- pop eax
- ret
-_grfxCR_NoScroll: ; don't need to scroll, so just go down one line
- add [_grfxScreen_y],byte 1
- pop eax
- ret
-
-_grfxPrintChar:
- pushad
- push ax ; put char in a safe place
- movzx eax,word [_grfxLL] ; line size (dword)
- movzx ebx,byte [_grfxScreen_y]
- shl eax,1 ; line size (word)
- mul bx ; number of lines times line size
- movzx ebx,byte [_grfxScreen_x]
- add ebx,eax ; screen mem moves (word size)
- shl ebx,1 ; screen mem moves (byte size)
- add ebx,[_grfxScreen] ; add that to the screen base mem location
- pop ax ; char to print
- mov ah,[_grfxColor] ; the color text we want
- mov [ebx],ax ; put the text and color on screen
- mov al,[_grfxLL] ; load up the line size
- shl al,1 ; convert line size to bytes of text
- add [_grfxScreen_x],byte 1 ; set new text location
- cmp [_grfxScreen_x],al ; is new x location to large
- jb @f
- call _grfxCR
-@@:
- popad
- ret
-
-
- ;-----------------------;
- ; The Fasm Basic macros ;
- ;-----------------------;
-
-;___________CLS______________________
-macro CLS clrmode,_opt2,_opt3 ; just for textmode right now
-{
- push ecx
- push eax
- push edx
- push edi
- mov edi,[_grfxScreen] ; start address of screen fill
- if clrmode eq
- else if clrmode eq 4 ; start cls one line down
- movzx eax,word [_grfxLL]
- shl eax,2
- add edi,eax
- else if clrmode eq 5 ; Start cls two lines down
- movzx eax,word [_grfxLL]
- mov edx,12
- mul edx
- add edi,eax
- end if
- if _opt2 eq
- mov eax,0x0f200f20 ; char to fill screen with (0f=color 20=blank)
- else
- mov ah,_opt3 ; Background color 0-7
- shl ah,4
- add ah,_opt2 ; Text color 0-31
- cmp ah,0 ; was there no color set
- jne @f
- mov ah,0x0f ; set a color
- @@:
- mov al," " ; a blank space
- mov cx,ax ; now fill up eax
- shl eax,16
- mov ax,cx
- end if
- movzx ecx,word [_grfxCls] ; how many dwords to write
- if clrmode in <2,4>
- sub cx,[_grfxLL] ; leave 1 line uncleared
- else if clrmode in <3,5>
- sub cx,[_grfxLL] ; leave 3 lines uncleared
- sub cx,[_grfxLL]
- sub cx,[_grfxLL]
- end if
- cli ; can't be changing the screen while clearing it
- rep stosd ; put blanks on screen
- sti
- pop edi
- pop edx
- pop eax
- pop ecx
- Locate 0,0
-}
-
-;___________CURSOR__________________
-macro CURSOR option* ;Turns on cursor if option = TRUE, off if option = FALSE.
-{
- pushf
- pusha
- mov ch,0x0b ;Turns on cursor if option = TRUE
- mov cl,0x0c
- if option = FALSE
- mov ch,0x1c ;turns it off if option = FALSE.
- mov cl,0x1b
- end if
- mov ah,1 ;Set cursor status
- call [RealModeInt10h]
- popa
- popf
-}
-
-
-;_____________CURSOROFF________________
-macro CURSOROFF
-{
- push cx
- push ax
- mov ch,00110000b
- mov cl,00010000b
- mov ah,01h
- call [RealModeInt10h]
- pop ax
- pop cx
-}
-
-;_______________CURSORON_______________
-macro CURSORON
-{
- push cx
- push ax
- mov ch,00010000b
- mov cl,00010000b
- mov ah,01h
- call [RealModeInt10h]
- pop ax
- pop cx
-}
-
-;_______________PAUSE__________________
-macro PAUSE time
-{
- push ax
- mov ax,time
- call [SetDelay]
- pop ax
-}
-
-;________________COLOR_________________
-macro COLOR _opt1,_opt2,_opt3
-
-{
- push eax
- push ebx
- if _opt2 eq
- mov al,0
- else
- mov al,_opt2 ; Background color 0-7
- shl al,4
- end if
- add al,_opt1 ; Text color 0-31
- mov [_grfxColor],al ; Set the text color
- if _opt3 eq
- else
- mov ah,0
- mov al,_opt3 ; Border color 0-3Fh
- shl eax,16 ; top 16 of eax are bx in 16 bit dos mode
- mov ax,0B00h ; Set border color
- call [RealModeInt10h]
- end if
- pop ebx
- pop eax
-}
-
-;_________________END___________________
-macro END_PROGRAM
-{
- call [SetDex4uFonts]
- mov cx,0
- call [InterruptTimer]; restore timer
- ret
-include 'Dex.inc' ; Dex inc file
-}
-
-;_______________LOCATE_________________
-macro LOCATE row,col
-{
- push eax
- local .temp
- if col eq ah
- mov .temp,byte col
- mov ah,row
- mov al, .temp
- else
- mov ah,row
- mov al,col
- end if
- call _grfxLocate
- pop eax
-}
-
-
-;_______________PRINT_________________
-macro PRINT [String]
-{
- if String eqtype ""
- local .a
- push esi
- call _grfxPrintString ; call print & push address of data to stack
- .a db String,0 ; String to print
- pop esi
- else if String eq /n
- local .a
- push esi
- call _grfxPrintString
- .a db 13,0
- pop esi
- else if String eq /N
- local .a
- push esi
- call _grfxPrintString
- .a db 13,0
- pop esi
- else
- local .NotDone
- local .Done
- local .Start
- local .NotString
- push esi
- pushad
- mov esi,String
- cmp [esi],byte 9 ; is it a string varable
- jne .NotString
- add esi,3
- @@:
- mov al,[esi]
- add esi,1
- cmp al,0 ; 0x00 = end of string
- je .Done
- call _grfxPrintChar ; not a control, so must need printing
- jmp @b
- .NotString:
- mov ebx,String
- cmp [ebx],byte 0 ; is data a byte
- jne @f
- add ebx,1
- movzx eax,byte [ebx] ; store it in eax (make it a dword)
- jmp .Start
- @@:
- cmp [ebx],byte 1 ; is data a word
- jne @f
- add ebx,1
- movzx eax,word [ebx] ; store it in eax (make it a dword)
- jmp .Start
- @@:
- add ebx,1 ; data must be a dword
- mov eax,[ebx] ; store it in eax
- .Start:
- mov ebx,1000000000 ; 32 bit can only be 10 ascii digits
- @@:
- cmp eax,0 ; need to check if it's 0
- jnz @f ; if it's not 0 go figure out what it is
- mov al,"0" ; put ascii 0 in al
- call _grfxPrintChar ; and write it to screen
- jmp .Done
- @@:
- mov ecx,1 ; a flag to blow off leading 0's
- mov esi,10 ; we are working in base 10
- .NotDone:
- cmp ebx,0 ; are we done counting off digits
- jnz @f
- jmp .Done
- @@:
- cmp eax,ebx ; is this digit a non zero one
- jb @f
- xor ecx,ecx ; clear the flag to start printing 0's
- @@:
- mov edx,0
- div ebx ; digit to write ends up in al, rest of number in edx
- cmp ecx,1 ; do we need to write yet
- je @f
- add al,"0" ; make al an ASCII digit
- call _grfxPrintChar ; and write it to screen
- @@:
- push edx ; put the rest of number in a safe place
- xor edx,edx
- mov eax,ebx ; put the digit count in eax
- div esi ; reduce digit count one place
- mov ebx,eax ; digit count back in ebx
- pop eax ; get number back in eax
- jmp .NotDone ; try next digit
- .Done:
- popad
- pop esi
- call _grfxLocate2 ; End of string so place cursor and leave
- end if
-}
-
-;_______________INPUT_________________
-Macro INPUT [String]
-{
- if String eqtype ""
- local .a
- push esi
- call _grfxPrintString
- .a db String,0
- pop esi
- else if String eq /n
- local .a
- push esi
- call _grfxPrintString
- .a db 13,0
- pop esi
- else if String eq /N
- local .a
- push esi
- call _grfxPrintString
- .a db 13,0
- pop esi
- else
- local .loop
- local .done
- push edi
- push eax
- mov edi,String
- cmp [edi],byte 9 ; is the varable a string
- jne .done ; major bug if they don't use a string
- add edi,3 ; skip over varable type and size
- .loop:
- call [WaitForKeyPress] ; need to not let them enter to much
- cmp al,13
- je .done
- mov [edi],al ; <----need to make a string move
- inc edi
- call _grfxPrintChar
- call _grfxLocate2
- jmp .loop
- .done:
- mov byte [edi], 0 ;zero-terminate the string
- pop eax
- pop edi
- end if
-}
-
-;_______________SCREEN_________________
-macro SCREEN mode ;need to add active and working page....
-{
- push eax
- mov ah,0h
- mov [_grfxMode],byte mode
-
- if mode = 0
- mov al,3h ; text 80 x 25
- call [RealModeInt10h]
- mov [_grfxScreen],dword 0xb79e0 ; start address of screen
- mov [_grfxCls],word 1000 ; size of screen (in dword)
- mov [_grfxLL],word 40 ; screen width (in dword)
- else if mode = 1
- mov al,04h
- call [RealModeInt10h]
- else if mode = 2
- mov al,06h
- call [RealModeInt10h]
- else if mode = 7
- mov al,0Dh
- call [RealModeInt10h]
- else if mode = 8
- mov al,0Eh
- call [RealModeInt10h]
- else if mode = 9
- mov al,10h
- call [RealModeInt10h]
- else if mode = 11
- mov al,11h
- call [RealModeInt10h]
- else if mode = 12
- mov al,12h
- call [RealModeInt10h]
- else if mode = 13
- mov al,13h
- call [RealModeInt10h]
- else if mode = 14 ; DexOS text 80 x 50
- call [SetDex4uFonts]
- mov [_grfxScreen],dword 0xb79e0 ; start address of screen
- mov [_grfxCls],word 2000 ; screen size
- mov [_grfxLL],word 40 ; screen width
- else if mode = 15 ; text 132 x 60
- push cx
- mov cx,0x10c
- call [SetVesaMode]
- mov [_grfxScreen],dword 0xb79e0 ; Start address of screen
- mov [_grfxCls],word 3960 ; screen size
- mov [_grfxLL],word 66 ; screen width
- pop cx
- mov [_grfxScreen],dword 0xb79e0 ; start address of screen
- ;---------256 color modes-------------
- else if mode = 100
- push ecx
- push edi
- mov cx,0x4100 ; gfx 640 x 400
- else if mode = 101
- push ecx
- push edi
- mov cx,0x4101 ; gfx 640 x 480
- else if mode = 103
- push ecx
- push edi
- mov cx,0x4103 ; gfx 800 x 600
- else if mode = 105
- push ecx
- push edi
- mov cx,0x4105 ; gfx 1024 x 768
- else if mode = 107
- push ecx
- push edi
- mov cx,0x4101 ; gfx 1280 x 1024 ; oops need to fix
- ;---------32bit color modes-------------
- else if mode = 110
- push ecx
- push edi
- mov cx,0x410f ; gfx 320 x 200
- else if mode = 112
- push ecx
- push edi
- mov cx,0x410f ; gfx 640 x 480
- else if mode = 115
- push ecx
- push edi
- mov cx,0x4115 ; gfx 800 x 600
- else if mode = 118
- push ecx
- push edi
- mov cx,0x4118 ; gfx 1024 x 768
- else if mode = 119
- push ecx
- push edi
- mov cx,0x411B ; gfx 1280 x 1024
- end if
- if mode in <100,101,103,105,107,110,112,115,118,119>
- call [SetVesaMode] ; set the mode
- call [LoadVesaInfo] ; load vesa into to esi
- mov edi,VESA_Info ; where to put vesa info
- mov ecx,193 ; size of vesa info
- cld ; clear direction flag, string instructions forward
- cli ; turn off int
- rep movsd ; copy the vesa info 32 bits at a time
- sti ; turn on int
- mov edi,[ModeInfo_PhysBasePtr] ; location of vid memory
- sub edi,0x621 ; magic number for DexOS offset
- mov [_grfxScreen],edi ; start of vid mem.
- pop edi
- pop ecx
- end if
- if mode in <0,14,15> ; if we are in text mode
- xor eax,eax ; put cursor at 0,0
- call _grfxLocate
- end if
- pop eax
-}
-
-;________________SLEEP_________________
-macro SLEEP time
-{
-;Output:
-; ah = BIOS scancode of key pressed
-; al = ASCII character of key pressed
- push ax
- if time eq
- call [WaitForKeyPress]
- else
- mov ax,time
- call [SetDelay]
- end if
- pop ax
-}
-
-;________________GOTO__________________
-Macro GOTO _op1
-{
- jmp _op1
-}
-
-;________________GOSUB_________________
-Macro GOSUB _subname
-{
- call _subname
-}
-
-;________________RETURN________________
-Macro RETURN
-{
- ret
-}
-
-;________________PEEK__________________
-Macro PEEK _op1
-{
- mov al, [_op1] ;put value of address in eax
-}
-
-;________________POKE__________________
-Macro POKE _op1, _op2 ; need to check type, so they can use a varable not just number
-{
- push edx
- mov edx, _op1
- mov byte [edx], _op2 ;put _op2 into address _op1
- pop edx
-}
-
-;________________OUT___________________
-Macro OUT_PORT _op1, _op2 ; need to check type, so they can use a varable not just number
-{
- push dx
- push al
- mov dx, _op1
- mov al, _op2
- out word dx,al ;put _op2 into port _op1
- pop al
- pop dx
-}
-
-;________________IN____________________
-Macro IN_PORT _op1
-{
- mov al, [_op1] ;put value of address in eax
-}
-
-;________________REBOOT________________
-Macro REBOOT
-{
- call [ExitSystem]
-}
-
-;________________SOUND_________________
-Macro SOUND _opt1,_opt2
-{
- push ax
- push bx
- push dx
- mov al,0xB6 ; Init channel 2 of timer
- out 0x43,al
- mov dx,0x12 ; clock frequency /
- mov ax,0x34DD
- mov bx,_opt1 ; Frequency
- div bx ; = timer clock ticks
- out 0x42,al ; Load timer
- mov al,ah
- out 0x42,al
- in al,0x61 ; get value port 61h
- or al,00000011b ; Set bits to turn speaker on
- out 0x61,al
- mov ax,_opt2 ; sound duration in clock ticks
- call [SetDelay]
- in al,0x61 ; turn off speaker
- and al,11111100b
- out 0x61,al
- pop dx
- pop bx
- pop ax
-}
-
-;________________BEEP__________________
-Macro BEEP
-{
- push ax
- push bx
- push dx
- mov bx,0x200
- mov ax,0x34dd
- mov dx,0x0012
- div bx ; **** pre calc this number ***
- mov bx,ax
- in al,0x61 ; get value of port 61h
- test al,3 ; is the speaker turned on
- jnz @f ; skip the init and turning on if it's on
- or al,3
- out 0x61,al ; speaker on
- mov al,0xb6
- out 0x43,al ; Init port
-@@:
- mov al,bl ; set timer to frequency
- out 0x42,al
- mov al,bh
- out 0x42,al
- mov ax,8 ; wait about 1/2 second
- call [SetDelay]
- in al,0x61 ; turn off speaker
- and al,11111100b
- out 0x61,al
- pop dx
- pop bx
- pop ax
-}
-
-;________________DEF___________________
-Macro DEF _varname, _vartype, _varval
-{
- if _vartype = Short
- _varname db 0
- db _varval
- else if _vartype = Integer
- _varname db 1
- dw _varval
- else if _vartype = Long
- _varname db 2
- dd _varval
- else if _vartype = String
- _varname db 9
- dw 128 ;need to let it be defined several ways<----------**
- db _varval,0
- end if
-}
-
-Short equ 0
-Integer equ 1
-Long equ 2
-Float equ 3
-String equ 9
-FALSE equ 0
-False equ 0
-false equ 0
-TRUE equ 1
-True equ 1
-true equ 1
-
- ;---------------------------------;
- ; Dam, bunch of run time data ;
- ; not sure how to get around this ;
- ;---------------------------------;
-
-_grfxMode: db 14 ; the graphics mode we are in
-_grfxScreen: dd 0xb79e0 ; the base address of the screen
-_grfxCls: dw 2000 ; screen size (dwords)
-_grfxLL: dw 40 ; line size (dword)
-_grfxScreen_x db 0 ; cursor location on screen
-_grfxScreen_y db 0 ; cursor location on screen
-_grfxColor db 0Fh ; text color
-
-SkipQBASIC:
DELETED freshlib/_pending/FBasDx01/test.asm
Index: freshlib/_pending/FBasDx01/test.asm
==================================================================
--- freshlib/_pending/FBasDx01/test.asm
+++ /dev/null
@@ -1,113 +0,0 @@
-include 'FBASIC.INC'
-cls
-print "print in quits works "
-
-goto humm
-print "this shouldn't get printed"
-humm:
-
-gosub DoSub
-
-color 1
-print "color 1"
-color 2
-print "color 2"
-locate 5,5
-color 3
-print "color 3 at new location"
-sleep
-
-screen 0
-print "Dos text mode works, locate is off location"
-sleep
-screen 15
-print "decided to add hi res vesa text mode here"
-sleep
-screen 14
-print "decided to add Dexos text mode here"
-sleep
-
-PRINT /n,"Quoted String"," on the same line",/n,"or on the next line",/n,/n ; /n = next line
-PRINT "Short ",A,/n
-PRINT "Integer ",B,/n
-PRINT "Long ",C,/n
-PRINT D,/n,/n
-BEEP
-SLEEP
-
-Print "Sounds:"
-Sound 32,4
-Sound 64,4
-Sound 128,4
-Sound 256,4
-Sound 512,4
-Sound 1024,4
-Sound 2048,4
-Sound 4096,4
-Print /n,"cursor is now off"
-CursorOff
-Sleep
-Print /n,"cursor is now back on"
-CursorOn
-Sleep
-
-Input /n,"an input with no input",/n,/n
-Input "input a new D ",D
-Print /n,/n,"the old string over writen: ",D
-Sleep
-
-Print /n,/n,"Now lets wait a moment.",/n
-Pause 37
-Print "We are back.",/n
-sleep
-
-screen 14
-print "Back to Dexos mode. Fasm Basic doesn't leave the title block at a screen change"
-PRINT /n,/n,"but cls does have a few options"
-sleep
-
-screen 0
-cls 0,7,5
-gosub TwentyFive
-sleep
-cls 2,7,3
-sleep
-cls 0,7,5
-gosub TwentyFive
-sleep
-cls 3,7,3
-sleep
-cls 0,7,5
-gosub TwentyFive
-sleep
-cls 4,7,3
-sleep
-cls 0,7,5
-gosub TwentyFive
-sleep
-cls 5,7,3
-sleep
-cls 0,7,5
-gosub TwentyFive
-Sleep
-
-goto stop
-
-DoSub:
- print "gosub and return work"
-Return
-
-TwentyFive:
- color 7,5,5
- Print "1",/n,"2",/n,"3",/n,"4",/n,"5",/n,"6",/n,"7",/n,"8",/n,"9",/n
- Print "10",/n,"11",/n,"12",/n,"13",/n,"14",/n,"15",/n,"16",/n,"17",/n,"18",/n,"19",/n
- Print "20",/n,"21",/n,"22",/n,"23",/n,"24",/n,"25"
-Return
-
-DEF A, Short ,32 ; Examples of "Def" command
-DEF B, Integer ,12312 ;
-DEF C, Long ,2000000 ;
-DEF D, String ,"String Varable"
-
-stop:
-end_program
DELETED freshlib/_pending/lzss/readme.txt
Index: freshlib/_pending/lzss/readme.txt
==================================================================
--- freshlib/_pending/lzss/readme.txt
+++ /dev/null
@@ -1,63 +0,0 @@
-LZSS compression library for Flat Assembler
-by Mateusz Tymek
-
-1. Introduction
-LZSS is a library that provides you with simple routines for data compression. The
-algorithm is based on oryginal idea of Lempel and Ziv, with the modyfications suggeted by
-Storer and Szymanski (that's why its name is LZSS). You can search the Web for "LZSS
-compression" if you need any further information. This implementation uses binary search
-trees to speed up compression. It is based on the code of the Allegro Library
-(http://alleg.sourceforge.net), and it have similar (a bit better actually) compression
-ratio. All source code is included. The library is written in FASM, and it uses Fresh
-macro library.
-It is distributed under the terms of Fresh Artistic License
-(see http://www.decard.net/license.php).
-
-2. Using LZSS library
-To use LZSS library, first you have to include its files in your source. You have to
-include "lzss.inc" file somewhere in the beginning (it contains some definitions, not
-the code), and then "lzss.asm" (anywhere in the code section). See "lzsspack.asm" file.
-Now you can use the library functions. They can compress/decompress the data, and save
-or load it from file.
-In next part those functions are covered with more details.
-
-2.1. LZSS Function Reference
-
-proc lzssFreeData, lzss_data
-Frees memory occupied by given lzss data. As lzss_data parameter you should use value
-returned by lzssPackData.
-
-proc lzssLoadFile, file_name, ptr_size
-Loads packed file of given name, decompresses it and returns pointer to unpacked data.
-Usually you will want to obtain size of the data after decompression, in such case you
-have to pass a pointer to dword variable as "ptr_size" parameter. If you pass NULL,
-its also OK but then you won't know unpacked data size.
-
-proc lzssPackData, data_to_pack,data_size
-Compresses given data of given size. Returns pointer to LZSSData in eax.
-
-
-proc lzssSaveFile, file_name, buffer, size
-Compresses given data of given size and stores it in specified file. If given file
-already exists, it will be overwritten. Function returns zero on fail, and non-zero value
-on success.
-
-proc lzssUnpackData, lzss_data
-Decompresses packed data. lzss_data should be the value returned by lzssPackData.
-
-
-3. lzsspack.exe
-lzsspack is a simple utility that preforms file compression. It is a command line utility.
-To pack some file just type:
- >lzsspack source_file output_file
-source is your file with data to be packed, and output is a name of file to be generated.
-To unpack, type:
- >lzsspack -u packed_file output_file
-and it will decompress given file.
-
-lzsspack's source code is included in the package.
-
-4. Changelog
-
-26.10.2004 - fixed serious bug that was causing data loss.
-27.10.2004 - optimizations to bitstream library.
DELETED freshlib/_pending/lzss/source/bits.asm
Index: freshlib/_pending/lzss/source/bits.asm
==================================================================
--- freshlib/_pending/lzss/source/bits.asm
+++ /dev/null
@@ -1,169 +0,0 @@
-; creates bits stream and returns pointer
-proc BitsCreateNew, .buf_size
- begin
- push ebx edi
- invoke GetProcessHeap
- mov edi,eax
- invoke HeapAlloc,eax,HEAP_ZERO_MEMORY,sizeof.BitStream
- or eax,eax
- jz .finish
- mov ebx,eax
- invoke HeapAlloc,edi,HEAP_ZERO_MEMORY,[.buf_size]
- or eax,eax
- jz .finish
- mov [ebx+BitStream.buf],eax
- mov [ebx+BitStream.ptr],eax
- mov [ebx+BitStream.bit_ptr],0
- mov eax,ebx
- pop edi ebx
- .finish:
- return
-endp
-
-; create bitstream over existing buffer
-proc BitsCreateFrom, .bitbuf
- begin
- push ebx edi
- invoke GetProcessHeap
- mov edi,eax
- invoke HeapAlloc,eax,HEAP_ZERO_MEMORY,sizeof.BitStream
- or eax,eax
- jz .finish
- mov ebx,eax
- mov eax,[.bitbuf]
- mov [ebx+BitStream.buf],eax
- mov [ebx+BitStream.ptr],eax
- mov [ebx+BitStream.bit_ptr],0
- mov eax,ebx
- pop edi ebx
- .finish:
- return
-endp
-
-; destroys given bitstream, but not the buffer (!)
-proc BitsDestroy, .stream
- begin
- push eax
- invoke GetProcessHeap
- invoke HeapFree,eax,0,[.stream]
- pop eax
- return
-endp
-
-; destroys given bitstream with buffer
-proc BitsDestroyBuf, .stream
- begin
- push eax ebx
- invoke GetProcessHeap
- mov ebx,eax
- mov eax,[.stream]
- mov eax,[eax+BitStream.buf]
- invoke HeapFree,ebx,0,eax
- invoke HeapFree,ebx,0,[.stream]
- pop ebx eax
- return
-endp
-
-
-; sets given stream to position 0
-proc BitsReset, .stream
- begin
- push eax ebx
- mov ebx,[.stream]
- mov [ebx+BitStream.bit_ptr],0
- mov eax,[ebx+BitStream.buf]
- mov [ebx+BitStream.ptr],eax
- pop ebx eax
- return
-endp
-
-; puts given number of bits into stream
-proc BitsPut, .stream,.bits,.bit_count
- begin
- push eax ebx ecx edx esi edi
- ; generate mask in edi:esi
- xor eax,eax
- dec eax
- mov esi,eax
- mov edi,eax
- mov ebx,[.stream]
- mov ecx,[.bit_count]
- shl esi,cl
- mov ecx,[ebx+BitStream.bit_ptr]
- shld edi,esi,cl
- shld esi,eax,cl
- ; load new bits into edx:ecx; at this point ecx==[ebx+BitStream.bit_ptr]
- xor edx,edx
- mov eax,[.bits]
- shld edx,eax,cl
- shl eax,cl
- mov ecx,eax
- ; finally, store new bits using
- mov ebx,[ebx+BitStream.ptr]
- and [ebx],esi
- or [ebx],ecx
- add ebx,4
- and [ebx],edi
- or [ebx],edx
- ; and fix the pointers
- mov ebx,[.stream]
- mov eax,[.bit_count]
- add [ebx+BitStream.bit_ptr],eax
- cmp [ebx+BitStream.bit_ptr],32
- jb .finish
- sub [ebx+BitStream.bit_ptr],32
- add [ebx+BitStream.ptr],4
- .finish:
- pop edi esi edx ecx ebx eax
- return
-endp
-
-; reads given number of bits form the stream
-proc BitsGet, .stream,.bit_count
- begin
- push ebx ecx edx esi
- ; generate mask (in esi)
- xor esi,esi
- dec esi
- mov ecx,[.bit_count]
- shl esi,cl
- not esi
- mov ebx,[.stream]
- mov eax,[ebx+BitStream.ptr]
- mov edx,[eax+4]
- mov eax,[eax]
- mov ecx,[ebx+BitStream.bit_ptr]
- shrd eax,edx,cl
- and eax,esi
- ; fix the pointers
- mov ebx,[.stream]
- mov edx,[.bit_count]
- add [ebx+BitStream.bit_ptr],edx
- cmp [ebx+BitStream.bit_ptr],32
- jb .finish
- sub [ebx+BitStream.bit_ptr],32
- add [ebx+BitStream.ptr],4
- .finish:
- pop esi edx ecx ebx
- return
-endp
-
-; returns size (in bytes) of given stream
-proc BitsGetSize, .stream
- begin
- push ebx edx
- mov ebx,[.stream]
- xor edx,edx ; get number of bytes in additional bits
- mov eax,[ebx+BitStream.bit_ptr]
- or eax,eax
- jz .no_extra_bits
- shr eax,3
- inc eax
- mov edx,eax
- .no_extra_bits:
- mov eax,[ebx+BitStream.ptr]
- sub eax,[ebx+BitStream.buf]
- add eax,edx
- pop edx ebx
- return
-endp
DELETED freshlib/_pending/lzss/source/bits.inc
Index: freshlib/_pending/lzss/source/bits.inc
==================================================================
--- freshlib/_pending/lzss/source/bits.inc
+++ /dev/null
@@ -1,5 +0,0 @@
-struct BitStream
- .buf dd ?
- .ptr dd ?
- .bit_ptr dd ?
-ends
DELETED freshlib/_pending/lzss/source/cmdln.asm
Index: freshlib/_pending/lzss/source/cmdln.asm
==================================================================
--- freshlib/_pending/lzss/source/cmdln.asm
+++ /dev/null
@@ -1,273 +0,0 @@
-; ------------------------------
-; Base64 encoding program v1.0
-; by Mateusz Tymek (c) 2004
-;
-; ------------------------------
-; cmdln.asm
-; command line parsing
-; ------------------------------
-
-
-iglobal
-; command line variables
-cmdln:
- .argc dd ?
- .argv rd 0x10 ; 16 parameters limit
- .params rb 0x100
-
- .input_fname dd ?
- .output_fname dd ?
- .switches rd 8
- .out_buf rb 0x50
-endg
-
-
-; strlen - returns length of given string
-; from Fresh Standard Library
-proc strlen, .str
- begin
- push ebx
- mov eax,[.str]
- mov ebx,eax
- .scan:
- cmp byte[eax],0
- lea eax,[eax+1]
- jne .scan
- sub eax,ebx
- dec eax ; return value in eax
- pop ebx
- return
-endp
-
-; strlen - returns length of given string
-; from Fresh Standard Library
-proc strcpy, .dest, .source
- begin
- push esi edi eax ecx
- mov edi,[.dest]
- mov esi,[.source]
- stdcall strlen, esi
- mov ecx,eax
- cld
- rep movsb ; copy strings
-.finish:
- pop ecx eax edi esi
- return
-endp
-
-
-; splits command line into single parameters
-; (argv table)
-proc parse_command_line, .cmdline
- begin
- push eax ebx esi edi
- mov [cmdln.argc],0
- mov ebx,cmdln.argv
- mov edi,cmdln.params
- mov esi,[.cmdline]
- .load:
- mov al,[esi]
- inc esi
- .scan:
- cmp al,0x20
- je .load
- or al,al
- jz .finish
- inc [cmdln.argc]
- mov [ebx],edi
- add ebx,4
- cmp al,'"'
- je .copy_quoted
- .copy_param:
- mov [edi],al
- inc edi
- mov al,[esi]
- inc esi
- cmp al,0x20
- je .param_copied
- or al,al
- jz .param_copied
- jmp .copy_param
- .param_copied:
- mov byte[edi],0
- inc edi
- jmp .scan
- .copy_quoted:
- mov al,[esi]
- inc esi
- cmp al,'"'
- je .end_quoted
- or al,al
- jz .param_copied
- mov [edi],al
- inc edi
- jmp .copy_quoted
- .end_quoted:
- mov al,[esi]
- inc esi
- jmp .param_copied
- .finish:
- pop edi esi ebx eax
- return
-endp
-
-
-proc arrange_cmdline, .cmdline,.def_output_ext
- begin
- stdcall parse_command_line, [.cmdline]
- mov esi,cmdln.switches
- xor edx,edx
- xor ecx,ecx
-
- .scan_param:
- inc ecx
- cmp ecx,[cmdln.argc]
- jae .params_scanned
- mov eax,[cmdln.argv+ecx*4]
- cmp byte[eax],'-'
- je .switch
- or edx,edx
- jnz .output_name
- mov [cmdln.input_fname],eax
- inc edx
- jmp .scan_param
- .output_name:
- mov [cmdln.output_fname],eax
- inc edx
- jmp .scan_param
- .switch:
- mov [esi],eax
- add esi,4
- jmp .scan_param
-
- .params_scanned:
- cmp [cmdln.argc],1
- je .got_output_fname
- mov dword[esi],0
-
- cmp edx,2
- jae .got_output_fname
- stdcall strcpy, cmdln.out_buf,[cmdln.input_fname]
- stdcall replace_ext, cmdln.out_buf,[.def_output_ext]
- mov [cmdln.output_fname],cmdln.out_buf
- .got_output_fname:
- return
-endp
-
-
-; replaces extension of given filename to specified one.
-; if ext is NULL, then the extension is removed
-proc replace_ext, .filename,.ext
- begin
- mov edi,[.filename]
- stdcall strlen, [.filename]
- add edi,eax
- mov ebx,edi
- dec edi
- .scan:
- mov al,[edi]
- cmp al,'.'
- je .got_extension
- cmp al,'\'
- je .append
- cmp al,'/'
- je .append
- cmp al,':'
- je .append
- or al,al
- jz .append
- dec edi
- jmp .scan
-
- .append:
- mov edi,ebx
- mov byte[edi],'.'
- inc edi
- jmp .get_new_ext
-
- .got_extension:
- inc edi
- .get_new_ext:
- mov esi,[.ext]
- or esi,esi
- jz .remove_ext
- .copy_ext:
- mov al,[esi]
- mov [edi],al
- inc esi
- inc edi
- or al,al
- jnz .copy_ext
- .finish:
- return
- .remove_ext:
- dec edi
- xor al,al
- mov [edi],al
- jmp .finish
-endp
-
-
-; replaces filename in given path
-; if fname is NULL, then the file name is removed
-proc replace_fname, .path,.fname
- begin
- mov edi,[.path]
- stdcall strlen, [.path]
- or eax,eax
- jz .prepare_copy
- add edi,eax
- mov ebx,edi
- dec edi
- .scan:
- mov al,[edi]
- cmp al,'\'
- je .got_fname
- cmp al,'/'
- je .got_fname
- cmp al,':'
- je .got_fname
- or al,al
- jz .got_fname
- dec edi
- jmp .scan
-
- .got_fname:
- inc edi
- .prepare_copy:
- mov esi,[.fname]
- .copy_fname:
- mov al,[esi]
- mov [edi],al
- inc esi
- inc edi
- or al,al
- jnz .copy_fname
- .finish:
- return
-endp
-
-
-proc get_switch_w
- begin
- push ebx edx
- mov ebx,cmdln.switches
- .check:
- cmp dword[ebx],0
- je .false
- mov edx,[ebx]
-
- cmp word[edx],ax
- je .true
- add ebx,4
- jmp .check
- .false:
- xor eax,eax
- pop edx ebx
- return
- .true:
- xor eax,eax
- inc eax
- pop edx ebx
- return
-endp
DELETED freshlib/_pending/lzss/source/lzss.asm
Index: freshlib/_pending/lzss/source/lzss.asm
==================================================================
--- freshlib/_pending/lzss/source/lzss.asm
+++ /dev/null
@@ -1,640 +0,0 @@
-; lzss compression library
-; copyright (c) 2004 Mateusz Tymek
-;
-; 17.03.2004
-; last updated 27.10.2004
-; version 1.01
-
-
-uglobal
-
-lzss:
- .rnode rd LZSS_DICTIONARY_SIZE + 1 + 0x100
- .lnode rd LZSS_DICTIONARY_SIZE + 1
- .parent rd LZSS_DICTIONARY_SIZE + 1
- sizeof.trees = $-lzss.rnode
-
- .dictionary rb LZSS_DICTIONARY_SIZE + LZSS_MAX_COUNT
- sizeof.dictionary = $-lzss.dictionary
-
- .best_match_len dd ?
- .best_match_pos dd ?
-endg
-
-iglobal
- lzss.packer_func dd 0
-endg
-
-; creates new empty LZSSData structure
-proc lzssNewData
- begin
- invoke GetProcessHeap
- invoke HeapAlloc, eax,HEAP_ZERO_MEMORY,sizeof.LZSSData ; alloc mem for LZSSData struc
- return
-endp
-
-
-; destroys givem LZSSData structure
-proc lzssFreeData, .lzss_data
- begin
- push eax ebx
- invoke GetProcessHeap
- mov ebx,eax
- mov eax,[.lzss_data]
- invoke HeapFree, ebx,0,[eax+LZSSData.data]
- invoke HeapFree, ebx,0,[.lzss_data]
- pop ebx eax
- return
-endp
-
-;-----------------------------------------------------------------------------------------------
-
-
-proc lzss_new_tree
- begin
- push eax ecx esi edi
- mov eax,LZSS_NO_TREE
- mov ecx,LZSS_DICTIONARY_SIZE + 1
- mov esi,lzss.lnode
- mov edi,lzss.parent
- .clear:
- mov [esi],eax
- mov [edi],eax
- add edi,4
- add esi,4
- dec ecx
- jnz .clear
- mov edi,lzss.rnode
- mov ecx,LZSS_DICTIONARY_SIZE + 0x101
- .clear_btrees:
- mov [edi],eax
- add edi,4
- dec ecx
- jnz .clear_btrees
- pop edi esi ecx eax
- return
-endp
-
-
-proc lzss_insert_node, .buffer_pos ; inserts string at text_buf+[buf_pos] into the tree
- begin
- push eax ebx ecx edx esi edi
- xor eax,eax
- mov [lzss.best_match_len],eax
- mov [lzss.best_match_pos],eax
-
- mov eax,[.buffer_pos]
- mov edx,eax
- add eax,lzss.dictionary
- movzx eax,byte[eax]
- lea ebx,[LZSS_DICTIONARY_SIZE+1+eax]
- mov edx,1 ; edx will hold comparision result
- mov eax,LZSS_NO_TREE
- mov [lzss.rnode+edx*4],eax
- mov [lzss.lnode+edx*4],eax
-
- .search_tree:
- or edx,edx
- js .left_node
- .right_node:
- cmp [lzss.rnode+ebx*4],LZSS_NO_TREE
- je .put_right
-
- mov ebx,[lzss.rnode+ebx*4]
- jmp .node_ok
- .put_right:
- mov eax,[.buffer_pos]
- mov [lzss.rnode+ebx*4],eax
- mov [lzss.parent+eax*4],ebx
- jmp .finish
- .left_node:
- cmp [lzss.lnode+ebx*4],LZSS_NO_TREE
- je .put_left
-
- mov ebx,[lzss.lnode+ebx*4]
- jmp .node_ok
- .put_left:
- mov eax,[.buffer_pos]
- mov [lzss.lnode+ebx*4],eax
- mov [lzss.parent+eax*4],ebx
- jmp .finish
- .node_ok:
- push esi edi
- lea edi,[lzss.dictionary+ebx]
- mov esi,[.buffer_pos]
- lea esi,[lzss.dictionary+esi]
- mov ecx,LZSS_MAX_COUNT-1
- inc esi ; we know that first character
- inc edi ; already matches
- xor edx,edx
- xor eax,eax
- .compare:
- mov dl,[esi]
- mov al,byte[edi]
- sub edx,eax
- or edx,edx
- jnz .compared
- inc edi
- inc esi
- dec ecx
- jnz .compare
- .compared:
- pop esi edi
-
- mov eax,LZSS_MAX_COUNT-1
- dec ecx
- sub eax,ecx
- cmp eax,[lzss.best_match_len]
- jbe .search_tree
- mov [lzss.best_match_len],eax
- mov [lzss.best_match_pos],ebx
-
- cmp eax,LZSS_MAX_COUNT
- jae .got_max_count
-
- jmp .search_tree
-
- .got_max_count:
- mov eax,[.buffer_pos]
- mov edx,[lzss.parent+ebx*4]
- mov [lzss.parent+eax*4],edx
-
- mov edx,[lzss.lnode+ebx*4]
- mov [lzss.lnode+eax*4],edx
- mov [lzss.parent+edx*4],eax
-
- mov edx,[lzss.rnode+ebx*4]
- mov [lzss.rnode+eax*4],edx
- mov [lzss.parent+edx*4],eax
-
- mov edx,[lzss.parent+ebx*4]
- cmp [lzss.rnode+edx*4],ebx
- je .right
- .left:
- mov [lzss.lnode+edx*4],eax
- jmp .ok
- .right:
- mov [lzss.rnode+edx*4],eax
- .ok:
- mov eax,LZSS_NO_TREE
- mov [lzss.parent+ebx*4],eax
- mov [lzss.lnode+ebx*4],eax
- mov [lzss.rnode+ebx*4],eax
-
- .finish:
- pop edi esi edx ecx ebx eax
- return
-endp
-
-
-; removes tree node at [buffer_pos]
-proc lzss_delete_node, .buffer_pos
- begin
- push eax ebx ecx edx
- mov eax,[.buffer_pos]
- cmp dword[lzss.parent+eax*4],LZSS_NO_TREE ; empty?
- je .finish
-
- cmp dword[lzss.rnode+eax*4],LZSS_NO_TREE
- je .empty_right
- cmp dword[lzss.lnode+eax*4],LZSS_NO_TREE
- je .empty_left
-
-
- ; if we are here then none of children is empty
-
- mov ebx,[lzss.lnode+eax*4]
- cmp [lzss.rnode+ebx*4],LZSS_NO_TREE
- je .got_free_rnode
- .find_free_rnode:
- mov ebx,[lzss.rnode+ebx*4]
- cmp [lzss.rnode+ebx*4],LZSS_NO_TREE
- jne .find_free_rnode
-
- mov edx,[lzss.parent+ebx*4]
- mov ecx,[lzss.lnode+ebx*4]
- mov [lzss.rnode+edx*4],ecx
- mov [lzss.parent+ecx*4],edx
-
- mov edx,[lzss.lnode+eax*4]
- mov [lzss.lnode+ebx*4],edx
- mov [lzss.parent+edx*4],ebx
-
- .got_free_rnode:
-
- mov edx,[lzss.rnode+eax*4]
- mov [lzss.rnode+ebx*4],edx
- mov [lzss.parent+edx*4],ebx
-
- jmp .remove
-
- .empty_left:
- mov ebx,[lzss.rnode+eax*4]
- jmp .remove
- .empty_right:
- mov ebx,[lzss.lnode+eax*4]
-
- .remove:
-
- mov edx,[lzss.parent+eax*4] ; now edx holds parent of node being removed
- mov [lzss.parent+ebx*4],edx
-
- ; now fix the valid child
- cmp [lzss.rnode+edx*4],eax
- je .fix_right_child
- .fix_left_child:
- mov [lzss.lnode+edx*4],ebx
- jmp .clear
- .fix_right_child:
- mov [lzss.rnode+edx*4],ebx
-
- .clear: ; clear the node that is being removed
- mov [lzss.parent+eax*4],LZSS_NO_TREE
- mov [lzss.rnode+eax*4],LZSS_NO_TREE
- mov [lzss.lnode+eax*4],LZSS_NO_TREE
-
- .finish:
-
- pop edx ecx ebx eax
- return
-endp
-
-
-proc lzssPackData, .buffer,.buffer_size
-.lzss_data dd ?
-.bitstream dd ?
- begin
- push ebx ecx edx esi edi
- ; fill the dictionary with zeroes
- mov edi,lzss.dictionary
- mov ecx,(LZSS_DICTIONARY_SIZE + LZSS_MAX_COUNT)/2
- xor eax,eax
- .clear_dictionary:
- mov [edi],ax
- add edi,2
- dec ecx
- jnz .clear_dictionary
-
- stdcall lzssNewData
- or eax,eax
- jz .finish
- mov [.lzss_data],eax
- mov edi,eax
- invoke GetProcessHeap
- mov ebx,eax
- mov eax,[.buffer_size] ; calculate maximum memory that can be needed by
- shr eax,3 ; compressed data. It is data_size + data_size/8 ...
- inc eax ; and one more byte just to be sure :)
- add eax,[.buffer_size] ;
- invoke HeapAlloc, ebx,HEAP_ZERO_MEMORY,eax
- or eax,eax
- jz .finish
- mov [edi+LZSSData.data],eax
- mov ecx,[.buffer_size]
- mov [edi+LZSSData.unpacked_size],ecx
- mov eax,[.buffer] ; esi will point to input buffer
- add eax,ecx ; add eax,[buffer_size]
- stdcall BitsCreateFrom, [edi+LZSSData.data]
- mov [.bitstream],eax
-
- ; edi will point to the end of the dictionary...
- mov edi,LZSS_DICTIONARY_SIZE-LZSS_MAX_COUNT
- ; ... and esi will mark the start
- xor esi,esi
- stdcall lzss_new_tree
-
-
- xor edx,edx
- .read_first_bytes:
- mov eax,[.buffer]
- mov al,[eax]
- inc [.buffer]
- mov [lzss.dictionary+edi+edx],al
- inc edx
- cmp edx,LZSS_MAX_COUNT
- jae .got_first_bytes
- dec [.buffer_size]
- jz .got_first_bytes
- jmp .read_first_bytes
- .got_first_bytes:
-
- or edx,edx
- jz .packed
-
- mov ecx,LZSS_MAX_COUNT-1
- mov eax,edi
- dec eax
- .prepare_tree:
- stdcall lzss_insert_node,eax
- dec eax
- dec ecx
- jnz .prepare_tree
- stdcall lzss_insert_node,edi ; insert the string just read; best_match_len and best_match_pos are set
-
- .packer_loop:
- cmp [lzss.best_match_len],edx ; best_match_len may be too long near the end
- jbe .lzss.best_match_len_ok
- mov [lzss.best_match_len],edx
- .lzss.best_match_len_ok:
-
- cmp [lzss.best_match_len],LZSS_THRESHOLD ; send unpacked byte or ofs-length pair?
- ja .send_packed
- stdcall BitsPut, [.bitstream],0,1 ; send "unpacked data" flag
- mov al,[lzss.dictionary+edi]
- stdcall BitsPut, [.bitstream],eax,8 ; send byte directly
- mov [lzss.best_match_len],1 ; mark that we have processed just one byte
-
- jmp .item_packed
- .send_packed:
- stdcall BitsPut, [.bitstream],1,1 ; "packed data" flag
- stdcall BitsPut, [.bitstream],[lzss.best_match_pos],LZSS_OFFSET_BITS
- mov eax,[lzss.best_match_len]
- sub eax,LZSS_THRESHOLD+1
- stdcall BitsPut, [.bitstream],eax,LZSS_COUNT_BITS
-
-
- .item_packed:
- xor ecx,ecx
- mov ebx,[lzss.best_match_len] ; ebx will hold value of "last match length"
- cmp [.buffer_size],0
- je .new_bytes_ok
- .get_new_bytes:
- cmp ecx,ebx ; compare ecx to [last_match_len]
- jae .new_bytes_ok
- dec [.buffer_size]
- jz .new_bytes_ok
- stdcall lzss_delete_node,esi
- mov eax,[.buffer]
- inc [.buffer]
- mov al,[eax]
- mov [lzss.dictionary+esi],al ; put new byte in the dictionary
- cmp esi,LZSS_MAX_COUNT
- jae .no_extra
- mov [lzss.dictionary+esi+LZSS_DICTIONARY_SIZE],al
- .no_extra:
- inc esi
- inc edi
- mov eax,LZSS_DICTIONARY_SIZE
- dec eax
- and esi,eax
- and edi,eax
-
- stdcall lzss_insert_node,edi ; insert new string
-
- inc ecx
- jmp .get_new_bytes
- .new_bytes_ok:
- cmp ecx,ebx
- jae .packed
- inc ecx
- stdcall lzss_delete_node,esi
- inc esi
- inc edi
- mov eax,LZSS_DICTIONARY_SIZE
- dec eax
- and esi,eax
- and edi,eax
- dec edx
- jz .new_bytes_ok
-
- stdcall lzss_insert_node,edi
- jmp .new_bytes_ok
- .packed:
-
- or edx,edx
- jnz .packer_loop
-
- mov ebx,[.lzss_data]
- stdcall BitsGetSize, [.bitstream]
- mov [ebx+LZSSData.packed_size],eax
- .finish:
-
- mov eax,[.lzss_data]
- pop edi esi edx ecx ebx
- return
-endp
-
-
-;iglobal
-; szOutFile db "out.dat", 0
-; szOutFile2 db "out2.dat", 0
-;endg
-;
-
-;-----------------------------------------------------------------------------------------------
-
-
-
-; debug lines
-;iglobal
-; szDictionary db "ofs: %d, len: %d", 13, 10, 0
-; szDirect db "direct byte: %d ('%c')", 13, 10, 0
-; szEndMarker db "eof", 13, 10, 0
-;endg
-
-
-; unpacks given LZSSData structure and returns pointer
-; when you have finished with this data, you should
-; free this memory using HeapFree()
-proc lzssUnpackData, .lzss_data
-.uncompressed dd ?
-.size dd ?
- begin
- push ebx ecx edx esi edi
-
- ; fill the dictionary with zeroes
- mov edi,lzss.dictionary
- mov ecx,(LZSS_DICTIONARY_SIZE + LZSS_MAX_COUNT)/2
- xor eax,eax
- .clear_dictionary:
- mov [edi],ax
- add edi,2
- dec ecx
- jnz .clear_dictionary
-
- mov ebx,[.lzss_data]
- invoke GetProcessHeap
- invoke HeapAlloc, eax,HEAP_ZERO_MEMORY,[ebx+LZSSData.unpacked_size]
- mov [.uncompressed],eax
- mov edi,eax
- stdcall BitsCreateFrom, [ebx+LZSSData.data]
- mov esi,eax
- mov eax,[ebx+LZSSData.unpacked_size]
- mov [.size],eax
- mov edx,LZSS_DICTIONARY_SIZE - LZSS_MAX_COUNT
-
- .unpack:
- stdcall BitsGet,esi,1
- or eax,eax
- jnz .from_dictionary
- stdcall BitsGet,esi,8
-
- ; debug lines
-; pusha
-; cinvoke printf, szDirect, eax,eax
-; popa
- mov [edi],al
- inc edi
-
- mov [lzss.dictionary+edx],al
- inc edx
- mov eax,LZSS_DICTIONARY_SIZE
- dec eax
- and edx,eax
- dec [.size]
- jz .finish
- jmp .unpack
-
-
- .from_dictionary:
- stdcall BitsGet, esi,LZSS_OFFSET_BITS ; load position
-; push eax ; debug line
- mov ebx,eax ; no, unpack portion
- stdcall BitsGet, esi,LZSS_COUNT_BITS ; load counter
- mov ecx,eax
- add ecx,LZSS_THRESHOLD+1
- sub [.size],ecx
-
-; debug lines
-; pop eax
-; pusha
-; cinvoke printf, szDictionary, eax,ecx
-; popa
-
- .copy:
- mov al,[lzss.dictionary+ebx]
- mov [edi],al
- mov [lzss.dictionary+edx],al
- inc ebx
- inc edi
- inc edx
- mov eax,LZSS_DICTIONARY_SIZE
- dec eax
- and edx,eax
- and ebx,eax
-
- dec ecx
- jnz .copy
- cmp [.size],0
-
- je .finish
- jmp .unpack
- .finish:
-
-; debug lines
-; pusha
-; cinvoke printf, szEndMarker
-; popa
-
- stdcall BitsDestroy, esi
-
-
-; invoke CreateFile, szOutFile2,GENERIC_WRITE,0,0,CREATE_ALWAYS,0,0
-; mov ebx,eax
-; invoke WriteFile,eax,lzss.dictionary,sizeof.dictionary,tmp,0
-; invoke CloseHandle,ebx
-;
-
- mov eax,[.uncompressed]
-
-
- pop edi esi edx ecx ebx
- return
-endp
-
-
-
-; file routines
-
-; compress data and store it in given file; returns 0 on fail
-proc lzssSaveFile, .file_name,.buffer,.size
-.hdr LZSSFileHeader
-.tmp dd ?
- begin
- push ebx ecx edx esi
- mov eax,[lzss.packer_func]
- or eax,eax
- jnz .packer_func_ok
- mov [lzss.packer_func],lzssPackData
- .packer_func_ok:
- stdcall [lzss.packer_func], [.buffer],[.size]
- mov esi,eax
- mov [.hdr.id],"LZSS"
- mov eax,[.size]
- mov [.hdr.unpacked_size],eax
- invoke CreateFile, [.file_name],GENERIC_WRITE,0,0,CREATE_ALWAYS,0,0
- cmp eax,INVALID_HANDLE_VALUE
- je .error
- mov ebx,eax
- lea eax,[.hdr]
- lea edx,[.tmp]
- invoke WriteFile,ebx,eax,sizeof.LZSSFileHeader,edx,0
- mov ecx,[esi+LZSSData.packed_size]
- mov eax,[esi+LZSSData.data]
- invoke WriteFile,ebx,eax,ecx,tmp,0
- invoke CloseHandle,ebx
- stdcall lzssFreeData,esi
- xor eax,eax
- dec eax
- .finish:
- pop esi edx ecx ebx
- return
- .error:
- xor eax,eax
- jmp .finish
-endp
-
-
-; loads packed data from given file, unpacks it and returns pointer
-; (0 on fail); ptr_size should be a pointer to dword variable
-; that will contain unpacked data size
-proc lzssLoadFile, .file_name, .ptr_size
-.input_buf dd ?
-.input_size dd ?
- begin
- push ebx ecx edx esi edi
- invoke CreateFile, [.file_name],GENERIC_READ,0,0,OPEN_EXISTING,0,0
- cmp eax,INVALID_HANDLE_VALUE
- je .error
- mov ebx,eax
- invoke SetFilePointer,ebx,0,0,FILE_END
- mov [.input_size],eax
- mov esi,eax
- invoke GetProcessHeap
- invoke HeapAlloc, eax,HEAP_ZERO_MEMORY,esi
- or eax,eax
- jz .finish
- mov [.input_buf],eax
- invoke SetFilePointer, ebx,0,0,FILE_BEGIN
- invoke ReadFile, ebx,[.input_buf],esi,tmp,0
- invoke CloseHandle,ebx
- stdcall lzssNewData
- or eax,eax
- jz .finish
- mov esi,eax
- mov eax,[.input_buf]
- add eax,sizeof.LZSSFileHeader
- mov [esi+LZSSData.data],eax
- mov eax,[.input_buf]
- mov eax,[eax+LZSSFileHeader.unpacked_size]
- mov [esi+LZSSData.unpacked_size],eax
- stdcall lzssUnpackData, esi
- or eax,eax
- jz .finish
- mov ebx, eax
-
- mov eax,[.ptr_size]
- or eax,eax
- jz .no_size_ptr
- mov edx,[esi+LZSSData.unpacked_size]
- mov [eax],edx
- .no_size_ptr:
- stdcall lzssFreeData,esi
- mov eax,ebx
- .finish:
- pop edi esi edx ecx ebx
- return
- .error:
- xor eax,eax
- jmp .finish
-endp
DELETED freshlib/_pending/lzss/source/lzss.inc
Index: freshlib/_pending/lzss/source/lzss.inc
==================================================================
--- freshlib/_pending/lzss/source/lzss.inc
+++ /dev/null
@@ -1,26 +0,0 @@
-; packed data structure
-struct LZSSData
- .packed_size dd ?
- .unpacked_size dd ?
- .data dd ?
-ends
-
-
-; packed file header
-struct LZSSFileHeader
- .id dd ?
- .unpacked_size dd ?
-ends
-
-
-; lzss settings
-
-LZSS_THRESHOLD = 2
-
-LZSS_COUNT_BITS = 4
-LZSS_OFFSET_BITS = 12
-
-LZSS_DICTIONARY_SIZE = (2 shl (LZSS_OFFSET_BITS-1))
-LZSS_MAX_COUNT = (2 shl (LZSS_COUNT_BITS-1)) + LZSS_THRESHOLD
-
-LZSS_NO_TREE = LZSS_DICTIONARY_SIZE
DELETED freshlib/_pending/lzss/source/lzsspack.asm
Index: freshlib/_pending/lzss/source/lzsspack.asm
==================================================================
--- freshlib/_pending/lzss/source/lzsspack.asm
+++ /dev/null
@@ -1,129 +0,0 @@
-format PE console
-entry start
-include "%finc%/win32/win32a.inc"
-include "%finc%/libs/strlib.inc"
-include "bits.inc"
-include "lzss.inc"
-include "lzssstat.inc"
-
-..ShowSkipped = 0
-
-section '.code' code readable executable
-
-include "%finc%/libs/strlib.asm"
-include "bits.asm"
-include "cmdln.asm"
-include "lzss.asm"
-include "lzssstat.asm"
-
-
- start:
- invoke GetCommandLine
- stdcall arrange_cmdline, eax,szDefExt
-
- mov ax,'-u'
- call get_switch_w
- or eax,eax
- jz pack_file
-
-
- unpack_file:
- cmp [cmdln.input_fname],0
- je usage
- stdcall replace_ext, [cmdln.output_fname],szDefOutExt
- stdcall lzssLoadFile,[cmdln.input_fname],unp_size
- push eax
- invoke CreateFile, [cmdln.output_fname],GENERIC_WRITE,0,0,CREATE_ALWAYS,0,0
- mov ebx,eax
- pop eax
- invoke WriteFile,ebx,eax,[unp_size],tmp,0
- invoke CloseHandle,ebx
- stdcall lzssFreeData, esi
- jmp finish
-
- pack_file:
- cmp [cmdln.input_fname],0
- je usage
- invoke CreateFile, [cmdln.input_fname],GENERIC_READ,0,0,OPEN_EXISTING,0,0
- cmp eax,INVALID_HANDLE_VALUE
- je finish
- mov ebx,eax
- invoke SetFilePointer, ebx,0,0,FILE_END
- mov [input_size],eax
- mov esi,eax
- invoke GetProcessHeap
- invoke HeapAlloc, eax,HEAP_ZERO_MEMORY,esi
- or eax,eax
- jz finish
- mov [input_buf],eax
- invoke SetFilePointer, ebx,0,0,FILE_BEGIN
- invoke ReadFile, ebx,[input_buf],esi,tmp,0
- invoke CloseHandle, ebx
- mov [lzss.packer_func],lzssStatPack
- mov ebx,[cmdln.argv]
- stdcall lzssSaveFile, [cmdln.output_fname],[input_buf],[input_size]
- cinvoke printf, szStatus, [lzss_stat.time],[lzss_stat.kbytes_per_sec],\
- [lzss_stat.size],[lzss_stat.packed_size],[lzss_stat.ratio],\
- [lzss_stat.total_items],[lzss_stat.direct_bytes],\
- [lzss_stat.dictionary_entries]
- jmp finish
-
- usage:
- cinvoke printf, szUsage
- finish:
- invoke ExitProcess, 0
-
-
-
-iglobal
- szDefExt db "lzss", 0
- szDefOutExt db "out", 0
-
- szUsage db "usage:", 13, 10, " to compress: lzsspack input [output]", 13, 10
- db " to decompress: lzsspack -u input output", 13, 10, 0
-
- szStatus db "status: ", 13, 10
- db " total compression time: %d seconds", 13, 10
- db " average speed: %d kbytes/sec", 13, 10
- db " unpacked file size: %d bytes", 13, 10
- db " packed data size: %d bytes", 13, 10
- db " compression ratio: %d percent", 13, 10
- db 13, 10
- db " total items: %d", 13, 10
- db " direct (unpacked) bytes: %d", 13, 10
- db " dictionary entries: %d", 13, 10, 0
-
-endg
-
-
-uglobal
- input_buf dd ?
- input_size dd ?
- output_name dd ?
- tmp dd ?
- unp_size dd ?
- argc dd ?
- argv dd ?
- env dd ?
- hdr LZSSFileHeader
- name_buf rb 0x100
-endg
-
-;data fixups
-;end data
-
-section '.data' data readable writeable
-IncludeAllGlobals
-
-
-section '.idata' import data readable
-
-library kernel32,"KERNEL32.DLL",\
- crtdll,"CRTDLL.DLL"
-
-include "%finc%/win32/apia/kernel32.inc"
-
-import crtdll,\
- __getmainargs,"__GetMainArgs",\
- printf,"printf",\
- flushall,"_flushall"
DELETED freshlib/_pending/lzss/source/lzsspack.fpr
Index: freshlib/_pending/lzss/source/lzsspack.fpr
==================================================================
--- freshlib/_pending/lzss/source/lzsspack.fpr
+++ /dev/null
cannot compute difference between binary files
DELETED freshlib/_pending/lzss/source/lzssstat.asm
Index: freshlib/_pending/lzss/source/lzssstat.asm
==================================================================
--- freshlib/_pending/lzss/source/lzssstat.asm
+++ /dev/null
@@ -1,80 +0,0 @@
-proc lzssStatPack, .buffer, .buffer_size
- begin
- ; pack the data and count the time of the process
- invoke GetTickCount
- mov edi,eax
- stdcall lzssPackData, [.buffer],[.buffer_size]
- mov ebx,eax
- invoke GetTickCount
- sub eax,edi
- xor edx,edx
-
- mov esi,1000
- div esi
- mov [lzss_stat.time],eax
- mov esi,eax
- mov eax,[.buffer_size]
- xor edx,edx
- or esi,esi
- jz @f
- div esi
- @@:
- shr eax,10 ; divide eax by 1024
- mov [lzss_stat.kbytes_per_sec],eax
-
- xor eax,eax
- mov [lzss_stat.total_items],eax
- mov [lzss_stat.direct_bytes],eax
- mov [lzss_stat.dictionary_entries],eax
-
- ; calculate ratio
- mov edi,[.buffer_size]
- mov [lzss_stat.size],edi
- mov eax,[ebx+LZSSData.packed_size]
- mov [lzss_stat.packed_size],eax
- mov esi,100
- mul esi
- div edi
- mov [lzss_stat.ratio],eax
- mov edi,[ebx+LZSSData.unpacked_size]
- ; now scan compressed data
- stdcall BitsCreateFrom, [ebx+LZSSData.data]
- mov esi,eax
- .unpack:
- inc [lzss_stat.total_items]
- stdcall BitsGet,esi,1
- or eax,eax
- jnz .from_dictionary
- inc [lzss_stat.direct_bytes]
- stdcall BitsGet,esi,8
- dec edi
- jz .finish
- jmp .unpack
- .from_dictionary:
- stdcall BitsGet, esi,LZSS_OFFSET_BITS ; load position
- inc [lzss_stat.dictionary_entries]
- stdcall BitsGet, esi,LZSS_COUNT_BITS ; load counter
- sub edi,eax
- sub edi,LZSS_THRESHOLD+1
- jz .finish
- js .finish
- jmp .unpack
- .finish:
- stdcall BitsDestroy, esi
-
- mov eax,ebx
- return
-endp
-
-uglobal
- lzss_stat:
- .time dd ?
- .kbytes_per_sec dd ?
- .size dd ?
- .packed_size dd ?
- .ratio dd ?
-
- .total_items dd ?
- .direct_bytes dd ?
- .dictionary_entries dd ?
-endg
DELETED freshlib/_pending/lzss/source/lzssstat.inc
Index: freshlib/_pending/lzss/source/lzssstat.inc
==================================================================
--- freshlib/_pending/lzss/source/lzssstat.inc
+++ /dev/null
DELETED freshlib/_pending/profiling/data.asm
Index: freshlib/_pending/profiling/data.asm
==================================================================
--- freshlib/_pending/profiling/data.asm
+++ /dev/null
@@ -1,210 +0,0 @@
-include '%lib%/compiler/executable.inc'
-
-include '%lib%/macros/allmacros.inc'
-include '%lib%/equates/allequates.inc'
-
-_BinaryType console
-
-_CodeSection
-
-include '%lib%/system/process.asm'
-include '%lib%/simpledebug/debug.asm'
-include '%lib%/system/memory.asm'
-include '%lib%/system/files.asm'
-include '%lib%/data/arrays.asm'
-include '%lib%/data/strlib.asm'
-
-; very simple CPU clock cycles counter:
-
-macro START
-{
- align 4
- push ecx
- push ebx
- cpuid ;cpuid has different execution times the first two times
- xor eax, eax ; Flush the pipeline
- fwait
- cpuid
- rdtsc ;Get RDTSC counter in edx:eax
- push edx
- push eax
- cpuid
-}
-
-macro STOP ; CPU cycles in edx:eax
-{
- fwait
- cpuid
- rdtsc
- pop ebx
- pop ecx
- clc
- sub eax,ebx
- sub eax,144h ; Cut measurement overhead
- sbb edx,ecx
- pop ebx
- pop ecx
-}
-
-start:
-
- InitializeAll
-
-iglobal
- msg1 db 0ah,'Profiling FreshLib: data module',0ah,0ah,0
- sizeof.msg1 = $-msg1
- msg2 db 'This string is going to be used and abused:',0ah
- db '[español, français] {áèïôü} (1234567890)',0ah
- db '< @ # ¡ ! $ % & * - + " / | \ ', "' = ¿ ? >",0ah,0
- sizeof.msg2 = $-msg2
- msg3 db 'used ',0
- testfile db '../../UnicodeSample.txt',0
-endg
-
-uglobal
- array1 dd ?
- file1 dd ?
- string1 dd ?
- string2 dd ?
- string3 dd ?
- string4 dd ?
- string5 dd ?
- string6 dd ?
- string7 dd ?
-endg
-
- stdcall Output,msg1
- DebugMsg 'Cycles to create the first string:'
-START
- stdcall SetString, string1, msg1
-STOP
- stdcall OutputRegister, regEAX, 10
- DebugMsg 'Cycles to create the second string:'
-START
- stdcall SetString, string2, msg2
-STOP
- stdcall OutputRegister, regEAX, 10
-
- DebugMsg 'Cycles to load a file to a new string:'
-
-START
- push esi
- stdcall FileOpen, testfile
- mov [file1], eax
- stdcall FileSeek, [file1], 0, fsFromEnd
- mov ecx, eax
- stdcall FileSeek, [file1], 0, fsFromBegin
- stdcall StrNew
- mov [string7], eax
- stdcall StrSetCapacity, eax, ecx
- mov esi, eax
- stdcall FileRead, [file1], esi, ecx
- stdcall FileClose, [file1]
- stdcall StrFixLen, string7
-STOP
- stdcall OutputRegister, regEAX, 10
- stdcall Output, esi
- pop esi
- DebugMsg ''
-
- DebugMsg 'Cycles to extract and create a new string:'
-START
- stdcall StrExtract, [string2], 27, 15
- mov [string4], eax
-STOP
- stdcall OutputRegister, regEAX, 10
-
-
-
- stdcall StrPtr, [string4]
- stdcall Output, eax
- DebugMsg ' <- should be: used and abused'
-
- stdcall StrNew
- mov [string6], eax
- stdcall StrCopy, [string6], [string2]
- stdcall SetString, string5, msg3
- stdcall StrPos, [string6], [string5]
- mov esi, eax
- stdcall StrSplit, [string6], 42
- stdcall Output, esi
- DebugMsg ' <- should be: used and abused'
-
- DebugMsg 'Cycles to measure string lenght:'
-START
- stdcall StrPtr,[string2]
- stdcall StrLen,eax
- mov esi, eax
-STOP
- stdcall OutputRegister, regEAX, 10
- DebugMsg 'Lenght of the string:'
- mov eax,esi
- stdcall OutputRegister, regEAX, 10
-
- DebugMsg 'Original string for the following tests:'
- stdcall Output,msg2
-
- DebugMsg 'Cycles to ucase the loaded string:'
-START
- stdcall StrUCase2,[string7]
-STOP
- stdcall OutputRegister, regEAX, 10
- stdcall StrPtr, [string7]
- stdcall Output, eax
-
- DebugMsg 'Cycles to lcase the loaded string:'
-START
- stdcall StrLCase2,[string7]
-STOP
- stdcall OutputRegister, regEAX, 10
- stdcall StrPtr, [string7]
- stdcall Output, eax
-
- DebugMsg "**** testing pelaillo's case functions ****"
- stdcall SetString,string3,msg2
-
- DebugMsg 'Cycles to ucase the third string:'
-START
- stdcall StrUCase2,[string3]
-STOP
- stdcall OutputRegister, regEAX, 10
- stdcall StrPtr, [string3]
- stdcall Output, eax
-
- DebugMsg 'Cycles to lcase the third string:'
-START
- stdcall StrLCase2,[string3]
-STOP
- stdcall OutputRegister, regEAX, 10
- stdcall StrPtr, [string3]
- stdcall Output, eax
-
-
- jmp .exit
- stdcall CreateArray, 20h
- jc .error
- mov [array1],eax
- DebugMsg 'Step2: Array Created'
- stdcall NumToStr,eax,ntsHex
- stdcall StrPtr, eax
- stdcall Output, eax
- stdcall StrNew
- mov [string1],eax
-
- stdcall AddArrayItem,[array1]
- jmp .exit
-
-.error:
- DebugMsg 'An error occurred'
-
-.exit:
- FinalizeAll
- stdcall Terminate,0
-
-_ImportSection
-
-include '%lib%/imports/allimports.asm'
-
-_DataSection
-
-IncludeAllGlobals
DELETED freshlib/_pending/tutorial/files.asm
Index: freshlib/_pending/tutorial/files.asm
==================================================================
--- freshlib/_pending/tutorial/files.asm
+++ /dev/null
@@ -1,62 +0,0 @@
-include '%lib%/compiler/executable.inc'
-include '%lib%/macros/allmacros.inc'
-include '%lib%/equates/allequates.inc'
-
-_BinaryType console
-
-include '%lib%/simpledebug/debug.asm'
-include '%lib%/system/files.asm'
-include '%lib%/system/process.asm'
-
-_CodeSection
-
-start:
-
- InitializeAll
-
- DebugMsg 'FreshLib Tutorials - Module: Files'
-
-iglobal
- filename db './tut01.txt',0
- sizeof.filename = $-filename
-endg
-
-uglobal
- hFile dd ?
-endg
-
- stdcall FileCreate, filename
- jc .error
- mov [hFile], eax
- DebugMsg "A new file was created:"
- stdcall OutputNumber, [hFile], 16, 2
- DebugMsg " is the handle of the file"
-
- stdcall FileWrite, [hFile], filename, sizeof.filename
- jc .error
- stdcall OutputNumber, eax, 10, 2
- DebugMsg " bytes were written into the file"
-
- stdcall FileClose, [hFile]
- jc .error
- DebugMsg "The file was properly closed"
-
- stdcall FileDelete, filename
- jc .error
- DebugMsg "The file was finally deleted"
- jmp .exit
-
-.error:
- DebugMsg "Sorry, an error occurred"
-
-.exit:
- FinalizeAll
- stdcall Terminate, 0
-
-_ImportSection
-
-include '%lib%/imports/allimports.asm'
-
-_DataSection
-
-IncludeAllGlobals
DELETED freshlib/_pending/tutorial/gui.asm
Index: freshlib/_pending/tutorial/gui.asm
==================================================================
--- freshlib/_pending/tutorial/gui.asm
+++ /dev/null
@@ -1,118 +0,0 @@
-include '%lib%/compiler/executable.inc'
-_BinaryType GUI
-
-
-include '%lib%/macros/allmacros.inc'
-include '%lib%/equates/allequates.inc'
-include '%lib%/GUI/SysEvents.asm'
-
-
-_CodeSection
-
-include '%lib%/simpledebug/debug.asm'
-include '%lib%/system/process.asm'
-
-include '%lib%/system/memory.asm'
-include '%lib%/system/files.asm'
-include '%lib%/data/arrays.asm'
-include '%lib%/data/strlib.asm'
-
-include '%lib%/timers/timers.asm'
-
-include '%lib%/graphics/context.asm'
-include '%lib%/graphics/text.asm'
-include '%lib%/graphics/draw.asm'
-include '%lib%/graphics/images.asm'
-include '%lib%/graphics/giflib.asm'
-
-include '%lib%/mouse/mouse.asm'
-include '%lib%/GUI/GUI.asm'
-
-
-iglobal
-frmMainForm:
- ObjTemplate tfParent or tfEnd, Form, frmMain, \
- x, 100, \
- y, 50, \
- width, 320, \
- height, 200, \
- visible, TRUE, \
- caption, 'Very simple window'
-
- ObjTemplate tfChild or tfEnd, Button, btnChild1, \
- x, 48, \
- y, 48, \
- width, 80, \
- height, 48, \
- TextAlign, dtfAlignLeft or dtfAlignMiddle or dtfCRLF or dtfWordWrap,\
- caption, 'Hello', \
- visible, TRUE, \
- OnClick, Button1Click
-endg
-
-start:
- InitializeAll
-
- stdcall Create, CApplication
- jc .start_error
- mov [pApplication], ebx
-
-uglobal
- test_timer1 dd ?
-endg
-
-DebugMsg 'After initializing.'
-
- stdcall CreateFromTemplate, frmMainForm, 0
- mov ecx, [Application]
- mov [ecx+TApplication.MainWindow], ebx
-
- DebugMsg 'After attaching window.'
-
-
- stdcall TimerCreate
- mov [test_timer1], eax
- mov [eax+TTimer.interval], 10
- mov [eax+TTimer.Callback], procTestTimer1
- mov [eax+TTimer.flags], tmfCallProc
- or [eax+TTimer.flags], tmfRunning
-
-
- stdcall Run
-
- FinalizeAll
- stdcall Terminate, eax
-
-.start_error:
- stdcall Terminate, 1
-
-proc Button1Click, .self, .button
-begin
- DebugMsg 'Button1 clicked'
- return
-endp
-
-iglobal
- test_counter dd 0
-endg
-
-
-proc procTestTimer1, .ptrTimer
-begin
- add [test_counter],1
- cmp [test_counter],100
- jbe .not_yet
- stdcall OutputNumber,[test_counter],10,10
- stdcall Destroy,[frmMainForm]
- .not_yet:
- return
-endp
-
-
-
-_ImportSection
-
-include '%lib%/imports/allimports.asm'
-
-_DataSection
-IncludeAllGlobals
DELETED freshlib/_pending/tutorial/hello.asm
Index: freshlib/_pending/tutorial/hello.asm
==================================================================
--- freshlib/_pending/tutorial/hello.asm
+++ /dev/null
@@ -1,29 +0,0 @@
-include '%lib%/compiler/executable.inc'
-include '%lib%/macros/allmacros.inc'
-include '%lib%/equates/allequates.inc'
-
-GlobalAPI equ ascii
-_BinaryType console
-
-include '%lib%/system/process.asm'
-include '%lib%/simpledebug/debug.asm'
-
-_DataSection
-
-IncludeAllGlobals
-
-_CodeSection
-
-start:
-
- InitializeAll
-
- DebugMsg 'Hello world!'
-
- FinalizeAll
-
- stdcall Terminate,0
-
-_ImportSection
-
-include '%lib%/imports/allimports.asm'
DELETED freshlib/_trash/Common/header.inc
Index: freshlib/_trash/Common/header.inc
==================================================================
--- freshlib/_trash/Common/header.inc
+++ /dev/null
@@ -1,13 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description:
-;
-; Target OS:
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
DELETED freshlib/_trash/FastSwitch.png
Index: freshlib/_trash/FastSwitch.png
==================================================================
--- freshlib/_trash/FastSwitch.png
+++ /dev/null
cannot compute difference between binary files
DELETED freshlib/_trash/IDE options.png
Index: freshlib/_trash/IDE options.png
==================================================================
--- freshlib/_trash/IDE options.png
+++ /dev/null
cannot compute difference between binary files
DELETED freshlib/_trash/Project options.png
Index: freshlib/_trash/Project options.png
==================================================================
--- freshlib/_trash/Project options.png
+++ /dev/null
cannot compute difference between binary files
DELETED freshlib/_trash/SurplusSources/ForthScript/ForthLib.asm
Index: freshlib/_trash/SurplusSources/ForthScript/ForthLib.asm
==================================================================
--- freshlib/_trash/SurplusSources/ForthScript/ForthLib.asm
+++ /dev/null
@@ -1,390 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: ForthScript standard word library.
-;
-; Target OS: Any
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-macro ForthBlock blockname {
- forth@block equ blockname
- forth@block@size equ blockname#.size
-
- label blockname byte
-
- macro forthword name \{
- \local nnnn
-
- macro endfw \\{
- \\local ..footer
- endp
- label ..footer byte
- db name
- db 16-($-..footer) dup 0
- dd nnnn - blockname
- \\purge endfw
- \\}
- \proc nnnn
- \}
-}
-
-macro EndForthBlock {
- forth@block@size = $ - forth@block
- restore forth@block, forth@block@size
- purge forthword
-}
-
-
-
-ForthBlock ForthStandardLib
-
-; "->" word.
-forthword '->'
-begin
- or [ebx+TForthContext.Status], forthAssignMode
- clc
- retn
-endfw
-
-
-forthword '+'
-begin
- mov eax, [ebx+TForthContext.pAStack]
- mov ecx, [eax+TArray.count]
- cmp ecx, 2
- jb .error
-
- dec ecx
- imul ecx, [eax+TArray.itemsize]
- lea ecx, [eax+TArray.array+ecx]
-
- mov edx, [ecx+TFStackCell.value]
- sub ecx, [eax+TArray.itemsize]
- add [ecx+TFStackCell.value], edx
- mov [ecx+TFStackCell.type], ftypeNumber
-
- mov ecx, [eax+TArray.count]
- dec ecx
- stdcall DeleteArrayItem, [ebx+TForthContext.pAStack], ecx
- mov [ebx+TForthContext.pAStack], edx
- clc
- return
-
-.error:
- stc
- return
-endfw
-
-
-forthword '-'
-begin
- mov eax, [ebx+TForthContext.pAStack]
- mov ecx, [eax+TArray.count]
- cmp ecx, 2
- jb .error
-
- dec ecx
- imul ecx, [eax+TArray.itemsize]
- lea ecx, [eax+TArray.array+ecx]
-
- mov edx, [ecx+TFStackCell.value]
- sub ecx, [eax+TArray.itemsize]
- sub [ecx+TFStackCell.value], edx
- mov [ecx+TFStackCell.type], ftypeNumber
-
- mov ecx, [eax+TArray.count]
- dec ecx
- stdcall DeleteArrayItem, [ebx+TForthContext.pAStack], ecx
- mov [ebx+TForthContext.pAStack], edx
- clc
- return
-
-.error:
- stc
- return
-endfw
-
-
-
-forthword '*'
-begin
- mov eax, [ebx+TForthContext.pAStack]
- mov ecx, [eax+TArray.count]
- cmp ecx, 2
- jb .error
-
- dec ecx
- imul ecx, [eax+TArray.itemsize]
- lea ecx, [eax+TArray.array+ecx]
-
- mov edx, [ecx+TFStackCell.value]
- sub ecx, [eax+TArray.itemsize]
- imul edx, [ecx+TFStackCell.value]
- mov [ecx+TFStackCell.value], edx
- mov [ecx+TFStackCell.type], ftypeNumber
-
- mov ecx, [eax+TArray.count]
- dec ecx
- stdcall DeleteArrayItem, [ebx+TForthContext.pAStack], ecx
- mov [ebx+TForthContext.pAStack], edx
- clc
- return
-
-.error:
- stc
- return
-endfw
-
-
-
-forthword '/'
-begin
- mov eax, [ebx+TForthContext.pAStack]
- mov ecx, [eax+TArray.count]
- cmp ecx, 2
- jb .error
-
- dec ecx
- imul ecx, [eax+TArray.itemsize]
- lea ecx, [eax+TArray.array+ecx]
-
- mov edx, [ecx+TFStackCell.value]
- sub ecx, [eax+TArray.itemsize]
-
- push eax
- mov eax, edx
- cdq
- idiv [ecx+TFStackCell.value]
- mov [ecx+TFStackCell.value], eax
- mov [ecx+TFStackCell.type], ftypeNumber
- pop eax
-
- mov ecx, [eax+TArray.count]
- dec ecx
- stdcall DeleteArrayItem, [ebx+TForthContext.pAStack], ecx
- mov [ebx+TForthContext.pAStack], edx
- clc
- return
-
-.error:
- stc
- return
-endfw
-
-
-forthword '%'
-begin
- mov eax, [ebx+TForthContext.pAStack]
- mov ecx, [eax+TArray.count]
- cmp ecx, 2
- jb .error
-
- dec ecx
- shl ecx, 3
- lea ecx, [eax+TArray.array+ecx]
-
- mov edx, [ecx+TFStackCell.value]
- sub ecx, [eax+TArray.itemsize]
-
- push eax
- mov eax, edx
- cdq
- idiv [ecx+TFStackCell.value]
- mov [ecx+TFStackCell.value], eax
- mov [ecx+TFStackCell.type], ftypeNumber
- pop eax
-
- mov ecx, [eax+TArray.count]
- dec ecx
- stdcall DeleteArrayItem, [ebx+TForthContext.pAStack], ecx
- mov [ebx+TForthContext.pAStack], edx
- clc
- return
-
-.error:
- stc
- return
-endfw
-
-
-
-
-forthword 'swap'
-begin
- mov eax, [ebx+TForthContext.pAStack]
- mov ecx, [eax+TArray.count]
- cmp ecx, 2
- jb .finish ; jb == jc
-
- shl ecx, 3
- add ecx, [ebx+TForthContext.pAStack]
-; lea ecx, [ecx+TArray.array-2*sizeof.TFStackCell] TArray.array = 2*sizeof.TFStackCell
-
- mov eax, [ecx+TFStackCell.value]
- mov edx, dword [ecx+TFStackCell.type]
- xchg eax, [ecx+sizeof.TFStackCell+TFStackCell.value]
- xchg edx, dword [ecx+sizeof.TFStackCell+TFStackCell.type]
- mov [ecx+TFStackCell.value], ecx
- mov dword [ecx+TFStackCell.type], edx
-
- clc
-.finish:
- return
-endfw
-
-
-
-forthword 'dup'
-begin
- mov eax, [ebx+TForthContext.pAStack]
- mov ecx, [eax+TArray.count]
- cmp ecx, 1
- jb .finish ; jb == jc
-
- shl ecx, 3
- add ecx, [ebx+TForthContext.pAStack]
- lea ecx, [ecx+TArray.array-sizeof.TFStackCell]
-
- stdcall AddArrayItem, [ebx+TForthContext.pAStack]
- mov [ebx+TForthContext.pAStack], edx
- jc .finish
-
- pushd [ecx+TFStackCell.value] dword [ecx+TFStackCell.type]
- popd dword [eax+TFStackCell.type] [eax+TFStackCell.value]
-
- clc
-.finish:
- return
-endfw
-
-
-
-forthword 'label'
-begin
-
-
-endfw
-
-
-
-
-forthword 'jump'
-begin
-
-
-endfw
-
-
-
-
-forthword '?branch'
-begin
-
-
-endfw
-
-
-
-; : if +1 ?branch ;
-forthword 'if'
-begin
-
-
-endfw
-
-
-
-; : else label not +1 ?branch ;
-forthword 'else'
-begin
-
-
-endfw
-
-
-; : then label ;
-forthword 'then'
-begin
-
-
-endfw
-
-
-
-
-
-; : do label ;
-forthword 'do'
-begin
-
-
-endfw
-
-
-; : loop -1 ?branch ;
-forthword 'loop'
-
-
-
-
-forthword '.'
-begin
- mov eax, [ebx+TForthContext.pAStack]
- mov ecx, [eax+TArray.count]
- jecxz .exit
-
- dec ecx
- mov edx, ecx
-
- imul ecx, [eax+TArray.itemsize]
- lea ecx, [eax+TArray.array+ecx]
-
- cmp [ecx+TFStackCell.type], ftypeNumber
- jne .printstring
-
- stdcall NumToStr, [ecx+TFStackCell.value], ntsSigned or ntsDec
- mov [ecx+TFStackCell.value], eax
- mov [ecx+TFStackCell.type], ftypeStringFree
-
-.printstring:
- stdcall StrPtr, [ecx+TFStackCell.value]
- stdcall Output, eax
-
- cmp [ecx+TFStackCell.type], ftypeStringFree
- jne .popit
-
- stdcall StrDel, [ecx+TFStackCell.value]
-
-.popit:
- stdcall DeleteArrayItem, [ebx+TForthContext.pAStack], edx
- mov [ebx+TForthContext.pAStack], edx
-
-.exit:
- clc
- return
-
-endfw
-
-
-
-forthword 'crlf'
-begin
- stdcall Output, sCRLF
- clc
- return
-endfw
-
-
-
-EndForthBlock
-
-
-
-sCRLF db 13, 10, 0, 0
-
DELETED freshlib/_trash/SurplusSources/ForthScript/ForthScript.asm
Index: freshlib/_trash/SurplusSources/ForthScript/ForthScript.asm
==================================================================
--- freshlib/_trash/SurplusSources/ForthScript/ForthScript.asm
+++ /dev/null
@@ -1,721 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: ForthScript engine.
-;
-; Target OS: Any
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-module "Forth script compiler"
-
-include 'ForthLib.asm'
-
-; NOTE: E8 is the opcode for relative call
-; B8 is the opcode for mov eax, dword const
-; BA is the opcode for mov edx, dword const
-; FF D0 is the opcode for call eax
-; C3 is the opcode for retn
-; e9 is the opcode for jmp long offset
-
-
-
-ftypeNumber = 0
-ftypeString = 1
-ftypeStringFree = 2 ; this string should be destroyed after use.
-
-struct TFStackCell
- .value dd ? ; number or handle of the string.
- .type db ? ; number/string
- align 4
-ends
-
-
-struct TFLoopStackCell
-ends
-
-
-
-struct TFWordFooter
- .name rb 16 ; max 12 bytes name paded with 0
- .entry dd ? ; offset to the code of the word [.entry]-4 points to the footer of the previous word.
-ends
-
-
-; values for the Status flags.
-
-forthCompileMode = 1 ; if set the script is compiled instead of interpreted
-forthNextNewName = 2 ; if set the next extracted word should be interpreted as a new name.
-forthAssignMode = 4 ; if set the next variable word must pop value from the stack, instead of push.
-
-
-
-struct TForthContext
- .pAStack dd ? ; pointer to the aritmetic stack TArray.
- .pLStack dd ? ; pointer to the loop stack TArray.
- .pWords dd ? ; pointer to the words memory.
- .iWords dd ? ; offset to the first free byte in the words memory.
- .iLastWord dd ? ; offset to the end of the last word defined.
- .sizeWords dd ? ; size of the words memory.
-
- .Status dd ?
-
- .pUserWords dd ? ; pointer to the user words memory.
- .iUserWords dd ? ; offset of the end of the user word memory.
- .pUser dd ? ; pointer to the user provided object for example TFreshEdit or other.
-ends
-
-
-ForthInitWordsMemory = 1024
-
-
-proc ForthCreateContext
-begin
- push edi
-
- stdcall GetMem, sizeof.TForthContext
- mov edi, eax
-
- stdcall CreateArray, sizeof.TFStackCell
- mov [edi+TForthContext.pAStack], eax
-
- stdcall CreateArray, sizeof.TFLoopStackCell
- mov [edi+TForthContext.pLStack], eax
-
- mov [edi+TForthContext.sizeWords], ForthInitWordsMemory
- stdcall GetMem, [edi+TForthContext.sizeWords]
- mov [edi+TForthContext.pWords], eax
-
- mov eax, edi
- pop edi
- return
-endp
-
-
-proc ForthFreeContext, .forth_context
-begin
-
-
- return
-endp
-
-
-
-ferrSyntaxError = 1
-ferrUnknownWord = 2
-ferrOutOfMemory = 3
-ferrInvalidNumber = 4
-ferrInvalidString = 5
-ferrMissingBracket = 6
-
-ferrMaxError = 6
-
-dmsgEndWithoutBegin db 'Syntax error', 0
-dmsgUnknownWord db 'Unknown word', 0
-dmsgOutOfMemory db 'Out of memory', 0
-dmsgInvalidNumber db 'Invalid number', 0
-dmsgInvalidString db 'Invalid string', 0
-dmsgMissingBracket db 'Missing ")"', 0
-dmsgUnknownError db 'Unknown error. Probably bug.', 0
-
-
-
-ForthErrorMessages dd 0
- dd dmsgEndWithoutBegin
- dd dmsgUnknownWord
- dd dmsgOutOfMemory
- dd dmsgInvalidNumber
- dd dmsgInvalidString
- dd dmsgMissingBracket
-; this should be last.
- dd dmsgUnknownError
-
-
-proc GetForthErrorMsg, .errcode
-begin
- mov eax, [.errcode]
- cmp eax, ferrMaxError
- jbe @f
- mov eax, ferrMaxError+1
-@@:
- mov eax, [ForthErrorMessages+4*eax]
- return
-endp
-
-
-
-proc ForthExecScript, .pcontext, .psource
-.word rb 16
-.newword rb 16
-.entry dd ? ; the entry point of the currently compiled word.
-.ofs_error dd ?
-.sign dd ?
-begin
- push ebx ecx esi edi
-
- mov ebx, [.pcontext]
- mov esi, [.psource]
-
-.script_loop:
-
- xor eax, eax
- mov dword [.word], eax
- mov dword [.word+4], eax
- mov dword [.word+8], eax
- mov dword [.word+12], eax
- xor ecx, ecx
-
- dec esi
-
-.start_scan:
-
- inc esi
- mov al, [esi]
-
-; offset for the error message, if any
- mov edx, esi
- sub edx, [.psource]
- mov [.ofs_error], edx
-
- test al, al
- jz .end_of_script
-
- cmp al, '+'
- je .maybe_number
- cmp al, '-'
- je .maybe_number
-
- cmp al, '0'
- jb .nan
- cmp al, '9'
- jbe .extract_number
-
-.nan:
- cmp al, '"'
- je .extract_string
- cmp al, "'"
- je .extract_string
-
- cmp al, ' '
- jbe .start_scan
-
- cmp al, ':'
- jne @f
-
- test [ebx+TForthContext.Status], forthCompileMode
- jnz .syntax_error
-
- or [ebx+TForthContext.Status], forthCompileMode or forthNextNewName
- mov eax, [ebx+TForthContext.iWords]
- mov [.entry], eax
- jmp .start_scan
-
-@@:
- cmp al, ';'
- jne @f
-
- test [ebx+TForthContext.Status], forthCompileMode
- jz .syntax_error
-
-; finalize the compilation of a word.
-
- mov eax, sizeof.TFWordFooter+1
- call .allocate_bytes
- jc .err_out_of_memory
-
- sub eax, sizeof.TFWordFooter
- mov byte [eax+edx-1], $c3 ; retn
-
- pushd dword [.newword] dword [.newword+4] dword [.newword+8] dword [.newword+12]
- popd [eax+edx+12] [eax+edx+8] [eax+edx+4] [eax+edx]
-
- push [.entry]
- pop [eax+edx+TFWordFooter.entry]
-
- push [ebx+TForthContext.iWords]
- pop [ebx+TForthContext.iLastWord]
-
- and [ebx+TForthContext.Status], not forthCompileMode
-
- jmp .start_scan
-
-@@:
- cmp al, '('
- jne @f
-
-; comment ()
-.comment_loop:
- inc esi
- mov al, [esi]
- test al, al
- jz .err_missing_bracket
-
- cmp al, ')'
- jne .comment_loop
- inc esi
- jmp .script_loop
-
-@@:
- cmp al, '\'
- jne .extract_word
-
-; one line comment
-.comment_loop2:
- inc esi
- mov al, [esi]
- cmp al, ' '
- jae .comment_loop2
- jmp .script_loop
-
-.extract_word:
- mov [.word+ecx], al
- inc ecx
- and ecx, $0f
- inc esi
- mov al, [esi]
- cmp al, ' '
- ja .extract_word
-
-;.word_ok:
- test [ebx+TForthContext.Status], forthNextNewName
- jz .process_word
-
-; copy the word as a new word name to be placed at the end of the word definition.
- mov eax, dword [.word]
- mov ecx, dword [.word+4]
- mov dword [.newword], eax
- mov dword [.newword+4], ecx
-
- mov eax, dword [.word+8]
- mov ecx, dword [.word+12]
- mov dword [.newword+8], eax
- mov dword [.newword+12], ecx
-
- and [ebx+TForthContext.Status], not forthNextNewName
- jmp .script_loop
-
-
-.process_word:
- call .search_word ; eax offset relative to [TForthContext.pWords]
- jc .err_unknown_word
-
- test [ebx+TForthContext.Status], forthCompileMode
- jnz .compile_the_word
-
- push esi
-
- mov esi, [ebx+TForthContext.pUser]
- add eax, [ebx+TForthContext.pWords]
- call eax
-
- pop esi
- jmp .script_loop
-
-.compile_the_word:
- mov ecx, eax ; offset of the word entry
-
- cmp eax, [ebx+TForthContext.iWords]
- jb .internal_call
-
-;.external_call:
- add ecx, [ebx+TForthContext.pWords] ; absolute address
-
- mov eax, 7
- call .allocate_bytes
- jc .err_out_of_memory
-
- mov byte [edx+eax-7], $b8 ; mov eax, const
- mov [edx+eax-6], ecx
- mov word [edx+eax-2], $d0ff
-
- jmp .script_loop
-
-
-.internal_call:
- mov eax, 5
- call .allocate_bytes ; return new offset in eax and pointer to the memory block in edx
- jc .err_out_of_memory
-
-; relative call to the word entry point.
- sub ecx, eax
- mov byte [edx+eax-5], $e8 ; call instruction opcode.
- mov [edx+eax-4], ecx
-
- jmp .script_loop
-
-
-.maybe_number:
- cmp byte [esi+1], '0'
- jb .extract_word
- cmp byte [esi+1], '9'
- ja .extract_word
-
-.extract_number:
- xor edx, edx
- movzx eax, al
-
- mov byte [.sign], al
- cmp al, '-'
- je .next
- cmp al, '+'
- je .next
-
-.num_loop:
- cmp al, ' '
- jbe .number_ok
-
- cmp al, '0'
- jb .err_invalid_number
- cmp al, '9'
- ja .err_invalid_number
-
- sub al, '0'
- imul edx, 10
- add edx, eax
-
-.next:
- inc esi
- mov al, [esi]
- jmp .num_loop
-
-.number_ok:
- cmp byte [.sign], '-'
- jne @f
- neg edx
-@@:
- test [ebx+TForthContext.Status], forthCompileMode
- jnz .compile_number
-
- call forth_push_number
- jmp .script_loop
-
-
-.compile_number: ; $b8 forth_push_number $ba number $ff $d0
- mov ecx, edx
-
- mov eax, 12
- call .allocate_bytes
- jc .err_out_of_memory
-
- mov byte [edx+eax-12], $b8 ; mov eax, const
- mov dword [edx+eax-11], forth_push_number
- mov byte [edx+eax-7], $ba ; mov edx, const
- mov dword [edx+eax-6], ecx
- mov word [edx+eax-2], $d0ff
-
- jmp .script_loop
-
-
-.extract_string:
- mov ah, al ; end character.
- xor ecx, ecx ; length of the string
- lea edi, [esi+1]
-
-.str_loop:
- inc esi
- mov al, [esi]
- test al, al
- jz .err_invalid_string
-
- cmp al, ah
- je .string_ok
-
- inc ecx
- jmp .str_loop
-
-.string_ok:
- mov ecx, esi
- sub ecx, edi
-
- inc esi
-
- test [ebx+TForthContext.Status], forthCompileMode
- jnz .compile_string
-
- stdcall StrNew
- mov edx, eax
-
- stdcall StrCopyPart, edx, edi, 0, ecx
-
- push edx
- stdcall AddArrayItem, [ebx+TForthContext.pAStack]
- mov [ebx+TForthContext.pAStack], edx
- mov [eax+TFStackCell.type], ftypeStringFree
- pop [eax+TFStackCell.value]
-
- jmp .script_loop
-
-.compile_string:
- push esi
- mov esi, edi
- mov edi, [ebx+TForthContext.iWords]
-
- lea eax, [ecx+1+17]
- stdcall .allocate_bytes
- jc .err_out_of_memory
-
- lea eax, [edi+17]
- add edi, [ebx+TForthContext.pWords]
-
- mov byte [edi], $ba ; mov edx, offset of string
- mov dword [edi+1], eax ; offset of string
- mov byte [edi+5], $b8 ; mov eax, forth_push_string
- mov dword [edi+6], forth_push_string
- mov word [edi+10], $d0ff ; call eax
- lea eax, [ecx+1]
- mov byte [edi+12], $e9 ; jmp end
- mov dword [edi+13], eax ;
-
- add edi, 17
-
- rep movsb
- mov al, 0
- stosb
-
- pop esi
- jmp .script_loop
-
-
-.end_of_script:
- mov ecx, [ebx+TForthContext.pAStack]
- mov eax, [ecx+TArray.count]
- test eax, eax
- jz @f
-
- lea eax, [ecx+TArray.array+8*eax-8]
- mov eax, [eax+TFStackCell.value]
- dec [ecx+TArray.count]
-
-@@:
- clc
- jmp .finish
-
-; error handlers
-.err_missing_bracket:
- mov eax, ferrMissingBracket
- jmp .error
-
-.err_invalid_string:
- mov eax, ferrInvalidString
- jmp .error
-
-.err_invalid_number:
- mov eax, ferrInvalidNumber
- jmp .error
-
-.err_out_of_memory:
- mov eax, ferrOutOfMemory
- jmp .error
-
-.err_unknown_word:
- mov eax, ferrUnknownWord
- jmp .error
-
-.syntax_error:
- mov eax, ferrSyntaxError
-
-.error:
- mov edx, [.ofs_error]
- stc
-
-.finish:
- pop edi esi ecx ebx
- return
-
-
-; internal subroutines
-
-
-; returns:
-; CF=0 - word found.
-; eax - offset of word entry point in pWords memory.
-;
-; CF=1 - word not found.
-.search_word:
- push edx esi
-
-; search in the compiled words
- mov edx, [ebx+TForthContext.pWords]
- mov esi, [ebx+TForthContext.iLastWord]
- call .search_list
- jnc .word_found
-
-; if not found, search in the user provided words, if any.
- mov edx, [ebx+TForthContext.pUserWords]
- test edx, edx
- jz .check_std
-
- mov esi, [ebx+TForthContext.iUserWords]
- call .search_list
- jnc .word_found
-
-.check_std:
- mov edx, ForthStandardLib
- mov esi, ForthStandardLib.size
- call .search_list
- jnc .word_found
-
- stc
- pop esi edx
- retn
-
-.word_found:
- clc
- pop esi edx
- retn
-
-
-
-; arguments:
-; esi - offset of the end of the word area.
-; edx - pointer to the begin of the word area.
-; returns:
-; CF=0; eax=offset of the word entry in the word area.
-; CF=1 - not found
-.search_list:
- add esi, edx
-
-.search_loop:
- sub esi, sizeof.TFWordFooter
- cmp esi, edx
- jb .notfound
-
- mov eax, dword [esi+TFWordFooter.name]
- cmp eax, dword [.word]
- jne .prev_word
-
- mov eax, dword [esi+TFWordFooter.name+4]
- cmp eax, dword [.word+4]
- jne .prev_word
-
- mov eax, dword [esi+TFWordFooter.name+8]
- cmp eax, dword [.word+8]
- jne .prev_word
-
- mov eax, dword [esi+TFWordFooter.name+12]
- cmp eax, dword [.word+12]
- je .found
-
-.prev_word:
- mov esi, [esi+TFWordFooter.entry]
- add esi, edx
- jmp .search_loop
-
-.found:
- mov eax, [esi+TFWordFooter.entry]
- add eax, edx
- sub eax, [ebx+TForthContext.pWords] ; relatively to TForthContext.pWords
- clc
- retn
-
-.notfound:
- stc
- retn
-
-
-; argument: eax - count of bytes to allocate.
-; returns:
-; eax - offset in pWords of the new end ( iWords )
-; edx - pointer of pWords memory.
-
-.allocate_bytes:
- push ecx
-
- mov edx, [ebx+TForthContext.iWords]
- add edx, eax
- cmp edx, [ebx+TForthContext.sizeWords]
- jb .sizeok
-
- mov ecx, [ebx+TForthContext.sizeWords]
- call [ResizeIt]
- mov [ebx+TForthContext.sizeWords], ecx
-
- stdcall ResizeMem, [ebx+TForthContext.pWords], ecx
- jc .end_alloc
- mov [ebx+TForthContext.pWords], eax
-
-.sizeok:
- mov [ebx+TForthContext.iWords], edx
- mov eax, edx
- mov edx, [ebx+TForthContext.pWords]
- clc
-
-.end_alloc:
- pop ecx
- retn
-
-endp
-
-; arguments:
-; ebx - TForthContext
-; edx - number to be pushed
-; returns
-;
-forth_push_number:
- push edx
- stdcall AddArrayItem, [ebx+TForthContext.pAStack]
- mov [ebx+TForthContext.pAStack], edx
- mov [eax+TFStackCell.type], ftypeNumber
- pop [eax+TFStackCell.value]
- retn
-
-
-; arguments:
-; ebx - TForthContext
-; returns
-; eax - value from the top of the stack
-proc forth_pop_number
-begin
- mov edx, [ebx+TForthContext.pAStack]
- mov eax, [edx+TArray.count]
- dec eax
- js .empty_stack
-
- push eax
-
- imul eax, [edx+TArray.itemsize]
- mov eax, [edx+TArray.array+edx+TFStackCell.value]
-
- stdcall DeleteArrayItem, edx ; from the stack
- clc
- return
-
-.empty_stack:
- xor eax, eax
- stc
- return
-endp
-
-
-
-; arguments:
-; ebx - TForthContext
-; edx - offset to the string related to pWords memory.
-; returns
-;
-proc forth_push_string
-begin
- add edx, [ebx+TForthContext.pWords]
- push edx
- stdcall AddArrayItem, [ebx+TForthContext.pAStack]
- mov [ebx+TForthContext.pAStack], edx
- mov [eax+TFStackCell.type], ftypeString
- pop [eax+TFStackCell.value]
- return
-endp
-
-
-
-
-
-
-endmodule
-
-
-
-
-
DELETED freshlib/_trash/SurplusSources/FreshEdit/forth_link.asm
Index: freshlib/_trash/SurplusSources/FreshEdit/forth_link.asm
==================================================================
--- freshlib/_trash/SurplusSources/FreshEdit/forth_link.asm
+++ /dev/null
@@ -1,525 +0,0 @@
-iglobal
-FreshEditKeyScript file 'keyboard.forth'
- dd 0
-endg
-
-
-
-ForthBlock __FreshEditForthWords
-
-
-forthword 'Left'
-begin
- call TFreshEdit.__FitCaretInWindow
- jz @f
-
- stc
- return
-
-@@:
- push ecx
-
- mov ecx, [esi+TFreshEdit._xCaret]
- jecxz .exit
-
- dec ecx
- mov [esi+TFreshEdit._xCaret], ecx
-
- mov ecx, [esi+TFreshEdit._LeftColumn]
- cmp [esi+TFreshEdit._xCaret], ecx
- ja .exit
-
- mov ecx, [esi+TFreshEdit._cols]
- shr ecx, 2
- test ecx, ecx
- jnz @f
- inc ecx
-@@:
- sub [esi+TFreshEdit._LeftColumn], ecx
- jns @f
-
- mov [esi+TFreshEdit._LeftColumn], 0
-@@:
-
-.exit:
- clc
- pop ecx
- return
-endfw
-
-
-
-forthword 'Right'
-begin
- call TFreshEdit.__FitCaretInWindow
- jz @f
-
- stc
- return
-
-@@:
- push ecx edx
-
- mov ecx, [esi+TFreshEdit._xCaret]
- inc ecx
- mov [esi+TFreshEdit._xCaret], ecx
-
- mov edx, [esi+TFreshEdit._cols]
- add edx, [esi+TFreshEdit._LeftColumn]
- cmp ecx, edx
- jae .scroll_left
-
-.finish:
- clc
- pop edx ecx
- return
-
-.scroll_left:
- mov ecx, [esi+TFreshEdit._cols]
- shr ecx, 2
- test ecx, ecx
- jnz @f
- inc ecx
-@@:
- add [esi+TFreshEdit._LeftColumn], ecx
- jmp .finish
-endfw
-
-
-
-forthword 'Up'
-begin
- call TFreshEdit.__FitCaretInWindow
- jz @f
-
- stc
- return
-
-@@:
- push ecx
-
- cmp [esi+TFreshEdit._yCaret], 0
- je .exit
-
- dec [esi+TFreshEdit._yCaret]
-
- mov ecx, [esi+TFreshEdit._TopLine]
- cmp [esi+TFreshEdit._yCaret], ecx
- jl .scrollup
-
-.exit:
- clc
- pop ecx
- return
-
-.scrollup:
- mov ecx, [esi+TFreshEdit._TopLine]
- jecxz .exit
- dec [esi+TFreshEdit._TopLine]
- jmp .exit
-endfw
-
-
-
-TFreshEdit.__CommandScrollLockUp:
-forthword 'ScrLockUp'
-begin
- call TFreshEdit.__FitCaretInWindow
- jz @f
-
- stc
- return
-
-@@:
- push ecx
-
- cmp [esi+TFreshEdit._yCaret], 0
- je .exit
-
- dec [esi+TFreshEdit._yCaret]
-
- mov ecx, [esi+TFreshEdit._TopLine]
- jecxz .exit
-
- dec [esi+TFreshEdit._TopLine]
-
-.exit:
- clc
- pop ecx
- return
-endfw
-
-
-
-forthword 'ScrollUp'
-begin
- push ecx
- cmp [esi+TFreshEdit._TopLine], 0
- je .finish
- dec [esi+TFreshEdit._TopLine]
-.finish:
- clc
- pop ecx
- return
-endfw
-
-
-
-
-TFreshEdit.__CommandDown:
-forthword 'Down'
-begin
- call TFreshEdit.__FitCaretInWindow
- jz @f
-
- stc
- return
-
-@@:
- push ecx edx
-
- mov edx, [esi+TFreshEdit._pIndex]
-
- mov ecx, [esi+TFreshEdit._yCaret]
- inc ecx
- cmp ecx, [edx+TArray.count]
- jae .exit
-
- mov [esi+TFreshEdit._yCaret], ecx
-
- mov ecx, [esi+TFreshEdit._TopLine]
- add ecx, [esi+TFreshEdit._rows]
- cmp [esi+TFreshEdit._yCaret], ecx
- jae .scrolldn
-
-.exit:
- clc
- pop edx ecx
- return
-
-.scrolldn:
- mov ecx, [esi+TFreshEdit._TopLine]
- inc ecx
- cmp ecx, [edx+TArray.count]
- jae .exit
-
- mov [esi+TFreshEdit._TopLine], ecx
- jmp .exit
-endfw
-
-
-
-
-TFreshEdit.__CommandScrollLockDown:
-forthword 'ScrLockDown'
-begin
- call TFreshEdit.__FitCaretInWindow
- jz @f
-
- stc
- return
-
-@@:
- push ecx edx
-
- mov edx, [esi+TFreshEdit._pIndex]
-
- mov ecx, [esi+TFreshEdit._yCaret]
- inc ecx
- cmp ecx, [edx+TArray.count]
- jae .exit
-
- mov [esi+TFreshEdit._yCaret], ecx
-
- mov ecx, [esi+TFreshEdit._TopLine]
- inc ecx
- add ecx, [esi+TFreshEdit._rows]
- cmp ecx, [edx+TArray.count]
- ja .exit
-
- inc [esi+TFreshEdit._TopLine]
-
-.exit:
- clc
- pop edx ecx
- return
-
-endfw
-
-
-
-forthword 'ScrollDown'
-begin
- push ecx edx
- mov edx, [esi+TFreshEdit._pIndex]
-
- mov ecx, [esi+TFreshEdit._TopLine]
- inc ecx
- add ecx, [esi+TFreshEdit._rows]
- cmp ecx, [edx+TArray.count]
- ja .finish
-
- inc [esi+TFreshEdit._TopLine]
-
-.finish:
- clc
- pop edx ecx
- return
-
-endfw
-
-
-
-
-
-forthword 'PgDown'
-begin
- push ecx
- mov ecx, [esi+TFreshEdit._rows]
-
-@@:
- call TFreshEdit.__CommandScrollLockDown
- jc .finish
- loop @b
-
-.finish:
- pop ecx
- return
-endfw
-
-
-
-forthword 'PgUp'
-begin
- push ecx
- mov ecx, [esi+TFreshEdit._rows]
-@@:
- call TFreshEdit.__CommandScrollLockUp
- jc .finish
- loop @b
-
-.finish:
- pop ecx
- return
-endfw
-
-
-
-
-forthword 'LineBegin'
-begin
- call TFreshEdit.__FitCaretInWindow
- jz @f
-
- stc
- return
-
-@@:
- cmp [esi+TFreshEdit._xCaret], 0
- je .end
-
- mov [esi+TFreshEdit._xCaret], 0
-
- cmp [esi+TFreshEdit._LeftColumn], 0
- je .end
-
- mov [esi+TFreshEdit._LeftColumn], 0
-
-.end:
- clc
- return
-endfw
-
-
-
-
-
-forthword 'LineEnd'
-begin
- call TFreshEdit.__FitCaretInWindow
- jz @f
-
- stc
- return
-
-@@:
- push ebx ecx
-
- mov ecx, [esi+TFreshEdit._yCaret]
- mov ebx, [esi+TFreshEdit._pIndex]
-
- cmp ecx, [ebx+TArray.count]
- jae .end
-
- mov ecx, [ebx+TArray.array+4*ecx]
-
- shl ecx, TEditorLine.shift
- add ecx, [esi+TFreshEdit._pLines]
- add ecx, TArray.array
-
- stdcall StrLenUtf8, [ecx+TEditorLine.Data], -1
-
- cmp [esi+TFreshEdit._xCaret], eax
- je .end
-
- mov [esi+TFreshEdit._xCaret], eax
-
- mov ecx, [esi+TFreshEdit._cols]
- lea ecx, [ecx*3]
- shr ecx, 2
-
- cmp eax, [esi+TFreshEdit._LeftColumn]
- jg .leftok
-
- sub eax, ecx
- jns @f
- xor eax, eax
-@@:
- mov [esi+TFreshEdit._LeftColumn], eax
- jmp .end
-
-.leftok:
- add ecx, [esi+TFreshEdit._LeftColumn]
- sub ecx, [esi+TFreshEdit._xCaret]
- jge .end
-
- sub [esi+TFreshEdit._LeftColumn], ecx
-
-.end:
- clc
- pop ecx ebx
- return
-endfw
-
-
-
-TFreshEdit.__CommandBeginOfScreen:
-forthword 'ScreenBegin'
-begin
- call TFreshEdit.__FitCaretInWindow
- jz @f
-
- stc
- return
-
-@@:
- mov eax, [esi+TFreshEdit._TopLine]
- cmp eax, [esi+TFreshEdit._yCaret]
- je .end
-
- mov [esi+TFreshEdit._yCaret], eax
-.end:
- return
-endfw
-
-
-forthword 'ScreenEnd'
-begin
- call TFreshEdit.__FitCaretInWindow
- jz @f
-
- stc
- return
-
-@@:
- call TFreshEdit.__CommandBeginOfScreen
-
- mov ecx, [esi+TFreshEdit._rows]
- jecxz .end
- dec ecx
- jecxz .end
-
-@@:
- call TFreshEdit.__CommandDown
- jc .end
- loop @b
-
-.end:
- return
-endfw
-
-
-forthword 'FileBegin'
-begin
-
- return
-endfw
-
-
-forthword 'FileEnd'
-begin
-
- return
-endfw
-
-
-forthword 'WordPrev'
-begin
-
- return
-endfw
-
-
-forthword 'WordNext'
-begin
-
- return
-endfw
-
-
-
-forthword 'GetSelMode'
-begin
-
- return
-endfw
-
-
-
-forthword 'SetSelMode'
-begin
-
- return
-endfw
-
-
-
-forthword 'GetInsMode'
-begin
-
- return
-endfw
-
-
-forthword 'SetInsMode'
-begin
-
- return
-endfw
-
-
-forthword 'GetRowCount'
-begin
-
- return
-endfw
-
-
-
-forthword 'ToggleSelMode'
-begin
- mov eax, [esi+TFreshEdit._SelMode]
- inc eax
- cmp eax, 2
- jbe @f
- xor eax, eax
-@@:
- mov [esi+TFreshEdit._SelMode], eax
- return
-endfw
-
-
-
-EndForthBlock
-
-;_________________________________________________________________________________________
DELETED freshlib/_trash/SurplusSources/FreshEdit/keyboard.forth
Index: freshlib/_trash/SurplusSources/FreshEdit/keyboard.forth
==================================================================
--- freshlib/_trash/SurplusSources/FreshEdit/keyboard.forth
+++ /dev/null
@@ -1,32 +0,0 @@
-( This file contains ForthScript definitions for navigation and control keys in FreshEdit.
- The name of the words is actually the name of the pressed key, as returned by CreateKeyName procedure
- defined in the library SysEvents.asm
- The words can return a value through the stack top value. It is
- 1 - means the
-)
-
-: keyUp Up 0 ;
-: keyShift+Up Up 1 ;
-
-: keyDown Down 0 ;
-: keyShift+Down Down 1 ;
-
-: keyLeft Left 0 ;
-: keyShift+Left Left 1 ;
-
-: keyRight Right 0 ;
-: keyShift+Right Right 1 ;
-
-: keyPgUp PgUp 0 ;
-: keyShift+PgUp PgUp 1 ;
-
-: keyPgDn PgDown 0 ;
-: keyShift+PgDn PgDown 1 ;
-
-: keyHome LineBegin 0 ;
-: keyShift+Home LineBegin 1 ;
-
-: keyEnd LineEnd 0 ;
-: keyShift+End LineEnd 1 ;
-
-: keyCtrl+Alt+Ins ToggleSelMode 1 ;
DELETED freshlib/_trash/SurplusSources/Linux/TButtonLinux.asm
Index: freshlib/_trash/SurplusSources/Linux/TButtonLinux.asm
==================================================================
--- freshlib/_trash/SurplusSources/Linux/TButtonLinux.asm
+++ /dev/null
@@ -1,270 +0,0 @@
-
-proc TButton.Create, .obj, .parent
-begin
- push eax ecx edx esi edi
-
- mov ebx, [.obj]
-
- mov eax, [.parent]
- test eax, eax
- jz .root
-
- mov eax, [eax+TWindow.handle]
- jmp .parentok
-
-.root:
- mov eax, [hRootWindow]
-
-.parentok:
- cinvoke XCreateSimpleWindow, [hApplicationDisplay], eax, 0, 0, 1, 1, 0, 0, $d4d0c8
- mov [ebx+TButton.handle], eax
-
- stdcall _SetWindowStruct, eax, ebx
-
- cinvoke XSelectInput, [hApplicationDisplay], [ebx+TButton.handle], ExposureMask or \
- EnterWindowMask or \
- LeaveWindowMask or \
- ButtonPressMask or \
- ButtonReleaseMask
-
-
- pop edi esi edx ecx eax
- return
-endp
-
-
-
-
-
-proc TButton.SysEventHandler, .ptrEvent
-
-begin
- push esi edi
-
- mov esi, [.ptrEvent]
-
- stdcall _GetWindowStruct, [esi+XEvent.window]
- mov edi, eax
-
- mov eax, [esi+XEvent.type]
- cmp eax, Expose
- je .expose
- cmp eax, LeaveNotify
- je .leave
- cmp eax, EnterNotify
- je .enter
- cmp eax, ButtonPress
- je .button_press
- cmp eax, ButtonRelease
- je .button_release
-
-
-.finish:
- pop edi esi
- stc
- return
-
-.button_release:
- cmp [esi+XButtonPressedEvent.button], 1
- jne .finish
-
- cinvoke XUngrabPointer, [hApplicationDisplay], CurrentTime
-
- mov [edi+TButton.state], btnPointed
- jmp .needrepaint
-
-.button_press:
- cmp [esi+XButtonPressedEvent.button], 1
- jne .finish
-
- cinvoke XGrabPointer, [hApplicationDisplay], [esi+XButtonEvent.window], FALSE, \
- ButtonReleaseMask or EnterWindowMask or LeaveWindowMask, \
- GrabModeAsync, GrabModeAsync, None, None, CurrentTime
-
- mov [edi+TButton.state], btnPressed
- jmp .needrepaint
-
-.leave:
- cmp [edi+TButton.state], btnPressed
- je .end_mouse
-
- mov [edi+TButton.state], btnNormal
- jmp .needrepaint
-
-.enter:
- cmp [edi+TButton.state], btnPressed
- je .end_mouse
-
- mov [edi+TButton.state], btnPointed
-
-.needrepaint:
-locals
- .event XExposeEvent
-endl
- lea eax, [.event]
- mov ecx, [hApplicationDisplay]
- mov edx, [esi+XEvent.window]
- mov [eax+XExposeEvent.type], Expose
- mov [eax+XExposeEvent.display], ecx
- mov [eax+XExposeEvent.window], edx
-
- cinvoke XSendEvent, ecx, edx, FALSE, ExposureMask, eax
-
-.end_mouse:
- pop edi esi
- clc
- return
-
-.expose:
- stdcall _DrawBtnFace, [esi+XEvent.window], [edi+TButton.state]
- clc
- pop edi esi
- return
-endp
-
-
-
-
-
-
-
-proc _DrawBtnFace, .hwin, .state
-.attr XWindowAttributes
-.name dd ?
-.font dd ?
-.direction dd ?
-.ascent dd ?
-.descent dd ?
-.overall XCharStruct
-
-begin
- pushad
-
- lea ecx, [.attr]
- cinvoke XGetWindowAttributes, [hApplicationDisplay], [.hwin], ecx
- dec [.attr.width]
- dec [.attr.height]
-
- cinvoke XCreateGC, [hApplicationDisplay], [.hwin], 0, 0
- mov ebx, eax
-
-; clear the background
- cinvoke XSetForeground, [hApplicationDisplay], ebx, $d4d0c8
- cinvoke XFillRectangle, [hApplicationDisplay], [.hwin], ebx, 1, 1, [.attr.width], [.attr.height]
-
-; draw button frame
- mov eax, $ffffff
- mov ecx, $000000
-
- cmp [.state], btnPointed
- je .border_ok
-
- xchg eax, ecx
-
- cmp [.state], btnPressed
- je .border_ok
-
-; normal state.
- mov eax, $e0e0e0
- mov ecx, $808080
-
-.border_ok:
- stdcall DrawBtnFrame, ebx, [.hwin], eax, ecx, 0, 0, [.attr.width], [.attr.height]
-
- cinvoke XSetForeground, [hApplicationDisplay], ebx, $000000
- cinvoke XLoadQueryFont, [hApplicationDisplay], cGUIfont
- mov [.font], eax
- cinvoke XSetFont, [hApplicationDisplay], ebx, [eax+XFontStruct.fid]
-
- lea ecx, [.name]
- cinvoke XFetchName, [hApplicationDisplay], [.hwin], ecx
-
- stdcall StrLength, [.name]
- mov edi, eax
- lea ecx, [.direction]
- lea edx, [.ascent]
- lea eax, [.descent]
- lea esi, [.overall]
- cinvoke XTextExtents, [.font], [.name], edi, ecx, edx, eax, esi
-
- xor eax, eax
- mov ax, [.overall.ascent]
- add ax, [.overall.descent]
- movsx eax, ax
- sub eax, [.attr.height]
- add eax, 1
- neg eax
- sar eax, 1
- movsx ecx, [.overall.ascent]
- lea eax, [eax+ecx+1] ; this is the baseline.
- mov [.attr.y], eax
-
- mov ax, [.overall.width]
- movsx eax, ax
- sub eax, [.attr.width]
- add eax, 1
- neg eax
- sar eax, 1
- add eax, 1
- cmp eax, 1
- jge @f
- mov eax, 1
-@@:
- mov [.attr.x], eax
-
-; debug only
-; cinvoke XDrawLine, [hApplicationDisplay], [.hwin], ebx, [.attr.x], 1, [.attr.x], [.attr.height]
-; cinvoke XDrawLine, [hApplicationDisplay], [.hwin], ebx, 1, [.attr.y], [.attr.width], [.attr.y]
-
- stdcall StrLength, [.name]
- cinvoke XDrawString, [hApplicationDisplay], [.hwin], ebx, [.attr.x], [.attr.y], [.name], eax
-
- cinvoke XFree, [.name]
- cinvoke XFreeFont, [hApplicationDisplay], [.font]
- cinvoke XFreeGC, [hApplicationDisplay], ebx
-
- popad
- return
-endp
-
-
-proc DrawBtnFrame, .GC, .hwin, .upcolor, .dncolor, .left, .top, .right, .bottom
-begin
- cinvoke XSetForeground, [hApplicationDisplay], [.GC], [.upcolor]
- cinvoke XDrawLine, [hApplicationDisplay], [.hwin], [.GC], [.left], [.top], [.right], [.top]
- cinvoke XDrawLine, [hApplicationDisplay], [.hwin], [.GC], [.left], [.top], [.left], [.bottom]
-
- cinvoke XSetForeground, [hApplicationDisplay], [.GC], [.dncolor]
- cinvoke XDrawLine, [hApplicationDisplay], [.hwin], [.GC], [.left], [.bottom], [.right], [.bottom]
- cinvoke XDrawLine, [hApplicationDisplay], [.hwin], [.GC], [.right], [.bottom], [.right], [.top]
-
- return
-endp
-
-
-
-
-
-
-iglobal
- cGUIfont db '*helvetica-medium-r*--12*', 0 ;'*lucida-medium-r*-sans-12*',0
-endg
-
-
-proc StrLength, .name
-begin
- push ecx
- mov ecx, [.name]
- xor eax, eax
- jecxz .exit
-
- dec eax
-.loop:
- inc eax
- cmp byte [ecx+eax], 0
- jne .loop
-.exit:
- pop ecx
- return
-endp
-
DELETED freshlib/_trash/SurplusSources/Linux/TFormLinux.asm
Index: freshlib/_trash/SurplusSources/Linux/TFormLinux.asm
==================================================================
--- freshlib/_trash/SurplusSources/Linux/TFormLinux.asm
+++ /dev/null
@@ -1,100 +0,0 @@
-proc TForm.Create, .obj, .parent
-begin
- push eax ecx edx esi edi
-
- mov ebx, [.obj]
-
- mov eax, [.parent]
- test eax, eax
- jz .root
- mov eax, [eax+TWindow.handle]
- jmp .parentok
-
-.root:
- mov eax, [hRootWindow]
-
-.parentok:
- cinvoke XCreateSimpleWindow, [hApplicationDisplay], eax, 0, 0, 1, 1, 1, 0, $d4d0c8
- mov [ebx+TForm.handle], eax
-
- stdcall _SetWindowStruct, eax, ebx
-
- cinvoke XSetWMProtocols, [hApplicationDisplay], [ebx+TForm.handle], wmdelete_atom, 1
- cinvoke XSelectInput, [hApplicationDisplay], [ebx+TForm.handle], ExposureMask or KeyPressMask or KeyReleaseMask or SubstructureNotifyMask
-
- pop edi esi edx ecx eax
- return
-endp
-
-
-
-proc TForm.Get, .obj, .idparam
-begin
- stc
- return
-endp
-
-
-proc TForm.Set, .obj, .idparam, .value
-begin
- stc
- return
-endp
-
-
-
-
-proc TForm.SysEventHandler, .ptrEvent
-begin
- push esi edi
-
- stdcall _GetWindowStruct, [esi+XEvent.window]
- mov edi, eax
-
- mov esi, [.ptrEvent]
-
- mov eax, [esi+XEvent.type]
-
- cmp eax, Expose
- je .expose
-
- cmp eax, DestroyNotify
- je .destroy_notify
-
- cmp eax, ClientMessage
- je .clientmessage
-
-.finish:
- pop edi esi
- stc ; not processed
- return
-
-.clientmessage:
- mov eax, dword [esi+XClientMessageEvent.data]
- mov ecx, [wmdelete_atom]
- cmp eax, ecx
- je .do_destroy
-
- clc
- pop edi esi
- return
-
-.do_destroy:
- cinvoke XDestroyWindow, [hApplicationDisplay], [esi+XClientMessageEvent.window]
- clc
- pop edi esi
- return
-
-.destroy_notify:
- stdcall FreeMem, edi
-
- clc
- pop edi esi
- return
-
-.expose:
- stc
- pop edi esi
- return
-endp
-
DELETED freshlib/_trash/SurplusSources/Linux/_common.asm
Index: freshlib/_trash/SurplusSources/Linux/_common.asm
==================================================================
--- freshlib/_trash/SurplusSources/Linux/_common.asm
+++ /dev/null
DELETED freshlib/_trash/SurplusSources/Linux/allutils.asm
Index: freshlib/_trash/SurplusSources/Linux/allutils.asm
==================================================================
--- freshlib/_trash/SurplusSources/Linux/allutils.asm
+++ /dev/null
@@ -1,1 +0,0 @@
-include '_common.asm'
DELETED freshlib/_trash/SurplusSources/OldLibs/lists.asm
Index: freshlib/_trash/SurplusSources/OldLibs/lists.asm
==================================================================
--- freshlib/_trash/SurplusSources/OldLibs/lists.asm
+++ /dev/null
@@ -1,191 +0,0 @@
-;------------------------------------------------------------------
-; Creates TList dynamic list
-; or init existing one.
-; if ptrList = NULL, the memory for the list will be allocated.
-; Returns: pointer to TList structure, properly initialized.
-;------------------------------------------------------------------
-proc ListCreate, .ptrList
-begin
- push ebx esi
- xor ebx, ebx
- mov esi, [.ptrList]
- test esi,esi
- jnz .listok
-
- invoke HeapAlloc, [hHeap], ebx, sizeof.TList
- mov esi, eax
-
-.listok:
- mov [esi+TList.Count], ebx
-
- invoke HeapAlloc, [hHeap], HEAP_ZERO_MEMORY, 4*cMinListCapacity
- mov [esi+TList.ptrItems], eax
-
- mov eax, esi
- pop esi ebx
- return
-endp
-
-
-;--------------------------------------------
-; Frees all elements of the list calling
-; [FreeProc] on every element.
-; (proc FreeProc, ptrItem)
-; Frees the array of items
-;--------------------------------------------
-proc ListFree, .ptrList, .FreeProc
-begin
- push esi edi ebx
-
- mov edi, [.ptrList]
- xor ebx, ebx
- xor esi, esi
- xchg esi, [edi+TList.ptrItems]
- xchg ebx, [edi+TList.Count]
-
- cmp [.FreeProc], 0
- je .endwhile
-
- test esi, esi
- jz .finish
-
-.freeloop:
- dec ebx
- js .endwhile
-
- lea eax, [esi+4*ebx]
- stdcall [.FreeProc], [eax]
- jmp .freeloop
-
-.endwhile:
- invoke HeapFree, [hHeap], 0, esi
-
-.finish:
- pop ebx edi esi
- return
-endp
-
-
-
-;-----------------------------------------
-; Inserts new element in the list and
-; returns it's address.
-; If [Index] is bigger than List.Count
-; the new element will be appended as last
-; element.
-;-----------------------------------------
-proc ListInsert, .ptrList, .Index
-begin
- push esi edi ebx
-
- mov esi, [.ptrList]
-
- invoke HeapSize, [hHeap], 0, [esi+TList.ptrItems]
- cmp eax, -1
- je .exiterror
-
- shr eax, 2 ; get capacity
- mov ebx, eax
-
- mov edi, [.Index]
- cmp edi, [esi+TList.Count]
- jb .indexok
- mov edi, [esi+TList.Count]
-
-.indexok:
- cmp [esi+TList.Count], ebx
- jb .capacityok
-
- mov eax, ebx
- shr eax, 1
- add eax, 2
-
- cmp eax, 1024
- jbe .incok
- mov eax, 1024
-
-.incok:
- add ebx, eax
- shl ebx, 2
- invoke HeapReAlloc, [hHeap], 0, [esi+TList.ptrItems], ebx
- mov [esi+TList.ptrItems], eax
-
-.capacityok:
- mov ecx, [esi+TList.Count]
- sub ecx, edi ; index
- jz .dontmove
-
-; Move the items.
- std
- mov eax, [esi+TList.Count]
- mov esi, [esi+TList.ptrItems]
- lea edi, [esi+4*eax]
- lea esi, [edi-4]
- rep movsd
- cld
-
- mov eax, edi
- jmp .exit
-
-.exiterror:
- xor eax, eax
- jmp .exit
-
-.dontmove:
- inc [esi+TList.Count]
- mov eax, [esi+TList.ptrItems]
- lea eax, [eax+4*edi]
-.exit:
- pop ebx edi esi
- return
-endp
-
-
-
-proc ListDelete, .ptrList, .Index
-begin
- push esi edi ebx
-
- mov esi, [.ptrList]
- mov edi, [.Index]
-
- cmp edi, [esi+TList.Count]
- jae .exit
-
- dec [esi+TList.Count]
- mov ecx, [esi+TList.Count]
- sub ecx, edi
- jz .exit
-
- mov eax, [esi+TList.ptrItems]
- lea edi, [eax+4*edi]
- lea esi, [edi+4]
-
- rep movsd
-
-.exit:
- pop ebx edi esi
- return
-endp
-
-
-proc ListIndexOf, .ptrList, .Item
-begin
- push esi edi
- mov esi, [.ptrList]
- mov ecx, [esi+TList.Count]
- jecxz .empty
- mov edi, [esi+TList.ptrItems]
- lea edi, [edi+4*ecx-4] ; from the end
- mov eax, [.Item]
- std
- repnz scasd
- cld
- jz .found
-.empty:
- dec ecx
-.found:
- mov eax, ecx
- pop edi esi
- return
-endp
DELETED freshlib/_trash/SurplusSources/OldLibs/lists.inc
Index: freshlib/_trash/SurplusSources/OldLibs/lists.inc
==================================================================
--- freshlib/_trash/SurplusSources/OldLibs/lists.inc
+++ /dev/null
@@ -1,7 +0,0 @@
-cMinListCapacity = 128
-
-struct TList
- .Count dd ?
- .ptrItems dd ?
-ends
-
DELETED freshlib/_trash/SurplusSources/OldLibs/qsort.asm
Index: freshlib/_trash/SurplusSources/OldLibs/qsort.asm
==================================================================
--- freshlib/_trash/SurplusSources/OldLibs/qsort.asm
+++ /dev/null
@@ -1,168 +0,0 @@
-QuickSortLib:
-
-;****************************************************
-; Quick sort of the array in the memory.
-;
-; ptrArray - pointer to the memory array.
-; ElementSize - size of one array element in bytes.
-; iBegin - index of the first element
-; iEnd - index of the last element
-; ptrCompareProc - pointer to procedure that compares two elements.
-;
-; ptrCompareProc have interface:
-; proc CompareSomething, ptrElement1, ptrElement2
-; returns: c=1 if elements are not properly sorted.
-; c=0 if elements are sorted, i.e.
-; element1 should be before element2
-;****************************************************
-
-
-proc QSort, ptrArray, ElementSize, iBegin, iEnd, ptrCompareProc
-begin
- push esi edi ebx
- mov esi, [ptrArray]
- mov edi, [ptrCompareProc]
- mov ebx, [ElementSize]
-
- stdcall DoQSort, [iBegin], [iEnd]
- pop ebx edi esi
- return
-endp
-
-;*****************************************************
-; Procedure for internal call from QSort procedure.
-;*****************************************************
-proc DoQSort, Left, Right
-begin
- push ecx
-
- mov ecx, [Left] ; i variable
- mov eax, ecx
- mov edx, [Right] ; j variable
- add eax, edx
- sar eax, 1
- imul eax, ebx
- imul ecx, ebx
- imul edx, ebx
- add eax, esi
- add ecx, esi
- add edx, esi
-
-.repeat:
- sub ecx, ebx
- add edx, ebx
-
-.whylei:
- add ecx, ebx
- stdcall edi, ecx, eax
- jnc .whylei
-
-.whylej:
- sub edx, ebx
- stdcall edi, eax, edx
- jnc .whylej
-
- cmp edx, ecx
- jl .next
-
- call SwapElements
-
- push edx
- cmp eax, ecx
- je @f
- mov [esp], ecx
- cmp eax, edx
- je @f
-
- mov [esp], eax
-@@:
- pop eax
-
- add ecx, ebx
- sub edx, ebx
-
-.next:
- cmp ecx, edx
- jle .repeat
-
- mov eax, edx
- sub eax, esi
- cdq
- idiv ebx
-
- cmp [Left], eax
- jge .leftok
-
- stdcall DoQSort, [Left], eax
-
-.leftok:
- mov eax, ecx
- sub eax, esi
- cdq
- idiv ebx
-
- cmp eax, [Right]
- jge .rightok
-
- stdcall DoQSort, eax, [Right]
-
-.rightok:
- pop ecx
- return
-endp
-
-
-
-;********************************************
-; Swaps two elements of the array with
-; pointers in:
-; Element1 - ecx
-; Element2 - edx
-; ElementSize - ebx
-;********************************************
-proc SwapElements
-begin
- push esi eax
-
- xor esi, esi
-.loop:
- mov al, [ecx+esi]
- xchg al, [edx+esi]
- mov [ecx+esi], al
-
- inc esi
- cmp esi, ebx
- jne .loop
-
- pop eax esi
- return
-endp
-
-
-
-
-proc CompareIntAscending, ptrElement1, ptrElement2
-begin
- push eax esi edi
-
- mov esi, [ptrElement1]
- mov edi, [ptrElement2]
-
- mov eax, [esi]
- cmp eax, [edi]
- jl .qfalse
-
- stc
- pop edi esi eax
- return
-
-
-.qfalse:
- clc
- pop edi esi eax
- return
-endp
-
-
-
-DispSize 'QSort lib', $ - QuickSortLib
DELETED freshlib/_trash/SurplusSources/OldLibs/strlib.asm
Index: freshlib/_trash/SurplusSources/OldLibs/strlib.asm
==================================================================
--- freshlib/_trash/SurplusSources/OldLibs/strlib.asm
+++ /dev/null
@@ -1,1249 +0,0 @@
-;************************************************************
-; FASM dynamic string library.
-;
-; (c)2003 John Found
-; (c)2003 Mateusz Tymek (aka decard)
-; (c)2003 Victor Loh (aka roticv)
-;
-; You can use and modify this library, as long as modifyed
-; versions are clearly marked (author of the modification
-; and what is changed), copyright notice is not
-; removed and the library remains free.
-; Copyright for the library concept and parts written by
-; me, remains to me, John Found
-; Copyright for the modifyed/new parts remains to their
-; authors.
-;
-; Versions:
-; dd.mm.yyyy version author of modification
-; - description
-;--------------------------------------------------------
-; 09.07.2003 v1.0 John Found
-; - the first public version.
-; 15.07.2003 v1.0.1 John Found
-; - minor bug with string table expand. Look in NewStr
-; 17.09.2003 v1.1.0 Mateusz Tymek
-; - made all functions stdcall
-; - added StrCat and StrPos, and modified StrLen
-; 25.09.2003 v1.1.2 Mateusz Tymek, Victor Loh
-; - added StrLCase, StrUCase, StrCopyMMX, StrInsert
-; - added new NumToStr, old version renamed to _NumStr
-; - some small optimizations & bugfixes
-; 26.09.2003 v1.1.3 JohnFound
-; - some bug fixes and style corections.
-; 29.09.2003 v1.1.4 John Found, Mateusz Tymek
-; - library rewtiten to use John Found's stdcall macros
-; - added two new low-level NumToStr routines: NumToStrF and NumToStrUF
-; - NumToStr rewriten
-; - some small bugfixes & modifications
-; - added StrExtract
-; 01.11.2003 v1.1.4.1 Mateusz Tymek
-; - preserved ecx in StrDel (it was destroyed by API calls)
-; 21.11.2003 v1.1.5 John Found
-; - StrComp splitted to 2 functions: StrCompCase and StrCompNoCase
-; IMPORTANT: inversed return result: CARRY = 1 mean strings equal.
-; This is because the using is more natural this way:
-; stdcall StrCompCase, str1, str2
-; jc .equal
-; 27.11.2003 v1.2 John Found
-; - Added function StrHash, that produces 32bit hash value of the string.
-; The hash function is based on FASM hash function and have to be compatible.
-; 03.12.2003 v1.2.3 Mateusz Tymek
-; - Added StrCharPos and StrToNum
-; 13.12.2003 v1.2.4 Materusz Tymek
-; - added StrCharCat and StrInsertChar
-; 04.01.2005 v1.2.5 John Found
-; - Fixed bug in StrSetLength
-; - Added function StrURLEncode
-;*************************************************************************************
-
-
-;--< How to use it >-----------------------------------------------------------------
-; 1. Include "strutils.inc" somewhere in the begining of main file.
-; 2. Define structure "StrTable" of type "TStrTable" somewhere in data section.
-; 3. Before using of library functions, call "InitStrings"
-; 4. After last use of the library (probably on close of application),
-; call "FreeStrings" to free all used memory.
-; 5. Some functions are with register parameter passing, other with "stdcall"
-; parameter passing. Read the header descriptions of the functions.
-;------------------------------------------------------------------------------------
-
-; Global variable, storing parameters of dynamic strings list.
-uglobal
- StrTable TStrTable ; StrLib library variable.
-endg
-
-
-; < Library functions >
-
-;************************************************************************************
-; Allocates memory for string table and allocates memory for strings.
-; Start it before any work with strings.
-; Returns 0 if failed to allocate needed memory.
-;************************************************************************************
-initialize InitStrings
-begin
- StrLib = 1
-
- push esi ebx
- mov esi,StrTable
- invoke GetProcessHeap
- test eax,eax
- jz .finish
- mov [StrTable.heap],eax
- invoke HeapAlloc,[StrTable.heap],HEAP_ZERO_MEMORY, STR_MINCOUNT * 4
- test eax,eax
- jz .finish
- mov [StrTable.ptr],eax
- mov [StrTable.LastHandle], 0
- mov [StrTable.count], STR_MINCOUNT
- or dword [eax], -1
-.finish:
- pop ebx esi
- return
-endp
-
-;**************************************************************************************
-; Frees all memory used for strings library
-; Call it before exit of the program.
-;**************************************************************************************
-finalize FreeStrings
-begin
- push edi esi ebx
- mov esi,[StrTable.ptr]
- mov edi,[StrTable.count]
- xor ebx,ebx
-.freeloop:
- mov ebx, [esi]
- test ebx,ebx
- jz .nxt
- js .nxt
- invoke HeapFree,[StrTable.heap],0,ebx
-.nxt:
- add esi,4
- dec edi
- jnz .freeloop
- invoke HeapFree,[StrTable.heap],0, [StrTable.ptr]
- xor ebx,ebx
- mov [StrTable.heap],ebx
- mov [StrTable.ptr],ebx
- mov [StrTable.count],ebx
- pop ebx esi edi
- return
-endp
-
-;**************************************************************************************
-; Returns the pointer in memory of the hString, or NULL on error
-;**************************************************************************************
-proc StrPtr ; proc StrPtr [hString]
- begin
- mov eax,[esp+4] ; mov eax,[hString]
- test eax,$ffff0000
- jnz .finish ; It's pointer, go to finish.
- cmp eax,[StrTable.count]
- jae .notfound
- push ebx
- mov ebx, [StrTable.ptr]
- mov eax, [4*eax+ebx]
- pop ebx
-.finish:
- ret 4
-.notfound:
- xor eax,eax
- ret 4
-endp
-
-;**************************************************************************************
-; Creates new empty string and returns handle
-; Return: handle of the new created string.
-;**************************************************************************************
-proc StrNew
-begin
- push ebx ecx edx esi edi
-
-; Find first empty place.
- mov ecx,[StrTable.count]
- mov ebx,[StrTable.ptr]
- mov esi,[StrTable.LastHandle]
- xor edx,edx
-
-.search:
- inc esi
- cmp esi, [StrTable.count]
- jne @f
- xor esi,esi
- inc esi
-@@:
- cmp [4*esi+ebx],edx
- je .found
- dec ecx
- jnz .search
-
-.notfound: ; expands the table. esi is right.
- mov esi, [StrTable.count]
- mov eax, esi
- shl eax,1
- add eax, esi
- shr eax,1 ; count = count * 1.5
- inc eax
- mov [StrTable.count],eax
- shl eax,2
- invoke HeapReAlloc,[StrTable.heap],HEAP_ZERO_MEMORY, [StrTable.ptr],eax
- mov [StrTable.ptr],eax
- mov ebx, eax ; 15.07.2003 this added to repair bug with table expanding
-
-.found: ; [4*esi+ebx] points to StrTable entry.
- mov [StrTable.LastHandle], esi
- invoke HeapAlloc, [StrTable.heap], HEAP_ZERO_MEMORY, STR_MINSTRLEN
- mov dword [eax], 0
- mov [4*esi+ebx],eax
- mov eax,esi
- pop edi esi edx ecx ebx
- return
-endp
-
-;**************************************************************************
-; Deletes the string if it is possible.
-;**************************************************************************
-proc StrDel, .hString
- begin
- push eax ebx ecx edx esi
- mov esi, [StrTable.ptr]
- mov eax,[.hString] ; mov eax,[hString]
- test eax, eax
- jz .finish
- test eax,$ffff0000
- jz .process
-; Find the pointer in the table.
- mov ecx, [StrTable.count]
- xor ebx,ebx
-.search:
- cmp [esi+4*ebx],eax
- je .free
- inc ebx
- dec ecx
- jnz .search
- jmp .finish
-
-.process:
- mov ebx, eax
- stdcall StrPtr,eax
- test eax,eax
- jz .finish
-.free:
- invoke HeapFree, [StrTable.heap], 0, eax
- mov dword [esi+4*ebx], NULL ; Set the cell of the table to null.
-.finish:
- pop esi edx ecx ebx eax
- return
-endp
-
-
-;**************************************************************************
-; Duplicates given string, and returns a handle to new one
-;**************************************************************************
-proc StrDup ; proc StrDup [hBaseStr]
-begin
- mov eax,[esp+4] ; mov eax,[esp+4]
- or eax,eax
- jz .exit
- stdcall StrNew
- stdcall StrCopy, eax,dword[esp+4] ; stdcall StrCopy, [hBaseStr]
-.exit: ret 4
-endp
-
-;**************************************************************************
-; Returns the length of the string.
-; Arguments:
-; hString - handle or pointer to the string (static or dynamic)
-;**************************************************************************
-proc StrLen, .hString ; proc StrLen [hString]
- begin
- push ebx
- stdcall StrPtr, [.hString]
- mov ebx,eax
- .scan:
- cmp byte[eax],0
- lea eax,[eax+1]
- jne .scan
- sub eax,ebx
- dec eax ; return value in eax
- pop ebx
- return
-endp
-
-;***************************************************************************
-; If the hString is larger than length - do nothing
-; If the hString is smaller than length -> set the length of string to length
-; returns pointer to the new (old) string
-;
-; Arguments:
-; hString - string handle. /not pointer!/
-; length - new string length.
-; Returns: pointer to the string.
-;***************************************************************************
-proc StrSetLength, .hString, .length ; proc StrSetLength [hString], [length]
- begin
- push ebx ecx edx esi edi ; esp=esp-20
-
- mov ebx, [.length] ; mov ecx,[length]
- lea ebx, [ebx+4] ; the string have to be at least 1 dword bigger than the length specified.
-
- mov eax,[.hString] ; mov eax,[hString]
- test eax,$ffff0000 ; if eax is pointer then error
- jnz .error
- cmp eax,[StrTable.count] ; invalid handle.
- jge .error
-
- mov edi,[StrTable.ptr]
- lea edi,[4*eax+edi] ; points to the address of table pointer of destination string
- mov esi,[edi]
- test esi,esi ; Error string not defined
- jz .error ;
-
- invoke HeapSize, [StrTable.heap], 0, esi
- cmp eax,-1
- je .error
- cmp eax,ebx
- jl .resize
- mov eax,esi
- jmp .finish
-
-.resize:
- invoke HeapReAlloc, [StrTable.heap], HEAP_GENERATE_EXCEPTIONS or HEAP_ZERO_MEMORY, esi, ebx
- mov [edi], eax
- jmp .finish
-
-.error:
- xor eax,eax
-
-.finish:
- pop edi esi edx ecx ebx
- return
-endp
-
-
-;***************************************************************************************
-; Copyes source to destination string.
-; Arguments:
-; source - destination string (handle only)
-; dest - source string (handle or pointer)
-;***************************************************************************************
-proc StrCopy, .dest, .source
- begin
- push esi edi eax ecx
- mov edi,[.dest]
- test edi,$ffff0000 ; if edi is pointer go to finish.
- jnz .finish
- mov esi,[.source]
- test esi,esi
- jz .finish
- stdcall StrPtr, esi
- mov esi,eax
- test esi, esi
- jz .finish
- stdcall StrLen, eax
- inc eax
- mov ecx,eax
- stdcall StrSetLength, edi,eax
- test eax,eax
- jz .finish
- stdcall StrPtr, edi
- mov edi,eax
- cld
- rep movsb ; copy strings
-.finish:
- pop ecx eax edi esi
- return
-endp
-
-;***************************************************************************************
-; Compares two strings - case sensitive.
-; Returns CARRY = 1 if the strings are equal.
-; Returns CARRY = 0 if the strings are different.
-;***************************************************************************************
-proc StrCompCase, .str1, .str2
-begin
- push eax esi edi
-
- cmp [.str1], 0
- je .noteq
- cmp [.str2], 0
- je .noteq
-
- stdcall StrPtr, [.str1]
- mov esi,eax
- stdcall StrPtr, [.str2]
- mov edi,eax
-.loop:
- mov al, [esi]
- lea esi, [esi+1]
- cmp al, [edi]
- lea edi, [edi+1]
- jne .noteq
-
- test al, al
- jnz .loop
-
- stc
- pop edi esi eax
- return
-
-.noteq:
- clc
- pop edi esi eax
- return
-endp
-
-
-;***************************************************************************************
-; Compares two strings - case NOT sensitive.
-; Returns CARRY = 1 if the strings are equal.
-; Returns CARRY = 0 if the strings are different.
-;***************************************************************************************
-proc StrCompNoCase, .str1, .str2
-begin
- push eax esi edi
- stdcall StrPtr, [.str1]
- mov esi,eax
- stdcall StrPtr, [.str2]
- mov edi,eax
-
-.cmploop:
- mov al, [esi]
- lea esi, [esi+1]
- mov ah, [edi]
- lea edi, [edi+1]
-
- test al,al
- jz .eos
- test ah,ah
- jz .noteq
-
- or eax, $2020
- cmp al, ah
- je .cmploop
-
-.noteq:
- clc
- pop edi esi eax
- return
-
-.eos:
- test ah,ah
- jnz .noteq
-
- stc
- pop edi esi eax
- return
-endp
-
-
-
-;*******************************************************************************
-; Get the text of the [Control] using WM_GETTEXT and put it to the string with
-; handle (only) in [string].
-;
-; if [string] = NULL creates new string and returns the handle.
-; if [string] <> NULL just copyes the text.
-;*******************************************************************************
-proc GetControlText, .Control, .string
-.res dd ?
-.len dd ?
-begin
- push ebx edi
- mov eax,[.string]
- test eax,eax
- jnz @f
- stdcall StrNew
-@@:
- mov [.res],eax
- invoke SendMessage, [.Control], WM_GETTEXTLENGTH, 0, 0
- add eax, 16
- mov [.len], eax
- stdcall StrSetLength, [.res], eax
- test eax,eax
- jz .error
- invoke SendMessage, [.Control], WM_GETTEXT, [.len], eax
- mov eax,[.res]
-.error:
- pop edi ebx
- return
-endp
-
-;*******************************************************************************
-; Sets the text in control using WM_SETTEXT from string with handle or pointer
-; in [string].
-;*******************************************************************************
-proc SetControlText, .Control, .string
-begin
- push eax ecx edx
- stdcall StrPtr, [.string]
- invoke SendMessage, [.Control], WM_SETTEXT, 0, eax
- pop edx ecx eax
- return
-endp
-
-;**********************************************************
-; Creates string and assigns it to variable. If variable
-; already contains string handle, the old string will be
-; deleted.
-; Arguments:
-; [ptrHString] - variable containing string handle.
-; ptrSource - pointer to the source for string.
-;**********************************************************
-; Bug fix 26.09.2003 JohnFound
-proc SetString, .ptrHString, .ptrSource
-begin
- push eax esi
- mov esi, [.ptrHString]
-
- cmp dword [esi], 0
- je @f
- stdcall StrDel, [esi]
-@@:
- stdcall StrNew
- mov [esi], eax
- stdcall StrCopy, eax, [.ptrSource]
- pop esi eax
- return
-endp
-
-;**********************************************************************************
-; StrCat appends one string to another
-; Arguments:
-; dest - destination string (handle only)
-; source - source string
-;**********************************************************************************
-proc StrCat, .dest, .source
-begin
- push eax ebx ecx
-
- stdcall StrLen, [.dest]
- mov ebx,eax ; store dest length in ebx
-
- stdcall StrLen, [.source]
- add eax, ebx
- inc eax ; new dest length
- stdcall StrSetLength, [.dest], eax
- add ebx, eax ; calculate end of old dest in ebx
- stdcall StrPtr, [.source]
-.copy:
- mov cl,[eax]
- inc eax
- mov [ebx],cl
- inc ebx
- or cl,cl
- jnz .copy
- pop ecx ebx eax
- return
-endp
-
-
-;**********************************************************************************
-; StrCharPos returns a pointer to the first occurence of a given char
-; in specified string
-; Arguments:
-; Char - char to look for
-; hString - string to search
-; Returns: a pointer to the char in source, or NULL if char doesn't occur
-; in given string
-;**********************************************************************************
-proc StrCharPos, .hPattern, .char
- begin
- push esi
- stdcall StrPtr,[.hPattern]
- mov esi,eax
- mov eax,[.char]
- xchg al,ah
- .search:
- mov al,[esi]
- inc esi
- or al,al
- je .not_found
- cmp al,ah
- jne .search
- mov eax,esi
- dec eax
- pop esi
- return
- .not_found:
- xor eax,eax
- pop esi
- return
-endp
-
-
-;**********************************************************************************
-; StrPos returns a pointer to the first occurence of a pattern string
-; in another string
-; Arguments:
-; hPattern - 'pattern' string
-; hString - string to search
-; Returns: a pointer to the pattern string in source , or NULL if pattern string
-; doesn't occur in the string to search
-;**********************************************************************************
-proc StrPos ; proc StrPos [hString], [hPattern]
-begin
- push ebx ecx edx esi edi ; esp = esp -20
- mov esi,[esp+20+8] ; mov esi,[hPattern]
- mov edi,[esp+20+4] ; mov edi,[hString]
- stdcall StrLen, edi
- mov ebx,eax ; now ebx holds lenght of the string to search
- stdcall StrLen, esi
- mov edx,eax ; now edx holds length of the pattern string
- stdcall StrPtr, esi
- mov esi,eax ; put pointer to the pattern str in esi
- stdcall StrPtr,edi
- mov edi,eax ; put pointer to the search str in edi
- lodsb ; load first character of the pattern
- mov ecx,ebx ;
- mov ebx,edx ; put str_len(pattern)-1 in ebx
- dec ebx ;
- .search:
- repne scasb
- jne .not_found
- cmp ecx,ebx
- jb .not_found
- push edi esi ecx
- or ebx,ebx ; ebx==0 means that we were searching for one
- jz .got_it ; character. We found it, so we stop.
- mov ecx,ebx
- repe cmpsb
- jne .not_match
- .got_it:
- pop ecx esi edi
- dec edi
- mov eax,edi
- .ret:
- pop edi esi edx ecx ebx
- ret 8
- .not_match:
- pop ecx esi edi
- jmp .search
- .not_found:
- xor eax,eax
- jmp .ret
-endp
-
-;**********************************************************************************
-; StrInsert inserts one string into another at specified pos
-; Arguments:
-; dest - destination where the source will be inserted (handle only)
-; source - string to insert
-;**********************************************************************************
-proc StrInsert ; proc StrInsert [dest], [source], [pos]
- begin
- push eax ebx ecx esi edi ; esp = esp-20
- stdcall StrLen, dword[esp+20+4] ; stdcall StrLen,[dest]
- cmp eax,dword[esp+20+12] ; cmp eax,[pos]
- jb .ret ; don't insert a string if pos>StrLen(dest)
- inc eax
- mov ecx,eax
- stdcall StrNew ; create temporary string...
- mov ebx,eax ; ... and store its handle in ebx
- stdcall StrSetLength, ebx,ecx
- stdcall StrPtr, dword[esp+20+4] ; stdcall StrPtr,[dest]
- mov esi,eax
- stdcall StrPtr, ebx
- mov edi,eax
- mov ecx,dword[esp+20+12] ; mov ecx,[pos]
- jz @f
- rep movsb
- @@: stdcall StrCat, ebx,dword[esp+20+8] ; stdcall StrCat, ebx,[source]
- stdcall StrCat, ebx,esi
- mov eax,dword[esp+24]
- stdcall StrCopy, eax,ebx
- stdcall StrDel, ebx
- .ret:
- pop edi esi ecx ebx eax
- ret 12
-endp
-
-;**********************************************************************************
-; Converts strings to Lower Case
-; First parameter = String to Convert to lower case
-; corrupts eax
-;**********************************************************************************
-proc StrLCase ; proc StrLCase [hString]
- begin
- push edi
- stdcall StrPtr, [esp+4+1*4]
- xchg edi, eax
-._lowercaseloop:
- mov al, [edi]
- cmp al, 'A'
- jc @F
- cmp al, 'Z'
- ja @F
- or byte[edi], 20h
-@@:
- cmp byte[edi],0
- lea edi, [edi+1]
- jnz ._lowercaseloop
- pop edi
- retn 4
-endp
-
-
-;**********************************************************************************
-; Converts strings to Upper Case
-; First parameter = String to Convert to upper case
-; corrupts eax
-;**********************************************************************************
-proc StrUCase ; proc StrUCase [hString]
- begin
- push edi
- stdcall StrPtr, [esp+4+1*4]
- xchg edi, eax
-._uppercaseloop:
- mov al, [edi]
- cmp al, 'a'
- jc @F
- cmp al, 'z'
- ja @F
- sub byte[edi], 20h
-@@:
- cmp byte[edi], 0
- lea edi, [edi+1]
- jnz ._uppercaseloop
- pop edi
- retn 4
-endp
-
-;**********************************************************************************
-; String copy mmx version for long strings does by copying qword at a time
-; First parameter = String destination
-; Second parameter = String source
-;**********************************************************************************
-proc StrCopyMMX ; proc StrCopyMMX [str1], [str2]
- begin
- push eax
- push ebx
- push ecx
- push edx
- stdcall StrPtr, [esp+4+4*4]
- xchg eax, edx
- stdcall StrPtr, [esp+8+4*4]
- mov ecx,eax
- stdcall StrLen,eax
- stdcall StrSetLength, [esp+4+4*4+4], eax
- mov eax,ecx
- xor ecx,ecx
- pxor MM7, MM7
-.MMX_loop:
- movq MM0, [eax+ecx]
- movq MM1, MM0
- pcmpeqb MM0, MM7
- packsswb MM0, MM0
- movd ebx, MM0
- test ebx, ebx
- jnz .normal_copy
- movq [edx+ecx], MM1
- add ecx, 8
- jmp .MMX_loop
-.normal_copy:
- mov bl, [eax+ecx]
- mov [edx+ecx], bl
- inc ecx
- test bl, bl
- jnz .normal_copy
- pop edx
- pop ecx
- pop ebx
- pop eax
- retn 8
-endp
-
-;**********************************************************************************
-; StrExtract copies the part of [str] from [index] with lenght in [len]
-; Returns handle to new created string.
-;**********************************************************************************
-proc StrExtract, .string, .index, .len
-begin
- push ebx ecx esi edi
- stdcall StrLen,[.string]
- cmp eax,[.index]
- jbe .error
- stdcall StrNew
- mov ebx,eax
- mov ecx,[.len]
- stdcall StrSetLength, eax,ecx ; stdcall StrSetLength, eax,[len]
- stdcall StrPtr, eax
- mov edi,eax
- stdcall StrPtr, [.string]
- add eax,[.index]
- mov esi,eax
- @@: mov al,[esi]
- mov [edi],al
- inc esi
- inc edi
- or al,al
- jz .copied
- dec ecx
- jnz @b
- xor al,al
- mov [edi],al
- .copied:
- mov eax,ebx
- pop edi esi ecx ebx
- return
- .error:
- xor eax,eax
- pop edi esi ecx ebx
- return
-endp
-
-;**********************************************************************************
-; _NumToStr converts the number in eax to the string in any radix approx. [2..26]
-; Arguments:
-; [edi] - pointer to the string buffer
-; ecx - radix
-; eax - number to convert.
-; There is no parameter check, so be careful.
-; returns: edi points to the end of a converted number
-;**********************************************************************************
-proc _NumToStr
-begin
- test eax,eax
- jns _NumToStrU
- neg eax
- mov byte [edi],"-"
- inc edi
-endp
-
-proc _NumToStrU
-begin
- cmp eax,ecx
- jb .lessA
- xor edx,edx
- div ecx
- push edx
- call _NumToStrU
- pop eax
-.lessA:
- cmp al, 10
- sbb al, 69h
- das
- stosb
- return
-endp
-
-;*****************************************************
-; NumToStrF:
-; Converts signed integer value to string.
-; NumToStrUF:
-; Converts unsigned integer value to string.
-;
-; edi - pointer to string buffer
-; eax - Number to convert
-; ecx - radix from 2 to $ff
-; esi - length of the number in chars
-;
-; returns: edi - pointer to the end of converted num
-;
-; Note: Don't use 1 as radix.
-;*****************************************************
-proc NumToStrF
-begin
- test eax,eax
- jns NumToStrUF
- neg eax
- mov byte [edi],'-'
- push esi
- dec esi
- add edi,esi
- push edi
- jmp NumToStrUF.loopc
-endp
-
-proc NumToStrUF
- begin
- push esi
- add edi, esi
- push edi
- dec edi
-.loopc:
- xor edx,edx
- div ecx
- xchg al,dl
- cmp al,$0a
- sbb al,$69
- das
- mov [edi],al
- dec edi
- xchg al,dl
- dec esi
- jnz .loopc
- pop edi
- pop esi
- return
-endp
-
-
-;***********************************************************
-; NumToStr - converts number to any radix.
-; num - number to convert
-; str - handle of the string. If NULL - creates new string.
-; index - Offset in string where to put converted number.
-; flags:
-; byte 0 - number of digits if ntsFixedWidth is set.
-; byte 1 - contains radix for the convertion.
-; byte 2,3 - flags.
-; Returns:
-; eax - handle of the string (new one or passed in [str])
-; edx - pointer to the string.
-;***********************************************************
-proc NumToStr, .num, .strng, .index, .flags
-.max_len dd ?
-.len_tab rb 20 ; table that holds maximum number of digits in given system
- begin
- push ebx ecx edx esi edi
-
- mov [.len_tab+2],32+2 ; binary number - max. 32 digits (+2 bytes for '-' character and NULL terminator)
- mov [.len_tab+4],16+2 ; quad number - max. 16 digits
- mov [.len_tab+8],11+2 ; octal number - max. 11 digits
- mov [.len_tab+10],9+2 ; decimal number - max. 9 digits
- mov [.len_tab+16],8+2 ; hexadecimal number - max. 8 digits
- movzx ebx,byte [.flags+1] ; load radix into ebx
- movzx eax,byte[.len_tab+ebx]
- mov [.max_len],eax ; store max. number of digits
- mov eax,[.strng]
- or eax,eax
- jnz .string_exists
- stdcall StrNew
- mov [.strng],eax
- .string_exists:
- test eax,0xffff0000
- jnz @f ; don't resize if [str] isn't a handle
- mov ebx,eax
- mov eax,[.max_len]
- add eax,[.index]
- mov edx,eax
- stdcall StrLen,ebx
- cmp eax,edx
- ja @f ; don't resize string if it has enough place for converted number
-
- stdcall StrSetLength,ebx, edx
-
- @@: ; determine which conversion func to use
- mov eax,[.flags]
- mov edx,eax
- and eax,ntsFixedWidth
- jnz .fixed_width
- mov eax,edx
- and eax,ntsUnsigned
- jnz .unsigned
- mov ebx,_NumToStr
- jmp .got_func
- .unsigned:
- mov ebx,_NumToStrU
- jmp .got_func
-
- .fixed_width:
- movzx esi, byte [.flags] ; load fixed width into esi
- mov eax, edx
- and eax, ntsUnsigned
- jnz .fixed_unsigned
- mov ebx,NumToStrF
- jmp .got_func
- .fixed_unsigned:
- mov ebx,NumToStrUF
- .got_func:
- stdcall StrPtr, [.strng]
- add eax,[.index]
- mov edi,eax
- movzx ecx,byte [.flags+1] ; load radix into ecx
- mov eax, [.num]
- call ebx ; call low-level convertion routine
- mov eax, [.flags]
- and eax, ntsZeroTerminated
- jz .ret
- mov byte [edi], 0
-
- .ret:
- pop edi esi edx ecx ebx
- mov eax, [.strng]
- return
-endp
-
-
-;-------------------------------------------------
-; function StrHash
-; Computes 32 bit hash value from the string.
-; The function is compatible with FASM hash
-; function if OrMask = 0.
-;
-; Arguments:
-; hString - handle/pointer of the string.
-; OrMask - every byte from the string will be ORed
-; with this value (byte)
-; Return:
-; eax - 32bit hash value.
-;-------------------------------------------------
-proc StrHashOld, .hString, .OrMask
-begin
- push esi ebx ecx
-
- stdcall StrPtr, [.hString]
- mov esi, eax
-
- xor ebx, ebx
- xor eax, eax
-.hashloop:
- rol eax, 12
- mov ecx, eax
- shr eax, 8
- and ecx, 1111b
- or eax, ecx
- movzx ecx, byte [esi+ebx]
- jecxz .endloop
- or cl, byte [.OrMask]
- add eax, ecx
- inc ebx
- jmp .hashloop
-
-.endloop:
- and eax,0FFFFFFh
- shl ebx,24
- or eax,ebx
- pop ecx ebx esi
- return
-endp
-
-
-proc StrHash, .hString, .OrMask
-begin
- push esi edi ebx ecx edx
-
- stdcall StrPtr, [.hString]
- mov esi, eax
-
- xor ebx, ebx
- mov eax,2166136261 ; FNV offset basis
- xor ecx, ecx
- mov edi, 16777619 ; FNV prime
-.hashloop:
- mov cl, [esi+ebx]
- jecxz .endstring
- inc bl
- or cl, byte [.OrMask]
- xor al,cl ; FNV-1a hashing
- mul edi
- jmp .hashloop
-
-.endstring:
- mov edx,eax
- and eax,0FFFFFFh ; xor-fold to 24 bits
- shr edx,24
- xor eax,edx
- shl ebx,24 ; the length of the string
- or eax,ebx ; store length in high 8 bits
- pop edx ecx ebx edi esi
- return
-endp
-
-
-
-;-------------------------------------------------------
-; function StrToNum
-; Converts specified string into a number
-;
-; Arguments:
-; hString - handle/pointer of the string containing
-; number to convert. It doesn't have to be ended by
-; NULL, any other character will stop conversion.
-; Number to convert must be decimal.
-;
-; Return:
-; eax - converted number
-;
-; Note: in case of failture (first char of given pointer
-; isn't a number) function returns -1.
-;-------------------------------------------------------
-proc StrToNum, .hString
- begin
- push ebx edx esi
- xor ebx,ebx ; ebx will store our number
- stdcall StrPtr, [.hString]
- mov esi,eax
- xor eax,eax
- mov al,[esi]
- cmp al,'0'
- jb .error
- cmp al,'9'
- jbe .digit
- jmp .error
- .digit:
- sub al,'0'
- add ebx,eax
- inc esi
- mov al,[esi]
- cmp al,'0'
- jb .finish
- cmp al,'9'
- ja .finish
- mov edx,ebx ; multiply ebx by 10
- shl ebx,3
- add ebx,edx
- add ebx,edx
- jmp .digit
- .finish:
- mov eax,ebx
- pop esi edx ebx
- return
-
- .error:
- xor eax,eax
- dec eax
- pop esi edx ebx
- return
-endp
-
-;-------------------------------------------------------
-; function StrCharCat
-; Addes specified char to the end of a string
-;
-; Arguments:
-; hString - string to append
-; char - char to add
-;-------------------------------------------------------
-proc StrCharCat, .hString, .char
-begin
- push eax ebx ecx
- mov ebx, [.hString]
- stdcall StrLen, ebx
- mov ecx, eax
- inc eax
- stdcall StrSetLength, ebx, eax
-; stdcall StrPtr, ebx ; StrSetLength returns a pointer to the string
- add ecx, eax
- mov eax, [.char]
- mov [ecx], al
- inc ecx
- mov byte [ecx], 0
- pop ecx ebx eax
- return
-endp
-
-;------------------------------------------------------------
-; function StrInsertChar
-; Inserts specified char into given position ot the string
-;
-; Arguments:
-; hString - string to append
-; char - char to add
-; pos - position where to add the char
-;-------------------------------------------------------------
-proc StrInsertChar, .hString, .char, .pos
- begin
- push eax ebx ecx
- mov ebx, [.hString]
- stdcall StrLen, ebx
- cmp eax, [.pos]
- jb .finish
- je .append
- mov ecx,eax
- inc eax
- stdcall StrSetLength, ebx, eax
- stdcall StrPtr, ebx
- add ecx, eax
- mov ebx, eax
- add ebx, [.pos]
- mov byte [ecx+1], 0 ; add NULL-terminator in the end of our string
- .shift:
- mov al, [ecx-1]
- mov [ecx], al
- dec ecx
- cmp ecx, ebx
- jne .shift
- mov eax, [.char]
- mov [ebx], al
- .finish:
- pop ecx ebx eax
- return
- .append:
- stdcall StrCharCat, ebx, [.char]
- jmp .finish
-endp
-
-
-
-
-
-proc StrURLEncode, .hstr
-.res dd ?
-begin
- push ebx ecx edx esi edi
- stdcall StrPtr, [.hstr]
- mov esi, eax
-
- stdcall StrLen, esi
- mov ecx, eax
- lea edx, [2*eax+eax] ; the encoded string can be max 3x long as original string.
-
- stdcall StrNew
- mov [.res], eax
- jecxz .finish
-
- stdcall StrSetLength, eax, edx
- mov edi, eax
- xor edx, edx
- xor ebx, ebx
-
-.encode:
- lodsb
- cmp al, $80
- jae .store ; it is a hack, but I hope save enough.
-
- mov dl, al
- mov bl, al
- shr edx, 5
- and ebx, $1f
- bt dword [URLCharTable+4*edx], ebx
- jnc .store
-
- mov ah, al
- mov al, '%'
- stosb
- mov al, ah
- shr al, 4
- cmp al, $0a
- sbb al, $69
- das
- stosb
- mov al, ah
- and al, $0f
- cmp al, $0a
- sbb al, $69
- das
-
-.store:
- stosb
- loop .encode
-.end:
- xor al, al
- stosb
-.finish:
- mov eax, [.res]
- pop edi esi edx ecx ebx
- return
-endp
-
-; Contains 1 where the character must be % encoded and 0 where it is save to pass it directly
-URLCharTable db 11111111b ;
- db 11111111b ;
- db 11111111b ;
- db 11111111b ; 0..31 -control chars | encoded
- db 11111111b ; $27 - $20: '&%$#"! | encoded
- db 11111111b ; $2f - $28: /.-,+*)( | encoded
- db 00000000b ; $37 - $30: 76543210 | not encoded
- db 11111100b ; $3f - $38: ?>=<;:98 | partially
- db 00000001b ; $47 - $40: GFEDCBA@ | partially
- db 00000000b ; $4f - $48: ONMLKJIH | not encoded
- db 00000000b ; $57 - $50: WVUTSRQP | not encoded
- db 11111000b ; $5f - $58: _^]\[ZYX | partially
- db 00000001b ; $67 - $60: gfedcba` | partially
- db 00000000b ; $6f - $68: onmlkjih | not encoded
- db 00000000b ; $77 - $70: wvutsrqp | not encoded
- db 11111000b ; $7f - $78: ~}|{zyx | partially
DELETED freshlib/_trash/SurplusSources/OldLibs/strlib.inc
Index: freshlib/_trash/SurplusSources/OldLibs/strlib.inc
==================================================================
--- freshlib/_trash/SurplusSources/OldLibs/strlib.inc
+++ /dev/null
@@ -1,37 +0,0 @@
-STR_MINCOUNT = 10 ; minimum 10 strings in the table
-STR_MINSTRLEN = 16 ; 16 bytes minimum string length
-
-struct TStrTable
- .count dd 0 ; max count of the strings in table.
- .LastHandle dd 0 ; last allocated handle.
- .ptr dd 0 ; pointer to the table data
- .heap dd 0 ; handle of strings heap
-ends
-
-
-; NumToStr flags
-ntsSigned = $00000
-ntsUnsigned = $10000
-ntsZeroTerminated = $20000
-ntsFixedWidth = $40000
-
-ntsBin = $0200
-ntsQuad = $0400
-ntsOct = $0800
-ntsDec = $0a00
-ntsHex = $1000
-
-
-;-------------------------------------
-; It is stand-alone macroses
-;-------------------------------------
-macro IndexedStrings [lparam, string] {
- forward
- local ..lbl
- dd ..lbl, lparam
- common
- dd 0
- forward
-..lbl db string, 0
-}
-
DELETED freshlib/_trash/SurplusSources/Win32/TFormWin32.asm
Index: freshlib/_trash/SurplusSources/Win32/TFormWin32.asm
==================================================================
--- freshlib/_trash/SurplusSources/Win32/TFormWin32.asm
+++ /dev/null
@@ -1,278 +0,0 @@
-;************************************************************
-;* Form class library *
-;* *
-;* This file is part of Fresh base library *
-;* This is base window class for "Fresh" created project *
-;* *
-;* (C)2003, 2004 John Found *
-;************************************************************
-
-
-
-
-
-
-;;*********************************************************************************************
-;; Main window procedure for 'TForm' window class.
-;;*********************************************************************************************
-;winproc FormMessageProc
-;begin
-; push ebx edi esi
-; mov ebx, [.wmsg]
-;
-;ondefault
-; invoke DefWindowProc, [.hwnd],[.wmsg],[.wparam],[.lparam]
-; pop esi edi ebx
-; return
-;
-;;------------------------------------------------------------------------
-;onmessage WM_SYSCOMMAND
-; mov eax, [.wparam]
-; and eax, $fff0
-;
-; cmp eax, SC_KEYMENU
-; jne .ondefault
-;
-; invoke GetParent, [.hwnd]
-; mov ebx, eax
-; test eax, eax
-; jnz .resendmessage
-;
-;; Get the main application window.
-; mov eax, [Application]
-; mov eax, [eax+TApplication.MainWindow]
-; test eax, eax
-; jz .ondefault
-;
-; cmp eax, [.hwnd]
-; je .ondefault
-;
-; mov ebx, eax
-;
-; invoke GetMenu, [.hwnd]
-; test eax, eax
-; jnz .ondefault
-;
-; invoke GetFocus
-; mov [hLastBeforeMenu], eax
-;
-; invoke SetFocus, ebx
-;
-;.resendmessage:
-; invoke SendMessage, ebx, [.wmsg], [.wparam], [.lparam]
-;
-; xor eax, eax
-; pop esi edi ebx
-; return
-;
-;;------------------------------------------------------------------------
-;onmessage WM_ERASEBKGND
-;locals
-; .rect RECT
-;endl
-; lea eax, [.rect]
-; invoke GetClientRect, [.hwnd], eax
-;
-; invoke GetSysColor, COLOR_BTNFACE
-;
-;.colorok:
-; and eax, $ffffff
-; invoke CreateSolidBrush, eax
-; push eax
-; lea ecx, [.rect]
-; invoke FillRect, [.wparam], ecx, eax
-; invoke DeleteObject ; from the stack.
-; xor eax, eax
-; inc eax
-; pop esi edi ebx
-; return
-;
-;;------------------------------------------------------------------------
-;onmessage WM_CLOSE
-;
-; mov eax, [Application]
-; mov eax, [eax+TApplication.MainWindow]
-; cmp eax, [.hwnd]
-; jne .ondefault
-;
-; invoke PostQuitMessage, 0
-; jmp .ondefault
-;
-;;------------------------------------------------------------------------
-;onmessage WM_EXITMENULOOP
-; cmp [hLastBeforeMenu], 0
-; je @f
-;
-; invoke SetFocus, [hLastBeforeMenu]
-;@@:
-; xor eax, eax
-; mov [hLastBeforeMenu], eax
-; pop esi edi ebx
-; return
-;
-;endwp
-;
-;
-;
-;proc GetFocusedControl, .hwnd
-;begin
-; push esi ebx
-; invoke GetFocus
-; mov esi, eax
-;
-;.parentloop:
-; mov ebx, eax
-; invoke GetParent, eax
-; test eax, eax
-; jnz .parentloop
-;
-;; xor eax, eax ; eax is zero here...
-; cmp ebx, [.hwnd]
-; jne .endfocused
-; mov eax, esi
-;.endfocused:
-; pop ebx esi
-; return
-;endp
-;
-;
-;;*********************************************************************************************
-;; Shows given form in modal form.
-;; Returns modal result
-;; This is first version so behaviour is not very proper.
-;;*********************************************************************************************
-;
-;proc ShowModal, .hwnd, .flags
-;
-;.rect RECT
-;
-; begin
-; push esi edi ebx
-;
-; invoke GetFocus
-; push eax ; the parameter for SetFocus at the end of the procedure.
-;
-; lea eax, [.rect]
-; invoke GetWindowRect, [.hwnd], eax
-;
-; mov esi, [.rect.left]
-; mov edi, [.rect.top]
-;
-; test [.flags], MSF_HCENTER
-; jz @f
-;
-; invoke GetSystemMetrics, SM_CXSCREEN
-; sub eax, [.rect.right]
-; add eax, [.rect.left]
-; sar eax,1
-; mov esi, eax
-;@@:
-; test [.flags], MSF_VCENTER
-; jz @f
-;
-; invoke GetSystemMetrics, SM_CYSCREEN
-; sub eax, [.rect.bottom]
-; add eax, [.rect.top]
-; sar eax,1
-; mov edi, eax
-;
-;@@:
-; invoke SendMessage, [.hwnd], WM_INITDIALOG, 0, 0
-; invoke SetWindowPos, [.hwnd], HWND_TOP, esi, edi, 0, 0, SWP_NOSIZE
-; invoke ShowWindow, [.hwnd], SW_SHOW
-;; invoke SendMessage, [.hwnd], AM_CHILDRESIZED, 0, 0
-;
-; invoke GetWindow, [.hwnd], GW_OWNER
-; mov ebx, eax
-;
-;; Disables window owner and all other windows owned by window owner.
-;
-; invoke EnableWindow, ebx, FALSE
-; stdcall EnableAllOwnedWindows, ebx, FALSE ; This is useless if all top level windows
-; ; are TForm, but it is important if not...
-;
-; invoke EnableWindow, [.hwnd], TRUE ; IMPORTANT: re-enable modal window.
-;
-; invoke GetNextDlgTabItem, [.hwnd], NULL, FALSE
-; test eax, eax
-; jz @f
-; invoke SetFocus, eax
-;@@:
-; invoke SetProp, [.hwnd], [propModalResult], MR_NONE
-;
-;; Special message loop for modal window. It not finish until window becomes invisible.
-;.modalloop:
-; call ProcessMessages
-;
-; invoke IsWindowVisible, [.hwnd]
-; test eax,eax
-; jz .endloop
-;
-; invoke GetProp, [.hwnd], [propModalResult]
-; test eax,eax ; mrNone = 0
-; jnz .endloop
-;
-; invoke SendMessage, [.hwnd], AM_ONIDLE, 0, 0
-;
-; invoke WaitMessage
-; jmp .modalloop
-;
-;.endloop:
-; stdcall EnableAllOwnedWindows, ebx, TRUE
-; invoke EnableWindow, ebx, TRUE
-; invoke ShowWindow, [.hwnd], SW_HIDE
-;
-; invoke SetFocus ; the parameter is in stack
-;
-; invoke GetProp, [.hwnd], [propModalResult]
-; pop ebx edi esi
-; return
-;endp
-;
-;
-;;-------------------------------------------------------------
-;; Enables or disables all windows owned by specifyed window.
-;;
-;; fEnable - TRUE = enable
-;; FALSE = disable
-;;-------------------------------------------------------------
-;proc EnableAllOwnedWindows, .hwnd, .fEnable
-; begin
-;
-; mov eax, _EnableOwnedProc
-; cmp [.fEnable], FALSE
-; jne @f
-; mov eax, _DisableOwnedProc
-;@@:
-; invoke EnumWindows, eax, [.hwnd]
-; return
-;endp
-;
-;
-;; callback procedure used in EnableAllOwnedWindows
-;proc _EnableOwnedProc, .hwnd, .owner
-;begin
-;
-; invoke GetWindow, [.hwnd], GW_OWNER
-; cmp eax, [.owner]
-; jne .ready
-; invoke EnableWindow, [.hwnd], TRUE
-;
-;.ready:
-; mov eax, 1
-; return
-;endp
-;
-;
-;; callback procedure used in EnableAllOwnedWindows
-;proc _DisableOwnedProc, .hwnd, .owner
-;begin
-; invoke GetWindow, [.hwnd], GW_OWNER
-;
-; cmp eax, [.owner]
-; jne .ready
-; invoke EnableWindow, [.hwnd], FALSE
-;.ready:
-; mov eax, 1
-; return
-;endp
DELETED freshlib/_trash/SurplusSources/Win32/_chainmsg.asm
Index: freshlib/_trash/SurplusSources/Win32/_chainmsg.asm
==================================================================
--- freshlib/_trash/SurplusSources/Win32/_chainmsg.asm
+++ /dev/null
@@ -1,228 +0,0 @@
-winmessage WM_SUBCLASSED ;(ptrProcedure, Tag) the window receives this message immediately after subclassing with AddWinProc.
-
-struct TChainElement
- .WinProc dd ?
- .Tag dd ?
- .count dd ?
- .next dd ?
-ends
-
-
-iglobal
- winproperty propWinProcChain, 'WinProcChain'
-endg
-
-
-;initialize InitChainMessages
-;begin
-; stdcall CreateWinProperty, propWinProcChain
-; return
-;endp
-;
-;
-;finalize FinalChainMessages
-;begin
-; stdcall DestroyWinProperty, propWinProcChain
-; return
-;endp
-;
-
-
-proc AddWinProc, .hwnd, .winproc, .tag
-begin
- push esi edi
-
- stdcall SearchChainElement, [.hwnd], [.winproc], [.tag]
- jc .addit
-
-; The message handler exists, just inc the count
- inc [esi+TChainElement.count]
- jmp .exit
-
-; Add new message handler.
-.addit:
- stdcall GetMem, sizeof.TChainElement
- mov esi, eax
-
- mov eax, [.winproc]
- mov ecx, [.tag]
- mov [esi+TChainElement.WinProc], eax
- mov [esi+TChainElement.Tag], ecx
- mov [esi+TChainElement.count], 1
-
- invoke GetProp, [.hwnd], [propWinProcChain]
- test eax, eax
- jz .newchain
-
- mov [esi+TChainElement.next], eax
-.save:
- invoke SetProp, [.hwnd], [propWinProcChain], esi
-.exit:
- invoke SendMessage, [.hwnd], WM_SUBCLASSED, [.winproc], [.tag]
- pop edi esi
- return
-
-.newchain:
- stdcall GetMem, sizeof.TChainElement
- mov edi, eax
-
- invoke GetWindowLong, [.hwnd], GWL_WNDPROC
- mov [edi+TChainElement.WinProc], eax
- mov [esi+TChainElement.next], edi
- invoke SetWindowLong, [.hwnd], GWL_WNDPROC, ChainWinProc
- jmp .save
-endp
-
-
-
-
-;----------------------------------------------------
-; if [.winproc] <> 0 removes the message handle with
-; specified [.winproc], [.tag] from the handler chain
-; if [.winproc] = 0 removes the first handler from
-; the chain.
-;----------------------------------------------------
-proc RemoveWinProc, .hwnd, .winproc, .tag
-begin
- push edi esi
-
- stdcall SearchChainElement, [.hwnd], [.winproc], [.tag]
- jc .exit
-
- dec [esi+TChainElement.count]
- jnz .exit ; don't remove, someone needs it.
-
- test edi, edi
- jz .first
-
- mov ecx, [esi+TChainElement.next]
- jecxz .exit ; can't be removed the original handler.
-
- mov [edi+TChainElement.next], ecx
-
-.free:
- stdcall FreeMem, esi
-.exit:
- pop esi edi
- return
-
-.first:
- mov edi, [esi+TChainElement.next]
- cmp [edi+TChainElement.next], 0
- je .removechain
-
- invoke SetProp, [.hwnd], [propWinProcChain], edi
- jmp .free
-
-.removechain:
- invoke SetWindowLong, [.hwnd], GWL_WNDPROC, [edi+TChainElement.WinProc]
- invoke RemoveProp, [.hwnd], [propWinProcChain]
- stdcall FreeMem, edi
- jmp .free
-endp
-
-
-
-;-----------------------------------------------
-; Arguments:
-; .hwnd - handle of the window
-; .winproc - user winproc (if 0 - returns the first in chain)
-; .tag - user defined value.
-; Returns:
-; CF = 0 -> element found.
-; esi - TChainElement
-; edi - previous in chain
-; CF = 1 -> element not found.
-; esi = 0
-; edi = 0 -> the window is not subclassed
-; edi <> 0 -> TChainElement of original winproc
-;-----------------------------------------------
-proc SearchChainElement, .hwnd, .winproc, .tag
-begin
- xor edi, edi
-
- invoke GetProp, [.hwnd], [propWinProcChain]
- mov esi, eax
- test eax, eax
- jz .exit
-
- cmp [.winproc], 0
- je .found
-
-.loop:
- mov ecx, [esi+TChainElement.WinProc]
- mov eax, [esi+TChainElement.Tag]
-
- cmp ecx, [.winproc]
- jne .next
- cmp ecx, [.tag]
- jne .next
-
-.found:
- clc
- return
-
-.next:
- mov edi, esi
- mov esi, [esi+TChainElement.next]
- test esi, esi
- jnz .loop
-
-.exit:
- stc
- return
-endp
-
-
-;--------------------------------------------------------------
-; This is universal message handler for subclassed windows.
-; Saves registers and provides call to the previous handler.
-;--------------------------------------------------------------
-proc ChainWinProc, .hwnd, .wmsg, .wparam, .lparam
-begin
- push ebx esi edi
-
- invoke GetProp, [.hwnd], [propWinProcChain]
- mov ecx, eax
-
-.loop:
- jecxz .finish
-
- push [ecx+TChainElement.next] ; in the case current handler removes itself from the chain.
- mov edi, [ecx+TChainElement.Tag]
- cmp [ecx+TChainElement.WinProc], 0
- jg .procedure
-
- ; handle
- invoke CallWindowProc, [ecx+TChainElement.WinProc], [.hwnd], [.wmsg], [.wparam], [.lparam]
- jmp .next
-
-.procedure:
- stdcall [ecx+TChainElement.WinProc], [.hwnd], [.wmsg], [.wparam], [.lparam]
-
-.next:
- pop ecx
- jc .loop
-
-.finish:
- cmp [.wmsg], WM_DESTROY
- jne .quit
-
-; clear whole chain and remove the property.
- push eax
- xor ebx, ebx
-
-.freeloop:
- stdcall RemoveWinProc, [.hwnd], ebx, ebx
- invoke GetProp, [.hwnd], [propWinProcChain]
- test eax, eax
- jnz .freeloop
- pop eax
-
-.quit:
- pop edi esi ebx
- return
-endp
-
-
-
DELETED freshlib/_trash/SurplusSources/Win32/_winprops.asm
Index: freshlib/_trash/SurplusSources/Win32/_winprops.asm
==================================================================
--- freshlib/_trash/SurplusSources/Win32/_winprops.asm
+++ /dev/null
@@ -1,55 +0,0 @@
-;------------------------------------------------------------------------
-; Macro for defining names for window properties (SetProp/GetProp)
-; that to be used with and without AddAtom function.
-; When the name is not added to the atom table, the first
-; dword of the structure contains pointer to the string.
-; If the macro is added to the application atom table
-; (via CreateProperty procedure), the first dword contains
-; atom handle. In both cases GetProp and SetProp uses [propname] as
-; pointer to the property name.
-;------------------------------------------------------------------------
-macro winproperty [name, string] {
- forward
- align 4
- local ..txt
- name dd ..txt
- TEXT ..txt, string
- dw 0
-}
-
-
-; Various property related string procedures
-proc CreateWinProperty, .ptrProp
-begin
- push ebx
- mov ebx, [.ptrProp]
- invoke IsBadReadPtr, ebx, 4
- test eax, eax
- jnz .exit
-
- invoke IsBadStringPtr, [ebx], 256
- test eax, eax
- jnz .exit
-
- invoke AddAtom, [ebx]
- movzx eax, ax
- mov [ebx], eax
-.exit:
- pop ebx
- return
-endp
-
-
-proc DestroyWinProperty, .ptrProp
-begin
- push ebx
- mov ebx, [.ptrProp]
- invoke IsBadReadPtr, ebx, 4
- test eax, eax
- jnz .exit
-
- invoke DeleteAtom, [ebx]
-.exit:
- pop ebx
- return
-endp
DELETED freshlib/_trash/SurplusSources/Win32/allutils.asm
Index: freshlib/_trash/SurplusSources/Win32/allutils.asm
==================================================================
--- freshlib/_trash/SurplusSources/Win32/allutils.asm
+++ /dev/null
@@ -1,2 +0,0 @@
-Sequence winmessage, WM_USER+$3000
-winmessage.display = 1
DELETED freshlib/_trash/SurplusSources/command_tables.asm
Index: freshlib/_trash/SurplusSources/command_tables.asm
==================================================================
--- freshlib/_trash/SurplusSources/command_tables.asm
+++ /dev/null
@@ -1,824 +0,0 @@
-; This file is not needed anymore, but it contains very tiny implementation of Forth-like script engine.
-; maybe it worths to keep it some time......
-
-__ScriptEngine:
-
-struct TCommandItem
- .name dd ?
- .proc dd ?
-ends
-
-macro CommandList lbl, [name, proc] {
-common
- label lbl dword
-forward
- local len
- dd name, proc
-common
- dd 0
-}
-
-
-CommandList ScriptCommands, \
- 'l' , TFreshEdit.__CommandLeft, \ ; left
- 'r' , TFreshEdit.__CommandRight, \ ; right
- 'u' , TFreshEdit.__CommandUp, \ ; up
- 'd' , TFreshEdit.__CommandDown, \ ; down
- 'ul', TFreshEdit.__CommandScrollLockUp, \ ; up scroll lock
- 'dl', TFreshEdit.__CommandScrollLockDown, \ ; down scroll lock
- 'su', TFreshEdit.__CommandScrollUp, \ ; scroll up
- 'sd', TFreshEdit.__CommandScrollDown, \ ; scroll down
- 'pu', TFreshEdit.__CommandPgUp, \ ; page up
- 'pd', TFreshEdit.__CommandPgDown, \ ; page down
- 'lb', TFreshEdit.__CommandHome, \ ; line begin
- 'le', TFreshEdit.__CommandEnd, \ ; line end
- 'sb', TFreshEdit.__CommandBeginOfScreen, \ ; begin of screen
- 'se', TFreshEdit.__CommandEndOfScreen, \ ;
- 'fb', TFreshEdit.__CommandFileBegin, \ ; file begin
- 'fe', TFreshEdit.__CommandFileEnd, \ ; file end
- 'wp', TFreshEdit.__CommandWordPrev, \ ; word previous
- 'wn', TFreshEdit.__CommandWordNext, \ ; word next
- 'gsm', TFreshEdit.__CommandGetSelectionMode, \ ; get selection mode (0..2)
- 'ssm', TFreshEdit.__CommandSetSelectionMode, \ ; set selection mode (0..2)
- 'gim', TFreshEdit.__CommandGetInsertMode, \ ; get insert mode.
- 'sim', TFreshEdit.__CommandSetInsertMode, \ ; set insert mode.
- 'grc', TFreshEdit.__CommandGetRowCount, \ ; get row count.
-\
-\ ; Aritmerics
-\
- '+', __ScriptPlus, \
- '-', __ScriptMinus, \
- '*', __ScriptMul, \
- '/', __ScriptDiv, \
- '%', __ScriptMod, \
- 'neg', __ScriptNeg, \
-\
-\ ; Output
-\
- '.', __ScriptOutNumber, \
- '?', __ScriptOutString, \
-\
-\ ; Stack operations and variables
-\
- 'swap', __ScriptSwap, \
- 'pop', __ScriptPop, \
- '->', ExecScript.__assign, \
-\
-\ ; word logic
-\
- 'and', __ScriptAnd, \
- 'or', __ScriptOr, \
- 'xor', __ScriptXor, \
- 'not', __ScriptNot, \
-\
-\ ; Loop
-\
- 'rep', __ScriptRepeat, \
- 'loop', __ScriptLoop, \
-\
-\ ; conditional
-\
- 'if', ExecScript.__if, \
- 'else', ExecScript.__else, \
- 'then', ExecScript.__then
-
-
-
-
-macro KeyScripts [scancode, modkeys, script] {
-forward
-local ptrscr
- dd scancode, modkeys
- if script eqtype 'A'
- dd ptrscr
- else
- dd script
- end if
-common
- dd 0
-forward
- if script eqtype 'A'
- ptrscr db script, 0
- align 4
- end if
-}
-
-struc script text {
- db text, 0
- align 4
-}
-
-
-KeyScripts \
- keyUp, 0, scrUp, \
- keyUpNumpad, 0, scrUp, \
- keyDown, 0, scrDown, \
- keyDownNumpad, 0, scrDown, \
- keyLeft, 0, scrLeft, \
- keyLeftNumpad, 0, scrLeft, \
- keyRight, 0, scrRight, \
- keyRightNumpad,0, scrRight, \
- keyPgUp, 0, scrPgUp, \
- keyPgUpNumpad, 0, scrPgUp, \
- keyPgDown, 0, scrPgDn, \
- keyPgDnNumpad, 0, scrPgDn, \
- keyHome, 0, scrHome, \
- keyHomeNumpad, 0, scrHome, \
- keyEnd, 0, scrEnd, \
- keyEndNumpad, 0, scrEnd, \
- keyPgDown, maskCtrl, scrEndOfFile, \
- keyPgDnNumpad, maskCtrl, scrEndOfFile, \
- keyPgUp, maskCtrl, scrBegOfFile, \
- keyPgUpNumpad, maskCtrl, scrBegOfFile, \
- keyHome, maskCtrl, scrBegOfScreen, \
- keyHomeNumpad, maskCtrl, scrBegOfScreen, \
- keyEnd, maskCtrl, scrEndOfScreen, \
- keyEndNumpad, maskCtrl, scrEndOfScreen, \
- keyInsert, 0, scrToggleInsMode, \
- keyInsNumpad, 0, scrToggleInsMode, \
- keyInsert, maskAlt, scrToggleSelectionMode
-
-
-scrUp script 'u'
-scrDown script 'd'
-scrLeft script 'l'
-scrRight script 'r'
-scrPgUp script 'pu'
-scrPgDn script 'pd'
-scrHome script 'lb'
-scrEnd script 'le'
-scrEndOfFile script 'fe'
-scrBegOfFile script 'fb'
-scrBegOfScreen script 'sb'
-scrEndOfScreen script 'se'
-scrToggleInsMode script 'gim 1 xor sim'
-scrToggleSelectionMode script 'gsm 1 + 3 % ssm'
-
-
-
-
-proc ExecScript, .editor, .pScript
-
-.stack rd 16
-
-.pvar dd ?
-.fassign dd ?
-
-.changes dd ?
-
-.errInvalidCommand = -1
-.errInvalidNumber = -2
-.errStackOverflow = -3
-.errMissingQuote = -4
-.errInvalidVar = -5
-.errIfThenElse = -6
-
-
-begin
- push ebx ecx edx esi edi
-
- stdcall GetMem, 65536
- mov [.pvar], eax
-
- mov ecx, 16
- lea edi, [.stack]
- xor eax, eax
- rep stosd
-
- mov [.changes], eax
- mov [.fassign], eax
- mov edi, 15 ; intex to the stack bottom
- mov esi, [.pScript]
-
-.scriptloop:
- xor ebx, ebx
- xor ecx, ecx
- xor eax, eax
-
-.wordloop:
- movzx eax, byte [esi]
-
- cmp al, ' '
- jbe .endofword
-
- cmp al, '@'
- je .variable
-
- cmp al, "'"
- je .string
-
- cmp al, '"'
- je .string
-
- cmp al, '0'
- jb .word
- cmp al, '9'
- jbe .digit
-
-.word:
- inc esi
- shl eax, cl
- or ebx, eax ; command
- add cl, 8
- cmp cl, 32
- jbe .wordloop
- jmp .invalid_command
-
-
-.variable:
- test ecx, ecx
- jnz .invalid_command
-
- mov eax, $811C9DC5 ; 2166136261 ; FNV offset basis
-
-.hashloop:
- inc esi
-
- movzx edx, byte [esi]
-
- cmp edx, ' '
- jbe .endofvar
-
- xor eax, edx
- imul eax, $01000193 ; 16777619 ; FNV prime
- jmp .hashloop
-
-.endofvar:
- mov ebx, eax
- and eax, $ffff
- shr ebx, 16
- xor ebx, eax
- and ebx, $fffc
- add ebx, [.pvar]
-
- cmp [.fassign], 0
- je .pushvar
-; pop var
- mov [.fassign], 0
- cmp edi, 15
- jae .stack_overflow
-
- inc edi
- mov eax, [.stack+4*edi]
- mov [ebx], eax
- jmp .nextchar
-
-.pushvar:
- test edi, edi
- js .stack_overflow
-
- mov eax, [ebx]
- mov [.stack+4*edi], eax
- dec edi
- jmp .nextchar
-
-.string:
- test ecx, ecx
- jnz .invalid_command
-
- inc esi
- mov ebx, esi
-
- xor ecx, ecx
-
-.lenloop:
- cmp byte [esi], 0
- je .missing_quote
-
- cmp byte [esi], al
- je .endofstring
-
- inc esi
- inc ecx
- jmp .lenloop
-
-.endofstring:
- test edi, edi
- js .stack_overflow
-
- stdcall StrNew
- mov [.stack+4*edi], eax
- stdcall StrCopyPart, eax, ebx, 0, ecx
- stdcall StrPtr, eax
-
- dec edi
- inc esi
- jmp .scriptloop
-
-.digit:
- test ecx, ecx
- jnz .invalid_command
-
-.numberloop:
- mov al, [esi]
- cmp al, ' '
- jbe .endofnumber
- inc esi
-
- cmp al, '0'
- jb .invalid_number
- cmp al, '9'
- ja .invalid_number
-
- and eax, $0f
- imul ebx, 10
- add ebx, eax
- jmp .numberloop
-
-.endofnumber:
- test edi, edi
- js .stack_overflow
-
- mov [.stack+4*edi], ebx
- dec edi
-
- test eax, eax
- jz .endofscript
-
- inc esi
- jmp .scriptloop
-
-
-.endofword:
- jecxz .nextchar
- mov eax, ScriptCommands - sizeof.TCommandItem
-
-.search_command:
- add eax, sizeof.TCommandItem
-
- cmp dword [eax], 0
- je .invalid_command
-
- cmp [eax], ebx
- jne .search_command
-
-;.found:
- push esi
- lea ebx, [.stack]
- mov esi, [.editor]
- call [eax+TCommandItem.proc]
- pop esi
-
- jc .stack_overflow
- or [.changes], eax
-
- cmp edi, 15
- ja .stack_overflow
-
-.nextchar:
- inc esi
- cmp byte [esi-1], 0
- jne .scriptloop
-
-.endofscript:
- clc
- mov eax, [.changes]
-
-.finish:
- stdcall FreeMem, [.pvar]
- pop edi esi edx ecx ebx
- return
-
-; Context dependent control commands
-
-; "->" (assign) command
-.__assign:
- mov [.fassign], 1
- xor eax, eax
- clc
- retn
-
-.__if:
- cmp edi, 15
- jae .ifok
-
- inc edi
- cmp [.stack+4*edi], 0
- jne .ifok
-
-; search for else of then
- mov eax, [esp+4] ; stored pointer to the script text
- xor ecx, ecx
-
-.ifloop:
- inc eax
- mov edx, [eax]
- cmp edx, 'else'
- je .else
- cmp edx, 'then'
- je .then
- test edx, $ff000000
- jz .iferror
-
- and edx, $ffff
- cmp edx, 'if'
- jne .ifloop
-
- inc ecx
- jmp .ifloop
-
-.else:
- jecxz .elsehere
- dec ecx
- jmp .ifloop
-
-.elsehere:
- add eax, 4
- cmp byte [eax], ' '
- ja .iferror
-
- mov [esp+4], eax
- jmp .ifok
-
-.then:
- jecxz .thenhere
- dec ecx
- jmp .ifloop
-
-.thenhere:
- add eax, 4
- cmp byte [eax], ' '
- ja .iferror
- mov [esp+4], eax
-
-.ifok:
- xor eax, eax
- clc
- retn
-
-.iferror:
- stc
- mov eax, .errIfThenElse
- retn
-
-
-.__else:
-; search for "then"
- mov eax, [esp+4] ; stored pointer to the script text
- xor ecx, ecx
-
-.elseloop:
- inc eax
- mov edx, [eax]
- cmp edx, 'else'
- je .else2
- cmp edx, 'then'
- je .then2
- test edx, $ff000000
- jz .iferror
-
- and edx, $ffff
- cmp edx, 'if'
- jne .elseloop
-
- inc ecx
- jmp .elseloop
-
-.else2:
- jecxz .iferror
- dec ecx
- jmp .elseloop
-
-.then2:
- jecxz .thenhere2
- dec ecx
- jmp .elseloop
-
-.thenhere2:
- add eax, 4
- cmp byte [eax], ' '
- ja .iferror
- mov [esp+4], eax
- jmp .ifok
-
-.__then:
- xor eax, eax
- clc
- retn
-
-
-; errors
-
-.invalid_command:
- stc
- mov eax, .errInvalidCommand
- jmp .finish
-
-.invalid_number:
- stc
- mov eax, .errInvalidNumber
- jmp .finish
-
-.stack_overflow:
- stc
- mov eax, .errStackOverflow
- jmp .finish
-
-.missing_quote:
- stc
- mov eax, .errMissingQuote
- jmp .finish
-
-endp
-
-
-call ExecScript
-
-
-
-proc __ScriptPlus
-begin
- cmp edi, 14
- jae .end
-
- mov eax, [ebx+4*edi+4]
- inc edi
- add [ebx+4*edi+4], eax
-
-.end:
- xor eax, eax
- return
-endp
-
-
-
-proc __ScriptMinus
-begin
- cmp edi, 14
- jae .end
-
- mov eax, [ebx+4*edi+4]
- inc edi
- sub [ebx+4*edi+4], eax
-
-.end:
- xor eax, eax
- clc
- return
-endp
-
-
-
-proc __ScriptMul
-begin
- cmp edi, 14
- jae .end
-
- mov eax, [ebx+4*edi+4]
- inc edi
- imul eax, [ebx+4*edi+4]
- mov [ebx+4*edi+4], eax
-.end:
- xor eax, eax
- clc
- return
-endp
-
-
-
-proc __ScriptDiv
-begin
- cmp edi, 14
- jae .end
-
- cmp dword [ebx+4*edi+4], 0
- je .err
-
- inc edi
- mov eax, [ebx+4*edi+4]
- cdq
- div dword [ebx+4*edi]
- mov [ebx+4*edi+4], eax
-
-.end:
- xor eax, eax
- clc
- return
-
-.err:
- stc
- return
-endp
-
-
-
-
-proc __ScriptMod
-begin
- cmp edi, 14
- jae .end
-
- cmp dword [ebx+4*edi+4], 0
- je .err
-
- inc edi
- mov eax, [ebx+4*edi+4]
- cdq
- div dword [ebx+4*edi]
- mov [ebx+4*edi+4], edx
-
-.end:
- xor eax, eax
- clc
- return
-
-.err:
- stc
- return
-endp
-
-
-
-proc __ScriptOutNumber
-begin
- cmp edi, 15
- jae .end
-
- inc edi
- mov eax, [ebx+4*edi]
-
- stdcall NumToStr, eax, ntsSigned or ntsDec
- push eax
-
- stdcall StrPtr, eax
- stdcall Output, eax
- stdcall StrDel ; from the stack.
-
-.end:
- xor eax, eax
- clc
- return
-endp
-
-
-proc __ScriptOutString
-begin
- cmp edi, 15
- jae .end
-
- inc edi
- cmp dword [ebx+4*edi], 0
- je .crlf
-
- stdcall StrPtr, [ebx+4*edi]
- stdcall Output, eax
- stdcall StrDel, [ebx+4*edi]
-
-.end:
- xor eax, eax
- clc
- return
-
-.crlf:
- stdcall Output, .scrlf
- jmp .end
-
-.scrlf db 13, 10, 0
-
-endp
-
-
-
-proc __ScriptSwap
-begin
- cmp edi, 14
- jae .end
-
- pushd [ebx+4*edi+4]
- pushd [ebx+4*edi+8]
- popd [ebx+4*edi+4]
- popd [ebx+4*edi+8]
-
-.end:
- xor eax, eax
- clc
- return
-endp
-
-
-proc __ScriptPop
-begin
- cmp edi, 15
- jae .end
-
- inc edi
-.end:
- xor eax, eax
- clc
- return
-endp
-
-
-
-proc __ScriptAnd
-begin
- cmp edi, 14
- jae .end
-
- mov eax, [ebx+4*edi+4]
- inc edi
- and [ebx+4*edi+4], eax
-
-.end:
- xor eax, eax
- clc
- return
-endp
-
-
-proc __ScriptOr
-begin
- cmp edi, 14
- jae .end
-
- mov eax, [ebx+4*edi+4]
- inc edi
- or [ebx+4*edi+4], eax
-
-.end:
- xor eax, eax
- clc
- return
-endp
-
-
-proc __ScriptXor
-begin
- cmp edi, 14
- jae .end
-
- mov eax, [ebx+4*edi+4]
- inc edi
- xor [ebx+4*edi+4], eax
-
-.end:
- xor eax, eax
- clc
- return
-endp
-
-
-
-
-proc __ScriptNot
-begin
- cmp edi, 15
- jae .end
-
- not dword [ebx+4*edi+4]
-
-.end:
- xor eax, eax
- clc
- return
-endp
-
-
-
-proc __ScriptNeg
-begin
- cmp edi, 15
- jae .end
-
- neg dword [ebx+4*edi+4]
-
-.end:
- xor eax, eax
- clc
- return
-endp
-
-
-
-proc __ScriptRepeat
-begin
- cmp edi, 14
- jae .end
-
-
-.end:
- xor eax, eax
- clc
- return
-endp
-
-
-proc __ScriptLoop
-begin
- cmp edi, 14
- jae .end
-
-.end:
- xor eax, eax
- clc
- return
-endp
-
-
-
-
-
-
-
-DispSize 'Script engine', $ - __ScriptEngine
-
DELETED freshlib/_trash/SurplusSources/drafts/HashList.asm
Index: freshlib/_trash/SurplusSources/drafts/HashList.asm
==================================================================
--- freshlib/_trash/SurplusSources/drafts/HashList.asm
+++ /dev/null
@@ -1,104 +0,0 @@
-;uses memory.asm
-
-cInitTreeSize = 256
-
-struct THashList
- .ptrHashTree dd ?
- .TreeSize dd ?
- .StrHeap TStringPool
-ends
-
-
-
-proc HashListCreate, .ptrHashList
-begin
- push esi eax
-
- mov esi, [.ptrHashList]
-
- mov [esi+THashList.TreeSize], cInitTreeSize
- stdcall GetMem, [esi+THashList.TreeSize]
- mov [esi+THashList.ptrHashTree], eax
-
- lea esi, [esi+THashList.StrHeap]
- stdcall StringHeapCreate, esi
-
- pop eax esi
- return
-endp
-
-
-
-
-proc HashListDestroy, .ptrHashList
-begin
- push esi
- mov esi, [.ptrHashList]
- stdcall FreeMem, [esi+THashList.ptrHashTree]
- stdcall FreeMem, [esi+THashList.ptrStrList]
- pop esi
- return
-endp
-
-
-;_______________________________________________________________________
-;
-; RETURNS:
-; if CF=1 the string is already in the list.
-; returns eax = pointer to the string in the list.
-; edx = hash of the string.
-;
-; if CF=0 the string is not in the list.
-; in this case if fAdd=TRUE, adds the string to the list.
-; returns eax = pointer to the string in the list.
-; edx = hash of the string.
-;
-; if fAdd = FALSE doesn't add the string to the list and
-;_______________________________________________________________________
-proc HashListCheck, .ptrHashList, .hString, .fAdd
-begin
-
- return
-endp
-
-
-
-;_______________________________________________________________________
-;
-; function StrHash
-; Computes 32 bit hash value from the string.
-; The function is compatible with FASM hash
-; function if OrMask = 0.
-;
-; Arguments:
-; ptrString - pointer to PASCAL string with dword length at [ptr-4]
-;
-; Return:
-; eax - 32bit hash value.
-;
-; Changes:
-; eax
-;_______________________________________________________________________
-proc Hash_FNV1a, .ptrString
-begin
- push edx ecx esi
-
- mov esi, [.ptrString]
- mov eax, $811C9DC5 ; 2166136261 ; FNV offset basis
- mov ecx, [esi-4] ; length of the string
- jecxz .exit
-
-.hashloop:
- movzx edx, byte [esi]
- xor eax, edx
- inc esi
- imul eax, $01000193 ; 16777619 ; FNV prime
- dec ecx
- jnz .hashloop
-
-.exit:
- pop esi ecx edx
- return
-endp
-
-DispSize "Hash_FNV1a", $-Hash_FNV1a
DELETED freshlib/_trash/SurplusSources/drafts/StrLibUltra.asm
Index: freshlib/_trash/SurplusSources/drafts/StrLibUltra.asm
==================================================================
--- freshlib/_trash/SurplusSources/drafts/StrLibUltra.asm
+++ /dev/null
@@ -1,856 +0,0 @@
-; ____________________________________________________________________
-;| |
-;| This file is part of the project: |
-;| |
-;| ..::FreshLib::.. - portable, assembler library and GUI toolkit. |
-;|____________________________________________________________________|
-;| |
-;| This file |
-;| _________ |
-;| Author: |
-;| |
-;| Title: StrLib.asm - OS independent string manipulation library. |
-;| |
-;| OS: |
-;| |
-;| Notes and changes: |
-;| Uses memory.asm library for memory functions. |
-;| |
-;| |
-;|____________________________________________________________________|
-
-; NumToStr flags
-ntsSigned = $00000000
-ntsUnsigned = $00010000
-ntsZeroTerminated = $00020000
-ntsFixedWidth = $00040000
-
-ntsBin = $00000200
-ntsQuad = $00000400
-ntsOct = $00000800
-ntsDec = $00000a00
-ntsHex = $00001000
-
-cStrShift = 6
-cStrChunkSize = 1 shl cStrShift
-
-cStrChunkCount = 1024
-
-; TChunkIndex is a dword with following format:
-; $00000000 - empty chunk
-; $pxffffff - last chunk in the string. Only $ffffff have special meaning. $fffffe for example is normal chunk number.
-; .next is unsigned 24 bit number.
-; $nxyyyyyy - first chunk in the string. nx = not (px) - it is not NEG!
-struct TChunkIndex
- .next rb 3
- .len db ?
-ends
-
-
-struct TStrTableNew
- .count dd 0 ; Count of the chunks in the string pool
- .ptrPool dd 0 ; One big area of memory to be allocated for strings.
- .ptrIndex dd 0 ; array of dword for every chunk in the pool: if >0 it is index of the next chunk in the string. If <0 it is occuped space in the last chunk.
- .Hint dd ? ; index of the fast found free chunk. From here you must start to search for the next allocation.
-ends
-
-
-uglobal
- _StrList TStrTableNew
-endg
-
-
-initialize StrLibInit
-begin
- stdcall GetMem, cStrChunkCount * cStrChunkSize
- jc .error_init
- mov [_StrList.ptrPool], eax
-
- stdcall GetMem, cStrChunkCount * 4
- jc .error_init
- mov [_StrList.ptrIndex], eax
-
- mov [_StrList.count], cStrChunkCount
- mov [_StrList.Hint], -1
- return
-
-.error_init:
- int3
- return
-
-endp
-
-
-
-
-finalize StrLibDestroy
-begin
- stdcall FreeMem, [_StrList.ptrPool]
- stdcall FreeMem, [_StrList.ptrIndex]
- return
-endp
-
-
-; ____________________________________________________________________
-;| proc StrNew |
-;| Creates new dynamic string and returns the handle. |
-;| Arguments: |
-;| None |
-;| Returns: |
-;| CF = 0; no error: eax contains handle of the string. |
-;| CF = 1; error. eax = 0 |
-;|____________________________________________________________________|
-proc StrNew
-begin
- push ebx
- mov ebx, [_StrList.ptrIndex]
- call _search_empty_chunk
- jc .error_new
- mov dword [ebx+4*eax], $ffffffff ; first chunk; last chunk; zero occupied (empty string).
- clc
- pop ebx
- return
-
-.error_new:
- stc
- pop ebx
- return
-endp
-
-
-;__________________________________________
-;
-; Arguments:
-; ebx - pointer to the index.
-
-; Returns:
-; eax - index of new empty chunk.
-;
-; Returns index of a empty chunk.
-; If needed, resizes memory arrays for
-; chunks and for index.
-; Updates _StrList as well.
-;__________________________________________
-
-proc _search_empty_chunk
-begin
- push ecx edx
-
- mov edx, [_StrList.Hint]
- mov ecx, [_StrList.count]
-
-.searchloop:
- inc edx
- cmp edx, [_StrList.count]
- jb @f
- xor edx, edx
-@@:
- cmp dword [ebx+4*edx], 0
- je .free_found
-
- dec ecx
- jnz .searchloop
-
-; the empty chunk not found. so, resize the arrays
- mov edx, [_StrList.count] ; that is the new string handle.
-
- lea eax, [2*edx] ; new size of the arrays. very aggressive.
- mov [_StrList.count], eax
-
- shl eax, cStrShift
- stdcall ResizeMem, [_StrList.ptrPool], eax
- jc .finish
-
- mov [_StrList.ptrPool], eax
-
- mov eax, [_StrList.count]
- lea eax, [4*eax]
- stdcall ResizeMem, [_StrList.ptrIndex], eax
- mov [_StrList.ptrIndex], eax
- mov ebx, eax
-
-.free_found:
- mov [_StrList.Hint], edx
- mov eax, edx
-.finish:
- pop edx ecx
- return
-endp
-
-
-
-; ____________________________________________________________________
-;| proc StrDel, .hString |
-;| Destroys dynamic string |
-;| Arguments: |
-;| .hString - only handle to a string. |
-;| Returns: |
-;| CF = 0; no error: |
-;| CF = 1; error |
-;|____________________________________________________________________|
-proc StrDel, .hString
-begin
- push ebx edx
- mov ebx, [_StrList.ptrIndex]
- mov edx, [.hString]
- cmp byte [ebx+4*edx+TChunkIndex.len], 0 ; first .len should be negative!
- jge .invalid_handle
-
- mov [_StrList.Hint], edx
- dec [_StrList.Hint]
-
-.del_loop:
- push dword [ebx+4*edx]
- mov dword [ebx+4*edx], 0 ; free chunk
- pop edx
- and edx, $ffffff
- cmp edx, $ffffff
- je .end_string
-
- cmp byte [ebx+4*edx+TChunkIndex.len], 0
- jge .del_loop ; every next .len should be positive.
-
-.invalid_handle:
- stc
- pop edx ebx
- return
-
-.end_string:
- clc
- pop edx ebx
- return
-
-endp
-
-
-
-;____________________________________________________________________
-;
-; proc StrCatAsciiZ, .hString, .ptrAsciiZ
-;
-; Concatenates asciiz string from the memory to the given dynamic
-; string.
-;
-; Arguments:
-; .hString - handle of a dynamic string.
-; .ptrAsciiZ - pointer to asciiz string in memory.
-;
-; Returns:
-; CF=1 if error.
-;____________________________________________________________________
-
-proc StrCatAsciiZ, .hString, .ptrAsciiZ
-begin
- push eax ebx ecx edx esi edi
-
- mov ebx, [_StrList.ptrIndex]
- mov eax, [.hString]
-
-; first search to the end chunk of the string.
-.endloop:
- mov edx, eax
- mov eax, [ebx+4*edx]
- and eax, $ffffff
- cmp eax, $ffffff
- jne .endloop
-
- mov eax, edx
- mov edi, [_StrList.ptrPool]
- shl eax, cStrShift
- add edi, eax ; edi - pointer to the begin of the last chunk in string.
-
- movsx ecx, byte [ebx+4*edx+TChunkIndex.len] ; offset in the chunk.
- mov esi, [.ptrAsciiZ]
- test ecx, ecx
- jns .copyloop
-
- not ecx
-
-; so, copy to the end of the chunk
-.copyloop:
- cmp ecx, cStrChunkSize
- jb .sizeok
-
- call _search_empty_chunk
- jc .finish
-
-; set previous chunk index.
- mov [ebx+4*edx], eax
- mov cl, cStrChunkSize
- cmp edx, [.hString]
- jne @f
- not cl
-@@:
- mov byte [ebx+4*edx+TChunkIndex.len], cl
-
- mov edi, eax
- xor ecx, ecx ; zero offset.
- shl edi, cStrShift
- mov edx, eax ; new chunk index.
- add edi, [_StrList.ptrPool] ; new chunk pointer
-
-.sizeok:
- mov al, [esi]
- inc esi
- cmp al, 0
- je .endofstring
- mov [edi+ecx], al
- inc ecx
- jmp .copyloop
-
-.endofstring:
- mov dword [ebx+4*edx+TChunkIndex.next], $00ffffff
-
- cmp edx, [.hString]
- jne @f
- not cl
-@@:
- mov byte [ebx+4*edx+TChunkIndex.len], cl
-
-.finish:
- pop edi esi edx ecx ebx eax
- return
-endp
-
-
-
-;____________________________________________________________________
-;
-; proc StrCatChar, .hString, .char
-;
-; Concatenates 1..4 characters to the given dynamic string.
-; Actually uses StrCatAsciiZ to do the work.
-;
-; Arguments:
-; .hString - handle of a dynamic string.
-; .char - dword with 1 to 4 characters.
-;
-; Returns:
-; CF=1 if error.
-;____________________________________________________________________
-
-proc StrCatChar, .hString, .char
-.buff rd 2
-begin
- push eax
- mov eax, [.char]
- mov [.buff], eax
- mov [.buff+4], 0
- lea eax, [.buff]
- stdcall StrCatAsciiZ, [.hString], eax
- pop eax
- return
-endp
-
-
-
-
-;____________________________________________________________________
-;
-; proc StrSplit, .hString, .pos
-;
-; Splits [.hString] at position [.pos].
-; The left portion of the string remains in [.hString]
-; The right portion forms new string that is returned by function.
-; This procedure increases fragmentation of the string pool.
-; In most cases it allocates one more chunk to keep the begin of
-; the right part of the string.
-;
-; Arguments:
-; .hString - handle of string to be splitted.
-; .pos - position for split.
-; Returns:
-; CF = 1 - error.
-; CF = 0 - no error. eax contains handle of string with right part of
-; the splitted string.
-;____________________________________________________________________
-
-proc StrSplit, .hString, .pos
-begin
- push ebx ecx edx esi edi
-
- mov ebx, [_StrList.ptrIndex]
- mov edx, [.hString]
- cmp edx, [_StrList.count]
- cmc
- jc .finish
-
- movsx eax, [ebx+4*edx+TChunkIndex.len]
- not eax
-
- bt eax, 31
- jc .finish
-
- sub [.pos], eax
- jle .found
-
-.lenloop:
- mov edx, [ebx+4*edx]
- and edx, $00ffffff
- cmp edx, $00ffffff
- je .exit_error
-
- movsx eax, [ebx+4*edx+TChunkIndex.len]
- bt eax, 31
- jc .finish
-
- sub [.pos], eax
- jg .lenloop
-
-.found:
- jl .insertchunk
-
- mov eax, [ebx+4*edx]
- and eax, $00ffffff
- cmp eax, $00ffffff
- je .exit_error
-
- or dword [ebx+4*edx], $00ffffff
- xor dword [ebx+4*eax], $ff000000
- clc
- jmp .finish
-
-.insertchunk:
- sar [ebx+4*edx+TChunkIndex.len], 7
- add [.pos], eax
- mov ecx, [.pos] ; remaining in the left string.
- xor [ebx+4*edx+TChunkIndex.len], cl ; proper sign length.
-
- mov esi, edx
- shl esi, cStrShift
- add esi, ecx ; the offset in the pool.
-
- push dword [ebx+4*edx]
- or dword [ebx+4*edx], $00ffffff
- pop edx
- and edx, $00ffffff
-
- sub eax, [.pos] ; length of the remaining in the right.
- mov ecx, eax
-
- call _search_empty_chunk
-
- mov [ebx+4*eax+TChunkIndex.len], cl
- xor dword [ebx+4*eax], $ff000000 ; it is first chunk in the new string.
- or dword [ebx+4*eax], edx ; next chunk.
-
- mov edi, eax
- shl edi, cStrShift
- add edi, [_StrList.ptrPool]
- add esi, [_StrList.ptrPool]
- rep movsb
- clc
-.finish:
- pop edi esi edx ecx ebx
- return
-
-.exit_error:
- stc
- jmp .finish
-endp
-
-
-
-;____________________________________________________________________
-;
-; proc StrInsert, .hDest, .hSrc, .position
-;
-; Insrts [.hSrs] at [.position] inside [.hDest].
-; Uses StrSplit and StrCat to do the work.
-; .hStr is destroyed.
-;
-; Arguments:
-; .hDest - handle of destination string.
-; .hStr - string to be inserted.
-; .position - position of insertion.
-;
-; Returns:
-; CF = 1 - error.
-; CF = 0 - no error.
-;____________________________________________________________________
-
-proc StrInsert, .hDest, .hSrc, .position
-begin
- push eax
- stdcall StrSplit, [.hDest], [.position]
- jc .finish
- stdcall StrCat, [.hDest], [.hSrc]
- jc .freeeax
- stdcall StrCat, [.hDest], eax
- jc .strange
-
-.finish:
- pop eax
- return
-
-.freeeax:
- stdcall StrCat, [.hDest], eax
- jc .strange
- stc
- jmp .finish
-
-.strange:
- stdcall StrDel, eax
- stc
- jmp .finish
-
-endp
-
-
-
-;____________________________________________________________________
-;
-; proc StrCat, .hDest, .hSrc
-;
-; Concatenates two dynamic strings. The result string is [.hDest]
-; After concatenation, [.hSrc] is destroyed. If you need to keep
-; .hSrc, make copy of it with StrDup and then concatenate the
-; copy with the destination string.
-;
-; Arguments:
-; .hString - handle of a dynamic string.
-; .ptrAsciiZ - pointer to asciiz string in memory.
-;
-; Returns:
-; CF=1 if error.
-;____________________________________________________________________
-proc StrCat, .hDest, .hSrc
-begin
- push eax ebx ecx edx
-
- mov ebx, [_StrList.ptrIndex]
- mov eax, [.hDest]
- cmp eax, [_StrList.count]
- cmc
- jc .finish
-
- movsx ecx, [ebx+4*eax+TChunkIndex.len]
- not ecx
- bt ecx, 31
- jc .finish
-
-.chunkloop:
- mov edx, eax
- mov eax, [ebx+4*edx]
- and eax, $00ffffff
- cmp eax, $00ffffff
- jne .chunkloop
-
- mov ecx, [.hSrc]
- cmp ecx, [_StrList.count]
- cmc
- jc .finish
-
- xor dword [ebx+4*ecx], $ff000000
- bt dword [ebx+4*ecx], 31
- jc .finish
-
- and dword [ebx+4*edx], $ff000000
- or dword [ebx+4*edx], ecx
-
-.finish:
- pop edx ecx ebx eax
- return
-endp
-
-
-;____________________________________________________________________
-; proc StrCompact, .hStr
-;
-; Compacts the string. This means, that if some chunks of the string
-; are not fully used (as a result of string manipulations -
-; inserts, concatenations, deletes, etc.) this function removes
-; the empty spaces from the chunks and frees resulted empty chunks
-; from the end of the string.
-; This operation is slow if the string is fragmented and should be
-; avoided without reason. Even when needed, you should call this
-; procedure as later as possible, after all operations that may
-; fragment the string.
-;
-;____________________________________________________________________
-proc StrCompact, .hStr
-begin
-
-
- return
-endp
-
-
-
-
-;____________________________________________________________________
-;
-; proc StrDup, .hString
-;
-; Creates duplicate of the given string.
-;
-; Arguments:
-; .hString - handle of a dynamic string.
-;
-; Returns:
-; CF=1 if error.
-; CF=0 - eax = handle of the new created string.
-;____________________________________________________________________
-proc StrDup, .hString
-.new dd ?
-begin
- push ebx ecx edx esi edi
-
- mov edx, [.hString]
- mov ebx, [_StrList.ptrIndex]
- cmp edx, [_StrList.count]
- cmc
- jc .finish
-
- movsx ecx, [ebx+4*edx+TChunkIndex.len]
- not ecx
- bt ecx, 31
- jc .finish
-
- call _search_empty_chunk
- jc .finish
-
- mov [.new], eax
-
-.chunkloop:
- mov edi, eax
- mov esi, edx
- shl edi, cStrShift
- shl esi, cStrShift
- add edi, [_StrList.ptrPool]
- add esi, [_StrList.ptrPool]
-
- mov ecx, cStrChunkSize / 4
- rep movsd
-
- mov ecx, [ebx+4*edx]
- and ecx, $ff000000
- push ecx
-
- mov edx, [ebx+4*edx]
- and edx, $00ffffff
- cmp edx, $00ffffff
- je .endofstring
-
- mov ecx, eax
- call _search_empty_chunk
- jc .finish
-
- pop dword [ebx+4*ecx]
- or [ebx+4*ecx], eax
-
- jmp .chunkloop
-
-.endofstring:
- pop dword [ebx+4*eax]
- or [ebx+4*eax], edx
- mov eax, [.new]
- clc
-.finish:
- pop edi esi edx ecx ebx
- return
-endp
-
-
-
-
-proc SubStr, .hString, .index, .length
-begin
-
-
-
-
-endp
-
-
-
-
-; ____________________________________________________________________
-;| |
-;| proc StrLen, .hString |
-;| Returns the length of the string in bytes. |
-;| Arguments: |
-;| .hString: pointer or handle to a string. |
-;| Returns: |
-;| ecx - length of the strin in bytes. |
-;|____________________________________________________________________|
-
-proc StrLen, .hString
-begin
- push ebx edx eax
-
- mov ebx, [_StrList.ptrIndex]
- mov edx, [.hString]
- cmp edx, [_StrList.count]
- cmc
- jc .finish
-
- movsx ecx, [ebx+4*edx+TChunkIndex.len]
- not ecx
-
- bt ecx, 31
- jc .finish
-
-.lenloop:
- mov edx, [ebx+4*edx]
- and edx, $00ffffff
- cmp edx, $00ffffff
- je .finish
-
- movsx eax, [ebx+4*edx+TChunkIndex.len]
- bt eax, 31
- jc .finish
-
- add ecx, eax
- jmp .lenloop
-
-.finish:
- pop eax edx ebx
- return
-endp
-
-
-;_____________________________________________________________________
-;
-; proc StrFreeBuffer, .ptrBuffer
-;
-; Frees thestring buffer, allocated by StrPointer.
-; Arguments:
-; .ptrBuffer - pointer to the buffer.
-; Returns:
-; CF=1 if error. In this case, the memory is not released.
-;_____________________________________________________________________
-
-proc StrFreeBuffer, .ptrBuffer
-begin
- push eax
- mov eax, [.ptrBuffer]
- sub eax, 4
- stdcall FreeMem, eax
- pop eax
- return
-endp
-
-
-;____________________________________________________________________________________
-; proc StrPointer, .hString
-;
-; Extracts the string [.hString] to the allocated buffer and returns pointer
-; to the allocated memory.
-; Allocated memory must be freed with StrFreeBuffer.
-; The buffer have dword size. The string is Zero terminated and there is guarantied
-; that at least one full dword at the end is zero.
-; At the [pointer - 4] is placed the length of the string in bytes.
-;
-; Arguments:
-; .hString - handle to a string.
-; Returns:
-; esi - pointer to allocated buffer in memory.
-; CF = 1 in case of error - invalid handle of string or the memory can not be
-; allocated.
-;____________________________________________________________________________________
-proc StrPointer, .hString
-.ptr dd ?
-.len dd ?
-begin
- push eax ebx ecx edx edi
-
- stdcall StrLen, [.hString]
- jc .finish
-
- mov [.len], ecx
- add ecx, 11 ; we need 8bytes more memory for length and termination
- and cl, $fc
-
- stdcall GetMem, ecx
- jc .finish
-
- mov [.ptr], eax
- lea edi, [eax+4]
-
- mov ebx, [_StrList.ptrIndex]
- mov edx, [.hString]
-
- cmp dword [ebx+4*edx], 0
- je .invalid_handle
-
-.outerextract:
- mov esi, edx
- shl esi, cStrShift
- add esi, [_StrList.ptrPool]
- movsx ecx, [ebx+4*edx+TChunkIndex.len]
- test ecx, ecx
- jns .innerextract
- not ecx
-
-.innerextract:
- cmp ecx, 0
- jle .endofchunk
-
- movsd
- sub ecx, 4
- jmp .innerextract
-
-.endofchunk:
- add edi, ecx ; ecx <= 0
-
- mov edx, [ebx+4*edx]
- and edx, $00ffffff
- cmp edx, $00ffffff
- jne .outerextract
-
- xor eax, eax
- stosd ; terminator
- mov esi, [.ptr]
- pushd [.len]
- popd [esi]
- add esi, 4
- clc
-.finish:
- pop edi edx ecx ebx eax
- return
-
-.invalid_handle:
- stc
- pop edi edx ecx ebx eax
- return
-endp
-
-
-;_______________________________________________________________________
-;
-; function StrHash
-; Computes 32 bit hash value from the string.
-;
-; Arguments:
-; .hString - handle or pointer to the string.
-;
-; Return:
-; eax - 32bit hash value; FNV-1a algorithm.
-;
-; Changes:
-; eax
-;_______________________________________________________________________
-proc StrHash, .hString, .OrMask
-begin
- push edx ecx esi
-
- stdcall StrPtr, [.hString]
- mov esi, eax
- mov eax, $811C9DC5 ; 2166136261 ; FNV offset basis
- mov ecx, [esi-4] ; length of the string
- jecxz .exit
-
-.hashloop:
- movzx edx, byte [esi]
- inc esi
- or edx, [.OrMask]
- xor eax, edx
- imul eax, $01000193 ; 16777619 ; FNV prime
- dec ecx
- jnz .hashloop
-
-.exit:
- pop esi ecx edx
- return
-endp
DELETED freshlib/_trash/SurplusSources/drafts/StringHeap.asm
Index: freshlib/_trash/SurplusSources/drafts/StringHeap.asm
==================================================================
--- freshlib/_trash/SurplusSources/drafts/StringHeap.asm
+++ /dev/null
@@ -1,104 +0,0 @@
-cInitStringPoolSize = 1024
-
-
-struct TStringPool
- .ptrPool dd ?
- .iEnd dd ?
-ends
-
-
-
-proc StringHeapCreate, .ptrStringPool
-begin
- push esi
- mov esi, [.ptrStringPool]
- stdcall GetMem, cInitStringPoolSize
- mov [esi+TStringPool.ptrPool], eax
-
- pop esi
- return
-endp
-
-
-
-proc StringHeapAdd, .ptrStringPool, .ptrString
-.size dd ?
-begin
- push ebx ecx edx esi edi
-
- mov esi, [.ptrString]
- mov edi, [.ptrStringPool]
-
- stdcall GetMemSize, [edi+TStringPool.ptrPool]
- mov [.size], eax
-
- mov ebx, [edi+TStringPool.iEnd]
- add ebx, [esi-4] ; length of the string.
- add ebx, 8 ; dword len + dword zero terminator.
- cmp ebx, [.size] ;
- jb .sizeok
-
- mov ecx, [.size]
- sar ecx, 2 ; 1/4 of the size.
- cmp ecx, cInitStringPoolSize
- ja .reserveok
- mov ecx, cInitStringPoolSize
-.reserveok:
-
- add ebx, ecx
- stdcall ResizeMem, [edi+TStringPool.ptrPool], ebx
- mov [edi+TStringPool.ptrPool], eax
-
-.sizeok:
-; size is OK, so go copy:
-
- mov ebx, [edi+TStringPool.ptrPool]
- mov ecx, [esi-4] ; len of the string
-
- mov eax, [edi+TStringPool.iEnd]
- lea eax, [eax+4]
- push eax ; result offset.
-
- lea ebx, [ebx+eax]
- mov [ebx-4], ecx ; length of the string
-
-; ebx -> pointer to the destination
-; esi -> pointer to the source
-; ecx -> lenght in bytes.
-
- mov edx, ecx
- shr edx, 2 ; quotient
- and ecx, 3 ; remainder
-
- mov dword [ebx+4*edx], 0 ; zero termination
- mov dword [ebx+4*edx+4], 0 ; zero termination
- lea eax, [ebx+4*edx+8]
- sub eax, [edi+TStringPool.ptrPool]
- mov [edi+TStringPool.iEnd], eax
-
- push ebx esi
- lea ebx, [ebx+4*edx]
- lea esi, [esi+4*edx]
-
-.looprem:
- dec ecx
- js .endrem
- mov al, [esi+ecx]
- mov [ebx+ecx], al
- jmp .looprem
-
-.endrem:
- pop esi ebx
-
-.loopdword:
- dec edx
- js .endcopy
- mov eax, [esi+4*edx]
- mov [ebx+4*edx], eax
- jmp .loopdword
-
-.endcopy:
- pop eax
- pop edi esi edx ecx ebx
- return
-endp
DELETED freshlib/_trash/SurplusSources/drafts/strlib.asm
Index: freshlib/_trash/SurplusSources/drafts/strlib.asm
==================================================================
--- freshlib/_trash/SurplusSources/drafts/strlib.asm
+++ /dev/null
@@ -1,1270 +0,0 @@
-;************************************************************
-; FASM dynamic string library.
-;
-; (c)2003 John Found
-; (c)2003 Mateusz Tymek (aka decard)
-; (c)2003 Victor Loh (aka roticv)
-;
-; You can use and modify this library, as long as modifyed
-; versions are clearly marked (author of the modification
-; and what is changed), copyright notice is not
-; removed and the library remains free.
-; Copyright for the library concept and parts written by
-; me, remains to me, John Found
-; Copyright for the modifyed/new parts remains to their
-; authors.
-;
-; Versions:
-; dd.mm.yyyy version author of modification
-; - description
-;--------------------------------------------------------
-; 09.07.2003 v1.0 John Found
-; - the first public version.
-; 15.07.2003 v1.0.1 John Found
-; - minor bug with string table expand. Look in NewStr
-; 17.09.2003 v1.1.0 Mateusz Tymek
-; - made all functions stdcall
-; - added StrCat and StrPos, and modified StrLen
-; 25.09.2003 v1.1.2 Mateusz Tymek, Victor Loh
-; - added StrLCase, StrUCase, StrCopyMMX, StrInsert
-; - added new NumToStr, old version renamed to _NumStr
-; - some small optimizations & bugfixes
-; 26.09.2003 v1.1.3 JohnFound
-; - some bug fixes and style corections.
-; 29.09.2003 v1.1.4 John Found, Mateusz Tymek
-; - library rewtiten to use John Found's stdcall macros
-; - added two new low-level NumToStr routines: NumToStrF and NumToStrUF
-; - NumToStr rewriten
-; - some small bugfixes & modifications
-; - added StrExtract
-; 01.11.2003 v1.1.4.1 Mateusz Tymek
-; - preserved ecx in StrDel (it was destroyed by API calls)
-; 21.11.2003 v1.1.5 John Found
-; - StrComp splitted to 2 functions: StrCompCase and StrCompNoCase
-; IMPORTANT: inversed return result: CARRY = 1 mean strings equal.
-; This is because the using is more natural this way:
-; stdcall StrCompCase, str1, str2
-; jc .equal
-; 27.11.2003 v1.2 John Found
-; - Added function StrHash, that produces 32bit hash value of the string.
-; The hash function is based on FASM hash function and have to be compatible.
-; 03.12.2003 v1.2.3 Mateusz Tymek
-; - Added StrCharPos and StrToNum
-; 13.12.2003 v1.2.4 Materusz Tymek
-; - added StrCharCat and StrInsertChar
-; 04.01.2005 v1.2.5 John Found
-; - Fixed bug in StrSetLength
-; - Added function StrURLEncode
-;*************************************************************************************
-
-
-;--< How to use it >-----------------------------------------------------------------
-; 1. Include "strutils.inc" somewhere in the begining of main file.
-; 2. Define structure "StrTable" of type "TStrTable" somewhere in data section.
-; 3. Before using of library functions, call "InitStrings"
-; 4. After last use of the library (probably on close of application),
-; call "FreeStrings" to free all used memory.
-; 5. Some functions are with register parameter passing, other with "stdcall"
-; parameter passing. Read the header descriptions of the functions.
-;------------------------------------------------------------------------------------
-
-
-STR_MINCOUNT = 10 ; minimum 10 strings in the table
-STR_MINSTRLEN = 16 ; 16 bytes minimum string length
-
-
-
-; NumToStr flags
-ntsSigned = $00000
-ntsUnsigned = $10000
-ntsZeroTerminated = $20000
-ntsFixedWidth = $40000
-
-
-ntsBin = $0200
-ntsQuad = $0400
-ntsOct = $0800
-ntsDec = $0a00
-ntsHex = $1000
-
-
-; Global variable, storing parameters of dynamic strings list.
-uglobal
- StrTable dd ? ; StrLib library variable.
-endg
-
-
-; < Library functions >
-
-;************************************************************************************
-; Allocates memory for string table and allocates memory for strings.
-; Start it before any work with strings.
-; Returns 0 if failed to allocate needed memory.
-;************************************************************************************
-initialize InitStrings
-begin
- StrLib = 1
-
- stdcall CreateArray, 4
- jc .finish
-
- stdcall AddArrayItem, eax
- mov [StrTable], edx
- mov [edx+TArray.lparam], 0 ; lParam is the last allocated handle number
- or dword [eax], -1
-
-.finish:
- return
-endp
-
-;**************************************************************************************
-; Frees all memory used for strings library
-; Call it before exit of the program.
-;**************************************************************************************
-finalize FreeStrings
-begin
- mov esi, [StrTable]
- mov edi, [esi+TArray.count]
- xor ebx,ebx
-
-.freeloop:
- mov ebx, [esi+TArray.array]
- test ebx,ebx
- jz .nxt
- js .nxt
-
- stdcall FreeMem, ebx
-
-.nxt:
- add esi, 4
- dec edi
- jnz .freeloop
-
- stdcall FreeMem, [StrTable]
- mov [StrTable], 0
- return
-endp
-
-
-
-;**************************************************************************************
-; Returns the pointer in memory of the hString, or NULL on error
-;**************************************************************************************
-proc StrPtr, .hString
-begin
- mov eax, [.hString]
- test eax, $ffff0000
- jnz .finish ; It's pointer, go to finish.
-
- push ebx
-
- mov ebx, [StrTable]
- cmp eax, [ebx+TArray.count]
- jae .notfound
-
- mov eax, [ebx+TArray.array+4*eax]
- pop ebx
-.finish:
- return
-
-.notfound:
- pop ebx
- xor eax,eax
- return
-endp
-
-;**************************************************************************************
-; Creates new empty string and returns handle
-; Return: handle of the new created string.
-;**************************************************************************************
-proc StrNew
-begin
- push ecx edx esi
-
-; Find first empty place.
- mov edx, [StrTable]
- mov ecx,[edx+TArray.count]
- mov esi,[edx+TArray.lparam]
- xor eax,eax
-
-.search:
- inc esi
- cmp esi, [edx+TArray.count]
- jne @f
- xor esi,esi
- inc esi
-@@:
- cmp [edx+TArray.array+4*esi],eax
- je .found
- dec ecx
- jnz .search
-
-.notfound:
- mov esi, [edx+TArray.count]
- cmp esi, $10000
- jb @f
- int3 ; 65535 strings max.
-@@:
- stdcall AddArrayItem, edx
- mov [StrTable], edx
-
-.found:
- mov [edx+TArray.lparam], esi
- stdcall GetMem, STR_MINSTRLEN
- mov [edx+TArray.array+4*esi], eax
- mov eax, esi
- pop esi edx ecx
- return
-endp
-
-;**************************************************************************
-; Deletes the string if it is possible.
-;**************************************************************************
-proc StrDel, .hString
-begin
- push eax ebx ecx edx esi
-
- mov esi, [StrTable]
- mov eax, [.hString]
- test eax, eax
- jz .finish
-
- test eax,$ffff0000
- jz .process
-
-; search the pointer in the table.
- mov ecx, [esi+TArray.count]
-
-.search:
- dec ecx
- js .finish
- cmp [esi+TArray.array+4*ecx], eax
- jne .search
-
- stdcall FreeMem, eax
- mov [esi+TArray.array+4*ecx], 0
-
- jmp .finish
-
-.process:
- mov ebx, eax
- stdcall StrPtr,eax
- test eax,eax
- jz .finish
-.free:
- invoke HeapFree, [StrTable.heap], 0, eax
- mov dword [esi+4*ebx], NULL ; Set the cell of the table to null.
-.finish:
- pop esi edx ecx ebx eax
- return
-endp
-
-
-;**************************************************************************
-; Duplicates given string, and returns a handle to new one
-;**************************************************************************
-proc StrDup ; proc StrDup [hBaseStr]
-begin
- mov eax,[esp+4] ; mov eax,[esp+4]
- or eax,eax
- jz .exit
- stdcall StrNew
- stdcall StrCopy, eax,dword[esp+4] ; stdcall StrCopy, [hBaseStr]
-.exit: ret 4
-endp
-
-;**************************************************************************
-; Returns the length of the string.
-; Arguments:
-; hString - handle or pointer to the string (static or dynamic)
-;**************************************************************************
-proc StrLen, .hString ; proc StrLen [hString]
- begin
- push ebx
- stdcall StrPtr, [.hString]
- mov ebx,eax
- .scan:
- cmp byte[eax],0
- lea eax,[eax+1]
- jne .scan
- sub eax,ebx
- dec eax ; return value in eax
- pop ebx
- return
-endp
-
-;***************************************************************************
-; If the hString is larger than length - do nothing
-; If the hString is smaller than length -> set the length of string to length
-; returns pointer to the new (old) string
-;
-; Arguments:
-; hString - string handle. /not pointer!/
-; length - new string length.
-; Returns: pointer to the string.
-;***************************************************************************
-proc StrSetLength, .hString, .length ; proc StrSetLength [hString], [length]
- begin
- push ebx ecx edx esi edi ; esp=esp-20
-
- mov ebx, [.length] ; mov ecx,[length]
- lea ebx, [ebx+4] ; the string have to be at least 1 dword bigger than the length specified.
-
- mov eax,[.hString] ; mov eax,[hString]
- test eax,$ffff0000 ; if eax is pointer then error
- jnz .error
- cmp eax,[StrTable.count] ; invalid handle.
- jge .error
-
- mov edi,[StrTable.ptr]
- lea edi,[4*eax+edi] ; points to the address of table pointer of destination string
- mov esi,[edi]
- test esi,esi ; Error string not defined
- jz .error ;
-
- invoke HeapSize, [StrTable.heap], 0, esi
- cmp eax,-1
- je .error
- cmp eax,ebx
- jl .resize
- mov eax,esi
- jmp .finish
-
-.resize:
- invoke HeapReAlloc, [StrTable.heap], HEAP_GENERATE_EXCEPTIONS or HEAP_ZERO_MEMORY, esi, ebx
- mov [edi], eax
- jmp .finish
-
-.error:
- xor eax,eax
-
-.finish:
- pop edi esi edx ecx ebx
- return
-endp
-
-
-;***************************************************************************************
-; Copyes source to destination string.
-; Arguments:
-; source - destination string (handle only)
-; dest - source string (handle or pointer)
-;***************************************************************************************
-proc StrCopy, .dest, .source
- begin
- push esi edi eax ecx
- mov edi,[.dest]
- test edi,$ffff0000 ; if edi is pointer go to finish.
- jnz .finish
- mov esi,[.source]
- test esi,esi
- jz .finish
- stdcall StrPtr, esi
- mov esi,eax
- test esi, esi
- jz .finish
- stdcall StrLen, eax
- inc eax
- mov ecx,eax
- stdcall StrSetLength, edi,eax
- test eax,eax
- jz .finish
- stdcall StrPtr, edi
- mov edi,eax
- cld
- rep movsb ; copy strings
-.finish:
- pop ecx eax edi esi
- return
-endp
-
-;***************************************************************************************
-; Compares two strings - case sensitive.
-; Returns CARRY = 1 if the strings are equal.
-; Returns CARRY = 0 if the strings are different.
-;***************************************************************************************
-proc StrCompCase, .str1, .str2
-begin
- push eax esi edi
-
- cmp [.str1], 0
- je .noteq
- cmp [.str2], 0
- je .noteq
-
- stdcall StrPtr, [.str1]
- mov esi,eax
- stdcall StrPtr, [.str2]
- mov edi,eax
-.loop:
- mov al, [esi]
- lea esi, [esi+1]
- cmp al, [edi]
- lea edi, [edi+1]
- jne .noteq
-
- test al, al
- jnz .loop
-
- stc
- pop edi esi eax
- return
-
-.noteq:
- clc
- pop edi esi eax
- return
-endp
-
-
-;***************************************************************************************
-; Compares two strings - case NOT sensitive.
-; Returns CARRY = 1 if the strings are equal.
-; Returns CARRY = 0 if the strings are different.
-;***************************************************************************************
-proc StrCompNoCase, .str1, .str2
-begin
- push eax esi edi
- stdcall StrPtr, [.str1]
- mov esi,eax
- stdcall StrPtr, [.str2]
- mov edi,eax
-
-.cmploop:
- mov al, [esi]
- lea esi, [esi+1]
- mov ah, [edi]
- lea edi, [edi+1]
-
- test al,al
- jz .eos
- test ah,ah
- jz .noteq
-
- or eax, $2020
- cmp al, ah
- je .cmploop
-
-.noteq:
- clc
- pop edi esi eax
- return
-
-.eos:
- test ah,ah
- jnz .noteq
-
- stc
- pop edi esi eax
- return
-endp
-
-
-
-;*******************************************************************************
-; Get the text of the [Control] using WM_GETTEXT and put it to the string with
-; handle (only) in [string].
-;
-; if [string] = NULL creates new string and returns the handle.
-; if [string] <> NULL just copyes the text.
-;*******************************************************************************
-proc GetControlText, .Control, .string
-.res dd ?
-.len dd ?
-begin
- push ebx edi
- mov eax,[.string]
- test eax,eax
- jnz @f
- stdcall StrNew
-@@:
- mov [.res],eax
- invoke SendMessage, [.Control], WM_GETTEXTLENGTH, 0, 0
- add eax, 16
- mov [.len], eax
- stdcall StrSetLength, [.res], eax
- test eax,eax
- jz .error
- invoke SendMessage, [.Control], WM_GETTEXT, [.len], eax
- mov eax,[.res]
-.error:
- pop edi ebx
- return
-endp
-
-;*******************************************************************************
-; Sets the text in control using WM_SETTEXT from string with handle or pointer
-; in [string].
-;*******************************************************************************
-proc SetControlText, .Control, .string
-begin
- push eax ecx edx
- stdcall StrPtr, [.string]
- invoke SendMessage, [.Control], WM_SETTEXT, 0, eax
- pop edx ecx eax
- return
-endp
-
-;**********************************************************
-; Creates string and assigns it to variable. If variable
-; already contains string handle, the old string will be
-; deleted.
-; Arguments:
-; [ptrHString] - variable containing string handle.
-; ptrSource - pointer to the source for string.
-;**********************************************************
-; Bug fix 26.09.2003 JohnFound
-proc SetString, .ptrHString, .ptrSource
-begin
- push eax esi
- mov esi, [.ptrHString]
-
- cmp dword [esi], 0
- je @f
- stdcall StrDel, [esi]
-@@:
- stdcall StrNew
- mov [esi], eax
- stdcall StrCopy, eax, [.ptrSource]
- pop esi eax
- return
-endp
-
-;**********************************************************************************
-; StrCat appends one string to another
-; Arguments:
-; dest - destination string (handle only)
-; source - source string
-;**********************************************************************************
-proc StrCat, .dest, .source
-begin
- push eax ebx ecx
-
- stdcall StrLen, [.dest]
- mov ebx,eax ; store dest length in ebx
-
- stdcall StrLen, [.source]
- add eax, ebx
- inc eax ; new dest length
- stdcall StrSetLength, [.dest], eax
- add ebx, eax ; calculate end of old dest in ebx
- stdcall StrPtr, [.source]
-.copy:
- mov cl,[eax]
- inc eax
- mov [ebx],cl
- inc ebx
- or cl,cl
- jnz .copy
- pop ecx ebx eax
- return
-endp
-
-
-;**********************************************************************************
-; StrCharPos returns a pointer to the first occurence of a given char
-; in specified string
-; Arguments:
-; Char - char to look for
-; hString - string to search
-; Returns: a pointer to the char in source, or NULL if char doesn't occur
-; in given string
-;**********************************************************************************
-proc StrCharPos, .hPattern, .char
- begin
- push esi
- stdcall StrPtr,[.hPattern]
- mov esi,eax
- mov eax,[.char]
- xchg al,ah
- .search:
- mov al,[esi]
- inc esi
- or al,al
- je .not_found
- cmp al,ah
- jne .search
- mov eax,esi
- dec eax
- pop esi
- return
- .not_found:
- xor eax,eax
- pop esi
- return
-endp
-
-
-;**********************************************************************************
-; StrPos returns a pointer to the first occurence of a pattern string
-; in another string
-; Arguments:
-; hPattern - 'pattern' string
-; hString - string to search
-; Returns: a pointer to the pattern string in source , or NULL if pattern string
-; doesn't occur in the string to search
-;**********************************************************************************
-proc StrPos ; proc StrPos [hString], [hPattern]
-begin
- push ebx ecx edx esi edi ; esp = esp -20
- mov esi,[esp+20+8] ; mov esi,[hPattern]
- mov edi,[esp+20+4] ; mov edi,[hString]
- stdcall StrLen, edi
- mov ebx,eax ; now ebx holds lenght of the string to search
- stdcall StrLen, esi
- mov edx,eax ; now edx holds length of the pattern string
- stdcall StrPtr, esi
- mov esi,eax ; put pointer to the pattern str in esi
- stdcall StrPtr,edi
- mov edi,eax ; put pointer to the search str in edi
- lodsb ; load first character of the pattern
- mov ecx,ebx ;
- mov ebx,edx ; put str_len(pattern)-1 in ebx
- dec ebx ;
- .search:
- repne scasb
- jne .not_found
- cmp ecx,ebx
- jb .not_found
- push edi esi ecx
- or ebx,ebx ; ebx==0 means that we were searching for one
- jz .got_it ; character. We found it, so we stop.
- mov ecx,ebx
- repe cmpsb
- jne .not_match
- .got_it:
- pop ecx esi edi
- dec edi
- mov eax,edi
- .ret:
- pop edi esi edx ecx ebx
- ret 8
- .not_match:
- pop ecx esi edi
- jmp .search
- .not_found:
- xor eax,eax
- jmp .ret
-endp
-
-;**********************************************************************************
-; StrInsert inserts one string into another at specified pos
-; Arguments:
-; dest - destination where the source will be inserted (handle only)
-; source - string to insert
-;**********************************************************************************
-proc StrInsert ; proc StrInsert [dest], [source], [pos]
- begin
- push eax ebx ecx esi edi ; esp = esp-20
- stdcall StrLen, dword[esp+20+4] ; stdcall StrLen,[dest]
- cmp eax,dword[esp+20+12] ; cmp eax,[pos]
- jb .ret ; don't insert a string if pos>StrLen(dest)
- inc eax
- mov ecx,eax
- stdcall StrNew ; create temporary string...
- mov ebx,eax ; ... and store its handle in ebx
- stdcall StrSetLength, ebx,ecx
- stdcall StrPtr, dword[esp+20+4] ; stdcall StrPtr,[dest]
- mov esi,eax
- stdcall StrPtr, ebx
- mov edi,eax
- mov ecx,dword[esp+20+12] ; mov ecx,[pos]
- jz @f
- rep movsb
- @@: stdcall StrCat, ebx,dword[esp+20+8] ; stdcall StrCat, ebx,[source]
- stdcall StrCat, ebx,esi
- mov eax,dword[esp+24]
- stdcall StrCopy, eax,ebx
- stdcall StrDel, ebx
- .ret:
- pop edi esi ecx ebx eax
- ret 12
-endp
-
-;**********************************************************************************
-; Converts strings to Lower Case
-; First parameter = String to Convert to lower case
-; corrupts eax
-;**********************************************************************************
-proc StrLCase ; proc StrLCase [hString]
- begin
- push edi
- stdcall StrPtr, [esp+4+1*4]
- xchg edi, eax
-._lowercaseloop:
- mov al, [edi]
- cmp al, 'A'
- jc @F
- cmp al, 'Z'
- ja @F
- or byte[edi], 20h
-@@:
- cmp byte[edi],0
- lea edi, [edi+1]
- jnz ._lowercaseloop
- pop edi
- retn 4
-endp
-
-
-;**********************************************************************************
-; Converts strings to Upper Case
-; First parameter = String to Convert to upper case
-; corrupts eax
-;**********************************************************************************
-proc StrUCase ; proc StrUCase [hString]
- begin
- push edi
- stdcall StrPtr, [esp+4+1*4]
- xchg edi, eax
-._uppercaseloop:
- mov al, [edi]
- cmp al, 'a'
- jc @F
- cmp al, 'z'
- ja @F
- sub byte[edi], 20h
-@@:
- cmp byte[edi], 0
- lea edi, [edi+1]
- jnz ._uppercaseloop
- pop edi
- retn 4
-endp
-
-;**********************************************************************************
-; String copy mmx version for long strings does by copying qword at a time
-; First parameter = String destination
-; Second parameter = String source
-;**********************************************************************************
-proc StrCopyMMX ; proc StrCopyMMX [str1], [str2]
- begin
- push eax
- push ebx
- push ecx
- push edx
- stdcall StrPtr, [esp+4+4*4]
- xchg eax, edx
- stdcall StrPtr, [esp+8+4*4]
- mov ecx,eax
- stdcall StrLen,eax
- stdcall StrSetLength, [esp+4+4*4+4], eax
- mov eax,ecx
- xor ecx,ecx
- pxor MM7, MM7
-.MMX_loop:
- movq MM0, [eax+ecx]
- movq MM1, MM0
- pcmpeqb MM0, MM7
- packsswb MM0, MM0
- movd ebx, MM0
- test ebx, ebx
- jnz .normal_copy
- movq [edx+ecx], MM1
- add ecx, 8
- jmp .MMX_loop
-.normal_copy:
- mov bl, [eax+ecx]
- mov [edx+ecx], bl
- inc ecx
- test bl, bl
- jnz .normal_copy
- pop edx
- pop ecx
- pop ebx
- pop eax
- retn 8
-endp
-
-;**********************************************************************************
-; StrExtract copies the part of [str] from [index] with lenght in [len]
-; Returns handle to new created string.
-;**********************************************************************************
-proc StrExtract, .string, .index, .len
-begin
- push ebx ecx esi edi
- stdcall StrLen,[.string]
- cmp eax,[.index]
- jbe .error
- stdcall StrNew
- mov ebx,eax
- mov ecx,[.len]
- stdcall StrSetLength, eax,ecx ; stdcall StrSetLength, eax,[len]
- stdcall StrPtr, eax
- mov edi,eax
- stdcall StrPtr, [.string]
- add eax,[.index]
- mov esi,eax
- @@: mov al,[esi]
- mov [edi],al
- inc esi
- inc edi
- or al,al
- jz .copied
- dec ecx
- jnz @b
- xor al,al
- mov [edi],al
- .copied:
- mov eax,ebx
- pop edi esi ecx ebx
- return
- .error:
- xor eax,eax
- pop edi esi ecx ebx
- return
-endp
-
-;**********************************************************************************
-; _NumToStr converts the number in eax to the string in any radix approx. [2..26]
-; Arguments:
-; [edi] - pointer to the string buffer
-; ecx - radix
-; eax - number to convert.
-; There is no parameter check, so be careful.
-; returns: edi points to the end of a converted number
-;**********************************************************************************
-proc _NumToStr
-begin
- test eax,eax
- jns _NumToStrU
- neg eax
- mov byte [edi],"-"
- inc edi
-endp
-
-proc _NumToStrU
-begin
- cmp eax,ecx
- jb .lessA
- xor edx,edx
- div ecx
- push edx
- call _NumToStrU
- pop eax
-.lessA:
- cmp al, 10
- sbb al, 69h
- das
- stosb
- return
-endp
-
-;*****************************************************
-; NumToStrF:
-; Converts signed integer value to string.
-; NumToStrUF:
-; Converts unsigned integer value to string.
-;
-; edi - pointer to string buffer
-; eax - Number to convert
-; ecx - radix from 2 to $ff
-; esi - length of the number in chars
-;
-; returns: edi - pointer to the end of converted num
-;
-; Note: Don't use 1 as radix.
-;*****************************************************
-proc NumToStrF
-begin
- test eax,eax
- jns NumToStrUF
- neg eax
- mov byte [edi],'-'
- push esi
- dec esi
- add edi,esi
- push edi
- jmp NumToStrUF.loopc
-endp
-
-proc NumToStrUF
- begin
- push esi
- add edi, esi
- push edi
- dec edi
-.loopc:
- xor edx,edx
- div ecx
- xchg al,dl
- cmp al,$0a
- sbb al,$69
- das
- mov [edi],al
- dec edi
- xchg al,dl
- dec esi
- jnz .loopc
- pop edi
- pop esi
- return
-endp
-
-
-;***********************************************************
-; NumToStr - converts number to any radix.
-; num - number to convert
-; str - handle of the string. If NULL - creates new string.
-; index - Offset in string where to put converted number.
-; flags:
-; byte 0 - number of digits if ntsFixedWidth is set.
-; byte 1 - contains radix for the convertion.
-; byte 2,3 - flags.
-; Returns:
-; eax - handle of the string (new one or passed in [str])
-; edx - pointer to the string.
-;***********************************************************
-proc NumToStr, .num, .strng, .index, .flags
-.max_len dd ?
-.len_tab rb 20 ; table that holds maximum number of digits in given system
- begin
- push ebx ecx edx esi edi
-
- mov [.len_tab+2],32+2 ; binary number - max. 32 digits (+2 bytes for '-' character and NULL terminator)
- mov [.len_tab+4],16+2 ; quad number - max. 16 digits
- mov [.len_tab+8],11+2 ; octal number - max. 11 digits
- mov [.len_tab+10],9+2 ; decimal number - max. 9 digits
- mov [.len_tab+16],8+2 ; hexadecimal number - max. 8 digits
- movzx ebx,byte [.flags+1] ; load radix into ebx
- movzx eax,byte[.len_tab+ebx]
- mov [.max_len],eax ; store max. number of digits
- mov eax,[.strng]
- or eax,eax
- jnz .string_exists
- stdcall StrNew
- mov [.strng],eax
- .string_exists:
- test eax,0xffff0000
- jnz @f ; don't resize if [str] isn't a handle
- mov ebx,eax
- mov eax,[.max_len]
- add eax,[.index]
- mov edx,eax
- stdcall StrLen,ebx
- cmp eax,edx
- ja @f ; don't resize string if it has enough place for converted number
-
- stdcall StrSetLength,ebx, edx
-
- @@: ; determine which conversion func to use
- mov eax,[.flags]
- mov edx,eax
- and eax,ntsFixedWidth
- jnz .fixed_width
- mov eax,edx
- and eax,ntsUnsigned
- jnz .unsigned
- mov ebx,_NumToStr
- jmp .got_func
- .unsigned:
- mov ebx,_NumToStrU
- jmp .got_func
-
- .fixed_width:
- movzx esi, byte [.flags] ; load fixed width into esi
- mov eax, edx
- and eax, ntsUnsigned
- jnz .fixed_unsigned
- mov ebx,NumToStrF
- jmp .got_func
- .fixed_unsigned:
- mov ebx,NumToStrUF
- .got_func:
- stdcall StrPtr, [.strng]
- add eax,[.index]
- mov edi,eax
- movzx ecx,byte [.flags+1] ; load radix into ecx
- mov eax, [.num]
- call ebx ; call low-level convertion routine
- mov eax, [.flags]
- and eax, ntsZeroTerminated
- jz .ret
- mov byte [edi], 0
-
- .ret:
- pop edi esi edx ecx ebx
- mov eax, [.strng]
- return
-endp
-
-
-;-------------------------------------------------
-; function StrHash
-; Computes 32 bit hash value from the string.
-; The function is compatible with FASM hash
-; function if OrMask = 0.
-;
-; Arguments:
-; hString - handle/pointer of the string.
-; OrMask - every byte from the string will be ORed
-; with this value (byte)
-; Return:
-; eax - 32bit hash value.
-;-------------------------------------------------
-proc StrHashOld, .hString, .OrMask
-begin
- push esi ebx ecx
-
- stdcall StrPtr, [.hString]
- mov esi, eax
-
- xor ebx, ebx
- xor eax, eax
-.hashloop:
- rol eax, 12
- mov ecx, eax
- shr eax, 8
- and ecx, 1111b
- or eax, ecx
- movzx ecx, byte [esi+ebx]
- jecxz .endloop
- or cl, byte [.OrMask]
- add eax, ecx
- inc ebx
- jmp .hashloop
-
-.endloop:
- and eax,0FFFFFFh
- shl ebx,24
- or eax,ebx
- pop ecx ebx esi
- return
-endp
-
-
-proc StrHash, .hString, .OrMask
-begin
- push esi edi ebx ecx edx
-
- stdcall StrPtr, [.hString]
- mov esi, eax
-
- xor ebx, ebx
- mov eax,2166136261 ; FNV offset basis
- xor ecx, ecx
- mov edi, 16777619 ; FNV prime
-.hashloop:
- mov cl, [esi+ebx]
- jecxz .endstring
- inc bl
- or cl, byte [.OrMask]
- xor al,cl ; FNV-1a hashing
- mul edi
- jmp .hashloop
-
-.endstring:
- mov edx,eax
- and eax,0FFFFFFh ; xor-fold to 24 bits
- shr edx,24
- xor eax,edx
- shl ebx,24 ; the length of the string
- or eax,ebx ; store length in high 8 bits
- pop edx ecx ebx edi esi
- return
-endp
-
-
-
-;-------------------------------------------------------
-; function StrToNum
-; Converts specified string into a number
-;
-; Arguments:
-; hString - handle/pointer of the string containing
-; number to convert. It doesn't have to be ended by
-; NULL, any other character will stop conversion.
-; Number to convert must be decimal.
-;
-; Return:
-; eax - converted number
-;
-; Note: in case of failture (first char of given pointer
-; isn't a number) function returns -1.
-;-------------------------------------------------------
-proc StrToNum, .hString
- begin
- push ebx edx esi
- xor ebx,ebx ; ebx will store our number
- stdcall StrPtr, [.hString]
- mov esi,eax
- xor eax,eax
- mov al,[esi]
- cmp al,'0'
- jb .error
- cmp al,'9'
- jbe .digit
- jmp .error
- .digit:
- sub al,'0'
- add ebx,eax
- inc esi
- mov al,[esi]
- cmp al,'0'
- jb .finish
- cmp al,'9'
- ja .finish
- mov edx,ebx ; multiply ebx by 10
- shl ebx,3
- add ebx,edx
- add ebx,edx
- jmp .digit
- .finish:
- mov eax,ebx
- pop esi edx ebx
- return
-
- .error:
- xor eax,eax
- dec eax
- pop esi edx ebx
- return
-endp
-
-;-------------------------------------------------------
-; function StrCharCat
-; Addes specified char to the end of a string
-;
-; Arguments:
-; hString - string to append
-; char - char to add
-;-------------------------------------------------------
-proc StrCharCat, .hString, .char
-begin
- push eax ebx ecx
- mov ebx, [.hString]
- stdcall StrLen, ebx
- mov ecx, eax
- inc eax
- stdcall StrSetLength, ebx, eax
-; stdcall StrPtr, ebx ; StrSetLength returns a pointer to the string
- add ecx, eax
- mov eax, [.char]
- mov [ecx], al
- inc ecx
- mov byte [ecx], 0
- pop ecx ebx eax
- return
-endp
-
-;------------------------------------------------------------
-; function StrInsertChar
-; Inserts specified char into given position ot the string
-;
-; Arguments:
-; hString - string to append
-; char - char to add
-; pos - position where to add the char
-;-------------------------------------------------------------
-proc StrInsertChar, .hString, .char, .pos
- begin
- push eax ebx ecx
- mov ebx, [.hString]
- stdcall StrLen, ebx
- cmp eax, [.pos]
- jb .finish
- je .append
- mov ecx,eax
- inc eax
- stdcall StrSetLength, ebx, eax
- stdcall StrPtr, ebx
- add ecx, eax
- mov ebx, eax
- add ebx, [.pos]
- mov byte [ecx+1], 0 ; add NULL-terminator in the end of our string
- .shift:
- mov al, [ecx-1]
- mov [ecx], al
- dec ecx
- cmp ecx, ebx
- jne .shift
- mov eax, [.char]
- mov [ebx], al
- .finish:
- pop ecx ebx eax
- return
- .append:
- stdcall StrCharCat, ebx, [.char]
- jmp .finish
-endp
-
-
-
-
-
-proc StrURLEncode, .hstr
-.res dd ?
-begin
- push ebx ecx edx esi edi
- stdcall StrPtr, [.hstr]
- mov esi, eax
-
- stdcall StrLen, esi
- mov ecx, eax
- lea edx, [2*eax+eax] ; the encoded string can be max 3x long as original string.
-
- stdcall StrNew
- mov [.res], eax
- jecxz .finish
-
- stdcall StrSetLength, eax, edx
- mov edi, eax
- xor edx, edx
- xor ebx, ebx
-
-.encode:
- lodsb
- cmp al, $80
- jae .store ; it is a hack, but I hope save enough.
-
- mov dl, al
- mov bl, al
- shr edx, 5
- and ebx, $1f
- bt dword [URLCharTable+4*edx], ebx
- jnc .store
-
- mov ah, al
- mov al, '%'
- stosb
- mov al, ah
- shr al, 4
- cmp al, $0a
- sbb al, $69
- das
- stosb
- mov al, ah
- and al, $0f
- cmp al, $0a
- sbb al, $69
- das
-
-.store:
- stosb
- loop .encode
-.end:
- xor al, al
- stosb
-.finish:
- mov eax, [.res]
- pop edi esi edx ecx ebx
- return
-endp
-
-; Contains 1 where the character must be % encoded and 0 where it is save to pass it directly
-URLCharTable db 11111111b ;
- db 11111111b ;
- db 11111111b ;
- db 11111111b ; 0..31 -control chars | encoded
- db 11111111b ; $27 - $20: '&%$#"! | encoded
- db 11111111b ; $2f - $28: /.-,+*)( | encoded
- db 00000000b ; $37 - $30: 76543210 | not encoded
- db 11111100b ; $3f - $38: ?>=<;:98 | partially
- db 00000001b ; $47 - $40: GFEDCBA@ | partially
- db 00000000b ; $4f - $48: ONMLKJIH | not encoded
- db 00000000b ; $57 - $50: WVUTSRQP | not encoded
- db 11111000b ; $5f - $58: _^]\[ZYX | partially
- db 00000001b ; $67 - $60: gfedcba` | partially
- db 00000000b ; $6f - $68: onmlkjih | not encoded
- db 00000000b ; $77 - $70: wvutsrqp | not encoded
- db 11111000b ; $7f - $78: ~}|{zyx | partially
DELETED freshlib/_trash/SurplusSources/drafts/strlibnew.asm
Index: freshlib/_trash/SurplusSources/drafts/strlibnew.asm
==================================================================
--- freshlib/_trash/SurplusSources/drafts/strlibnew.asm
+++ /dev/null
@@ -1,1000 +0,0 @@
-; ____________________________________________________________________
-;| |
-;| This file is part of the project: |
-;| |
-;| ..::FreshLib::.. - portable, assembler library and GUI toolkit. |
-;|____________________________________________________________________|
-;| |
-;| This file |
-;| _________ |
-;| Author: |
-;| |
-;| Title: StrLib.asm - OS independent string manipulation library. |
-;| |
-;| OS: |
-;| |
-;| Notes and changes: |
-;| Uses memory.asm library for memory functions. |
-;| |
-;| |
-;|____________________________________________________________________|
-
-
-STR_MINSTRLEN = 16 ; 16 bytes minimum string length
-
-; NumToStr flags
-ntsSigned = $00000
-ntsUnsigned = $10000
-ntsZeroTerminated = $20000
-ntsFixedWidth = $40000
-
-ntsBin = $0200
-ntsQuad = $0400
-ntsOct = $0800
-ntsDec = $0a00
-ntsHex = $1000
-
-struc TString {
- .capacity dd ? ; length of allocated buffer.
- .len dd ? ; length of the string.
- label .data byte
-}
-virtual at -(sizeof.TString)
- TString TString
- sizeof.TString = $-TString
-end virtual
-
-
-struc string [value] {
-common
-local ..len, ..capacity, ..pad1, ..pad2
- virtual
- align 4
- ..pad1 = $ - $$
- end virtual
- db ..pad1 dup 0
-
- dd ..capacity
- dd ..len
-label . byte
-forward
- db value
-common
- ..len = $ - .
- virtual
- align 4
- ..pad2 = $ - $$
- end virtual
- db ..pad2 dup 0
- ..capacity = $ - .
- dd 0
-}
-
-
-; String format:
-; Let esi points to StrLib string. Then:
-; dword [esi-8] contains allocated memory size for the string.
-; dword [esi-4] contains length of the string in bytes.
-; [esi] .. [esi+length] contains the string itself.
-; at the end of the string, always have at least one dword zero, so it is safe to
-; scan the string by dwords.
-
-
-; < Library functions >
-
-
-;______________________________________________________________________________________
-;
-; Creates new empty string and returns pointer to it.
-; Arguments:
-; NONE
-; RETURNS:
-; CF=0 -> no error; ebx = pointer to the new created string.
-; CF=1 -> memory allocation error. ebx=0
-;______________________________________________________________________________________
-proc StrNew
-begin
- stdcall GetMem, STR_MINSTRLEN+sizeof.TString+4
- jc .finish
-
- lea eax, [eax+sizeof.TString]
- mov [eax+TString.capacity], STR_MINSTRLEN
-
-.finish:
- return
-endp
-
-
-;__________________________________________________________________________
-;
-; Delete string.
-; Arguments:
-; .pString - string created with StrNew, or other StrLib procedure.
-; Returns:
-; Nothing
-;__________________________________________________________________________
-proc StrDel, .pString
-begin
- push [.pString]
- sub dword [esp], sizeof.TString
- call FreeMem
- return
-endp
-
-
-
-;__________________________________________________________________________
-;
-; Duplicates given string, and returns a pointer to new one
-; Arguments:
-; .pString - pointer to the string, allocated with StrLib
-; Returns:
-; CF=0; eax - pointer to the duplicated string.
-; CF=1; eax - NULL
-;__________________________________________________________________________
-proc StrDup, .pString
-begin
- stdcall StrNew
- jc .exit
-
- stdcall StrCopy, eax, [.pString]
- jnc .exit
-
- stdcall StrDel, eax
- xor eax, eax
- stc
-.exit:
- return
-endp
-
-
-
-proc StrDupAsciiZ, .pAsciiZ
-begin
- stdcall StrNew
- jc .exit
-
- stdcall StrCopyAsciiZ, eax, [.pAsciiZ]
- jnc .exit
-
- stdcall StrDel, eax
- xor eax, eax
- stc
-.exit:
- return
-endp
-
-
-
-;__________________________________________________________________________
-;
-; proc StrSearchLen, .pString
-; Searches to the end of ASCIIZ string and returns the length of the string.
-;
-; Arguments:
-; pString - pointer to the string.
-; Returns:
-; ecx - length of the string in bytes.
-;__________________________________________________________________________
-proc StrSearchLen, .pString
-begin
- mov ecx, [.pString]
-.scan:
- cmp byte [ecx], 0
- lea ecx, [ecx+1]
- jne .scan
-
- stc
- sbb ecx, [.pString]
- return
-endp
-
-
-;__________________________________________________________________________
-; proc StrSearchLenFast, .pString
-; The same as StrSearchLen, but works on dwords and is much faster.
-; The string must ends with at least one aligned dword of NULL.
-; This is the case with every string from StrLib, but not always with
-; system provided strings.
-;
-; Arguments:
-; pString - pointer to the string.
-; Returns:
-; ecx - length of the string in bytes.
-;__________________________________________________________________________
-proc StrSearchLenFast, .pString
-begin
- mov ecx, [.pString]
-.scan:
- cmp dword [ecx], 0
- lea ecx, [ecx+4]
- jne .scan
-
- lea ecx, [ecx-4]
-
-; so search back
-.byteloop:
- lea ecx, [ecx-1]
- cmp byte [ecx], 0
- je .byteloop
-
- lea ecx, [ecx+1]
- sub ecx, [.pString]
- return
-endp
-
-
-
-
-
-;___________________________________________________________________________
-;
-; Ensures that the string can take [.capacity] bytes.
-; If the function resize the string, the new size is multiple of 4.
-;
-; Arguments:
-; .pString - string pointer.
-; .capacity - desired string capacity.
-; Returns:
-; eax - pointer to the string (can be different than passed in .pString)
-; CF=1 if error allocation. In this case eax still contains pointer, but
-; the capacity is not changed.
-;___________________________________________________________________________
-proc StrSetCapacity, .pString, .capacity
-begin
- push ecx
-
- mov ecx, [.capacity]
-
- add ecx, 3 + sizeof.TString + 4
- and cl, $fc
- cmp ecx, STR_MINSTRLEN + sizeof.TString + 4
- jae @f
- mov ecx, STR_MINSTRLEN + sizeof.TString + 4
-@@:
- sub [.pString], sizeof.TString
-
- stdcall ResizeMem, [.pString], ecx
- jc .finish
-
-.sizeok:
- lea ecx, [ecx-(sizeof.TString+4)]
- mov [eax], ecx
-
-.finish:
- lea eax, [eax+sizeof.TString]
- pop ecx
- return
-endp
-
-
-
-
-;_______________________________________________________________________________________
-; Copies source to destination string.
-; Arguments:
-; source - source string. for StrCopyAsciiZ - can be any zero terminated string.
-; for StrCopy, must be strlib string.
-; dest - destination string. Always strlib string.
-; Returns:
-; eax - pointer to destination string.
-; CF=1 -> error with memory allocation. source is not copied and destination is
-; not changed.
-;_______________________________________________________________________________________
-proc StrCopyAsciiZ, .dest, .source
-begin
- push ecx esi edi
-
- mov esi, [.source]
- stdcall StrSearchLen, esi
- jmp StrCopy.docopy
-virtual
- call StrCopy
-end virtual
-endp
-
-
-
-proc StrCopy, .dest, .source
-begin
- push ecx esi edi
-
- mov esi, [.source]
- mov ecx, [esi+TString.len]
-
-.docopy:
- stdcall StrSetCapacity, [.dest], ecx
- jc .finish
-
- mov edi, eax
- mov [eax+TString.len], ecx
- push ecx
- shr ecx, 2
- rep movsd
- pop ecx
- and ecx, 3
- rep movsb
-
- mov dword [edi], ecx
- add edi, 3
- and edi, $fffffffc
- mov dword [edi], ecx
- clc
-
-.finish:
- pop edi esi ecx
- return
-endp
-
-
-
-
-proc StrCopyPart, .dest, .source, .pos
-begin
- push ecx esi edi
-
- mov eax, [.dest]
- mov esi, [.source]
- mov ecx, [esi+TString.len]
- cmp [.pos], ecx
- jae .finish
-
- sub ecx, [.pos]
- add esi, [.pos]
-
- stdcall StrSetCapacity, [.dest], ecx
- jc .finish
-
- mov edi, eax
- mov [eax+TString.len], ecx
-
- push ecx
- shr ecx, 2
- rep movsd
- pop ecx
- and ecx, 3
- rep movsb
-
- mov dword [edi], ecx
- add edi, 3
- and edi, $fffffffc
- mov dword [edi], ecx
- clc
-
-.finish:
- pop edi esi ecx
- return
-endp
-
-
-;__________________________________________________________________________________
-; Splits the string on two strings, at position [.pos]
-; Arguments:
-; .pString - pointer to string to be splitted.
-; .pos - position where to split the string.
-; Returns:
-; eax - pointer to the new created string with second part of the string.
-; the original string does not reallocate memory and it's capacity
-; and the pointer will remains the same.
-;__________________________________________________________________________________
-
-proc StrSplit, .pString, .pos
-begin
- push ecx
-
- stdcall StrNew
-
- mov ecx, [.pString]
- mov ecx, [ecx+TString.len]
- cmp [.pos], ecx
- jae .ready
-
- stdcall StrCopyPart, eax, [.pString], [.pos]
-
- mov ecx, [.pString]
- push [.pos]
- pop [ecx+TString.len] ; new length of the string.
-
- add ecx, [ecx+TString.len]
-
- mov dword [ecx], 0
- add ecx, 3
- and cl, $fc
- mov dword [ecx], 0
-
-.ready:
- pop ecx
- return
-endp
-
-
-
-
-
-
-
-
-;_______________________________________________________________________________________
-; Compares two strings - case sensitive.
-; Returns CARRY = 1 if the strings are equal.
-; Returns CARRY = 0 if the strings are different.
-;_______________________________________________________________________________________
-proc StrCompCase, .str1, .str2
-begin
- push eax ecx esi edi
-
- mov esi, [.str1]
- mov edi, [.str2]
-
- cmp esi, 0
- je .noteq
-
- cmp edi, 0
- je .noteq
-
- mov ecx, [esi+TString.len]
- cmp ecx, [edi+TString.len]
- jne .noteq
-
- repe cmpsb
- jne .noteq
-
- stc
- pop edi esi ecx eax
- return
-
-.noteq:
- clc
- pop edi esi ecx eax
- return
-endp
-
-
-;_______________________________________________________________________________________
-; Compares two strings - case NOT sensitive.
-; Returns CARRY = 1 if the strings are equal.
-; Returns CARRY = 0 if the strings are different.
-;_______________________________________________________________________________________
-proc StrCompNoCase, .str1, .str2
-begin
- push eax esi edi
- stdcall StrPtr, [.str1]
- mov esi,eax
- stdcall StrPtr, [.str2]
- mov edi,eax
-
-.cmploop:
- mov al, [esi]
- lea esi, [esi+1]
- mov ah, [edi]
- lea edi, [edi+1]
-
- test al,al
- jz .eos
- test ah,ah
- jz .noteq
-
- or eax, $2020
- cmp al, ah
- je .cmploop
-
-.noteq:
- clc
- pop edi esi eax
- return
-
-.eos:
- test ah,ah
- jnz .noteq
-
- stc
- pop edi esi eax
- return
-endp
-
-
-
-
-
-;__________________________________________________________________________________
-; StrCat appends one string to another
-; Arguments:
-; dest - destination string (handle only)
-; source - source string
-; Returs:
-; eax - pointer to destination string.
-; CF - error flag.
-;__________________________________________________________________________________
-proc StrCat, .dest, .source
-begin
- push ecx esi edi
-
- mov eax, [.dest]
- mov esi, [.source]
- mov edi, eax
-
- mov ecx, [esi+TString.len]
- add ecx, [edi+TString.len]
- cmp ecx, [edi+TString.capacity]
- jbe .sizeok
-
- stdcall StrSetCapacity, edi, ecx
- jc .finish
- mov edi, eax
-
-.sizeok:
- xchg [edi+TString.len], ecx
- add edi, ecx
-
- mov ecx, [esi+TString.len]
- push ecx
- shr ecx, 2
-
- rep movsd
- pop ecx
- and ecx, 3
- rep movsb
-
- mov dword [edi], 0
-
- clc
-
-.finish:
- pop edi esi ecx
- return
-endp
-
-
-;__________________________________________________________________________________
-; StrCharPos returns a pointer to the first occurence of a given char
-; in specified string
-; Arguments:
-; Char - char to look for
-; hString - string to search
-; Returns:
-; ebx - offset of the char in the string.
-; CF=1 if the char is found.
-; CF=0 if the char is not found. EBX is not changed in this case.
-;__________________________________________________________________________________
-proc StrPosChar, .pString, .char
-begin
- push eax ecx ebx
-
- mov ebx, [.pString]
- mov ecx, [esi+TString.len]
-
- mov al, byte [.char]
-
-.search:
- cmp [ebx], al
- je .found
- lea ebx, [ebx+1]
- dec ecx
- jnz .search
-
- clc
- pop ebx ecx eax
- return
-
-.found:
- sub ebx, [.pString]
- lea esp, [esp+4]
- stc
- pop ecx eax
- return
-endp
-
-
-;__________________________________________________________________________________
-; StrPos returns the offset of the first occurence of a pattern string
-; in another string
-; Arguments:
-; hPattern - 'pattern' string
-; hString - string to search
-; Returns: a pointer to the pattern string in source , or NULL if pattern string
-; doesn't occur in the string to search
-;__________________________________________________________________________________
-proc StrPos, .pString, .pPatern
-begin
- push esi edi eax ecx ebx
-
- mov esi, [.pString]
- mov edi, [.pPatern]
-
- mov ecx, [esi+TString.len]
- mov ebx, [edi+TString.len]
- test ebx, ebx
- jz .found
-
- cmp ebx, ecx
- ja .notfound ; the parern is longer than string.
-
- sub ecx, ebx
- dec esi
- lea ecx, [ecx+2]
-
-.outer:
- dec ecx
- jz .notfound
-
- mov ebx, [edi+TString.len]
- lea esi, [esi+1]
-
-.inner:
- mov al, [esi+ebx-1]
- cmp al, [edi+ebx-1]
- jne .outer
-
- dec ebx
- jnz .inner
-
-.found:
- sub esi, [.pString]
- mov [esp], esi
- stc
- pop ebx ecx eax edi esi
- return
-
-.notfound:
- clc
- pop ebx ecx eax edi esi
- return
-endp
-
-
-
-
-;__________________________________________________________________________________
-; StrInsert inserts one string into another at specified pos
-; Arguments:
-; dest - destination where the source will be inserted.
-; source - string to insert
-; pos - where to insert.
-; Returns:
-; eax - pointer to destination string.
-;__________________________________________________________________________________
-proc StrInsert, .dest, .source, .pos
-begin
- stdcall StrSplit, [.dest], [.pos]
- push eax eax
- stdcall StrCat, [.dest], [.source]
- stdcall StrCat, eax ; source from the stack.
- stdcall StrDel; from the stack.
- return
-endp
-
-
-
-;__________________________________________________________________________________
-; Converts strings to Lower Case
-; First parameter = String to Convert to lower case
-; corrupts eax
-;__________________________________________________________________________________
-proc StrLCase, .ptrString
-begin
- push eax edi
- mov edi, [.ptrString]
- mov eax, [edi+TString.len]
- dec edi
-.loop:
- inc edi
- dec eax
- js .endstring
-
- cmp byte [edi], 'A'
- jb .loop
- cmp byte [edi], 'Z'
- ja .loop
-
- or byte [edi], 20h
- jmp .loop
-
-.endstring:
- pop edi eax
- return
-endp
-
-
-;__________________________________________________________________________________
-; Converts strings to Upper Case
-; First parameter = String to Convert to upper case
-; corrupts eax
-;__________________________________________________________________________________
-proc StrUCase, .ptrString
-begin
- push eax edi
- mov edi, [.ptrString]
- mov eax, [edi+TString.len]
- dec edi
-.loop:
- inc edi
- dec eax
- js .endstring
-
- cmp byte [edi], 'a'
- jb .loop
- cmp byte [edi], 'z'
- ja .loop
-
- and byte [edi], ~20h
- jmp .loop
-
-.endstring:
- pop edi eax
- return
-endp
-
-
-
-
-;__________________________________________________________________________________
-; _NumToStr converts the number in eax to the string in any radix approx. [2..26]
-; Arguments:
-; edi - pointer to the string buffer
-; ecx - radix
-; eax - number to convert.
-; There is no parameter check, so be careful.
-; returns: edi points to the end of a converted number
-;__________________________________________________________________________________
-proc _NumToStr
-begin
- test eax, eax
- jns _NumToStrU
- neg eax
- mov byte [edi],"-"
- inc edi
-endp
-
-
-proc _NumToStrU
-begin
- cmp eax,ecx
- jb .lessA
-
- xor edx,edx
- div ecx
- push edx
- call _NumToStrU
- pop eax
-
-.lessA:
- cmp al, 10
- sbb al, 69h
- das
- stosb
- return
-endp
-
-;_____________________________________________________
-; NumToStrF:
-; Converts signed integer value to string.
-; NumToStrUF:
-; Converts unsigned integer value to string.
-;
-; edi - pointer to string buffer
-; eax - Number to convert
-; ecx - radix from 2 to 26
-; esi - length of the number in chars
-;
-; returns: edi - pointer to the end of converted num
-;
-; Note: Don't use 1 as radix.
-;_____________________________________________________
-proc NumToStrF
-begin
- test eax,eax
- jns NumToStrUF
- neg eax
- mov byte [edi],'-'
- push esi
- dec esi
- add edi,esi
- push edi
- jmp NumToStrUF.loopc
-endp
-
-proc NumToStrUF
- begin
- push esi
- add edi, esi
- push edi
- dec edi
-.loopc:
- xor edx,edx
- div ecx
- xchg al,dl
- cmp al,$0a
- sbb al,$69
- das
- mov [edi],al
- dec edi
- xchg al,dl
- dec esi
- jnz .loopc
- pop edi
- pop esi
- return
-endp
-
-
-;___________________________________________________________
-; NumToStr - converts number to any radix.
-; num - number to convert
-; str - handle of the string. If NULL - creates new string.
-; index - Offset in string where to put converted number.
-; flags:
-; byte 0 - number of digits if ntsFixedWidth is set.
-; byte 1 - contains radix for the convertion.
-; byte 2,3 - flags.
-; Returns:
-; eax - handle of the string (new one or passed in [str])
-; edx - pointer to the string.
-;___________________________________________________________
-proc NumToStr, .num, .strng, .index, .flags
-.max_len dd ?
-.len_tab rb 20 ; table that holds maximum number of digits in given system
-begin
- push ebx ecx edx esi edi
-
- mov [.len_tab+2],32+2 ; binary number - max. 32 digits (+2 bytes for '-' character and NULL terminator)
- mov [.len_tab+4],16+2 ; quad number - max. 16 digits
- mov [.len_tab+8],11+2 ; octal number - max. 11 digits
- mov [.len_tab+10],9+2 ; decimal number - max. 9 digits
- mov [.len_tab+16],8+2 ; hexadecimal number - max. 8 digits
- movzx ebx,byte [.flags+1] ; load radix into ebx
- movzx eax,byte[.len_tab+ebx]
- mov [.max_len],eax ; store max. number of digits
- mov eax,[.strng]
- or eax,eax
- jnz .string_exists
- stdcall StrNew
- mov [.strng],eax
-
- .string_exists:
- test eax,0xffff0000
- jnz @f ; don't resize if [str] isn't a handle
- mov ebx,eax
- mov eax,[.max_len]
- add eax,[.index]
- mov edx,eax
- stdcall StrSearchLen, ebx
- cmp eax,edx
- ja @f ; don't resize string if it has enough place for converted number
-
- stdcall StrSetLength,ebx, edx
-
- @@: ; determine which conversion func to use
- mov eax,[.flags]
- mov edx,eax
- and eax,ntsFixedWidth
- jnz .fixed_width
- mov eax,edx
- and eax,ntsUnsigned
- jnz .unsigned
- mov ebx,_NumToStr
- jmp .got_func
- .unsigned:
- mov ebx,_NumToStrU
- jmp .got_func
-
- .fixed_width:
- movzx esi, byte [.flags] ; load fixed width into esi
- mov eax, edx
- and eax, ntsUnsigned
- jnz .fixed_unsigned
- mov ebx,NumToStrF
- jmp .got_func
- .fixed_unsigned:
- mov ebx,NumToStrUF
- .got_func:
- stdcall StrPtr, [.strng]
- add eax,[.index]
- mov edi,eax
- movzx ecx,byte [.flags+1] ; load radix into ecx
- mov eax, [.num]
- call ebx ; call low-level convertion routine
- mov eax, [.flags]
- and eax, ntsZeroTerminated
- jz .ret
- mov byte [edi], 0
-
- .ret:
- pop edi esi edx ecx ebx
- mov eax, [.strng]
- return
-endp
-
-
-
-;-------------------------------------------------------
-; function StrToNum
-; Converts specified string into a number
-;
-; Arguments:
-; hString - handle/pointer of the string containing
-; number to convert. It doesn't have to be ended by
-; NULL, any other character will stop conversion.
-; Number to convert must be decimal.
-;
-; Return:
-; eax - converted number
-;
-; Note: in case of failture (first char of given pointer
-; isn't a number) function returns -1.
-;-------------------------------------------------------
-proc StrToNum, .hString
-begin
- push ebx edx esi
- xor ebx,ebx ; ebx will store our number
- stdcall StrPtr, [.hString]
- mov esi,eax
- xor eax,eax
- mov al,[esi]
- cmp al,'0'
- jb .error
- cmp al,'9'
- jbe .digit
- jmp .error
- .digit:
- sub al,'0'
- add ebx,eax
- inc esi
- mov al,[esi]
- cmp al,'0'
- jb .finish
- cmp al,'9'
- ja .finish
- mov edx,ebx ; multiply ebx by 10
- shl ebx,3
- add ebx,edx
- add ebx,edx
- jmp .digit
- .finish:
- mov eax,ebx
- pop esi edx ebx
- return
-
- .error:
- xor eax,eax
- dec eax
- pop esi edx ebx
- return
-endp
-
-
-;-------------------------------------------------------
-; function StrCharCat
-; Addes up to 4 chars to the end of a string.
-;
-; Arguments:
-; ptrString - string to append
-; char - char(s) to add
-; Returns
-; eax: pointer to the string.
-;-------------------------------------------------------
-proc StrCatChar, .ptrString, .char
-begin
- push ebx ecx
-
- mov eax, [.ptrString]
- mov ecx, [eax+TString.len]
- lea ebx, [ecx+4]
- cmp ebx, [eax+TString.capacity]
- jbe .sizeok
-
- stdcall StrSetCapacity, eax, ebx
-
- pushd [.char]
- popd [eax+ecx]
- xor ebx, ebx
- mov [eax+ecx+4], ebx
- dec ecx
-.len:
- inc ecx
- cmp [eax+ecx], bl
- jne .len
-
- mov [eax+TString.len], ecx
- pop ecx ebx
- return
-endp
DELETED freshlib/_trash/SurplusSources/drafts/tests/MainForm.frm
Index: freshlib/_trash/SurplusSources/drafts/tests/MainForm.frm
==================================================================
--- freshlib/_trash/SurplusSources/drafts/tests/MainForm.frm
+++ /dev/null
@@ -1,327 +0,0 @@
-;
-uglobal
- pointer dd ?
-endg
-
-
-
-proc StrProc1, .ptr
-
-begin
- push edi ecx
-
- xor eax, eax
- or ecx, -1
- mov edi, [.ptr]
-
- repnz scasb
-
- not ecx
- dec ecx
- mov eax, ecx
-
- pop ecx edi
- return
-endp
-
-
-
-proc StrProc2, .ptr
-begin
- mov eax, [.ptr]
-
-.loop:
- cmp byte [eax], 0
- lea eax, [eax+1]
- jne .loop
-
- stc
- sbb eax, [.ptr]
- return
-endp
-
-
-
-
-proc StrProc3, .ptr
-begin
- push ebx ecx edx esi edi
-
- mov edi, $7f7f7f7f
- mov ecx, $80808080
-
- mov esi, [.ptr]
-
-.scan:
- mov eax, [esi]
- mov edx, [esi+4]
-
- and eax, edi
- and edx, edi
-
- add eax, edi
- add edx, edi
-
- or eax, [esi]
- or edx, [esi+4]
-
- and eax, ecx
- and edx, ecx
-
- and eax, edx
- add esi, 8
-
- cmp eax, ecx
- je .scan
-
-.found:
- lea eax, [esi-9]
-
-; so search by bytes
-.byteloop:
- lea eax, [eax+1]
- cmp byte [eax], 0
- jne .byteloop
-
- sub eax, [.ptr]
-
- pop edi esi edx ecx ebx
- return
-endp
-
-
-
-
-
-proc StrProc4, .pString
-begin
- mov eax, [.pString]
-.scan:
- cmp dword [eax], 0
- lea eax, [eax+4]
- jne .scan
-
- lea eax, [eax-4]
-
-; so search back
-.byteloop:
- lea eax, [eax-1]
- cmp byte [eax], 0
- je .byteloop
-
- lea eax, [eax+1]
- sub eax, [.pString]
- return
-endp
-
-
-
-
-proc StrProc5, .ptr
-begin
- push edx esi
-
- mov esi, [.ptr]
-.scan:
- mov eax, [esi]
- mov edx, [esi+4]
-
- and eax, $7f7f7f7f
- and edx, $7f7f7f7f
-
- add eax, $7f7f7f7f
- add edx, $7f7f7f7f
-
- or eax, [esi]
- or edx, [esi+4]
-
- and eax, $80808080
- and edx, $80808080
-
- and eax, edx
- add esi, 8
-
- cmp eax, $80808080
- je .scan
-
- lea eax, [esi-9]
-
-; so search by bytes
-.byteloop:
- lea eax, [eax+1]
- cmp byte [eax], 0
- jne .byteloop
-
- sub eax, [.ptr]
-
- pop esi edx
- return
-endp
-
-
-proc StrProc6, .ptr
-begin
- push ecx edx esi edi
-
- mov eax, [.ptr]
-.scan:
- mov ecx, [eax]
- mov edx, [eax+4]
-
- lea eax, [eax+8]
-
- lea esi, [ecx-$01010101]
- lea edi, [edx-$01010101]
-
- not ecx
- not edx
-
- and esi, ecx
- and edi, edx
-
- and esi, $80808080
- and edi, $80808080
-
- or esi, edi
- jz .scan
-
- sub eax, 9
-
-; byte 0 was found: so search by bytes.
-.byteloop:
- lea eax, [eax+1]
- cmp byte [eax], 0
- jne .byteloop
-
- sub eax, [.ptr]
-
- pop edi esi edx ecx
- return
-endp
-
-
-
-proc StrProc7, .ptr
-begin
- push ebx ecx
-
- mov eax, [.ptr]
-
-.scan:
- mov ebx, [eax]
- lea eax, [eax+4]
-
- lea ecx, [ebx-$01010101]
- not ebx
- and ecx, ebx
- and ecx, $80808080
- jz .scan
-
- lea eax, [eax-5]
-
-; so search by bytes
-.byteloop:
- inc eax
- cmp byte [eax], 0
- jne .byteloop
-
- sub eax, [.ptr]
-
- pop ecx ebx
- return
-endp
-
-
-
-
-
-
-
-
-
-
-
-
-winproc MainFormWinProc
-begin
-
-
-ondefault
- stc
- return
-
-
-
-
-onmessage WM_COMMAND
-
- invoke GetProcessHeap
- invoke HeapAlloc, eax, HEAP_ZERO_MEMORY, 1000000
-
- mov [pointer], eax
-
- mov edi, eax
- mov ecx, 985000 / 4
- or eax, -1
-
- rep stosd
- mov ecx, 29
- rep stosb
-
-
- invoke GetTickCount
- push eax
-
- mov ecx, 1000
-
-.loop1:
- stdcall StrProc7, [pointer]
- loop .loop1
-
- pop ebx
- push eax
-
- invoke GetTickCount
- sub eax, ebx
-
- stdcall SetNumber, [.hwnd], 100, eax
-
- pop eax
- stdcall SetNumber, [.hwnd], 101, eax
-
- invoke GetProcessHeap
- invoke HeapFree, eax, 0, [pointer]
-
- clc
- return
-
-
-endwp
-
-
-
-
-
-proc SetNumber, .hwnd, .id, .number
-begin
- pushad
-
- stdcall NumToStr, [.number], 0, 0, ntsDec or ntsUnsigned or ntsZeroTerminated
- push eax
- stdcall StrPtr, eax
- invoke SendDlgItemMessage, [.hwnd], [.id], WM_SETTEXT, 0, eax
- stdcall StrDel ; from the stack
-
- popad
- return
-endp
-
-
-
DELETED freshlib/_trash/SurplusSources/drafts/tests/README.TXT
Index: freshlib/_trash/SurplusSources/drafts/tests/README.TXT
==================================================================
--- freshlib/_trash/SurplusSources/drafts/tests/README.TXT
+++ /dev/null
@@ -1,11 +0,0 @@
-Atom 270 1.6GHz (eeepc 901HA)
-
-Proc1 - [repnz scasb] - 2380ms
-Proc2 - [cmp byte [eax],0] - 3000ms
-Proc3 - [$7f/$80 qword regs] - 1078ms
-Proc4 - [cmp dword[eax],0] - 828ms
-Proc5 - [$7f/$80 qword const] - 1080ms
-Proc6 - [$01/$80 qword const] - 1000ms
-Proc7 - [$01/$80 dword const] - 1297ms
-
-Proc2 is interesting.
DELETED freshlib/_trash/SurplusSources/drafts/tests/TinyGUI.asm
Index: freshlib/_trash/SurplusSources/drafts/tests/TinyGUI.asm
==================================================================
--- freshlib/_trash/SurplusSources/drafts/tests/TinyGUI.asm
+++ /dev/null
@@ -1,61 +0,0 @@
-format PE GUI 4.0
-entry Start
-
-include '%finc%\win32\win32a.inc'
-include '%finc%\libs\strlib.inc'
-
-include "%finc%\libs\msgutils.inc"
-include "%finc%\libs\tform.inc"
-include "%finc%\libs\parents.inc"
-include "%finc%\libs\templates.inc"
-
-include "%finc%\libs\msgutils.asm"
-include "%finc%\libs\tform.asm"
-include "%finc%\libs\parents.asm"
-include "%finc%\libs\templates.asm"
-
-include '%finc%\libs\strlib.asm'
-
-
-include "MainForm.frm"
-
-uglobal
- hInstance dd ?
- hHeap dd ?
- hMainForm dd ?
-endg
-
-Start:
- invoke GetModuleHandle,0
- mov [hInstance],eax
- invoke GetProcessHeap
- mov [hHeap], eax
-
- InitializeAll
-
- stdcall CreateForm, frmMain, NULL
- xor eax, eax
- test ebx, ebx
- jz .terminate
-
- mov [hMainForm], ebx
-
-.run:
- call ProcessMessages
- jc .terminate
-
- invoke WaitMessage
- jmp .run
-
-.terminate:
- push eax
- FinalizeAll
- invoke ExitProcess ; exit code from the stack.
-
-data import
- ImportLib kernel32, user32, gdi32, \
- comctl32, comdlg32, shell32, \
- ole32, advapi32
-end data
-
-IncludeAllGlobals
DELETED freshlib/_trash/SurplusSources/drafts/tests/TinyGUI.fpr
Index: freshlib/_trash/SurplusSources/drafts/tests/TinyGUI.fpr
==================================================================
--- freshlib/_trash/SurplusSources/drafts/tests/TinyGUI.fpr
+++ /dev/null
cannot compute difference between binary files
DELETED freshlib/_trash/SurplusSources/macroses.inc
Index: freshlib/_trash/SurplusSources/macroses.inc
==================================================================
--- freshlib/_trash/SurplusSources/macroses.inc
+++ /dev/null
@@ -1,191 +0,0 @@
-;*************************************************************
-;* macroses.inc
-;*
-;* This file contains some common data structures and
-;* constants. It not contains any data or
-;* code.
-;*
-;* You must include somewhere in the begining of the program.
-;*
-;* You can use this work for any purpos, only don't forget to
-;* write somewhere in docs: "Based on work of John Found" or
-;* something similar. :)
-;*
-;* '2003 John Found
-;*************************************************************
-
-macro icon group, [label, icon_file, index] {
- common
- local count
-
- count = 0
- forward
- local data,size,position
-
- load size dword from icon_file:$0e + $10 * index ; size of icon
- load position dword from icon_file:$12 + $10 * index ; position
-
- label dd RVA data,size, 0, 0
-
- data file icon_file:position,size
-
- count = count + 1
-
- common
- local header
-
- align 4
- group dd RVA header,6+count*14,0,0
- header dw 0,1,count
-
- forward
-
- file icon_file: 6+index*16, 12
- dw label#.resid
-
- common
- align 4
-
-}
-
-
-
-macro cursor [group,_label,cursor_file] {
- forward
- local _header, _data,_size,_position,_hotX, _hotY, _xsize, _ysize
-
- load _xsize byte from cursor_file:$06
- load _ysize byte from cursor_file:$07
- load _hotX word from cursor_file:$0a
- load _hotY word from cursor_file:$0c
- load _size dword from cursor_file:$0e
- load _position dword from cursor_file:$12
-
- align 4
-
- group dd RVA _header, $14, 0, 0
-
- _header dw 0, 2, 1
- dw _xsize, _ysize
- dw $1 ; Planes ???
- dw $00 ; Bit count ???
- dd _size+4 ; Resource len
-
- filter_id = RVA _label
-
- dw _label#.resid
-
- _label dd RVA _data, _size+4, 0, 0
-
- _data dw _hotX, _hotY
- file cursor_file:_position,_size
-}
-
-
-
-
-
-
-
-
-struc TInitCommonControlsEx Flg {
- .dwSize: dd .size ; size of this structure
- .dwICC: dd Flg ; flags indicating which classes to be initialized
- .size = $ - .dwSize
-}
-
-
-struc TMenuItemInfo {
- .cbSize dd .size
- .fMask dd ?
- .fType dd ?
- .fState dd ?
- .wID dd ?
- .hSubMenu dd ?
- .hBmpChecked dd ?
- .hBmpUnchecked dd ?
- .dwItemData dd ?
- .dwTypeData dd ?
- .cch dd ?
- .size = $ - .cbSize
-}
-
-
-virtual at 0
- TMenuItemInfo TMenuItemInfo
-end virtual
-
-
-
-struc TMeasureItemStruct {
- .CtlType dd ?
- .CtlID dd ?
- .itemID dd ?
- .itemWidth dd ?
- .itemHeight dd ?
- .itemData dd ?
-
- .size = $ - .CtlType
-}
-
-virtual at 0
- TMeasureItemStruct TMeasureItemStruct
-end virtual
-
-
-struc TDrawItemStruct {
- .CtlType dd ?
- .CtlID dd ?
- .itemID dd ?
- .itemAction dd ?
- .itemState dd ?
- .hwndItem dd ?
- .hDC dd ?
- .rectItem RECT
- .itemData dd ?
-
- .size = $ - .CtlType
-}
-
-virtual at 0
- TDrawItemStruct TDrawItemStruct
-end virtual
-
-
-
-
-struc TLogBrush Color {
- .lbStyle dd BS_SOLID
- .lbColor dd Color
- .lbHatch dd ?
-}
-
-
-struc TWindowClass AStyle, AWinProc, ABackground, AClassName
- {
- .style dd AStyle
- .lpfnWndProc dd AWinProc
- .cbClsExtra dd 0
- .cbWndExtra dd 0
- .hInstance dd ?
- .hIcon dd ?
- .hCursor dd ?
- .hbrBackground dd ABackground
- .lpszMenuName dd 0
-
- if AClassName eqtype ''
- .lpszClassName dd .ClassName
- .ClassName db AClassName,0
- else
- .lpszClassName dd AClassName
- .ClassName = AClassName
- end if
- }
-
-
-struc TLogBrush Color {
- .lbStyle dd BS_SOLID
- .lbColor dd Color
- .lbHatch dd ?
-}
-
DELETED freshlib/_trash/SurplusSources/qsort.asm
Index: freshlib/_trash/SurplusSources/qsort.asm
==================================================================
--- freshlib/_trash/SurplusSources/qsort.asm
+++ /dev/null
@@ -1,168 +0,0 @@
-QuickSortLib:
-
-;****************************************************
-; Quick sort of the array in the memory.
-;
-; ptrArray - pointer to the memory array.
-; ElementSize - size of one array element in bytes.
-; iBegin - index of the first element
-; iEnd - index of the last element
-; ptrCompareProc - pointer to procedure that compares two elements.
-;
-; ptrCompareProc have interface:
-; proc CompareSomething, ptrElement1, ptrElement2
-; returns: c=1 if elements are not properly sorted.
-; c=0 if elements are sorted, i.e.
-; element1 should be before element2
-;****************************************************
-
-
-proc QSort, ptrArray, ElementSize, iBegin, iEnd, ptrCompareProc
-begin
- push esi edi ebx
- mov esi, [ptrArray]
- mov edi, [ptrCompareProc]
- mov ebx, [ElementSize]
-
- stdcall DoQSort, [iBegin], [iEnd]
- pop ebx edi esi
- return
-endp
-
-;*****************************************************
-; Procedure for internal call from QSort procedure.
-;*****************************************************
-proc DoQSort, Left, Right
-begin
- push ecx
-
- mov ecx, [Left] ; i variable
- mov eax, ecx
- mov edx, [Right] ; j variable
- add eax, edx
- sar eax, 1
- imul eax, ebx
- imul ecx, ebx
- imul edx, ebx
- add eax, esi
- add ecx, esi
- add edx, esi
-
-.repeat:
- sub ecx, ebx
- add edx, ebx
-
-.whylei:
- add ecx, ebx
- stdcall edi, ecx, eax
- jnc .whylei
-
-.whylej:
- sub edx, ebx
- stdcall edi, eax, edx
- jnc .whylej
-
- cmp edx, ecx
- jl .next
-
- call SwapElements
-
- push edx
- cmp eax, ecx
- je @f
- mov [esp], ecx
- cmp eax, edx
- je @f
-
- mov [esp], eax
-@@:
- pop eax
-
- add ecx, ebx
- sub edx, ebx
-
-.next:
- cmp ecx, edx
- jle .repeat
-
- mov eax, edx
- sub eax, esi
- cdq
- idiv ebx
-
- cmp [Left], eax
- jge .leftok
-
- stdcall DoQSort, [Left], eax
-
-.leftok:
- mov eax, ecx
- sub eax, esi
- cdq
- idiv ebx
-
- cmp eax, [Right]
- jge .rightok
-
- stdcall DoQSort, eax, [Right]
-
-.rightok:
- pop ecx
- return
-endp
-
-
-
-;********************************************
-; Swaps two elements of the array with
-; pointers in:
-; Element1 - ecx
-; Element2 - edx
-; ElementSize - ebx
-;********************************************
-proc SwapElements
-begin
- push esi eax
-
- xor esi, esi
-.loop:
- mov al, [ecx+esi]
- xchg al, [edx+esi]
- mov [ecx+esi], al
-
- inc esi
- cmp esi, ebx
- jne .loop
-
- pop eax esi
- return
-endp
-
-
-
-
-proc CompareIntAscending, ptrElement1, ptrElement2
-begin
- push eax esi edi
-
- mov esi, [ptrElement1]
- mov edi, [ptrElement2]
-
- mov eax, [esi]
- cmp eax, [edi]
- jl .qfalse
-
- stc
- pop edi esi eax
- return
-
-
-.qfalse:
- clc
- pop edi esi eax
- return
-endp
-
-
-
-DispSize 'QSort lib', $ - QuickSortLib
DELETED freshlib/_trash/readme.txt
Index: freshlib/_trash/readme.txt
==================================================================
--- freshlib/_trash/readme.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-So, this is very early version of "FreshLib", that
-is highly portable library for Fresh and FASM
-development.
-
-Even now, you can create simple applications, portable
-between Win32 and Linux simply with one-click change in
-project options.
-
-The test project, that uses FreshLib is "TestFreshLib.fpr"
-You can compile and run it as Windows or as Linux application.
DELETED freshlib/data/Linux/utf8.asm
Index: freshlib/data/Linux/utf8.asm
==================================================================
--- freshlib/data/Linux/utf8.asm
+++ /dev/null
DELETED freshlib/data/ToBeRemoved/StrLibOS.asm
Index: freshlib/data/ToBeRemoved/StrLibOS.asm
==================================================================
--- freshlib/data/ToBeRemoved/StrLibOS.asm
+++ /dev/null
@@ -1,53 +0,0 @@
-;*******************************************************************************
-; Get the text of the [Control] using WM_GETTEXT and put it to the string with
-; handle (only) in [string].
-;
-; if [string] = NULL creates new string and returns the handle.
-; if [string] <> NULL just copyes the text.
-;*******************************************************************************
-proc GetControlText, .Control, .string
-.len dd ?
-begin
- push ebx ecx edx
-
- mov eax, [.string]
- test eax,eax
- jnz @f
- stdcall StrNew
-@@:
- mov ebx, eax
-
- invoke SendMessageA, [.Control], WM_GETTEXTLENGTH, 0, 0
- mov [.len], eax
- stdcall StrSetCapacity, ebx, eax
- jc .error
-
- push eax
- add [.len], 1
- invoke SendMessageA, [.Control], WM_GETTEXT, [.len], eax
- pop ecx
- mov [ecx+string.len], eax
- mov eax, ebx
- clc
-
-.error:
- pop edx ecx ebx
- return
-endp
-
-
-
-
-
-;*******************************************************************************
-; Sets the text in control using WM_SETTEXT from string with handle or pointer
-; in [string].
-;*******************************************************************************
-proc SetControlText, .Control, .string
-begin
- push eax ecx edx
- stdcall StrPtr, [.string]
- invoke SendMessageA, [.Control], WM_SETTEXT, 0, eax
- pop edx ecx eax
- return
-endp
DELETED freshlib/data/Win32/utf8.asm
Index: freshlib/data/Win32/utf8.asm
==================================================================
--- freshlib/data/Win32/utf8.asm
+++ /dev/null
@@ -1,73 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Library for converting UTF8 to and from WideChar
-;
-; Target OS: Win32
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-
-;-----------------------------------------------------------
-; Returns:
-; eax - pointer to the widechar string.
-; ecx - length of the widechar string in characters.
-;-----------------------------------------------------------
-proc utf8ToWideChar, .hString
-begin
- push edx edi
-
- stdcall StrLen, [.hString]
- mov ecx, eax
-
- mov edx, eax
- shl edx, 2
- stdcall GetMem, edx
- mov edi, eax
-
- stdcall StrPtr, [.hString]
-
- sar edx, 1
- invoke MultiByteToWideChar, CP_UTF8, 0, eax, ecx, edi, edx
- mov ecx, eax
- mov eax, edi
-
- pop edi edx
- return
-endp
-
-
-
-
-proc WideCharToUtf8, .ptrWideChar
-begin
- push ebx ecx edx edi
- invoke WideCharToMultiByte, CP_UTF8, 0, [.ptrWideChar], -1, 0, 0, 0, 0
- test eax, eax
- jz .error
-
- mov ebx, eax
- stdcall GetMem, ebx
- mov edi, eax
-
- invoke WideCharToMultiByte, CP_UTF8, 0, [.ptrWideChar], -1, edi, ebx, 0, 0
- stdcall StrDup, edi
-
- push eax
- stdcall FreeMem, edi
- pop eax
-
- clc
-.finish:
- pop edi edx ecx ebx
- return
-
-.error:
- stc
- jmp .finish
-endp
DELETED freshlib/data/all.asm
Index: freshlib/data/all.asm
==================================================================
--- freshlib/data/all.asm
+++ /dev/null
@@ -1,6 +0,0 @@
-include 'arrays.asm'
-include 'strlib.asm'
-include 'uconfig.asm'
-include 'memstream.asm'
-include 'markdown.asm'
-include 'md5lib.asm'
DELETED freshlib/data/arrays.asm
Index: freshlib/data/arrays.asm
==================================================================
--- freshlib/data/arrays.asm
+++ /dev/null
@@ -1,677 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: OS independent dynamic arrays library.
-;
-; Target OS: Any
-;
-; Dependencies: memory.asm
-;
-; Notes:
-;_________________________________________________________________________________________
-
-module "Arrays library"
-
-struct TArray
- .count dd ? ; Count of elements in dynamic array
- .capacity dd ? ; Capacity of the array allocated memory.
- .itemsize dd ? ; Size of one element in dynamic array. Aligned on dword.
- .lparam dd ? ; User defined value.
- label .array dword
-ends
-
-
-; ____________________________________________________________________
-;| |
-;| Creates dynamic array. |
-;| |
-;| Arguments: |
-;| |
-;| .ItemSize: size in bytes of one array element. |
-;| This size will be aligned to dword. |
-;| |
-;| Return: |
-;| if CF=1 the memory can't be allocated. |
-;| if CF=0 eax contains pointer to the created array. |
-;|____________________________________________________________________|
-
-proc CreateArray, .ItemSize
-begin
- push ecx edx
- mov ecx, [.ItemSize]
- add ecx, 3
- and cl, $fc
- mov edx, ecx
-
- imul ecx, cInitialCapacity
- add ecx, sizeof.TArray
- stdcall GetMem, ecx
-.retaddr:
- jc .finish
-
- mov [eax+TArray.itemsize], edx
- mov [eax+TArray.capacity], cInitialCapacity
- clc
-
-.finish:
- pop edx ecx
- return
-endp
-
-
-; returns a pointer to the array item.
-; Arguments:
-; .array - pointer to TArray
-; .index - index of the array element.
-;
-; Returns:
-; CF=0; EAX = pointer to the array element.
-; CF=1 - indicates that [.index] is bigger than the array element count;
-; in this case EAX = points after the last element of the array.
-
-proc GetArrayItem, .array, .index
-begin
- push ecx esi
-
- mov esi, [.array]
- mov eax, [.index]
- mov ecx, [esi+TArray.count]
-
- cmp eax, ecx
- cmovae eax, ecx
-
- imul eax, [esi+TArray.itemsize]
- lea eax, [esi+TArray.array+eax]
-
-; set CF
- sub ecx, 1
- jc @f
- cmp ecx, [.index]
-@@:
- pop esi ecx
- return
-endp
-
-
-
-;____________________________________________________________________
-;
-; proc AddArrayItems - adds new item at the end of TArray
-; dynamic array.
-; Arguments:
-;
-; .ptrArray - pointer to dword variable containing pointer
-; to TArray structure.
-; .count - count of the elements to be added.
-;
-; Returns:
-; CF=1 if error: edx - pointer to the original array.
-;
-; CF=0 if OK: eax - pointer to new created element.
-; edx - pointer to the array.
-;
-; Notes:
-; The procedure returns in edx pointer to the TArray. This pointer
-; can differs from .ptrArray argument, if the memory was
-; reallocated. The user should save the pointer for future access
-; to the array. It is safe to save the pointer before check of CF
-; for error, because the procedure returns original pointer in case
-; of memory allocation error.
-;____________________________________________________________________
-
-proc AddArrayItems, .ptrArray, .count
-begin
- push ebx ecx
-
- mov edx, [.ptrArray]
- test edx, edx
- jnz @f
-
- stc
- pop ecx ebx
- return
-
-@@:
- mov eax, [edx+TArray.count]
- mov ecx, [edx+TArray.capacity]
- add eax, [.count]
- cmp ecx, eax
- jae .memallocated
-
-; enlarge the array. Strategy here is not clear.
- mov ecx, eax
- call dword [ResizeIt]
- jc .finish
-
- mov ebx, ecx
- imul ecx, [edx+TArray.itemsize]
- add ecx, sizeof.TArray
-
- stdcall ResizeMem, edx, ecx
-.readdr:
- jc .finish
-
- mov edx, eax
- mov [edx+TArray.capacity], ebx
-
-.memallocated:
- mov eax, [edx+TArray.count]
- mov ecx, [.count]
- add [edx+TArray.count], ecx
-
- imul eax, [edx+TArray.itemsize]
- lea eax, [edx+eax+TArray.array]
- clc
-
-.finish:
- pop ecx ebx
- return
-endp
-
-
-;____________________________________________________________________
-;
-; proc InsertArrayItems - inserts new item in the array.
-;
-; Arguments:
-;
-; .ptrArray - pointer to TArray structure.
-; .iElement - on what index to be inserted the new elements.
-; .count - how many elements to be inserted.
-;
-; Returns:
-; CF=1 if error: edx - pointer to the original array; new elements are
-; not inserted.
-;
-; CF=0 if OK: eax - pointer to the first of the new inserted elements.
-; edx - pointer to the array.
-;
-; Notes:
-; If .iElement is larger or equal to [TArray.count] the elements are
-; appended at the end of the array. Otherwise, all elements are moved
-; to make room for the new elements. If the capacity of the array is
-; not enough to hold the new elements, the array is resized.
-;
-; The procedure returns in edx pointer to the TArray. This pointer
-; can differs from .ptrArray argument, if the memory was
-; reallocated. The user should save the pointer for future access
-; to the array. It is safe to save the pointer before check of CF
-; for error, because the procedure returns original pointer in case
-; of memory allocation error.
-;____________________________________________________________________
-
-proc InsertArrayItems, .ptrArray, .iElement, .count
-begin
- stdcall AddArrayItems, [.ptrArray], [.count]
- jc .end1
-
- push ecx
-
- mov ecx, [.iElement]
- add ecx, [.count]
- cmp ecx, [edx+TArray.count]
- jae .end2
-
- push esi edi
-
- imul ecx, [edx+TArray.itemsize]
- lea ecx, [edx+ecx+TArray.array]
-
- lea esi, [eax-4] ; the last element.
- mov edi, [edx+TArray.count]
- imul edi, [edx+TArray.itemsize]
- lea edi, [edx+edi+TArray.array] ; end of the array.
-
- mov eax, ecx
- sub eax, [edx+TArray.itemsize]
-
- sub ecx, edi
- neg ecx
- shr ecx, 2
-
- sub edi, 4
-
- std
-
-; scroll the data.
- rep movsd
-
-; clear the new items.
- mov ecx, [edx+TArray.itemsize]
- imul ecx, [.count]
- shr ecx, 2
- xor eax, eax
- rep stosd
-
- lea eax, [edi+4]
- cld
-
- pop edi esi
-
-.end2:
- pop ecx
-.end1:
- return
-endp
-
-
-;**************************************************************
-; proc DeleteArrayItems - deletes the items with the specified
-; index and specified count from TArray
-; dynamic array.
-; If the capacity of the array is bigger than the recomended
-; for the new count, then the array is resized.
-; The recomended size is calculated using ResizeIt procedure
-; from memory library.
-;
-; Arguments:
-; .ptrArray - pointer to TArray structure.
-; .iElement - index of the element to be deleted.
-; .count - how many elements to be deleted.
-;
-; Returns: edx - pointer to the TArray. In the most cases
-; this pointer will not be changed, but this
-; also depends on the current OS memory
-; allocation API, so it is safer to store
-; the pointer for future use instead of
-; passed to the procedure.
-;
-; Notes:
-; This function can't fail, because delete is
-; always possible in already allocated array.
-; in some cases shrinking resize possibly can fail
-; but this will not affect the data in the array.
-;
-; if [.iElement]+[.count] is bigger that the [TArray.count]
-; of the array, only the elements to the end of the array
-; will be deleted.
-;
-;*******************************************************
-proc DeleteArrayItems, .ptrArray, .iElement, .count
-begin
- push edi esi ecx ebx eax
-
- mov edx, [.ptrArray]
- test edx, edx
- jz .exit
-
- mov ecx, [.iElement]
- mov eax, [edx+TArray.count]
-
- test ecx, ecx
- js .exit
-
- cmp ecx, eax
- jae .exit ; index greater or equal to the count...
-
- add ecx, [.count]
- cmp ecx, eax
- jae .movedone ; if there is no more elements after the last deleted element, don't move
-
- mov eax, [edx+TArray.itemsize]
-
- imul ecx, eax
- lea esi, [edx+ecx+TArray.array] ; the first after deleted
-
- mov ecx, [.iElement]
- imul ecx, eax ; offset of the deleted element.
- lea edi, [edx+ecx+TArray.array] ; destination address.
-
- mov ecx, [edx+TArray.count]
- imul ecx, eax
- lea ecx, [ecx+edx+TArray.array]
- sub ecx, esi ; bytes to be moved. It should be dword aligned count.
-
- shr ecx, 2
- rep movsd ; move the data.
-
-.movedone:
- mov ecx, [edx+TArray.count]
- mov eax, [.iElement]
- sub ecx, [.count]
- cmp ecx, eax
- ja @f
- mov ecx, eax
-@@:
- mov [edx+TArray.count], ecx
-
- call [ResizeIt]
- jc .exit ; the array is OK, but the resize failed.
-
- cmp ecx, [edx+TArray.capacity]
- jae .exit ; the array have smaller capacity than recomended, so don't resize.
-
- mov eax, ecx
- imul eax, [edx+TArray.itemsize]
- add eax, sizeof.TArray
- stdcall ResizeMem, edx, eax
- jc .exit ; the resize failed, but the array is ok.
-
- mov edx, eax
- mov [edx+TArray.capacity], ecx ; set new capacity.
-
-.exit:
- pop eax ebx ecx esi edi
- return
-endp
-
-
-
-;**************************************************************
-; proc VacuumArray - deletes the reserved memory from the array.
-;
-; Arguments:
-; .ptrArray - pointer to TArray structure.
-;
-; Returns: edx - pointer to the TArray. In the most cases
-; this pointer will not be changed, but this
-; also depends on the current OS memory
-; allocation API, so it is safer to store
-; the pointer for future use instead of
-; passed to the procedure.
-; CF=1 - there is a error on vacuuming. This is not
-; exactly error, because this case indicates
-; simply some memory manager unabiliry to reallocate
-; memory. Although the array will not be changed.
-;
-; This procedure removes all reserved space in the array.
-; Vacuum can save a lot of memory space, but takes time and
-; also will make future inserts of new elements
-; slower at least for the first add/insert.
-;
-; it is wise to vacuum the array after it is filled with
-; most/all of the needed elements.
-;
-proc VacuumArray, .ptrArray
-begin
- push eax ecx
-
- mov edx, [.ptrArray]
- mov ecx, [edx+TArray.count]
- mov eax, [edx+TArray.itemsize]
- add ecx, 1
- imul eax, ecx
- add eax, sizeof.TArray
-
- stdcall ResizeMem, edx, eax
- jc .exit
-
- mov edx, eax
- mov [eax+TArray.capacity], ecx
-
-.exit:
- pop ecx eax
- return
-
-endp
-
-
-
-
-
-;****************************************************
-; Quick sort of the array in the memory.
-;
-; ptrArray - pointer to TArray structure.
-; ptrCompareProc - pointer to procedure that compares two elements.
-;
-; ptrCompareProc have interface:
-; proc CompareSomething, ptrElement1, ptrElement2
-; returns: c=1 if elements are not properly sorted.
-; c=0 if elements are sorted, i.e.
-; element1 should be before element2
-;****************************************************
-
-
-proc SortArray, .ptrArray, .ptrCompareProc
-begin
- pushad
-
- mov esi, [.ptrArray]
- mov edi, [.ptrCompareProc]
- mov ebx, [esi+TArray.itemsize]
-
- mov eax, [esi+TArray.count]
- dec eax
- xor ecx, ecx
- lea esi, [esi+TArray.array]
-
- stdcall __DoQSort, ecx, eax
-
- popad
- return
-endp
-
-;*****************************************************
-; Procedure for internal call from QSort procedure.
-;*****************************************************
-proc __DoQSort, .Left, .Right
-begin
- push ecx
-
- mov ecx, [.Left] ; i variable
- mov eax, ecx
- mov edx, [.Right] ; j variable
- add eax, edx
- sar eax, 1
- imul eax, ebx
- imul ecx, ebx
- imul edx, ebx
- add eax, esi
- add ecx, esi
- add edx, esi
-
- call ___CopyMiddleElement
-
-.repeat:
- sub ecx, ebx
- add edx, ebx
-
-.whilei:
- add ecx, ebx
- stdcall edi, ecx, eax
- jnc .whilei
-
-.whilej:
- sub edx, ebx
- stdcall edi, eax, edx
- jnc .whilej
-
- cmp ecx, edx
- jg .next ;i>j
- je .swapok
- call ___SwapElements
-.swapok:
- add ecx, ebx
- sub edx, ebx
-
-.next:
- cmp ecx, edx
- jle .repeat
-
- stdcall FreeMem, eax
-
- mov eax, edx ;j
- sub eax, esi
- cdq
- idiv ebx
-
- cmp [.Left], eax
- jge .leftok
-
- stdcall __DoQSort, [.Left], eax
-
-.leftok:
- mov eax, ecx ;i
- sub eax, esi
- cdq
- idiv ebx
-
- cmp eax, [.Right]
- jge .rightok
-
- stdcall __DoQSort, eax, [.Right]
-
-.rightok:
- pop ecx
- return
-endp
-
-
-
-;********************************************
-; Swaps two elements of the array with
-; pointers in:
-; Element1 - ecx
-; Element2 - edx
-; ElementSize - ebx
-;********************************************
-proc ___SwapElements
-begin
- pushad
-
- xor esi, esi
-.loop:
- mov al, [ecx+esi]
- xchg al, [edx+esi]
- mov [ecx+esi], al
-
- inc esi
- cmp esi, ebx
- jne .loop
-
- popad
- return
-endp
-
-
-proc ___CopyMiddleElement
-begin
- push ecx esi edi
-
- mov esi, eax
- stdcall GetMem, ebx
- mov edi, eax
- mov ecx, ebx
- mov eax, edi
-
- rep movsb
- pop edi esi ecx
- return
-endp
-
-
-
-
-proc CompareIntAscending, .ptrElement1, .ptrElement2
-begin
- push eax esi edi
-
- mov esi, [.ptrElement1]
- mov edi, [.ptrElement2]
-
- mov eax, [esi]
- cmp eax, [edi]
- jl .qfalse
-
- stc
- pop edi esi eax
- return
-
-
-.qfalse:
- clc
- pop edi esi eax
- return
-endp
-
-
-
-
-
-
-
-;____________________________________________________________________
-;
-; proc ListIndexOf, .ptrArray, .item - searches dynamic list for
-; the given item.
-;
-; List is a special case of dynamic array, where the size of the
-; elements is dword (4 bytes).
-;
-; Arguments:
-; .ptrList - pointer to TArray dynamic array.
-; .item - value of the element.
-; Returns:
-; CF = 0 if the element was found. eax contains index of
-; the element.
-; CF = 1 the element is not found.
-;____________________________________________________________________
-
-proc ListIndexOf, .ptrList, .Item
-begin
- push edi ecx
-
- mov edi, [.ptrList]
-
- cmp [edi+TArray.itemsize], 4
- jne .notfound
-
- mov ecx, [edi+TArray.count]
- jecxz .notfound
-
- lea edi, [edi+4*ecx+TArray.array-4] ; from the end
- mov eax, [.Item]
- std
- repnz scasd
- cld
- jz .found
-
-.notfound:
- stc
- pop ecx edi
- return
-
-.found:
- clc
- mov eax, ecx
- pop ecx edi
- return
-endp
-
-
-;--------------------------------------------
-; Frees all elements of the list calling
-; [FreeProc] on every element.
-; (proc FreeProc, ptrItem)
-; Frees the array of items
-;--------------------------------------------
-proc ListFree, .ptrList, .FreeProc
-begin
- push edi ebx
-
- mov edi, [.ptrList]
- mov ebx, [edi+TArray.count]
-
- cmp [.FreeProc], 0
- je .endwhile
-
-.freeloop:
- dec ebx
- js .endwhile
-
- stdcall [.FreeProc], [edi+4*ebx+TArray.array]
- jmp .freeloop
-
-.endwhile:
- stdcall FreeMem, edi
-
-.finish:
- pop ebx edi
- return
-endp
-
-
-endmodule
DELETED freshlib/data/markdown.asm
Index: freshlib/data/markdown.asm
==================================================================
--- freshlib/data/markdown.asm
+++ /dev/null
@@ -1,1469 +0,0 @@
-module "markdown parser"
-
-struct TMarkdownResults
- .hContent dd ?
- .hIndex dd ?
- .hKeywords dd ?
- .hDescription dd ?
-ends
-
-
-
-fblkQuote = 1
-fblkTable = 2
-
-
-fstateHeader = $01
-fstatePara = $02
-fstateWhite = $04
-fstateBold = $08
-fstateLink = $10
-fstateUnderline = $20
-fstateStrikeout = $40
-fstateItalic = $80
-
-fstateTextNow = $200 ; don't use the second byte for any other flags.
-fstateTextPrev = $100
-
-fstateInlineSource = $10000
-fstateBlockSource = $20000
-fstateImage = $40000
-fstateInlineImage = $80000
-fstateTable = $100000
-
-
-; Translates some markdown text to HTML
-; Arguments:
-; .markdown - pointer or handler of the markdown text.
-; .procFixLink - [proc .ptrLink] procedure that process the link address and returns
-; handle to the processed link address. if [.procFixLink]=NULL, the links
-; are inserted as they are in the HTML.
-; .fBacklinks - flag, that defines whether to insert after the headers back links to the
-; table of contents item.
-; Returns:
-; eax - handler of the HTML formated text.
-; edx - handler of the page index.
-; ebx - handler of the detected keywords.
-; ecx - handler of the detected page description.
-
-proc TranslateMarkdown, .markdown, .procFixLink, .fBacklinks, .pResult
-
-.result dd ?
-.index dd ?
-.keywords dd ?
-.description dd ?
-
- ; first and second pass local variables
- .IdString rb 256
- .IdLen dd ?
-
- .cntH2 dd ?
- .cntH3 dd ?
- .cntH4 dd ?
- .cntH5 dd ?
- .cntH6 dd ?
-
-.pHashTable dd ?
-.pHTML dd ?
-.limit dd ?
-
- .blocks rb 1024
- .pblock dd ?
-
-begin
- pushad
-
- stdcall GetMem, 4*65536
- mov [.pHashTable], eax
- stdcall GetMem, 16384
- mov [.pHTML], eax
- add eax, 8192
- mov [.limit], eax
-
- stdcall StrNew
- mov [.result], eax
-
- stdcall StrNew
- mov [.index], eax
-
- stdcall StrNew
- mov [.keywords], eax
-
- stdcall StrNew
- mov [.description], eax
-
- stdcall StrPtr, [.markdown]
- mov esi, eax
-
- call .FirstPass
-
- stdcall StrPtr, [.markdown]
- mov esi, eax
- call .SecondPass
-
- stdcall FreeMem, [.pHTML]
- stdcall FreeMem, [.pHashTable]
-
- mov edi, [.pResult]
-
- mov eax, [.result]
- mov edx, [.index]
- mov ebx, [.keywords]
- mov ecx, [.description]
-
- mov [edi+TMarkdownResults.hContent], eax
- mov [edi+TMarkdownResults.hIndex], edx
- mov [edi+TMarkdownResults.hKeywords], ebx
- mov [edi+TMarkdownResults.hDescription], ecx
-
- popad
- return
-
-;.... start of .FirstPass ..........................................
-
-.FirstPass:
- mov edi, [.pHTML]
- mov [.cntH2], 0
- mov [.cntH3], 0
- mov [.cntH4], 0
- mov [.cntH5], 0
- mov [.cntH6], 0
-
-.line_start:
- cmp edi, [.limit]
- jb @f
-
- mov dword [edi], 0
- stdcall StrCat, [.index], [.pHTML]
- mov edi, [.pHTML]
-
-@@:
- cmp byte [esi], '#'
- je .header
-
- cmp byte [esi], '['
- je .link
-
-.skip_to_eol:
- mov al, [esi]
- lea esi, [esi+1]
- cmp al, $0d
- je .line_start
- cmp al, $0a
- je .line_start
- test al, al
- jnz .skip_to_eol
-
-.end_of_file:
- mov dword [edi], 0
- stdcall StrCat, [.index], [.pHTML]
-
- retn
-
-; ----- return from .FirstPass -------------------
-
-; create table of contents item.
-.header:
- xor ecx, ecx
-
-.scan_level:
- inc ecx
-.scan_space:
- lea esi, [esi+1]
- mov al, [esi]
- cmp al, '#'
- je .scan_level
- cmp al, ' '
- je .scan_space
- cmp al, $09
- je .scan_space
-
- cmp al, $0d
- je .line_start
- cmp al, $0a
- je .line_start
-
- cmp ecx, 6
- jbe @f
- mov ecx, 6
-@@:
- call .BuildID
-
- mov dword [edi], ''
- lea edi, [edi+4]
-
- cmp ecx, 1
- je @f
- call .InsertID
-@@:
-; copy the header text
-
-.copy_loop:
- mov al, [esi]
- lea esi, [esi+1]
- cmp al, $0d
- je .end_header
- cmp al, $0a
- je .end_header
- test al, al
- jz .end_header
-
- mov [edi], al
- lea edi, [edi+1]
- jmp .copy_loop
-
-.end_header:
- dec esi
- mov dword [edi], ''
- mov dword [edi+4], '
'
- lea edi, [edi+10]
- jmp .line_start
-
-;link processing
-.link:
- mov edx, $811C9DC5 ; 2166136261 ; FNV offset basis
- mov ecx, esi
-
-.label_loop:
- mov al, [esi]
- lea esi, [esi+1]
-
- cmp al, $20
- je .label_loop
- cmp al, $09
- je .label_loop
-
- cmp al, $0d
- je .line_start
- cmp al, $0a
- je .line_start
-
- test al, al
- jz .end_of_file
-
- xor dl, al
- imul edx, $01000193 ; 16777619 ; FNV prime
- cmp al, ']'
- jne .label_loop
-
-; fold the hash to 16 bit value...
- mov ebx, edx
- shr ebx, 16
- xor ebx, edx
- and ebx, $ffff
- mov edx, ebx
-
-; search free slot
-.search_slot:
- mov eax, [.pHashTable]
- xchg ecx, [eax+4*ebx]
- test ecx, ecx
- jz .skip_to_eol
-
-; conflict...
-; compare the labels on ecx (the old content of the slot) with [HashTable+4*ebx] (the new pointer)
- push edi ecx
-
- mov edi, [eax+4*ebx]
-
-.first:
- mov al, [ecx]
- lea ecx, [ecx+1]
-
- cmp al, $20
- je .first
- cmp al, $09
- je .first
-
-.second:
- mov ah, [edi]
- lea edi, [edi+1]
- cmp ah, $20
- je .second
- cmp ah, $09
- je .second
-
- cmp al, ah
- jne .add_not_equal
-
- cmp ah, ']'
- jne .first
-
- pop ecx edi
- jmp .skip_to_eol
-
-; save it to the next slot
-.add_not_equal:
- pop ecx edi
-
- inc ebx
- and ebx, $ffff
- cmp ebx, edx
- jne .search_slot
-
- int3 ; full hash table -> to be implemented error processing
-
-;---- End of .FirstPass --------------------------------
-
-
-;.... Start of .SecondPass .............................
-
-locals
- ; .SecondPass only local variables
- .state dd ?
- .last_header dd ?
- .linkID_end dd ?
-endl
-
-.SecondPass:
- mov edi, [.pHTML]
-
- xor eax, eax
- mov [.state], eax
- mov [.cntH2], eax
- mov [.cntH3], eax
- mov [.cntH4], eax
- mov [.cntH5], eax
- mov [.cntH6], eax
- mov [.pblock], eax
-
-
-.line_start2:
- shr byte [.state+1], 1 ; fstateTextPrev = fstateTextNow; fStateTextNow = 0
-
- cmp edi, [.limit]
- jb @f
- mov dword [edi], 0
- stdcall StrCat, [.result], [.pHTML]
- mov edi, [.pHTML]
-@@:
-
- test [.state], fstateBlockSource
- jnz .copy_source
-
- cmp byte [esi], '['
- je .link_definition
-
- cmp byte [esi], '#'
- je .header2
-
- cmp byte [esi], ';'
- je .block_element
-
- cmp dword [esi], '----'
- je .horiz_rule
-
-
-.scan_line2:
- mov al, [esi]
- lea esi, [esi+1]
-
- cmp al, ' '
- je .white_space
- cmp al, $09 ; tab
- je .white_space
-
- cmp al, $0d
- je .end_of_line
- cmp al, $0a
- je .end_of_line
- test al, al
- jz .end_of_line
-
-; it is not white space character...
- test [.state], fstateTextPrev or fstateTextNow or fstateHeader
- jz .start_para
-
-.process_char:
- or [.state], fstateTextNow
-
- test [.state], fstateInlineSource
- jnz .inline_source
-
- cmp al, '*'
- je .process_bold
-
- cmp al, '_'
- je .process_underline
-
- cmp al, '-'
- je .process_strikeout
-
- cmp al, '/'
- je .process_italic
-
- cmp al, '['
- je .is_link_begin
-
- cmp al, ']'
- je .is_link_end
-
-.inline_source:
- cmp al, '`'
- je .process_inline_code
-
-
-.normal_char:
- and [.state], not fstateWhite
-
-.markup_ok:
-
- call .store_char
- jmp .scan_line2
-
-
-; stores the char from al in [edi], and
-; replaces the invalid HTML characters
-; with their &name; representation.
-
-.store_char:
- cmp al, 'A'
- jb @f
-
- mov [edi], al
- lea edi, [edi+1]
- retn
-
-@@:
- cmp al, '<'
- je .char_less_then
- cmp al, '>'
- je .char_greater_then
- cmp al, '"'
- je .char_quote
- cmp al, '&'
- je .char_amp
-; cmp al, "'"
-; je .char_apos
-
- mov [edi], al
- lea edi, [edi+1]
- retn
-
-.char_less_then:
- mov dword [edi], '<'
- lea edi, [edi+4]
- retn
-
-.char_greater_then:
- mov dword [edi], '>'
- lea edi, [edi+4]
- retn
-
-.char_quote:
- mov dword [edi], '&quo'
- mov word [edi+4], 't;'
- lea edi, [edi+6]
- retn
-
-;.char_apos:
-; mov dword [edi], '&apo'
-; mov word [edi+4], 's;'
-; lea edi, [edi+6]
-; retn
-
-.char_amp:
- mov dword [edi], '&'
- mov byte [edi+1], ';'
- lea edi, [edi+5]
- retn
-
-
-.start_para:
- test [.state], fstateTable
- jz .not_td_open
-
- mov dword [edi], ''
- lea edi, [edi+4]
-
- cmp al, '(' ; col, row span
- jne .td_ok
-
- dec edi
-
- mov dword [edi], ' col'
- mov dword [edi+4], 'span'
- mov word [edi+8], '="'
- lea edi, [edi+10]
-
-.copy_span:
- mov al, [esi]
- lea esi, [esi+1]
- cmp al, ','
- je .row_span
- cmp al, ')'
- je .end_span
-
- call .store_char
- jmp .copy_span
-
-.row_span:
- mov dword [edi], '" ro'
- mov dword [edi+4], 'wspa'
- mov dword [edi+8], 'n="'
- lea edi, [edi+11]
- jmp .copy_span
-
-.end_span:
- mov word [edi], '">'
- lea edi, [edi+2]
-
- mov al, [esi]
- lea esi, [esi+1]
-
-.td_ok:
- or [.state], fstatePara
- jmp .process_char
-
-.not_td_open:
- mov word [edi], ' '
- lea edi, [edi+1]
- jmp .process_char
-
-.process_inline_code:
- mov ecx, fstateInlineSource
- mov ebx, 'code'
- jmp .ProcessTag
-
-.process_bold:
- mov ecx, fstateBold
- mov ebx, 'b'
- jmp .ProcessTag
-
-
-.process_italic:
- mov ecx, fstateItalic
- mov ebx, 'i'
- jmp .ProcessTag
-
-.process_underline:
- mov ecx, fstateUnderline
- mov ebx, 'u'
- jmp .ProcessTag
-
-.process_strikeout:
- mov ecx, fstateStrikeout
- mov ebx, 's'
-
-; ecx = state mask
-; ebx = html tag
-.ProcessTag:
- mov dl, al
-
- test [.state], ecx
- jz .start_tag
-
-; close tag
- not ecx
- and [.state], ecx
-
- mov word [edi], ''
- lea edi, [edi+2]
- jmp .finish_tag
-
-.start_tag:
- test [.state], fstateWhite
- jz .normal_char
- cmp byte [esi], $20
- je .normal_char
- cmp byte [esi], $09
- je .normal_char
- cmp byte [esi], $0d
- je .normal_char
- cmp byte [esi], $0a
- je .normal_char
-
- or [.state], ecx
-
-; open tag
- mov byte [edi], '<'
- lea edi, [edi+1]
-
-.finish_tag:
- mov [edi], ebx
-
-.taglen:
- lea edi, [edi+1]
- shr ebx, 8
- jnz .taglen
-
- mov byte [edi], '>'
- lea edi, [edi+1]
-
- jmp .scan_line2
-
-
-.white_space:
- test [.state], fstateWhite
- jnz .scan_line2
-
- or [.state], fstateWhite
- mov [edi], al
- lea edi, [edi+1]
- jmp .scan_line2
-
-; end of line and end of file processing
-.end_of_line:
- test al, al
- jz @f
-
- xor al, $0d xor $0a
- cmp [esi], al
- jne @f
- inc esi
-@@:
- or [.state], fstateWhite
-
- test [.state], fstateTextNow
- jnz .para_ok
-
- call .close_paragraph
-
-.para_ok:
- test [.state], fstateHeader
- jz .crlf
-
-; insert back link
- cmp [.fBacklinks], 0
- je .backlink_ok
-
- mov dword [edi], ''
- mov dword [edi+2], ''
- lea edi, [edi+6]
-
-.backlink_ok:
- mov byte [edi], '<'
- lea edi, [edi+1]
-
- mov ecx, [.last_header]
- add ecx, '/h0>'
- mov [edi], ecx
- lea edi, [edi+4]
-
- and [.state], not (fstateHeader or fstateTextNow) ; For the paragraph flow, the header loops like empty line.
-
-.crlf:
- test [.state], fstateTextPrev or fstateTextNow
- jz @f
- mov word [edi], $0a0d
- lea edi, [edi+2]
-@@:
- test al, al
- jnz .line_start2
-
-.finish:
- mov dword [edi], 0
- stdcall StrCat, [.result], [.pHTML]
- retn
-
-
-.is_link_begin:
- test [.state], fstateWhite
- jz .normal_char
-
-.searchID:
- dec esi
-
-;.SearchLink:
- push edi
- push esi
-
-; first compute the hash for the link label
- mov edx, $811C9DC5 ; 2166136261 ; FNV offset basis
-
-.hashloop:
- mov al, [esi]
- lea esi, [esi+1]
-
- cmp al, $20
- je .hashloop
- cmp al, $09
- je .hashloop
-
- cmp al, $0d
- je .not_a_link
- cmp al, $0a
- je .not_a_link
- test al, al
- je .not_a_link
-
- xor dl, al
- imul edx, $01000193 ; 16777619 ; FNV prime
- cmp al, ']'
- jne .hashloop
-
-; fold the hash to 16 bit value...
- mov [.linkID_end], esi
-
- mov ebx, edx
- shr ebx, 16
- xor ebx, edx
- dec ebx
-
-.hash_table_loop:
- lea ebx, [ebx+1]
- and ebx, $ffff
-
- mov eax, [.pHashTable]
- mov edi, [eax+4*ebx]
- mov esi, [esp]
-
- test edi, edi
- jnz .cmp_labels
-
-.inline_link: ; the linkID was not found in the hash table. So, it should be inline link address.
- lea edi, [esi+1] ; the address of the link is in esi
- mov esi, [.linkID_end] ; the address of the end of the linkID.
- jmp .create_link
-
-.not_a_link:
- pop esi edi
- mov al, [esi]
- lea esi, [esi+1]
- jmp .normal_char ; the link address was not found, so it is not link at all.
-
-.cmp_labels:
- mov al, [esi]
- lea esi, [esi+1]
-
- cmp al, ' '
- je .cmp_labels
- cmp al, $09
- je .cmp_labels
-
-.target:
- mov ah, [edi]
- lea edi, [edi+1]
-
- cmp ah, ' '
- je .target
- cmp ah, $09
- je .target
-
- cmp al, ah
- jne .hash_table_loop ; it is not the same label - try again.
-
- cmp ah, ']'
- jne .cmp_labels
-
-; the labels are equal, so search the address.
-
-.create_link:
- or [.state], fstateLink
- mov edx, [esp] ; the start of the linkID.
- cmp byte [esi], '[' ; is the link has separate ID and text?
- jne @f
- mov [esp], esi ; replace the source address.
-@@:
- inc edx
- cmp byte [edx], '#' ; is it internal link?
- je .internal_link_address
-
- cmp byte [edx], '?' ; is it inline image?
- jne .maybe_block_image
-
- xor [.state], fstateInlineImage or fstateLink
- jmp .firstnw
-
-.maybe_block_image:
- cmp byte [edx], '!' ; is it an image?
- jne .firstnw
- xor [.state], fstateImage or fstateLink
-
-.firstnw:
- mov al, [edi]
- lea edi, [edi+1]
- cmp al, ' '
- je .firstnw
- cmp al, $09
- je .firstnw
-
- dec edi
- mov edx, edi
-
-.internal_link_address:
- pop esi edi
-
- test [.state], fstateLink
- jnz .it_is_link
-
-; it is image.
- mov dword [edi], ' '
- lea edi, [edi+2]
-
-.go_link_text:
- and [.state], not fstateWhite
- inc esi
- cmp byte [esi], '#'
- jne .scan_line2
- inc esi
- jmp .scan_line2
-
-.finalize_image:
- mov dword [edi], '" al'
- mov dword [edi+4], 't="'
- lea edi, [edi+7]
- and [.state], not fstateWhite
- jmp .go_link_text
-
-;....................................................................
-
-.is_link_end:
- test [.state], fstateLink
- jnz .close_link_tag
-
- test [.state], fstateImage or fstateInlineImage
- jz .normal_char
-
-; close the image tag
- mov dword [edi], '" />'
- lea edi, [edi+4]
-
- and [.state], not (fstateImage or fstateInlineImage)
- jmp .scan_line2
-
-.close_link_tag:
- mov dword [edi], ''
- lea edi, [edi+4]
-
- and [.state], not fstateLink
- jmp .scan_line2
-
-;....................................................................
-; Processing of block source code
-.copy_source:
-
-.source_line:
-
- cmp edi, [.limit]
- jb @f
- mov dword [edi], 0
- stdcall StrCat, [.result], [.pHTML]
- mov edi, [.pHTML]
-@@:
-
- cmp dword [esi], ';end'
- je .end_source_block
-
-.copy_source_line:
- mov al, [esi]
- lea esi, [esi+1]
-
- call .store_char
-
- test al, al
- jz .end_source_block2
-
- cmp al, $0d
- je .end_source_line
- cmp al, $0a
- jne .copy_source_line
-
-.end_source_line:
- xor al, $0d xor $0a
- cmp [esi], al
- jne .source_line
-
- inc esi
- mov [edi], al
- lea edi, [edi+1]
- jmp .source_line
-
-.end_source_block2:
- dec esi
-
-.end_source_block:
- mov dword [edi], ''
- mov dword [edi+8], 'div>'
- mov word [edi+12], $0a0d
- lea edi, [edi+14]
-
- and [.state], not fstateBlockSource
- jmp .skip2
-
-;....................................................................
-
-.close_paragraph:
- test [.state], fstatePara
- jz .close_para_ok
-
- test [.state], fstateTable
- jnz .close_td
-
- mov dword [edi], ' '
- lea edi, [edi+4]
- jmp .close_para_ok
-
-.close_td:
- mov dword [edi], ' | '+($0a0d shl 8)
- lea edi, [edi+7]
-
-.close_para_ok:
- and [.state], not fstatePara
- retn
-
-;....................................................................
-; horizontal rule element
-
-.horiz_rule:
- call .close_paragraph
-
- mov dword [edi], '
'+($0a0d shl 16)
- lea edi, [edi+8]
- jmp .skip2
-
-;....................................................................
-; Processing of the block elements.
-
-.block_element:
- cmp dword [esi], ';end'
- je .end_block
-
- cmp dword [esi], ';beg'
- jne .not_code
- cmp word [esi+4], 'in'
- jne .not_code
-
-; code block
- call .close_paragraph
-
- mov dword [edi], ''
- lea edi, [edi+23]
- or [.state], fstateBlockSource
- jmp .skip2
-
-
-.not_code:
- cmp dword [esi], ';tab'
- jne .not_table
- cmp word [esi+4], 'le'
- jne .not_table
-
-; table block;
- call .close_paragraph
-
- mov al, fblkTable
- call .PushBlock
-
- mov dword [edi], '<'
- mov dword [edi+20], 'tr>'+($0d shl 24)
- mov byte [edi+24], $0a
- lea edi, [edi+25]
-
- or [.state], fstateTable
- jmp .skip2
-
-
-.not_table:
- cmp dword [esi], ';---'
- jne .not_row
-
-.table_row:
- call .close_paragraph
-
- mov dword [edi], ''
- lea edi, [edi+9]
- jmp .skip2
-
-
-.not_row:
- cmp dword [esi], ';quo'
- jne .not_quote
- cmp word [esi+4], 'te'
- jne .not_quote
-
-; block quote
- call .close_paragraph
-
- mov al, fblkQuote
- call .PushBlock
-
- mov dword [edi], ''
- lea edi, [edi+16]
-
- jmp .skip2
-
-
-.not_quote:
- cmp dword [esi], ';key'
- jne .not_keywords
- cmp dword [esi+4], 'word'
- jne .not_keywords
- cmp byte [esi+8], 's'
- jne .not_keywords
-
- add esi, 9
- mov ecx, [.keywords]
- jmp .append_line_to_string
-
-.not_keywords:
- cmp dword [esi], ';des'
- jne .not_desc
- cmp dword [esi+4], 'crip'
- jne .not_desc
- cmp dword [esi+8], 'tion'
- jne .not_desc
-
- add esi, 12
- mov ecx, [.description]
-
-.append_line_to_string:
-
-
- push esi ; first argument of
-
- nop
-
-.seek_eoa:
- mov al, [esi]
- lea esi, [esi+1]
-
- test al, al
- jz .end_of_appended
-
- cmp al, $0d
- je .end_of_appended
-
- cmp al, $0a
- jne .seek_eoa
-
-.end_of_appended:
- dec esi
- mov byte [esi], 0
-
- stdcall StrCat, ecx ; start address from the stack
- mov [esi], al ; restore the text
- jmp .skip2
-
-
-.not_desc:
- jmp .skip2 ; ";" at the begining without keyword is comment. The line is ignored.
-
-
-.end_block:
- call .close_paragraph
-
-.do_end_block:
- call .PopBlock
-
- cmp eax, fblkQuote
- je .end_quote
- cmp eax, fblkTable
- je .end_table
-
- jmp .skip2
-
-.end_quote:
- mov dword [edi], ''
- lea edi, [edi+6]
- jmp .skip2
-
-.end_table:
-
- mov dword [edi], '
'+($0a0d shl 8)
- mov dword [edi+7], ''
- mov word [edi+15], $0a0d
- lea edi, [edi+17]
- and [.state], not fstateTable
- jmp .skip2
-
-;....................................................................
-.PushBlock:
- push ecx
- mov ecx, [.pblock]
- mov [.blocks+ecx], al
- inc ecx
- cmp ecx, 1024
- jb @f
- dec ecx
-@@:
- mov [.pblock], ecx
- pop ecx
- retn
-
-.PopBlock:
- mov eax, [.pblock]
- dec eax
- jns @f
- xor eax, eax
- mov [.pblock], eax
- retn
-@@:
- mov [.pblock], eax
- movzx eax, [.blocks+eax]
- retn
-
-;....................................................................
-; processing link definitions in the second pass.
-.link_definition:
-
- mov al, [esi+1]
- cmp al, '#'
- je .define_anchor
-
- cmp al, '^'
- jne .skip2
-
-
-;.define_footnote:
-
- jmp .skip2 ; any other variant should be
- ; stripped from the text.
-
-.define_anchor:
- add esi, 2
- mov dword [edi], ''
- lea edi, [edi+3]
- or [.state], fstatePara or fstateTextNow
-
- mov dword [edi], ''
- lea edi, [edi+2]
-
- mov dword [edi], ''
- lea edi, [edi+4]
-
- mov al, [esi]
- jmp .normal_char
-
-.copy_id:
- mov al, [esi]
- lea esi, [esi+1]
- cmp al, ']'
- je .cpid_ok
- cmp al, $0d
- je .cpid_ok
- cmp al, $0a
- je .cpid_ok
- test al, al
- jz .cpid_ok
-
- mov [edi], al
- lea edi, [edi+1]
- jmp .copy_id
-
-.cpid_ok:
- retn
-
-;....................................................................
-
-; processing header items and building of the table of contents.
-
-.header2:
- xor ecx, ecx
-
-.scan_level2:
- inc ecx
-.scan_space2:
- lea esi, [esi+1]
- mov al, [esi]
- cmp al, '#'
- je .scan_level2
- cmp al, ' '
- je .scan_space2
- cmp al, $09
- je .scan_space2
-
- cmp al, $0d
- je .end_of_line
- cmp al, $0a
- je .end_of_line
-
- cmp ecx, 6
- jbe @f
- mov ecx, 6
-@@:
-
-; create ID
- call .BuildID
-
- shl ecx, 16
- mov [.last_header], ecx
-
- add ecx, ''
- lea edi, [edi+2]
-
- cmp [.last_header], 1 shl 16
- je @f
- call .InsertID
- mov dword [edi], '&nbs'
- mov word [edi+4], 'p;'
- lea edi, [edi+6]
-@@:
- or [.state], fstateHeader
- jmp .scan_line2
-
-.skip2:
- mov al, [esi]
- lea esi, [esi+1]
-
- test al, al
- jz .finish
- cmp al, $0d
- je .skip_eol
- cmp al, $0a
- jne .skip2
-
-.skip_eol:
- xor al, $0d xor $0a
- cmp [esi], al
- jne .line_start2
- inc esi
- jmp .line_start2
-
-;----- End of .SecondPass ------------------------------
-
-
-; ecx - level of the header 1..6
-.BuildID:
- push eax ebx ecx edx edi
-
- lea edi, [.IdString]
- cmp ecx, 1
- jbe .main
-
- sub ecx, 2
- push ecx
-
- inc [.cntH2+4*ecx]
-
-.zero:
- inc ecx
- cmp ecx, 5
- je .end_zero
- mov [.cntH2+4*ecx], 0
- jmp .zero
-
-.end_zero:
- xor ebx, ebx
- mov ecx, 10
-
-.loop_numbers:
- mov eax, [.cntH2+4*ebx]
- call _NumToStrU
- mov al, '.'
- stosb
- inc ebx
- cmp ebx, [esp]
- jbe .loop_numbers
-
- pop ecx
- jmp .finID
-
-.main:
- mov eax, 'main'
- stosd
-
-.finID:
- lea eax, [.IdString]
- sub edi, eax
- mov [.IdLen], edi
-
- pop edi edx ecx ebx eax
- retn
-
-.InsertID:
- push ecx esi
-
- lea esi, [.IdString]
- mov ecx, [.IdLen]
-
- rep movsb
-
- pop esi ecx
- retn
-endp
-
-
-
-
-
-
-
-
-
-endmodule
DELETED freshlib/data/md5lib.asm
Index: freshlib/data/md5lib.asm
==================================================================
--- freshlib/data/md5lib.asm
+++ /dev/null
@@ -1,367 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: OS independent MD5 library.
-;
-; Target OS: Any
-;
-; Dependencies: memory.asm
-;
-; Notes: The original code is from iblis. I changed it a bit, maybe losing performance,
-; but making it more structured.
-;
-;_________________________________________________________________________________________
-
-module "MD5 library"
-
-struct TContextMD5
- .__cntx rb 88
- .value rb 16
-ends
-
-
-iglobal
- if used ___MD5InternalData
- ___MD5InternalData db 0,1,1,5,5,3,0,7, \
- 7,5,5,5,5,4,5,6, \
- 4,7,5,7,6,4,5,6
- end if
-endg
-
-
-uglobal
- if used ___MD5SineTable
- ___MD5SineTable rd 65
- end if
-endg
-
-
-
-if used md5_open
-initialize ___md5_init
-begin
- xor eax, eax
- finit
- pushd 4F800000h
- pushd 0
- fstcw word [esp+2]
- fstcw word [esp]
- or word [esp], 0F3Fh
- fldcw word [esp]
- push 1
- @@: fild dword [esp]
- fsin
- fabs
- fmul dword [esp+8]
- fistp qword [eax*4+___MD5SineTable]
- inc dword [esp]
- inc eax
- test al, 40h
- jz @b
- fldcw word [esp+6]
- add esp, 12
- return
-endp
-end if
-
-
-
-
-;******************************************************
-; Computes MD5 hash of the data block from [.pData] with
-; length in [.pLen]
-; Returns new string handle in eax containing the hash of
-; the data.
-;******************************************************
-proc DataMD5, .pData, .pLen
-begin
- push ebx esi edi
-
- stdcall md5_open
- mov ebx, eax
-
- stdcall md5_read, ebx, [.pData], [.pLen]
- stdcall md5_getvalue, ebx
-
- stdcall StrNew
- mov edi, eax
- lea esi, [ebx+TContextMD5.value]
- mov ecx, 16
-
-.loop:
- movzx eax, byte [esi]
- inc esi
- stdcall NumToStr, eax, ntsUnsigned or ntsHex or ntsFixedWidth + 2
- push eax
- stdcall StrCat, edi, eax
- stdcall StrDel ; from the stack
- loop .loop
-
- stdcall StrLCase, edi
- stdcall FreeMem, ebx
-
- mov eax, edi
- pop edi esi ebx
- return
-endp
-
-
-
-
-
-
-;............................................................................
-; md5_open is used to allocate and initialize TContextMD5 structure for use with
-; subsequent processing.
-;
-; Arguments:
-; no
-;
-; Return Value: EAX - pointer to the allocated TContextMD5 structure.
-;
-; Modifies Registers: EAX
-;............................................................................
-proc md5_open
-begin
- push edi
-
- stdcall GetMem, sizeof.TContextMD5
- mov edi, eax
- push eax
-
- mov al, 01h
-
- @@: stosb
- add al, 22h
- jnc @b
-
- mov al, 0FEh
- @@: stosb
- sub al, 22h
- jnc @b
-
- xor eax, eax
- stosd
- stosd
-
- pop eax edi
- return
-endp
-
-
-
-
-;............................................................................
-; MD5_Read scans a block of data and updates the working context. Call it
-; once on a single block of data, or call it multiple times on consecutive
-; blocks of data, before retrieving the MD5 signature with MD5_Digest
-;
-; Arguments:
-; lpMD5CTXT - address of an initialized MD5CTXT structure
-; lpBuf - address of a contiguous block of data
-; bufLen - the size, in bytes, of the block of data
-;
-; Return Value: None
-;
-; Modifies Registers: None
-;............................................................................
-proc md5_read ;, .lpMD5CTXT, .lpBuf, .bufLen
-begin
- pushad
- mov esi, [esp+40]
- mov ebp, [esp+36]
- lea edi, [ebp+24]
- mov edx, [esp+44]
- mov ebx, edi
- mov eax, edx
- shl eax, 3
- mov ecx, edx
- shr ecx, 29
- push dword [ebp+16]
- add [ebp+16], eax
- adc [ebp+20], ecx
- pop eax
- shr eax, 3
- and eax, 3Fh
- .mn: xor ecx, ecx
- mov cl, 40h
- sub ecx, eax
- cmp ecx, edx
- jbe @f
- mov ecx, edx
- @@: sub edx, ecx
- add edi, eax
- add eax, ecx
- rep movsb
- mov edi, ebx
- cmp eax, 40h
- jb @f
-
- stdcall ___md5_BTrnsf, ebx, edi
-
- @@: xor eax, eax
- or edx, edx
- jnz .mn
- popad
- ret 12
-endp
-
-
-
-
-;............................................................................
-; md5_getvalue is used to retrieve the MD5 hash for the working context. It may
-; be called at any point during a buffer read to get the current MD5 hash for
-; all data scanned up to that point. It does not modify the contexutal data,
-; so this procedure may be called as many times as needed.
-; The value is stored in the context structure TContextMD5.value
-;
-; Arguments:
-; .pContextMD5 - address of an TContextMD5 structure
-;
-; Return Value: None
-;
-; Modifies Registers: None
-;............................................................................
-proc md5_getvalue ;, .pContextMD5
-begin
- pushad
- mov esi, dword [esp+36]
- lea edi, [esi+TContextMD5.value]
- lea ebp, [esi+16]
- mov ebx, edi
- sub esp, 64
- movsd
- movsd
- movsd
- movsd
- lodsd
- shr eax, 3
- add esi, 4
- and eax, 3Fh
- mov edi, esp
- mov ecx, eax
- rep movsb
- inc eax
- sub ecx, eax
- mov al, 80h
- stosb
- xor eax, eax
- cmp ecx, -56
- jae @f
- xor eax, eax
- add ecx, 64
- rep stosb
- mov edi, esp
-
- stdcall ___md5_BTrnsf, ebx, edi
-
- @@: xor eax, eax
- add ecx, 56
- rep stosb
- mov esi, ebp
- movsd
- movsd
-
- stdcall ___md5_BTrnsf, ebx, esp
-
- add esp, 64
- popad
- ret 4
-endp
-
-
-
-
-proc ___md5_BTrnsf ;, .phash, .lpBlock
-begin
- pushad
- mov eax, dword [esp+36]
- xor ecx, ecx
- mov cl, 4
- @@: push dword [eax]
- add eax, 4
- loop @b
- .mn: mov ebp, ecx
- shr ebp, 12
- add dl, dh
- and dl, 0Fh
- test ch, 03h
- jnz @f
- xor cl, cl
- test ch, 0Fh
- jnz @f
- mov esi, ___MD5InternalData
- mov edx, dword [esi+ebp*2]
- mov ebx, dword [esi+ebp*4+8]
- @@: add cl, bl
- ror ebx, 8
- push edx
- push ecx
- push ebx
- mov ebx, dword [esp+20]
- mov ecx, dword [esp+16]
- mov edx, dword [esp+12]
- test ebp, 02h
- jnz .hi
- test ebp, 01h
- jnz @f
- mov eax, ebx
- and ebx, ecx
- not eax
- and eax, edx
- or eax, ebx
- jmp .fghi
- @@: mov eax, edx
- and edx, ebx
- not eax
- and eax, ecx
- or eax, edx
- jmp .fghi
- .hi: test ebp, 01h
- jnz @f
- mov eax, ebx
- xor eax, ecx
- xor eax, edx
- jmp .fghi
- @@: mov eax, edx
- not eax
- or eax, ebx
- xor eax, ecx
- .fghi: pop ebx
- pop ecx
- pop edx
- add eax, dword [esp+12]
- mov esi, dword [esp+56]
- movzx edi, dl
- add eax, dword [esi+edi*4]
- movzx esi, ch
- add eax, dword [___MD5SineTable+esi*4]
- rol eax, cl
- add eax, dword [esp+8]
- mov dword [esp+12], eax
- mov esi, esp
- mov edi, esp
- lodsd
- movsd
- movsd
- movsd
- stosd
- inc ch
- test ch, 40h
- jz .mn
- mov eax, dword [esp+52]
- xor ecx, ecx
- mov cl, 4
- sub eax, ecx
- @@: pop edx
- add dword [eax+ecx*4], edx
- loop @b
- popad
- ret 8
-endp
-
-
-endmodule
DELETED freshlib/data/memstream.asm
Index: freshlib/data/memstream.asm
==================================================================
--- freshlib/data/memstream.asm
+++ /dev/null
@@ -1,90 +0,0 @@
-struct TMemoryStream
- .size dd ?
- .offset dd ?
- label .data byte
-ends
-
-
-;------------------------------------------------------------
-; Returns: ebx - base addr
-; edi - offset to put data.
-;------------------------------------------------------------
-proc GetStreamRoom, .ptrVarStream, .room
-begin
- push esi ecx
-
- mov esi, [.ptrVarStream]
- mov ebx, [esi] ; pointer to the array
-
- mov edi, [ebx+TMemoryStream.offset]
- mov eax, [ebx+TMemoryStream.size]
- sub eax, edi
- cmp eax, [.room] ; check for enough room
- jge .sizeok
-
- mov ecx, [ebx+TMemoryStream.size]
- call [ResizeIt]
- push ecx
-
- stdcall ResizeMem, ebx, ecx
- mov ebx, eax
- mov [esi], eax ; new pointer
- jc .exit
-
- mov [ebx+TMemoryStream.size], ecx ; new size.
-
-.sizeok:
- mov eax, [.room]
- add [ebx+TMemoryStream.offset], eax
-
-.exit:
- pop ecx esi
- return
-endp
-
-
-
-
-proc SetStreamOfs, .ptrVarStream, .offset
-begin
- push esi edi ebx
-
- mov edi, [.ptrVarStream]
- mov eax, [edi]
- mov ebx, [.offset]
- mov esi, [eax+TMemoryStream.size]
-
- cmp ebx, esi
- jl .sizeok
-
- lea esi, [ebx+$1000] ; new size
- stdcall ResizeMem, eax, esi
- mov [edi], eax
-
-.sizeok:
- mov [eax+TMemoryStream.size], esi
- mov [eax+TMemoryStream.offset], ebx
- pop ebx edi esi
- return
-endp
-
-
-
-
-
-proc CreateMemoryStream, .ptrVarStream, .initsize
-begin
- push ebx esi
-
- mov ebx, [.initsize]
- mov esi, [.ptrVarStream]
- add ebx, sizeof.TMemoryStream
-
- stdcall GetMem, ebx
- mov [esi], eax
- mov [eax+TMemoryStream.size], ebx
- mov [eax+TMemoryStream.offset], TMemoryStream.data
-
- pop esi ebx
- return
-endp
DELETED freshlib/data/strlib.asm
Index: freshlib/data/strlib.asm
==================================================================
--- freshlib/data/strlib.asm
+++ /dev/null
@@ -1,2662 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: OS independent string manipulation library.
-;
-; Target OS: Any
-;
-; Dependencies: memory.asm; arrays.asm
-;
-; Notes:
-;
-;_________________________________________________________________________________________
-
-module "String library"
-
-STR_MINSTRLEN = 127 ; must be N*8-1
-STR_SEARCH_ONE_ATEMPT = 100
-
-struc string {
- .capacity dd ?
- .len dd ?
- label .data byte
-}
-
-virtual at -(sizeof.string)
- string string
- sizeof.string = $-string
-end virtual
-
-
-; NumToStr flags
-ntsSigned = $00000
-ntsUnsigned = $10000
-ntsFixedWidth = $20000
-
-
-ntsBin = $0200
-ntsQuad = $0400
-ntsOct = $0800
-ntsDec = $0a00
-ntsHex = $1000
-
-
-; Global variable, storing parameters of dynamic strings list.
-uglobal
- if used InitStrings
- ptrStrTable dd ? ; StrLib strings arrray. Contains pointers to the memory allocated for strings.
- StrMutex dd ? ; mutex that allows thread safety of StrLib
- end if
-endg
-
-
-
-; < OS independent library functions >
-
-;************************************************************************************
-; Allocates memory for string table and allocates memory for strings.
-; Start it before any work with strings. (Or better use InitializeAll macro)
-; Returns 0 if failed to allocate needed memory.
-;************************************************************************************
-if used ptrStrTable
-initialize InitStrings
-begin
- StrLib = 1
-
- stdcall MutexCreate, 0, StrMutex
-
- stdcall CreateArray, 4
- jc .finish
-
- mov [ptrStrTable], eax
- mov [eax+TArray.lparam], 0 ; lParam is the last allocated handle number
-
-.finish:
- stdcall MutexRelease, StrMutex
- return
-endp
-end if
-
-;**************************************************************************************
-; Frees all memory used for strings library
-; Call it before exit of the program or use FinalizeAll macro.
-;**************************************************************************************
-if used InitStrings
-finalize FreeStrings
-begin
- stdcall WaitForMutex, StrMutex, -1
-
- mov esi, [ptrStrTable]
- mov ecx, [esi+TArray.count]
- xor ebx,ebx
-
-.freeloop:
- dec ecx
- js .endloop
-
- cmp [esi+TArray.array+4*ecx], ebx
- je .freeloop
-
- stdcall FreeMem, [esi+TArray.array+4*ecx]
- jmp .freeloop
-
-.endloop:
- stdcall FreeMem, esi
- mov [ptrStrTable], ebx
-
- stdcall MutexDestroy, StrMutex
- return
-endp
-end if
-
-
-
-;**************************************************************************************
-; Returns:
-; CF=0 no error; eax = pointer in memory of the hString
-; CF=1 on error - hString is handle, but is not in the table.*
-;**************************************************************************************
-proc StrPtr, .hString
-begin
- stdcall WaitForMutex, StrMutex, -1
-
- mov eax, [.hString]
-
- xor eax, $c0000000
- test eax, $c0000000
- jnz .pointer
-
- push ebx
-
- mov ebx, [ptrStrTable]
- cmp eax, [ebx+TArray.count]
- jae .notfound
-
- mov eax, [ebx+TArray.array+4*eax]
- test eax, eax
- jz .notfound
-
- add eax, sizeof.string
- pop ebx
-
-.finok:
- clc
-.finish:
- stdcall MutexRelease, StrMutex
- return
-
-.pointer:
- xor eax, $c0000000
- jmp .finok
-
-.notfound:
- stc
- pop ebx
- jmp .finish
-endp
-
-;**************************************************************************************
-; Creates new empty string and returns handle
-; Return: handle of the new created string.
-;**************************************************************************************
-proc StrNew
-begin
- push ecx edx esi
-
- stdcall WaitForMutex, StrMutex, -1
-
-; Search for first empty place.
- mov edx, [ptrStrTable]
- mov ecx, STR_SEARCH_ONE_ATEMPT ; search only limited count of items
- cmp ecx, [edx+TArray.count]
- jb @f
- mov ecx, [edx+TArray.count]
-@@:
-; cmp [flagStringFastAdd], 0
-; jne .notfound
-
- mov esi,[edx+TArray.lparam]
- xor eax,eax
-
-.search:
- dec ecx
- js .notfound
-
- inc esi
- cmp esi, [edx+TArray.count]
- jne @f
- xor esi,esi
-@@:
- cmp [edx+TArray.array+4*esi], eax
- je .found
- jmp .search
-
-.notfound:
- mov [edx+TArray.lparam], esi ; store the place where the search ends this time.
- mov esi, [edx+TArray.count]
- stdcall AddArrayItems, edx, 1
- mov [ptrStrTable], edx
-
-.found:
- mov [edx+TArray.lparam], esi
- stdcall GetMem, STR_MINSTRLEN + sizeof.string + 1
- mov [edx+TArray.array+4*esi], eax
- mov [eax+sizeof.string+string.capacity], STR_MINSTRLEN
-
- mov eax, esi
- or eax, $c0000000
-
- stdcall MutexRelease, StrMutex
- pop esi edx ecx
- return
-endp
-
-
-;**************************************************************************
-; Deletes the string if it is possible.
-;**************************************************************************
-proc StrDel, .hString
-begin
- push eax ecx esi
-
- stdcall WaitForMutex, StrMutex, -1
-
- mov esi, [ptrStrTable]
- mov ecx, [.hString]
- jecxz .finish
-
- xor ecx, $c0000000
- test ecx, $c0000000
- jnz .pointer
-
- cmp ecx, [esi+TArray.count]
- jae .finish
-
-.free:
- stdcall FreeMem, [esi+TArray.array+4*ecx]
- mov [esi+TArray.array+4*ecx], 0
-
-.finish:
- stdcall MutexRelease, StrMutex
- pop esi ecx eax
- return
-
-.pointer:
- xor ecx, $c0000000
-
-; search the pointer in the table.
- lea eax, [ecx-sizeof.string]
- mov ecx, [esi+TArray.count]
-
-.search:
- dec ecx
- js .finish
- cmp [esi+TArray.array+4*ecx], eax
- jne .search
- jmp .free
-endp
-
-
-;**************************************************************************
-; Duplicates given string, and returns a handle to new one
-;**************************************************************************
-proc StrDup, .hSource
-begin
- stdcall StrNew
- stdcall StrCopy, eax, [.hSource]
- return
-endp
-
-
-;**************************************************************************
-; Arguments:
-; hString - handle or pointer to the string (static or dynamic)
-; Returns:
-; CF=0; eax = length of the string in bytes.
-; CF=1; eax = 0 in case, the handle of the string can't be found in the
-; string table or the pointer is NULL.
-;
-; If pointer is passed the the procedure, it should be dword aligned and
-; all bytes of the string including zero terminator to be accessed on
-; qword boundary. Although, the zero terminator can be single byte zero.
-;
-; The performance of the procedure is high for pointers and
-; instant for handles (the StrLib created string doesn't need any
-; search, because the length is precomputed)
-;**************************************************************************
-
-proc StrLen, .hString ; proc StrLen [hString]
-begin
- mov eax, [.hString]
- xor eax, $c0000000
- test eax, $c0000000
- jnz .pointer
-
- stdcall StrPtr, [.hString]
- jc .error
-
- mov eax, [eax+string.len]
- clc
- return
-
-.error:
- xor eax, eax
- stc
- return
-
-.pointer:
- push ecx edx esi edi
-
- xor eax, $c0000000
-
-; align on dword
-.byte1:
- test eax, 3
- jz .scan
-
- cmp byte [eax], 0
- je .found
-
- inc eax
- jmp .byte1
-
-.scan:
- mov ecx, [eax]
- mov edx, [eax+4]
-
- lea eax, [eax+8]
-
- lea esi, [ecx-$01010101]
- lea edi, [edx-$01010101]
-
- not ecx
- not edx
-
- and esi, ecx
- and edi, edx
-
- and esi, $80808080
- and edi, $80808080
-
- or esi, edi
- jz .scan
-
- sub eax, 9
-
-; byte 0 was found: so search by bytes.
-.byteloop:
- lea eax, [eax+1]
- cmp byte [eax], 0
- jne .byteloop
-
-.found:
- sub eax, [.hString]
- clc
- pop edi esi edx ecx
- return
-endp
-
-
-
-
-
-; This procedure calculates the length of zero terminated string and "fixes" [string.len] field.
-; StrFixLen should be call when the content of the string is created by call to external to StrLib
-; procedures - for example Win32 API functions.
-;
-proc StrFixLen, .hstring
-begin
- push eax ecx
- stdcall StrPtr, [.hstring]
- mov ecx, eax
- stdcall StrLen, eax
- mov [ecx+string.len], eax
- pop ecx eax
- return
-endp
-
-
-
-
-;***************************************************************************
-; If the hString is larger than length - do nothing
-; If the hString is smaller than length -> set the length of string to length
-; returns pointer to the new (old) string
-;
-; Arguments:
-; hString - string handle. /not pointer!/
-; capacity - new string length.
-; Returns:
-; eax: pointer to the string.
-; CF: error flag. If 1 the pointer to the string is returned, but
-; the capacity is not changed.
-;***************************************************************************
-proc StrSetCapacity, .hString, .capacity
-begin
- push ebx ecx esi
-
- stdcall WaitForMutex, StrMutex, -1
-
- mov eax, [.hString]
-
- xor eax, $c0000000
- test eax, $c0000000
- jnz .pointer
-
- mov esi, eax
-
- mov ebx, [ptrStrTable]
- cmp esi, [ebx+TArray.count]
- jae .pointer
-
- mov eax, [ebx+TArray.array+4*esi] ; pointer to the string.
- mov ecx, [.capacity]
- cmp ecx, STR_MINSTRLEN
- jge @f
- mov ecx, STR_MINSTRLEN
-@@:
- cmp [eax+sizeof.string+string.capacity], ecx
- jae .sizeok
-
- shl ecx, 1
- add ecx, sizeof.string+4+7
- and cl, $f8 ; align the size to 8 bytes
-
- stdcall ResizeMem, eax, ecx
- jc .error
-
- lea ecx, [ecx-(sizeof.string+4)]
- mov [ebx+TArray.array+4*esi], eax
- mov [eax+sizeof.string+string.capacity], ecx
-
-.sizeok:
- add eax, sizeof.string
-
-.finish:
- stdcall MutexRelease, StrMutex
- pop esi ecx ebx
- return
-
-.error:
- int3
- add eax, sizeof.string
- stc
- jmp .finish
-
-.pointer:
- xor eax, $c0000000
- stc
- jmp .finish
-endp
-
-
-;***************************************************************************************
-; Copies source to destination string.
-; Arguments:
-; dest - destination string (handle only)
-; source - source string (handle or pointer)
-; Returns: nothing
-;***************************************************************************************
-proc StrCopy, .dest, .source
-begin
- push esi edi eax ecx
-
- stdcall StrLen, [.source]
- mov ecx, eax
-
- stdcall StrSetCapacity, [.dest], ecx
- mov edi, eax
- jc .error
-
- stdcall StrPtr, [.source]
- mov esi, eax
-
- mov [edi+string.len], ecx
-
- inc ecx
- mov eax, ecx
- shr ecx, 2
- rep movsd
- mov ecx, eax
- and ecx, 3
- rep movsb
- clc
-
-.finish:
- pop ecx eax edi esi
- return
-
-.error:
- int3
- jmp .finish
-
-endp
-
-
-
-proc CharLCase, .char
-begin
- mov eax, [.char]
- cmp eax, 'A'
- jb .end
- cmp eax, 'Z'
- ja .end
-
- add eax, 'a'-'A'
-.end:
- return
-endp
-
-
-;***************************************************************************************
-; Compares two strings for greater, equal or less.
-; Returns eax = 0 if the strings are equal.
-; eax = 1 if .str1 is grater than .str2
-; eax = -1 if .str1 is less than .str2
-;***************************************************************************************
-proc StrCompSort2, .str1, .str2, .fCaseSensitive
-begin
- push ebx ecx esi edi
-
- mov eax, [.str1]
- mov ecx, [.str2]
-
- cmp eax, ecx
- je .equal
-
- stdcall StrPtr, [.str1]
- mov esi,eax
- stdcall StrPtr, [.str2]
- mov edi,eax
-
-
-.cmp_loop:
- stdcall DecodeUtf8, [esi]
- add esi, edx
- cmp [.fCaseSensitive], 0
- jne @f
- stdcall CharLCase, eax
-@@:
- mov ecx, eax
-
- stdcall DecodeUtf8, [edi]
- add edi, edx
- cmp [.fCaseSensitive], 0
- jne @f
- stdcall CharLCase, eax
-@@:
- test ecx, ecx
- jz .endstr
- test eax, eax
- jz .endstr
-
- cmp ecx, eax
- je .cmp_loop
-
- ja .greater
- jmp .less
-
-.endstr:
- cmp ecx, eax
- ja .greater
- jb .less
-
-.equal:
- xor eax, eax
-
-.finish:
- pop edi esi ecx ebx
- return
-
-.greater:
- mov eax, 1
- jmp .finish
-
-.less:
- mov eax, -1
- jmp .finish
-endp
-
-
-
-
-
-
-;***************************************************************************************
-; Compares two strings - case sensitive.
-; Returns CARRY = 1 if the strings are equal.
-; Returns CARRY = 0 if the strings are different.
-;
-; As long as this function uses StrLen, it will be very fast on handles and relatively
-; slow on pointers.
-;***************************************************************************************
-proc StrCompCase, .str1, .str2
-begin
- push eax ecx esi edi
-
- mov eax, [.str1]
- mov ecx, [.str2]
-
- cmp eax, ecx
- je .equal
-
- test eax, eax
- jz .noteq
-
- test ecx, ecx
- jz .noteq
-
- stdcall StrLen, eax
- push eax
- stdcall StrLen, ecx
-
- pop ecx
- cmp eax, ecx
- jne .noteq
-
- stdcall StrPtr, [.str1]
- mov esi,eax
- stdcall StrPtr, [.str2]
- mov edi,eax
-
- mov eax, ecx
- shr ecx, 2
- repe cmpsd
- jne .noteq
- mov ecx, eax
- and ecx, 3
- repe cmpsb
- jne .noteq
-
-.equal:
- stc
- pop edi esi ecx eax
- return
-
-.noteq:
- clc
- pop edi esi ecx eax
- return
-endp
-
-
-;***************************************************************************************
-; Compares two strings - case NOT sensitive.
-; Returns CARRY = 1 if the strings are equal.
-; Returns CARRY = 0 if the strings are different.
-;
-; relatively slow, especially on equal strings, passed as pointers - this is the worst
-; case. The nontrivial best case is "strings with different lengths passed as handles."
-;***************************************************************************************
-proc StrCompNoCase, .str1, .str2
-begin
- push eax ebx ecx edx esi edi
-
- mov eax, [.str1]
- mov ecx, [.str2]
-
- cmp eax, ecx
- je .equal
-
- test eax, eax
- jz .noteq
-
- test ecx, ecx
- jz .noteq
-
- stdcall StrLen, eax
- push eax
- stdcall StrLen, ecx
-
- pop ecx
- cmp eax, ecx
- jne .noteq
-
- stdcall StrPtr, [.str1]
- mov esi,eax
- stdcall StrPtr, [.str2]
- mov edi,eax
-
-
- mov ebx, ecx
- shr ecx, 2
- and ebx, 3
-
-.dword:
- dec ecx
- js .byte
-
- mov eax, [esi]
- mov edx, [edi]
-
- and eax, $40404040
- and edx, $40404040
- shr eax, 1
- shr edx, 1
- or eax, [esi]
- or edx, [edi]
-
- lea esi, [esi+4]
- lea edi, [edi+4]
-
- cmp eax, edx
- jne .noteq
- jmp .dword
-
-.byte:
- dec ebx
- js .equal
-
- mov al, [esi]
- mov ah, [edi]
-
- and eax, $ffff
- mov edx, eax
- and eax, $4040
- shr eax, 1
- or eax, edx
-
- inc esi
- inc edi
-
- cmp al, ah
- je .byte
-
-.noteq:
- clc
- pop edi esi edx ecx ebx eax
- return
-
-.equal:
- stc
- pop edi esi edx ecx ebx eax
- return
-
-endp
-
-
-
-;**********************************************************
-; Creates string and assigns it to variable. If variable
-; already contains string handle, the old string will be
-; used.
-; Arguments:
-; [ptrHString] - variable containing string handle.
-; ptrSource - pointer to the source for string.
-;**********************************************************
-proc SetString, .ptrHString, .ptrSource
-begin
- push eax esi
- mov esi, [.ptrHString]
-
- mov eax, [esi]
- test eax, eax
- jnz @f
- stdcall StrNew
-@@:
- mov [esi], eax
- stdcall StrPtr, eax
- mov dword [eax], 0
- mov [eax+string.len], 0
-
- cmp [.ptrSource], 0
- je .finish
-
- stdcall StrCopy, [esi], [.ptrSource]
-
-.finish:
- pop esi eax
- return
-endp
-
-
-;**********************************************************************************
-; StrCat appends one string to another
-; Arguments:
-; dest - destination string (handle only)
-; source - source string
-;**********************************************************************************
-proc StrCat, .dest, .source
-begin
- push eax ebx ecx esi edi
-
- stdcall StrLen, [.dest]
- mov ebx,eax ; store dest length in ebx
-
- stdcall StrLen, [.source]
- mov esi, eax
- lea ecx, [eax+ebx]
-
- stdcall StrSetCapacity, [.dest], ecx
-
- mov [eax+string.len], ecx
- lea edi, [eax+ebx]
-
- stdcall StrPtr, [.source]
- lea ecx, [esi+1]
- mov esi, eax
-
- mov ebx, ecx
- shr ecx, 2
- rep movsd
- mov ecx, ebx
- and ecx, 3
- rep movsb
-
- pop edi esi ecx ebx eax
- return
-endp
-
-
-;**********************************************************************************
-; StrCharPos returns a pointer to the first occurence of a given char
-; in specified string
-; Arguments:
-; Char - char to look for
-; hString - string to search
-; Returns: a pointer to the char in source, or NULL if char doesn't occur
-; in given string
-;**********************************************************************************
-proc StrCharPos, .hString, .char
-begin
- push esi
-
- stdcall StrPtr, [.hString]
- mov esi,eax
-
- mov ah, byte [.char]
-; xchg al,ah
-
-.search:
- mov al,[esi]
- inc esi
- or al,al
- jz .not_found
- cmp al,ah
- jne .search
-
- mov eax, esi
- dec eax
- pop esi
- return
-
-.not_found:
- xor eax,eax
- pop esi
- return
-endp
-
-
-;**********************************************************************************
-; StrPos returns a pointer to the first occurence of a pattern string
-; in another string
-; Arguments:
-; hPattern - 'pattern' string
-; hString - string to search
-; Returns: a pointer to the pattern string in source , or NULL if pattern string
-; doesn't occur in the string to search
-;**********************************************************************************
-proc StrPos, .hString, .hPattern
-begin
- push ebx ecx edx esi edi ; esp = esp -20
- mov esi,[.hPattern] ; mov esi,[hPattern]
- mov edi,[.hString] ; mov edi,[hString]
- stdcall StrLen, edi
- mov ebx,eax ; now ebx holds lenght of the string to search
- stdcall StrLen, esi
- mov edx,eax ; now edx holds length of the pattern string
-
- cmp edx, ebx
- ja .not_found ; if the pattern is longer than the string
-
- stdcall StrPtr, esi
- mov esi,eax ; put pointer to the pattern str in esi
- stdcall StrPtr,edi
- mov edi,eax ; put pointer to the search str in edi
- lodsb ; load first character of the pattern
- mov ecx,ebx ;
- mov ebx,edx ; put str_len(pattern)-1 in ebx
- dec ebx ;
- sub ecx, ebx ; there is no need to search to the end, but only to len(string)-len(pattern)-1
-
-.search:
- repne scasb
- jne .not_found
-; cmp ecx,ebx
-; jb .not_found
- push edi esi ecx
- or ebx,ebx ; ebx==0 means that we were searching for one
- jz .got_it ; character. We found it, so we stop.
- mov ecx,ebx
- repe cmpsb
- jne .not_match
-
-.got_it:
- pop ecx esi edi
- dec edi
- mov eax,edi
-
-.ret:
- pop edi esi edx ecx ebx
- return
-
-.not_match:
- pop ecx esi edi
- jmp .search
-
-.not_found:
- xor eax,eax
- jmp .ret
-endp
-
-
-
-
-
-proc StrCopyPart, .dest, .source, .pos, .len
-begin
- push eax ecx esi edi
-
- stdcall StrPtr, [.source]
- mov esi, eax
- stdcall StrLen, [.source]
- mov ecx, eax
-
- mov eax, [.pos]
- cmp eax, ecx
- jae .cleardest ;
-
- sub ecx, [.pos]
- mov eax, [.len]
-
-; ecx = min(ecx, eax)
- sub eax, ecx
- sbb edi, edi
- and edi, eax
- add ecx, edi
-
- add esi, [.pos]
-
- stdcall StrSetCapacity, [.dest], ecx
- jc .finish
-
- mov edi, eax
- mov [edi+string.len], ecx
-
- push ecx
- shr ecx, 2
- rep movsd
- pop ecx
- and ecx, 3
- rep movsb
-
- lea ecx, [edi+3]
- and cl, $fc
- sub ecx, edi
- xor eax, eax
- rep stosb
-
-.finish:
- pop edi esi ecx eax
- return
-
-.cleardest:
- stdcall StrSetCapacity, [.dest], STR_MINSTRLEN
- mov [eax+string.len], 0
- mov dword [eax], 0
- jmp .finish
-endp
-
-
-
-
-;**********************************************************************************
-; StrExtract copies the part of [string] from [index] with lenght in [len]
-; Returns handle to new created string.
-;**********************************************************************************
-proc StrExtract, .string, .pos, .len
-begin
- stdcall StrNew
- stdcall StrCopyPart, eax, [.string], [.pos], [.len]
- return
-endp
-
-
-
-
-;__________________________________________________________________________________
-; Splits the string on two strings, at position [.pos]
-; Arguments:
-; .pString - pointer to string to be splitted.
-; .pos - position where to split the string.
-; Returns:
-; eax - handle to the new created string with second part of the string.
-; the original string does not reallocate memory and it's capacity
-; and the pointer will remains the same.
-;__________________________________________________________________________________
-
-proc StrSplit, .hString, .pos
-begin
- stdcall StrExtract, [.hString], [.pos], -1
- stdcall StrTrim, [.hString], [.pos]
- return
-endp
-
-
-
-
-;__________________________________________________________________________________
-; Trims the string at position [.pos]
-; Arguments:
-; .pString - pointer to string to be splitted.
-; .pos - position where to split the string.
-; Returns: nothing.
-;__________________________________________________________________________________
-proc StrTrim, .hString, .pos
-begin
- push eax ecx edi
-
- mov ecx, [.pos]
- stdcall StrLen, [.hString]
- cmp eax, ecx
- jbe .endtrim
-
- stdcall StrPtr, [.hString]
-
- mov [eax+string.len], ecx ; new length of the source string.
- add eax, ecx
- mov edi, eax
-
- lea ecx, [eax+3]
- and cl, $fc
- sub ecx, eax
- jnz @f
- inc ecx
-@@:
- xor eax, eax
- cld
- rep stosb
-
-.endtrim:
- pop edi ecx eax
- return
-endp
-
-
-
-;__________________________________________________________________________________
-; StrInsert inserts one string into another at specified pos
-; Arguments:
-; dest - destination where the source will be inserted.
-; source - string to insert
-; pos - where to insert.
-; Returns:
-; nothing.
-;__________________________________________________________________________________
-proc StrInsert, .dest, .source, .pos
-begin
- push eax
-
- stdcall StrSplit, [.dest], [.pos]
- push eax eax
-
- stdcall StrCat, [.dest], [.source]
- stdcall StrCat, [.dest] ; source from the stack.
- stdcall StrDel; from the stack.
-
- pop eax
- return
-endp
-
-
-; TODO:
-; String case functions are giving weird results in linux, so
-; here are two functons I wrote some time ago.
-; I have tested the following functions in win32 and worked well
-; Perhaps it is time to fully support UTF encoded strings.
-; These functions here are faster (20-25%), but the results are
-; exactly the same as the strlib ones.
-; pelaillo
-
-; -----------------------------------------------
-; str_ucase:
-; Author: pelaillo
-; Date: Jan. 16, 2002
-; Converts also accented characters: ÑÚ <--> ñú
-; -----------------------------------------------
-
-proc StrUCase2, .hString
-begin
- push eax edx edi
-
- stdcall StrPtr, [.hString]
- mov edi, eax
-.str_ucase:
- mov eax, [edi]
- mov edx, eax
- and edx, 40404040h
- ror edx, 1
- xor edx, -1
- and eax, edx
- mov [edi], eax
- add edi, 4
- lea edx, [eax-01010101h]
- xor eax, edx
- and eax, 80808080h
- jz .str_ucase
- and eax, edx
- jz .str_ucase
-
- pop edi edx eax
- return
-endp
-
-; -----------------------------------------------
-; str_lcase:
-; Author: pelaillo
-; Date: Jan. 16, 2002
-; Converts also accented characters: ÑÚ <--> ñú
-; -----------------------------------------------
-
-proc StrLCase2, .hString
-begin
- push eax edx edi
-
- stdcall StrPtr, [.hString]
- mov edi, eax
-.str_lcase:
- mov eax, [edi]
- mov edx, eax
- and edx, 40404040h
- ror edx, 1
- or eax, edx
- mov [edi], eax
- add edi, 4
- lea edx, [eax-01010101h]
- xor eax, edx
- and eax, 80808080h
- jz .str_lcase
- and eax, edx
- jz .str_lcase
-
- pop edi edx eax
- return
-endp
-
-
-;**********************************************************************************
-; Converts strings to Lower Case
-;**********************************************************************************
-proc StrLCase, .hString
-begin
- push eax ebx ecx edx edi
-
- stdcall StrPtr, [.hString]
- mov edi, eax
-
- stdcall StrLen, [.hString]
- mov ecx, eax
- mov ebx, edi
-
- and ebx, 3
- sub ecx, ebx
- jbe .byte2 ; the string is small enough, so process it by bytes.
-
-.byte1:
- test edi, 3
- jz .ddword
-
- mov al, [edi]
- and al, $40
- shr al, 1
- or byte [edi], al
-
- inc edi
- jmp .byte1
-
-.ddword:
- mov ebx, ecx
- and ebx, 3
- shr ecx, 2
- jecxz .byte
-
-.qword:
- mov eax, [edi]
- mov edx, [edi+4]
-
- and eax, $40404040
- and edx, $40404040
-
- shr eax, 1
- shr edx, 1
-
- or [edi], eax
- or [edi+4], edx
-
- add edi, 8
- dec ecx
- jnz .qword
-
-.byte:
- dec ebx
- js .finish
-
- mov al, [edi]
- and al, $40
- shr al, 1
- or byte [edi], al
-
- inc edi
- jmp .byte
-
-.byte2:
- mov ebx, ecx
- jmp .byte
-
-.finish:
- pop edi edx ecx ebx eax
- return
-endp
-
-
-;**********************************************************************************
-; Converts strings to Upper Case
-; First parameter = String to Convert to upper case
-;**********************************************************************************
-proc StrUCase, .hString
-begin
- push eax ebx ecx edx edi
-
- stdcall StrPtr, [.hString]
- mov edi, eax
-
- stdcall StrLen, [.hString]
- mov ecx, eax
- mov ebx, edi
-
- and ebx, 3
- sub ecx, ebx
- jbe .byte2 ; the string is small enough, so process it by bytes.
-
-.byte1:
- test edi, 3
- jz .ddword
-
- mov al, [edi]
- and al, $40
- shr al, 1
- not al
- and byte [edi], al
-
- inc edi
- jmp .byte1
-
-.ddword:
- mov ebx, ecx
- and ebx, 3
- shr ecx, 2
- jecxz .byte
-
-.qword:
- mov eax, [edi]
- mov edx, [edi+4]
-
- and eax, $40404040
- and edx, $40404040
-
- shr eax, 1
- shr edx, 1
-
- not eax
- not edx
-
- and [edi], eax
- and [edi+4], edx
-
- add edi, 8
- dec ecx
- jnz .qword
-
-.byte:
- dec ebx
- js .finish
-
- mov al, [edi]
- and al, $40
- shr al, 1
- not al
- and byte [edi], al
-
- inc edi
- jmp .byte
-
-.byte2:
- mov ebx, ecx
- jmp .byte
-
-.finish:
- pop edi edx ecx ebx eax
- return
-endp
-
-
-
-
-;**********************************************************************************
-; _NumToStr converts the number in eax to the string in any radix approx. [2..26]
-; Arguments:
-; [edi] - pointer to the string buffer
-; ecx - radix
-; eax - number to convert.
-; There is no parameter check, so be careful.
-; returns: edi points to the end of a converted number
-;**********************************************************************************
-proc _NumToStr
-begin
- test eax,eax
- jns _NumToStrU
- neg eax
- mov byte [edi],"-"
- inc edi
-endp
-
-proc _NumToStrU
-begin
- cmp eax,ecx
- jb .lessA
- xor edx,edx
- div ecx
- push edx
- call _NumToStrU
- pop eax
-.lessA:
- cmp al, 10
- sbb al, 69h
- das
- stosb
- return
-endp
-
-
-
-;*****************************************************
-; NumToStrF:
-; Converts signed integer value to string.
-; NumToStrUF:
-; Converts unsigned integer value to string.
-;
-; edi - pointer to string buffer
-; eax - Number to convert
-; ecx - radix from 2 to $ff
-; esi - length of the number in chars
-;
-; returns: edi - pointer to the end of converted num
-;
-; Note: Don't use 1 as radix.
-;*****************************************************
-proc _NumToStrF
-begin
- test eax,eax
- jns _NumToStrUF
- neg eax
- mov byte [edi],'-'
- push esi
- dec esi
- add edi, esi
- push edi
- jmp _NumToStrUF.loopc
-endp
-
-proc _NumToStrUF
-begin
- push esi
- add edi, esi
- push edi
- dec edi
-.loopc:
- xor edx,edx
- div ecx
- xchg al,dl
- cmp al,$0a
- sbb al,$69
- das
- mov [edi],al
- dec edi
- xchg al,dl
- dec esi
- jnz .loopc
- pop edi
- pop esi
- return
-endp
-
-
-;***********************************************************
-; NumToStr - converts number to any radix.
-; num - number to convert
-; str - handle of the string. If NULL - creates new string.
-; index - Offset in string where to put converted number.
-; flags:
-; byte 0 - number of digits if ntsFixedWidth is set.
-; byte 1 - contains radix for the convertion.
-; byte 2,3 - flags.
-; Returns:
-; eax - handle of the string.
-;***********************************************************
-proc NumToStr, .num, .flags
-begin
- push ebx ecx edx esi edi
-
- stdcall StrNew
- push eax
-
- stdcall StrSetCapacity, eax, 40
- mov edi, eax
- push eax ; pointer for the length.
-
-; determine which conversion func to use
- movzx eax, byte [.flags+2] ; signed/fixed
- and eax, (ntsUnsigned or ntsFixedWidth) shr 16
- mov ebx, [.NumToStrFunc+4*eax]
-
- movzx ecx, byte [.flags+1] ; load radix into ecx
- movzx esi, byte [.flags]
- mov eax, [.num]
- call ebx ; call low-level convertion routine
- mov dword [edi], 0
-
- pop eax
- sub edi, eax
- mov [eax+string.len], edi
-
- pop eax
- pop edi esi edx ecx ebx
- return
-
-.NumToStrFunc dd _NumToStr, _NumToStrU, _NumToStrF, _NumToStrUF
-
-endp
-
-
-
-
-;-------------------------------------------------------
-; function StrToNum
-; Converts specified string into a number
-;
-; Arguments:
-; hString - handle/pointer of the string containing
-; number to convert. It doesn't have to be ended by
-; NULL, any other character will stop conversion.
-; Number to convert must be decimal.
-;
-; Return:
-; eax - converted number
-; edx - offset to the byte where convertion ended.
-;
-; Note: in case of failture (first char of given pointer
-; isn't a number) function returns -1.
-;-------------------------------------------------------
-proc StrToNum, .hString
-begin
- push ebx esi edi
- xor ebx,ebx ; ebx will store our number
-
- stdcall StrPtr, [.hString]
- mov edi, eax
- mov esi,eax
- xor eax,eax
- mov al,[esi]
- cmp al,'0'
- jb .error
- cmp al,'9'
- jbe .digit
- jmp .error
- .digit:
- sub al,'0'
- add ebx,eax
- inc esi
- mov al,[esi]
- cmp al,'0'
- jb .finish
- cmp al,'9'
- ja .finish
- mov edx,ebx ; multiply ebx by 10
- shl ebx,3
- add ebx,edx
- add ebx,edx
- jmp .digit
- .finish:
-
- mov eax, ebx
- mov edx, esi
- sub edx, edi
- clc
- pop edi esi ebx
- return
-
- .error:
- mov eax, -1
- stc
- pop edi esi ebx
- return
-endp
-
-
-
-
-
-
-proc StrToNumEx, .hstring
-.sign dd ?
-begin
- push ebx edx esi edi
-
- stdcall StrLen, [.hstring]
- mov edx, eax
- test eax, eax
- jz .invalid_number
-
- stdcall StrPtr, [.hstring]
-
- mov esi, eax
- lea edi, [eax+edx]
-
-; sign?
- mov [.sign], 0
- cmp byte [esi], '-'
- jne .radix
-
- mov [.sign], -1
- inc esi
-
-; determine what is the radix.
-.radix:
- cmp byte [esi], '$'
- je .hex
- cmp word [esi], '0x'
- jne .postfix
- inc esi
-.hex:
- inc esi
- mov edx, 16
- jmp .decode
-
-.postfix:
-; search for 'h' or 'b' or 'o'
- mov al, [edi-1]
- or al, $40
-
- mov edx, 16
- cmp al, 'h'
- je .postok
-
- mov edx, 8
- cmp al, 'o'
- je .postok
-
- mov edx, 2
- cmp al, 'b'
- je .postok
-
- mov edx, 10
- inc edi
-
-.postok:
- dec edi
-
-; here, edx contains the radix, esi - begin of the number; edi - end of the number.
-.decode:
- xor ebx, ebx
- cmp esi, edi
- jae .invalid_number
-
-.decode_loop:
- lodsb
-
- cmp al, '0'
- jb .invalid_number
- cmp al, '9'
- jbe .digit
-
- or al, $40
- cmp al, 'z' ; common
- ja .invalid_number
- cmp al, 'a'
- jb .invalid_number
-
- sub al, 'a'-'0'-10
-
-.digit:
- sub al, '0'
- movzx eax, al
-
- cmp eax, edx
- jae .invalid_number
-
- imul ebx, edx
- add ebx, eax
-
- cmp esi, edi
- jne .decode_loop
-
-; set the sign:
- xor ebx, [.sign]
- sub ebx, [.sign]
-
- clc
- mov eax, ebx
- pop edi esi edx ebx
- return
-
-.invalid_number:
- xor eax, eax
- stc
- pop edi esi edx ebx
- return
-endp
-
-
-
-
-
-
-
-
-;-------------------------------------------------------
-; function StrCharCat
-; Appends up to 4 chard at the end of the string.
-;
-; Arguments:
-; hString - string to append
-; char - char(s) to add
-; Returns:
-; nothing
-;-------------------------------------------------------
-proc StrCharCat, .hString, .char
-begin
- push eax ecx
-
- stdcall StrLen, [.hString]
- mov ecx, eax
- add eax, 8
-
- stdcall StrSetCapacity, [.hString], eax
- jnc @f
- int3
-@@:
-
- pushd [.char]
- popd [eax+ecx]
- mov dword [eax+ecx+4], 0
- dec ecx
-.goend:
- inc ecx
- cmp byte [eax+ecx], 0
- jne .goend
-
- mov [eax+string.len], ecx
-
- pop ecx eax
- return
-endp
-
-
-;------------------------------------------------------------
-; function StrInsertChar
-; Inserts up to 4 chars into the given position of the string
-;
-; Arguments:
-; hString - string to append
-; char - char to add
-; pos - position where to add the char
-;-------------------------------------------------------------
-proc StrCharInsert, .hString, .char, .pos
-.str rd 4
-begin
- push eax
- push [.char]
- pop [.str]
- mov [.str+4], 0
- mov [.str+8], 0
-
- lea eax, [.str]
- stdcall StrInsert, [.hString], eax, [.pos]
- pop eax
- return
-endp
-
-
-
-;_______________________________________________________________________
-; proc StrClipSpacesR
-; Removes the spaces from the right of the string.
-; Arguments:
-; hString - string to be processed
-; Returns:
-; CF=1 - invalid string handle.
-;_______________________________________________________________________
-proc StrClipSpacesR, .hString
-begin
- push eax ecx
-
- stdcall StrPtr, [.hString]
- jc .finish
-
- mov ecx, [eax+string.len]
- jecxz .exit
-.loop:
- cmp byte [eax+ecx-1], ' '
- jne .exit
- dec ecx
- jnz .loop
-.exit:
- mov [eax+string.len], ecx
- mov dword [eax+ecx], 0
-
-.finish:
- pop ecx eax
- return
-endp
-
-
-;_______________________________________________________________________
-; proc StrClipSpacesL
-; Removes the spaces from the left of the string.
-; Arguments:
-; hString - string to be processed
-; Returns:
-; CF=1 - invalid string handle.
-;_______________________________________________________________________
-proc StrClipSpacesL, .hString
-begin
- push esi edi eax ecx
-
- stdcall StrPtr, [.hString]
- jc .finish
-
- mov ecx, [eax+string.len]
- mov esi, eax
- mov edi, eax
-
-.loop:
- jecxz .copy
- cmp byte [esi], ' '
- jne .copy
-
- inc esi
- dec ecx
- jmp .loop
-
-.copy:
- mov [edi+string.len], ecx
- jecxz .finish
- cmp esi, edi
- je .finish
-
- add ecx, 4
- rep movsb
-
-.finish:
- pop ecx eax edi esi
- return
-endp
-
-
-
-;_______________________________________________________________________
-; proc StrCleanDupSpaces
-; Removes duplicating spaces from the string.
-; Arguments:
-; hString - string to be processed
-; Returns:
-; CF=1 - invalid string handle.
-;_______________________________________________________________________
-proc StrCleanDupSpaces, .hString
-begin
- push esi edi eax ecx edx
-
- stdcall StrPtr, [.hString]
- jc .finish
-
- mov ecx, [eax+string.len]
- lea edx, [eax+string.len]
- mov esi, eax
- mov edi, eax
-
- jecxz .endcopy
-
-.loop:
- lodsb
- cmp al, ' '
- jne .store
- cmp byte [esi], ' '
- jne .store
-; skip
- dec dword [edx]
- jmp .next
-
-.store:
- stosb
-
-.next:
- dec ecx
- jnz .loop
-
-.endcopy:
- xor eax, eax
- stosd
-
-.finish:
- pop edx ecx eax edi esi
- return
-endp
-
-
-
-
-
-
-;_______________________________________________________________________
-;
-; proc StrHash
-; Computes 32 bit hash value from the string.
-; This procedure implements the hash algoritm: FNV-1b
-;
-; Arguments:
-; .hString - handle of string.
-;
-; Return:
-; eax - 32bit hash value.
-;
-; Changes:
-; eax
-;_______________________________________________________________________
-proc StrHash, .hString
-begin
- stdcall StrLen, [.hString]
- push eax
- stdcall StrPtr, [.hString]
- push eax
- call DataHash
- return
-endp
-
-
-proc DataHash, .ptrData, .len
-begin
- push ecx edx esi
-
- mov esi, [.ptrData]
- mov ecx, [.len]
- mov eax, $811C9DC5 ; 2166136261 ; FNV offset basis
- inc ecx
-
-.hashloop:
- dec ecx
- jz .exit
- movzx edx, byte [esi]
- xor eax, edx
- inc esi
- imul eax, $01000193 ; 16777619 ; FNV prime
- jmp .hashloop
-
-.exit:
- pop esi edx ecx
- return
-endp
-
-
-
-proc StrURLEncode, .hstr
-.res dd ?
-begin
- push ebx ecx edx esi edi
- stdcall StrPtr, [.hstr]
- mov esi, eax
-
- stdcall StrLen, esi
- mov ecx, eax
- lea edx, [2*eax+eax] ; the encoded string can be max 3x long as original string.
-
- stdcall StrNew
- mov [.res], eax
- jecxz .finish
-
- stdcall StrSetCapacity, eax, edx
- mov edi, eax
- xor edx, edx
- xor ebx, ebx
-
- push eax
-.encode:
- lodsb
- cmp al, $80
- jae .store ; it is a hack, but I hope save enough.
-
- mov dl, al
- mov bl, al
- shr edx, 5
- and ebx, $1f
- bt dword [.URLCharTable+4*edx], ebx
- jnc .store
-
- mov ah, al
- mov al, '%'
- stosb
- mov al, ah
- shr al, 4
- cmp al, $0a
- sbb al, $69
- das
- stosb
- mov al, ah
- and al, $0f
- cmp al, $0a
- sbb al, $69
- das
-
-.store:
- stosb
- loop .encode
-
- xor al, al
- mov [edi], al
-
- pop eax
- sub edi, eax
- mov [eax+string.len], edi
-
-.finish:
- mov eax, [.res]
- pop edi esi edx ecx ebx
- return
-
-; Contains 1 where the character must be % encoded and 0 where it is save to pass it directly
-.URLCharTable db 11111111b ;
- db 11111111b ;
- db 11111111b ;
- db 11111111b ; 0..31 -control chars | encoded
- db 11111111b ; $27 - $20: '&%$#"! | encoded
- db 11111111b ; $2f - $28: /.-,+*)( | encoded
- db 00000000b ; $37 - $30: 76543210 | not encoded
- db 11111100b ; $3f - $38: ?>=<;:98 | partially
- db 00000001b ; $47 - $40: GFEDCBA@ | partially
- db 00000000b ; $4f - $48: ONMLKJIH | not encoded
- db 00000000b ; $57 - $50: WVUTSRQP | not encoded
- db 11111000b ; $5f - $58: _^]\[ZYX | partially
- db 00000001b ; $67 - $60: gfedcba` | partially
- db 00000000b ; $6f - $68: onmlkjih | not encoded
- db 00000000b ; $77 - $70: wvutsrqp | not encoded
- db 11111000b ; $7f - $78: ~}|{zyx | partially
-endp
-
-
-
-proc StrURLDecode, .hstring
-begin
- pushad
-
- stdcall StrLen, [.hstring]
- mov ecx, eax
- jecxz .finish
-
- stdcall StrPtr, [.hstring]
- mov esi, eax
- mov edi, eax
- mov ebx, eax
-
-.loop:
- lodsb
-
- test al, al
- jz .end_of_string
-
- cmp al, '+'
- je .space
-
- cmp al, '%'
- jne .store
-
- lodsb
- cmp al, '9'
- jbe @f
- add al, $09
-@@:
- shl al, 4
- mov ah, al
-
- lodsb
- cmp al, '9'
- jbe @f
- add al, $09
-@@:
- and al, $0f
- or al, ah
- jmp .store
-
-.space:
- mov al, ' '
-
-.store:
- stosb
- loop .loop
-
-.end_of_string:
- mov ecx, edi
- sub ecx, ebx
- xor eax, eax
- stosd
-
- mov [ebx+string.len], ecx
-
-.finish:
- popad
- return
-
-endp
-
-
-; UTF-8 support functions.
-; Some of the above functions also need some revision in order to support
-; utf-8 strings properly.
-
-
-; Bug - on [.len]=-1 sometimes in Linux returns error on normal strings.
-
-proc StrLenUtf8, .hString, .len
-.maxptr dd ?
-begin
- push esi ecx edx
-
- stdcall StrPtr, [.hString]
- mov esi, eax
- mov eax, [.len]
- cmp eax, -1
- je @f
- add eax, esi
-@@:
- mov [.maxptr], eax
- xor ecx, ecx
-
-.loop:
- cmp esi, [.maxptr]
- jae .endofstring
-
- mov eax, [esi]
- stdcall DecodeUtf8, eax
- jc .error
-
- test eax, eax
- jz .endofstring
-
- add esi, edx
- inc ecx
- jmp .loop
-
-.endofstring:
- mov eax, ecx
- pop edx ecx esi
- clc
- return
-
-.error:
- pop edx ecx esi
- return
-endp
-
-
-
-proc StrOffsUtf8, .hString, .pos
-begin
- push edx esi
-
- stdcall StrPtr, [.hString]
- mov esi, eax
-
-.loop:
- dec [.pos]
- js .finish
-
- stdcall DecodeUtf8, [esi]
- jc .error
-
- test eax, eax
- jz .finish
-
- add esi, edx
- jmp .loop
-
-.finish:
- clc
- mov eax, esi
- pop esi edx
- return
-
-.error:
- xor eax, eax
- pop esi edx
- return
-endp
-
-
-
-; decodes 4 bytes in [.chars] to UNICODE dword value.
-; returns:
-; CF=0 - no error
-; eax - unicode value.
-; edx - byte count of the char. [1..4]
-; CF=1 - invalid utf-8 char;
-; eax = edx = 0 the character can not be decoded.
-; edx <> 0 -> eax = the overlong encoded character. edx = byte count of the char.
-;
-; Note: When CF=1 and [.chars] are overlong encoded char.
-; eax contains the proper value and edx contains the proper length.
-; But it is still invalid character, according to the standards.
-proc DecodeUtf8, .chars
-begin
- push ebx ecx
-
- xor ecx, ecx
-
-.loop1:
- shl byte [.chars], 1
- jnc .countok
- inc ecx
- jmp .loop1
-
-.countok:
- jecxz .ascii
-
- cmp ecx, 1
- je .error ; internal byte
- cmp ecx, 4
- ja .error ; more than 4 bytes
-
- mov edx, 1
- xor ebx, ebx
- movzx eax, byte [.chars]
- shr eax, cl
- shr eax, 1
-
-.loop2:
- mov bl, byte [.chars+edx]
- and bl, $c0
- cmp bl, $80
- jne .error
- mov bl, byte [.chars+edx]
- and bl, $3f
- shl eax, 6
- or eax, ebx
- inc edx
- cmp edx, ecx
- jne .loop2
-
- and eax, $1fffff
- cmp eax, $10ffff
- ja .error
-
- cmp eax, [._minimal+4*edx-8]
- jb .overlong ; overlong coding.
-
- clc
- pop ecx ebx
- return
-
-.ascii:
- movzx eax, byte [.chars]
- shr eax, 1
- mov edx, 1
- pop ecx ebx
- clc
- return
-
-.error:
- xor eax, eax
- xor edx, edx
-.overlong:
- stc
- pop ecx ebx
- return
-
-._minimal dd $80, $800, $10000
-
-endp
-
-
-
-proc ScanForwardUtf8
-begin
- push eax
-
- mov al, [esi]
- test al, al
- jns .finish
-
- and al, 11000000b
- cmp al, 11000000b
- je .finish
-
-; inc forward
-.loopf:
- inc esi
- mov al, [esi]
- and al, 11000000b
- cmp al, 10000000b
- je .loopf
-
-.finish:
- pop eax
- return
-endp
-
-
-
-proc ScanBackUtf8
-begin
- push eax
-
- mov al, [esi]
- test al, al
- jns .finish
-
- and al, 11000000b
- cmp al, 11000000b
- je .finish
-
-; inc back
-.loopf:
- dec esi
- mov al, [esi]
- and al, 11000000b
- cmp al, 10000000b
- je .loopf
-
-.finish:
- pop eax
- return
-endp
-
-
-
-proc ExpandTabs, .hstring, .tabstop
-.start dd ?
-.count dd ?
-.correction dd ?
-begin
- pushad
-
- mov [.count], 0
- mov [.correction], 0
-
- stdcall StrLen, [.hstring]
- mov ecx, eax
- stdcall StrPtr, [.hstring]
- mov [.start], eax
- mov esi, eax
- add ecx, eax
- xor ebx, ebx
-
- jecxz .end_scan
-
-.scan_loop:
- stdcall DecodeUtf8, [esi]
- cmp eax, $09
- jne .next
-
- mov byte [esi], $20
-
- push edx
- mov eax, ebx
- cdq
- div [.tabstop]
- imul eax, [.tabstop]
- pop edx
- add eax, [.tabstop]
- sub eax, ebx
- dec eax
- jz .next
-
- add ebx, eax
- add [.correction], eax
- push eax ; space count
-
- mov eax, esi
- sub eax, [.start]
- push eax ; offset
-
- inc [.count]
-
-.next:
- inc ebx
- add esi, edx
- cmp esi, ecx
- jb .scan_loop
-
-.end_scan:
- cmp [.count], 0
- je .finish
-
-.expand:
- pop ebx ; offset
- pop eax ; count
-
-.ins_spc:
- stdcall StrCharInsert, [.hstring], ' ', ebx
- dec eax
- jnz .ins_spc
-
-.next_tab:
- dec [.count]
- jnz .expand
-
-.finish:
- popad
- mov eax, [.correction]
- return
-endp
-
-
-
-proc StrIP2Num, .hString
-begin
- push ebx edx esi
-
- xor ebx, ebx
- stdcall StrPtr, [.hString]
- mov esi, eax
-
-; string to IP
-.iploop:
- stdcall StrToNum, esi
- cmp eax, $100
- jae .invalid_ip
-
- cmp ebx, $1000000
- jae .invalid_ip
-
- shl ebx, 8
- or bl, al
-
- cmp byte [esi+edx], 0
- je .end_of_ip
-
- cmp byte [esi+edx], '.'
- jne .invalid_ip
-
- lea esi, [esi+edx+1]
- jmp .iploop
-
-.invalid_ip:
- stc
- mov eax, ebx
- pop esi ebx
- return
-
-.end_of_ip:
- clc
- mov eax, ebx
- pop esi edx ebx
- return
-endp
-
-
-
-proc IP2Str, .ip
-begin
- push ebx
-
- movzx eax, byte [.ip+3]
- stdcall NumToStr, eax, ntsDec or ntsUnsigned
- mov ebx, eax
- stdcall StrCharCat, ebx, '.'
-
- movzx eax, byte [.ip+2]
- stdcall NumToStr, eax, ntsDec or ntsUnsigned
- stdcall StrCat, ebx, eax
- stdcall StrDel, eax
- stdcall StrCharCat, ebx, '.'
-
- movzx eax, byte [.ip+1]
- stdcall NumToStr, eax, ntsDec or ntsUnsigned
- stdcall StrCat, ebx, eax
- stdcall StrDel, eax
- stdcall StrCharCat, ebx, '.'
-
- movzx eax, byte [.ip]
- stdcall NumToStr, eax, ntsDec or ntsUnsigned
- stdcall StrCat, ebx, eax
- stdcall StrDel, eax
-
- mov eax, ebx
- pop ebx
- return
-endp
-
-
-proc StrEncodeHTML, .hString
-begin
- push esi edi
-
- stdcall StrNew
- mov edi, eax
-
- stdcall StrPtr, [.hString]
- mov esi, eax
-
-.loop:
- movzx eax, byte [esi]
- inc esi
-
- test eax, eax
- jz .end_of_string
-
- cmp al, '<'
- je .char_less_then
- cmp al, '>'
- je .char_greater_then
- cmp al, '"'
- je .char_quote
- cmp al, '&'
- je .char_amp
-; cmp al, "'"
-; je .char_apos
-
-.store:
- stdcall StrCharCat, edi, eax
- jmp .loop
-
-.end_of_string:
- mov eax, edi
- pop edi esi
- return
-
-.char_less_then:
- mov eax, '<'
- jmp .store
-
-.char_greater_then:
- mov eax, '>'
- jmp .store
-
-.char_quote:
- stdcall StrCharCat, edi, '&quo'
- mov eax, 't;'
- jmp .store
-
-;.char_apos:
-; stdcall StrCharCat, edi, '&apo'
-; mov eax, 's;'
-; jmp .store
-
-.char_amp:
- stdcall StrCharCat, edi, '&'
- mov eax, ';'
- jmp .store
-endp
-
-
-
-
-proc StrDecodeHTML, .hString
-begin
- pushad
-
- stdcall StrPtr, [.hString]
- mov esi, eax
- mov edi, eax
- mov ebx, eax
-
-.loop:
- lodsb
-
- test al, al
- jz .end_of_string
-
- cmp al, '&'
- je .collapse
-
-.store:
- stosb
- jmp .loop
-
-.collapse:
- cmp dword [esi], 'nbsp'
- jne .not_nbsp
- cmp byte [esi+4], ';'
- jne .not_nbsp
-
- add esi, 5
- mov al, ' '
- jmp .store
-
-.not_nbsp:
- mov ecx, [esi]
- and ecx, $ffffff
-
- cmp ecx, 'lt;'
- je .lessthen
- cmp ecx, 'gt;'
- jne .not_gt
-
- add esi, 3
- mov al, '>'
- jmp .store
-
-.lessthen:
- add esi, 3
- mov al, '<'
- jmp .store
-
-.not_gt:
- cmp dword [esi], 'quot'
- jne .not_quote
- cmp byte [esi+4], ';'
- jne .not_quote
-
- add esi, 5
- mov al, '"'
- jmp .store
-
-.not_quote:
- cmp dword [esi], 'apos'
- jne .not_apos
- cmp byte [esi+4], ';'
- jne .not_apos
-
- add esi, 5
- mov al, "'"
- jmp .store
-
-.not_apos:
- cmp dword [esi], 'amp;'
- jne .store
-
- add esi, 4
- mov al, '&'
- jmp .store
-
-
-.end_of_string:
- mov dword [edi], 0
- sub edi, ebx
- mov [ebx+string.len], edi
-
- popad
- return
-endp
-
-
-
-
-proc DateTimeToStr, .pDateTime, .format
-begin
- push ebx esi
-
- mov esi, [.pDateTime]
-
-; date
- stdcall NumToStr, [esi+TDateTime.date], ntsUnsigned or ntsFixedWidth or ntsDec + 2
- mov ebx, eax
- stdcall StrCharCat, ebx, '.'
- stdcall NumToStr, [esi+TDateTime.month], ntsUnsigned or ntsFixedWidth or ntsDec + 2
- stdcall StrCat, ebx, eax
- stdcall StrDel, eax
- stdcall StrCharCat, ebx, '.'
- stdcall NumToStr, [esi+TDateTime.year], ntsSigned or ntsFixedWidth or ntsDec + 4
- stdcall StrCat, ebx, eax
- stdcall StrDel, eax
- stdcall StrCharCat, ebx, ' '
-
-; time
- stdcall NumToStr, [esi+TDateTime.hour], ntsUnsigned or ntsFixedWidth or ntsDec + 2
- stdcall StrCat, ebx, eax
- stdcall StrDel, eax
- stdcall StrCharCat, ebx, ':'
- stdcall NumToStr, [esi+TDateTime.minute], ntsUnsigned or ntsFixedWidth or ntsDec + 2
- stdcall StrCat, ebx, eax
- stdcall StrDel, eax
- stdcall StrCharCat, ebx, ':'
- stdcall NumToStr, [esi+TDateTime.second], ntsUnsigned or ntsFixedWidth or ntsDec + 2
- stdcall StrCat, ebx, eax
- stdcall StrDel, eax
-
- mov eax, ebx
- pop esi ebx
- return
-endp
-
-
-
-proc StrExtractFilename, .hFilename
-begin
- push ebx ecx esi
-
- stdcall StrLen, [.hFilename]
- mov ecx, eax
-
- stdcall StrPtr, [.hFilename]
- lea esi, [eax+ecx]
- mov ebx, eax
-
-.loop:
- cmp esi, ebx
- je .found2
-
- dec esi
- mov al, [esi]
-
- cmp al, '/'
- je .found
- cmp al, '\'
- je .found
- jmp .loop
-
-.found:
- inc esi
-
-.found2:
- stdcall StrExtract, esi, 0, $7fffffff
-
- pop esi ecx ebx
- return
-endp
-
-
-
-proc StrChangeExt, .hFilename, .hNewExt
-begin
-
-
-
-
-
- return
-endp
-
-
-
-
-;******************************************************
-; Computes MD5 hash of the string .hString and returns
-; new string handle in eax containing the hash of the
-; string.
-;******************************************************
-proc StrMD5, .hString
-begin
- stdcall StrLen, [.hString]
- push eax
- stdcall StrPtr, [.hString]
- stdcall DataMD5, eax ; length from the stack.
- return
-endp
-
-
-
-include '%TargetOS%/utf8.asm'
-
-
-
-endmodule
DELETED freshlib/data/uConfig.asm
Index: freshlib/data/uConfig.asm
==================================================================
--- freshlib/data/uConfig.asm
+++ /dev/null
@@ -1,696 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: OS independent micro configuration files library.
-;
-; Target OS: Any
-;
-; Dependencies: memory.asm; strlib.asm; arrays.asm; files.asm
-;
-; Notes:
-;
-;_________________________________________________________________________________________
-module "uConfig library"
-
-
-; Structure of the file of uConfig:
-;
-; offset | size | description
-; --------+-------+-----------------------------------------------------------------------
-; 0 | 4 | Signature
-; 4 | 4 | $0a1a0a0d (CR, LF, EOF, 00)
-; 8 | 4 | Hash of the whole file including file length of the next field
-; 12 | 4 | Chunk data length (N)
-; 16 | N | Data chunks
-; --------+-------+-----------------------------------------------------------------------
-;
-; Every data chunk have following structure:
-;
-; offset | size | description
-; --------+-------+-----------------------------------------------------------------------
-; 0 | 4 | Key name 4xASCII chars.
-; 4 | 4 | Length of the data in bytes (K)
-; 8 | 4 | Data type. Constant of cdtXXXXX (see definitions below)
-; 12 | K | Chunk data.
-; --------+-------+-----------------------------------------------------------------------
-;
-
-
-cdtNULL = 0
-cdtInteger = 1 ; 32bit integer value.
-cdtString = 2 ; utf-8 string.
-cdtBlob = 3 ; arbitraty sized array of bytes.
-cdtConfig = 4
-
-cdtMaxAlowed = cdtConfig
-
-struct TConfigHeader
- .signature dd ?
- .filler dd ?
- .hash dd ?
- .length dd ?
- .chunks:
-ends
-
-
-struct TChunkHeader
- .KeyName dd ?
- .length dd ? ; length of the data without the size of the header and checksum.
- .type dd ?
-ends
-
-
-struct TConfigRecord
- .KeyName dd ?
- .DataSize dd ?
- .Type dd ?
- .Data dd ?
-ends
-
-
-; loads the file representation from the memory and expands it to the database tree structure.
-; returns pointer to TArray of TConfigRecord structures.
-proc LoadConfigDB, .ptrSource, .signature
-begin
- push ecx edx esi
-
- mov esi, [.ptrSource]
- test esi, esi
- jnz .process_source
-
- stdcall CreateArray, sizeof.TConfigRecord
- jmp .db_ok
-
-.process_source:
-; check 8 bytes signature
- mov edx, [esi+TConfigHeader.signature]
-
- cmp [.signature], -1
- je .signatureok
-
- cmp edx, [.signature]
- jne .error_bad_signature
-
-.signatureok:
- mov [.signature], edx
-
- cmp dword [esi+TConfigHeader.filler], $001a0a0d
- jne .error_bad_signature
-
- mov ecx, [esi+TConfigHeader.length]
- lea esi, [esi+TConfigHeader.length]
- add ecx, 4 ;(the length itself)
- stdcall DataHash, esi, ecx
- cmp eax, [esi-4]
- jne .error_bad_hash
-
- add esi, 4
- sub ecx, 4
- stdcall __DoRecurseConfigSource, esi, ecx
-
-.db_ok:
- pushd [.signature]
- popd [eax+TArray.lparam] ; store the signature to the .lparam field of the root TArray
- clc
-
-.finish:
- pop esi edx ecx
- return
-
-.error_bad_signature:
- mov eax, -1
- stc
- jmp .finish
-
-.error_bad_hash:
- mov eax, -2
- stc
- jmp .finish
-endp
-
-
-
-proc __DoRecurseConfigSource, .ptrSource, .length
-.array dd ?
-begin
- pushad
-
- stdcall CreateArray, sizeof.TConfigRecord
- mov [.array], eax
-
- mov esi, [.ptrSource]
- mov ecx, [.length]
-
-.chunk_loop:
- cmp ecx, sizeof.TConfigRecord
- jb .finish
-
- stdcall AddArrayItems, [.array], 1
- mov [.array], edx
- mov edi, eax
-
- mov eax, [esi+TChunkHeader.KeyName]
- mov edx, [esi+TChunkHeader.length]
- mov [edi+TConfigRecord.KeyName], eax
- mov [edi+TConfigRecord.DataSize], edx
-
- mov eax, [esi+TChunkHeader.type]
- mov [edi+TConfigRecord.Type], eax
-
- add esi, sizeof.TChunkHeader
- sub ecx, sizeof.TChunkHeader
-
- and eax, $7
- movzx eax, [.type_handlers+eax]
- add eax, .type_handlers
- call eax
- mov [edi+TConfigRecord.Data], eax
-
-.next_chunk:
- mov eax, [edi+TConfigRecord.DataSize]
- add eax, 3
- and al, $fc
-
- add esi, eax
- sub ecx, eax
- jmp .chunk_loop
-
-.finish:
- popad
- mov eax, [.array]
- return
-
-.type_handlers db .handle_null - .type_handlers
- db .handle_int - .type_handlers
- db .handle_string - .type_handlers
- db .handle_blob - .type_handlers
- db .handle_config - .type_handlers
- db .handle_blob - .type_handlers
- db .handle_blob - .type_handlers
- db .handle_blob - .type_handlers
-
-.handle_config:
- stdcall __DoRecurseConfigSource, esi, edx
-.handle_null:
- retn
-
-.handle_int:
- mov eax, [esi]
- retn
-
-.handle_string:
- stdcall StrNew
- stdcall StrCopyPart, eax, esi, 0, edx
- retn
-
-.handle_blob:
- stdcall GetMem, edx
- push esi edi ecx
- mov edi, eax
- mov ecx, edx
- rep movsb
- pop ecx edi esi
- retn
-endp
-
-
-; creates memory image (TArray) of the file of the config database.
-
-proc SaveConfigFile, .ptrRoot, .signature
-begin
- push edx ecx
-
- stdcall CreateArray, 4
- mov edx, eax
-
- mov ecx, [.ptrRoot]
- stdcall AddArrayItems, edx, sizeof.TConfigHeader/4
- pushd [.signature] $001a0a0d
- popd [eax+TConfigHeader.filler] [eax+TConfigHeader.signature]
-
- stdcall __DoSaveParamArray, edx, [.ptrRoot]
- push edx
-
- mov ecx, [edx+TArray.count]
- shl ecx, 2
- lea edx, [edx+TArray.array+TConfigHeader.length]
- sub ecx, sizeof.TConfigHeader
- mov [edx], ecx
- add ecx, 4 ; .length field
- stdcall DataHash, edx, ecx
- mov [edx-4], eax ; -4 if the offset to TConfigHeader.hash relative to TConfigHeader.length
-
- pop eax
- pop ecx edx
- return
-endp
-
-
-
-proc __DoSaveParamArray, .stream, .array
-.count dd ?
-begin
- pushad
-
- mov ebx, [.array]
- mov ecx, [ebx+TArray.count]
- lea ebx, [ebx+TArray.array-sizeof.TConfigRecord]
- mov [.count], ecx
-
-.loop:
- add ebx, sizeof.TConfigRecord
- dec [.count]
- js .end_save
-
- stdcall AddArrayItems, [.stream], 3
- mov [.stream], edx
-
- pushd [ebx+TConfigRecord.KeyName] [ebx+TConfigRecord.DataSize] [ebx+TConfigRecord.Type]
- popd [eax+TChunkHeader.type] [eax+TChunkHeader.length] [eax+TChunkHeader.KeyName]
-
- movzx eax, byte [ebx+TConfigRecord.Type]
- and al, $07
- movzx eax, [.type_handlers+eax]
- add eax, .type_handlers
- call eax
- jc .loop
-
-; align to dword
- mov ecx, [ebx+TConfigRecord.DataSize]
- add ecx, 3
- and cl, $fc
- shr ecx, 2
- stdcall AddArrayItems, [.stream], ecx
- mov [.stream], edx
- mov edi, eax
-
- rep movsd
- jmp .loop
-
-.end_save:
- popad
- mov edx, [.stream]
- return
-
-.type_handlers db .handle_null - .type_handlers
- db .handle_int - .type_handlers
- db .handle_string - .type_handlers
- db .handle_blob - .type_handlers
- db .handle_config - .type_handlers
- db .handle_blob - .type_handlers
- db .handle_blob - .type_handlers
- db .handle_blob - .type_handlers
-
-.handle_int:
- lea esi, [ebx+TConfigRecord.Data]
- clc
- retn
-
-.handle_string:
- stdcall StrPtr, [ebx+TConfigRecord.Data]
- mov esi, eax
- clc
- retn
-
-.handle_blob:
- mov esi, [ebx+TConfigRecord.Data]
- clc
- retn
-
-.handle_config:
- mov eax, [.stream]
- mov eax, [eax+TArray.count]
- push eax
- stdcall __DoSaveParamArray, [.stream], [ebx+TConfigRecord.Data]
- mov [.stream], edx
-
- pop eax ; old size
- mov ecx, [edx+TArray.count]
- sub ecx, eax
- lea edx, [edx+TArray.array+4*eax-sizeof.TChunkHeader]
- shl ecx, 2
- mov [edx+TChunkHeader.length], ecx
-
-.handle_null:
- stc
- retn
-endp
-
-
-
-proc FreeConfigDB, .ptrRoot
-.dummy TConfigRecord
-begin
- push eax
-
- cmp [.ptrRoot], 0
- je .exit
-
- mov [.dummy.Type], cdtConfig
- mov eax, [.ptrRoot]
- mov [.dummy.Data], eax
-
- lea eax, [.dummy]
- stdcall __FreeConfigRecord, eax
-
-.exit:
- pop eax
- return
-endp
-
-
-
-; searches the tree for the given path and returns a pointer to the variable, containing pointer to TArray of the directory.
-proc __GetParamArray, .ptrVarRoot, .pDirectory, .create
-begin
- push ebx edx esi
-
- mov esi, [.pDirectory]
- mov ebx, [.ptrVarRoot]
-
- test esi, esi
- jz .found
-
-.loop:
- cmp dword [esi], 0
- je .found
-
- stdcall __ScanParamArray, [ebx], [esi]
- jc .err_not_found
- cmp [eax+TConfigRecord.Type], cdtConfig
- jne .err_not_directory
-
-.next:
- lea ebx, [eax+TConfigRecord.Data]
- add esi, 4
- jmp .loop
-
-.found:
- mov eax, ebx
- clc
- pop esi edx ebx
- return
-
-.err_not_found:
- cmp [.create], 0
- je .no_create
-
- stdcall AddArrayItems, [ebx], 1
- mov [ebx], edx
- mov edx, eax
- pushd [esi]
- popd [edx+TConfigRecord.KeyName]
- mov [edx+TConfigRecord.Type], cdtConfig
- stdcall CreateArray, sizeof.TConfigRecord
- mov [edx+TConfigRecord.Data], eax
- mov eax, edx
- jmp .next
-
-.no_create:
- xor eax, eax
-.error:
- stc
- pop esi edx ebx
- return
-
-.err_not_directory:
- xor eax, eax
- dec eax
- jmp .error
-endp
-
-
-
-
-; returns:
-; CF=0 and eax = pointer to TConfigRecord
-; ecx = index of the record in the array.
-; CF=1 and eax = 0 - the key was not found.
-proc __ScanParamArray, .ptrArray, .name
-begin
- push ecx esi
- mov esi, [.ptrArray]
- test esi, esi
- jz .not_found
-
- mov ecx, [esi+TArray.count]
- lea esi, [esi+TArray.array]
- jecxz .not_found
-
- xor edx, edx
-.loop:
- mov eax, [esi+TConfigRecord.KeyName]
- cmp eax, [.name]
- je .found
-
- add esi, sizeof.TConfigRecord
- inc edx
- loop .loop
-
-.not_found:
- xor eax, eax
- stc
- pop esi ecx
- return
-
-.found:
- mov eax, esi
- clc
- pop esi ecx
- return
-endp
-
-
-; returns
-; eax - poiner to the TConfigRecord or NULL if missing
-proc GetConfigParam, .ptrConfig, .pDirectory, .name
-begin
- push edx
- lea eax, [.ptrConfig]
- stdcall __GetParamArray, eax, [.pDirectory], 0
- stdcall __ScanParamArray, [eax], [.name]
- pop edx
- return
-endp
-
-
-proc GetConfigParam.AsString, .ptrConfig, .pDirectory, .name
-begin
- push edx
-
- stdcall GetConfigParam, [.ptrConfig], [.pDirectory], [.name]
- jc .finish
-
- movzx edx, byte [eax+TConfigRecord.Type]
- and dl, $07
- movzx edx, [.type_handlers+edx]
- add edx, .type_handlers
- call edx
-
-.finish:
- pop edx
- return
-
-.type_handlers db .handle_null - .type_handlers
- db .handle_int - .type_handlers
- db .handle_string - .type_handlers
- db .handle_blob - .type_handlers
- db .handle_config - .type_handlers
- db .handle_blob - .type_handlers
- db .handle_blob - .type_handlers
- db .handle_blob - .type_handlers
-
-.handle_null:
- stdcall StrDup, .txtNULL
- retn
-
-.handle_int:
- stdcall NumToStr, [eax+TConfigRecord.Data], ntsSigned or ntsDec
- retn
-
-.handle_string:
- stdcall StrDup, [eax+TConfigRecord.Data]
- retn
-
-.handle_config:
- stdcall StrDup, .txtDir
- retn
-
-.handle_blob:
- stdcall StrDup, .txtBlob
- retn
-
-.txtNULL db 'NULL', 0
-.txtDir db 'SDIR', 0
-.txtBlob db 'BLOB', 0
-
-endp
-
-
-
-proc __FreeConfigRecord, .ptrRecord
-begin
- pushad
-
- mov esi, [.ptrRecord]
- movzx eax, byte [esi+TConfigRecord.Type]
-
- and al, $07
- mov al, [.type_handlers+eax]
- add eax, .type_handlers
- call eax
-
- xor eax, eax
- mov [esi+TConfigRecord.Type], eax
- mov [esi+TConfigRecord.Data], eax
- mov [esi+TConfigRecord.DataSize], eax
- popad
- return
-
-.type_handlers db .handle_null - .type_handlers
- db .handle_int - .type_handlers
- db .handle_string - .type_handlers
- db .handle_blob - .type_handlers
- db .handle_config - .type_handlers
- db .handle_blob - .type_handlers
- db .handle_blob - .type_handlers
- db .handle_blob - .type_handlers
-
-.handle_config:
- mov eax, [esi+TConfigRecord.Data]
- mov ecx, [eax+TArray.count]
- lea eax, [eax+TArray.array]
- jecxz .handle_blob
-
-.loop:
- stdcall __FreeConfigRecord, eax
- add eax, sizeof.TConfigRecord
- loop .loop
-
-.handle_blob:
- stdcall FreeMem, [esi+TConfigRecord.Data]
- retn
-
-.handle_string:
- stdcall StrDel, [esi+TConfigRecord.Data]
-.handle_null:
-.handle_int:
- retn
-endp
-
-
-
-
-
-proc DelCongigParam, .ptrVarConfig, .pDirectory, .name
-begin
- pushad
-
- stdcall __GetParamArray, [.ptrVarConfig], [.pDirectory], 0
- jc .deleted
- mov esi, eax
-
- stdcall __ScanParamArray, [esi], [.name]
- jc .deleted
-
- stdcall __FreeConfigRecord, eax
- stdcall DeleteArrayItems, [esi], edx, 1
- mov [esi], edx
-
-.deleted:
- popad
- return
-endp
-
-
-; set the value of the given config parameter.
-; if the parameter exists, the value will be changed.
-; if the parameter does not exists, it will be created.
-proc SetConfigParam, .ptrVarConfig, .pDirectory, .name, .type, .value, .size
-begin
- push eax ecx edx esi edi
-
- stdcall __GetParamArray, [.ptrVarConfig], [.pDirectory], 1
- jc .missing_directory
-
- mov esi, eax
-
- stdcall __ScanParamArray, [esi], [.name]
- jnc .record_ok
-
- stdcall AddArrayItems, [esi], 1
- mov [esi], edx
- push [.name]
- pop [eax+TConfigRecord.KeyName]
-
-.record_ok:
- mov esi, eax
-
- stdcall __FreeConfigRecord, esi
-
- movzx ecx, byte [.type]
- and cl, $7
- mov [esi+TConfigRecord.Type], ecx
- movzx ecx, [.type_handlers+ecx]
- add ecx, .type_handlers
-
- call ecx
- clc
-.finish:
- pop edi esi edx ecx eax
- return
-
-.missing_directory:
- stc
- jmp .finish
-
-.type_handlers db .handle_null - .type_handlers
- db .handle_int - .type_handlers
- db .handle_string - .type_handlers
- db .handle_blob - .type_handlers
- db .handle_config - .type_handlers
- db .handle_blob - .type_handlers
- db .handle_blob - .type_handlers
- db .handle_blob - .type_handlers
-
-.handle_int:
- mov [esi+TConfigRecord.DataSize], 4
- push [.value]
- pop [esi+TConfigRecord.Data]
-
-.handle_null:
- retn
-
-.handle_string:
- stdcall StrDup, [.value]
- mov [esi+TConfigRecord.Data], eax
- stdcall StrLen, eax
- mov [esi+TConfigRecord.DataSize], eax
- retn
-
-.handle_config:
- stdcall CreateArray, sizeof.TConfigRecord
- mov [esi+TConfigRecord.Data], eax
- mov [esi+TConfigRecord.DataSize], 4
- retn
-
-.handle_blob:
- mov ecx, [.size]
- stdcall GetMem, ecx
- mov [esi+TConfigRecord.Data], eax
- mov [esi+TConfigRecord.DataSize], ecx
-
- push esi
- mov edi, eax
- mov esi, [.value]
- rep movsb
- pop esi
- retn
-endp
-
-
-
-
-endmodule
DELETED freshlib/equates/Linux/XftCompat.inc
Index: freshlib/equates/Linux/XftCompat.inc
==================================================================
--- freshlib/equates/Linux/XftCompat.inc
+++ /dev/null
@@ -1,161 +0,0 @@
-;
-; * $Id: XftCompat.h,v 1.4 2005/07/03 07:00:57 daniels Exp $
-; *
-; * Copyright © 2001 Keith Packard
-; *
-; * Permission to use, copy, modify, distribute, and sell this software and its
-; * documentation for any purpose is hereby granted without fee, provided that
-; * the above copyright notice appear in all copies and that both that
-; * copyright notice and this permission notice appear in supporting
-; * documentation, and that the name of Keith Packard not be used in
-; * advertising or publicity pertaining to distribution of the software without
-; * specific, written prior permission. Keith Packard makes no
-; * representations about the suitability of this software for any purpose. It
-; * is provided "as is" without express or implied warranty.
-; *
-; * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-; * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
-; * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
-; * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
-; * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
-; * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-; * PERFORMANCE OF THIS SOFTWARE.
-;
-
-if ~defined _XFTCOMPAT_H_ | defined @f
-@@:
-_XFTCOMPAT_H_ = 1
-include "X11/Xfuncproto.h"
-
-
-;
-; * Compatibility definitions -- map Fc names to Xft names
-;
-
-XftChar8 equ FcChar8
-XftChar16 equ FcChar16
-XftChar32 equ FcChar32
-
-XFT_FAMILY equ FC_FAMILY
-XFT_STYLE equ FC_STYLE
-XFT_SLANT equ FC_SLANT
-XFT_WEIGHT equ FC_WEIGHT
-XFT_SIZE equ FC_SIZE
-XFT_PIXEL_SIZE equ FC_PIXEL_SIZE
-XFT_SPACING equ FC_SPACING
-XFT_FOUNDRY equ FC_FOUNDRY
-XFT_ANTIALIAS equ FC_ANTIALIAS
-XFT_FILE equ FC_FILE
-XFT_INDEX equ FC_INDEX
-XFT_RASTERIZER equ FC_RASTERIZER
-XFT_OUTLINE equ FC_OUTLINE
-XFT_SCALABLE equ FC_SCALABLE
-XFT_RGBA equ FC_RGBA
-
-; defaults from resources
-XFT_SCALE equ FC_SCALE
-XFT_MINSPACE equ FC_MINSPACE
-XFT_DPI equ FC_DPI
-
-; specific to FreeType rasterizer
-XFT_CHAR_WIDTH equ FC_CHAR_WIDTH
-XFT_CHAR_HEIGHT equ FC_CHAR_HEIGHT
-XFT_MATRIX equ FC_MATRIX
-
-XFT_WEIGHT_LIGHT equ FC_WEIGHT_LIGHT
-XFT_WEIGHT_MEDIUM equ FC_WEIGHT_MEDIUM
-XFT_WEIGHT_DEMIBOLD equ FC_WEIGHT_DEMIBOLD
-XFT_WEIGHT_BOLD equ FC_WEIGHT_BOLD
-XFT_WEIGHT_BLACK equ FC_WEIGHT_BLACK
-
-XFT_SLANT_ROMAN equ FC_SLANT_ROMAN
-XFT_SLANT_ITALIC equ FC_SLANT_ITALIC
-XFT_SLANT_OBLIQUE equ FC_SLANT_OBLIQUE
-
-XFT_PROPORTIONAL equ FC_PROPORTIONAL
-XFT_MONO equ FC_MONO
-XFT_CHARCELL equ FC_CHARCELL
-
-XFT_RGBA_UNKNOWN equ FC_RGBA_UNKNOWN
-XFT_RGBA_RGB equ FC_RGBA_RGB
-XFT_RGBA_BGR equ FC_RGBA_BGR
-XFT_RGBA_VRGB equ FC_RGBA_VRGB
-XFT_RGBA_VBGR equ FC_RGBA_VBGR
-XFT_RGBA_NONE equ FC_RGBA_NONE
-
-;
-; * Old constants
-;
-XFT_ENCODING equ "encoding"
-
-XftType equ FcType
-
-XftMatrix equ FcMatrix
-
-
-XftResult equ FcResult
-
-XftResultMatch equ FcResultMatch
-XftResultNoMatch equ FcResultNoMatch
-XftResultTypeMismatch equ FcResultTypeMismatch
-XftResultNoId equ FcResultNoId
-
-XftValue equ FcValue
-XftPattern equ FcPattern
-XftFontSet equ FcFontSet
-XftObjectSet equ FcObjectSet
-
-XftGlyphExists equ XftCharExists
-
-XftObjectSetCreate equ FcObjectSetCreate
-XftObjectSetAdd equ FcObjectSetAdd
-XftObjectSetDestroy equ FcObjectSetDestroy
-XftObjectSetVaBuild equ FcObjectSetVaBuild
-XftObjectSetBuild equ FcObjectSetBuild
-
-XftFontSetMatch equ FcFontSetMatch
-XftFontSetDestroy equ FcFontSetDestroy
-
-XftMatrixEqual equ FcMatrixEqual
-XftMatrixMultiply equ FcMatrixMultiply
-XftMatrixRotate equ FcMatrixRotate
-XftMatrixScale equ FcMatrixScale
-XftMatrixShear equ FcMatrixShear
-
-XftPatternCreate equ FcPatternCreate
-XftPatternDuplicate equ FcPatternDuplicate
-XftValueDestroy equ FcValueDestroy
-XftValueListDestroy equ FcValueListDestroy
-XftPatternDestroy equ FcPatternDestroy
-XftPatternFind equ FcPatternFind
-XftPatternAdd equ FcPatternAdd
-XftPatternGet equ FcPatternGet
-XftPatternDel equ FcPatternDel
-XftPatternAddInteger equ FcPatternAddInteger
-XftPatternAddDouble equ FcPatternAddDouble
-XftPatternAddMatrix equ FcPatternAddMatrix
-XftPatternAddBool equ FcPatternAddBool
-XftPatternGetInteger equ FcPatternGetInteger
-XftPatternGetDouble equ FcPatternGetDouble
-XftPatternGetMatrix equ FcPatternGetMatrix
-XftPatternGetBool equ FcPatternGetBool
-XftPatternVaBuild equ FcPatternVaBuild
-XftPatternBuild equ FcPatternBuild
-
-XftUtf8ToUcs = 4
- FcUtf8ToUcs4
-XftUtf = 8
-Len FcUtf8Len
-
-XftTypeVoid equ FcTypeVoid
-XftTypeInteger equ FcTypeInteger
-XftTypeDouble equ FcTypeDouble
-XftTypeString equ FcTypeString
-XftTypeBool equ FcTypeBool
-XftTypeMatrix equ FcTypeMatrix
-
-
-
-
-
-end if
DELETED freshlib/equates/Linux/Xrender.inc
Index: freshlib/equates/Linux/Xrender.inc
==================================================================
--- freshlib/equates/Linux/Xrender.inc
+++ /dev/null
@@ -1,377 +0,0 @@
-;
-; *
-; * Copyright © 2000 SuSE, Inc.
-; *
-; * Permission to use, copy, modify, distribute, and sell this software and its
-; * documentation for any purpose is hereby granted without fee, provided that
-; * the above copyright notice appear in all copies and that both that
-; * copyright notice and this permission notice appear in supporting
-; * documentation, and that the name of SuSE not be used in advertising or
-; * publicity pertaining to distribution of the software without specific,
-; * written prior permission. SuSE makes no representations about the
-; * suitability of this software for any purpose. It is provided "as is"
-; * without express or implied warranty.
-; *
-; * SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
-; * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
-; * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-; * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
-; * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
-; * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-; *
-; * Author: Keith Packard, SuSE, Inc.
-;
-
-if ~defined _XRENDER_H_ | defined @f
-@@:
-_XRENDER_H_ = 1
-
-include "X11/Xlib.h"
-
-include "X11/Xfuncproto.h"
-
-include "X11/Xosdefs.h"
-
-include "X11/Xutil.h"
-
-
-include "X11/extensions/render.h"
-
-
-struct
-{
-
- .red: rw 1
- .redMask: rw 1
- .green: rw 1
- .greenMask: rw 1
- .blue: rw 1
- .blueMask: rw 1
- .alpha: rw 1
- .alphaMask: rw 1
-
-}
-
-
-struct
-{
-
- PictFormat id;
- .type: rd 1
- .depth: rd 1
- XRenderDirectFormat direct;
- Colormap colormap;
-
-}
-
-
-
-struc _XRenderPictureAttributes
-{
-
- .repeat: rd 1
- Picture alpha_map;
- .alpha_x_origin: rd 1
- .alpha_y_origin: rd 1
- .clip_x_origin: rd 1
- .clip_y_origin: rd 1
- Pixmap clip_mask;
- Bool graphics_exposures;
- .subwindow_mode: rd 1
- .poly_edge: rd 1
- .poly_mode: rd 1
- Atom dither;
- Bool component_alpha;
-
- _XRenderPictureAttributes_size = $ - .
-}
-
-
-struct
-{
-
- .red: rw 1
- .green: rw 1
- .blue: rw 1
- .alpha: rw 1
-
-}
-
-
-struc _XGlyphInfo
-{
-
- .width: rw 1
- .height: rw 1
- .x: rw 1
- .y: rw 1
- .xOff: rw 1
- .yOff: rw 1
-
- _XGlyphInfo_size = $ - .
-}
-
-
-struc _XGlyphElt8
-{
-
- GlyphSet glyphset;
- .chars: rd 1
- .nchars: rd 1
- .xOff: rd 1
- .yOff: rd 1
-
- _XGlyphElt8_size = $ - .
-}
-
-
-struc _XGlyphElt16
-{
-
- GlyphSet glyphset;
- .chars: rd 1
- .nchars: rd 1
- .xOff: rd 1
- .yOff: rd 1
-
- _XGlyphElt16_size = $ - .
-}
-
-
-struc _XGlyphElt32
-{
-
- GlyphSet glyphset;
- .chars: rd 1
- .nchars: rd 1
- .xOff: rd 1
- .yOff: rd 1
-
- _XGlyphElt32_size = $ - .
-}
-
-
-XDouble equ double
-
-struc _XPointDouble
-{
-
- .x: rq 1
- .y: rq 1
-
- _XPointDouble_size = $ - .
-}
-
-
-
-XFixed equ int
-
-struc _XPointFixed
-{
-
- XFixed x;
- XFixed y;
-
- _XPointFixed_size = $ - .
-}
-
-
-struc _XLineFixed
-{
-
- XPointFixed p1;
- XPointFixed p2;
-
- _XLineFixed_size = $ - .
-}
-
-
-struc _XTriangle
-{
-
- XPointFixed p1;
- XPointFixed p2;
- XPointFixed p3;
-
- _XTriangle_size = $ - .
-}
-
-
-struc _XCircle
-{
-
- XFixed x;
- XFixed y;
- XFixed radius;
-
- _XCircle_size = $ - .
-}
-
-
-struc _XTrapezoid
-{
-
- XFixed top;
- XFixed bottom;
- XLineFixed left;
- XLineFixed right;
-
- _XTrapezoid_size = $ - .
-}
-
-
-struc _XTransform
-{
-
- XFixed matrix[3][3];
-
- _XTransform_size = $ - .
-}
-
-
-struc _XFilters
-{
-
- .nfilter: rd 1
- .filter: rd 1
- .nalias: rd 1
- .alias: rd 1
-
- _XFilters_size = $ - .
-}
-
-
-struc _XIndexValue
-{
-
- .pixel: rd 1
- .red: rw 1
- .green: rw 1
- .blue: rw 1
- .alpha: rw 1
-
- _XIndexValue_size = $ - .
-}
-
-
-struc _XAnimCursor
-{
-
- Cursor cursor;
- .delay: rd 1
-
- _XAnimCursor_size = $ - .
-}
-
-
-struc _XSpanFix
-{
-
- XFixed left;
- XFixed right;
- XFixed y;
-
- _XSpanFix_size = $ - .
-}
-
-
-struc _XTrap
-{
-
- XSpanFix top;
- XSpanFix bottom;
-
- _XTrap_size = $ - .
-}
-
-
-struc _XLinearGradient
-{
-
- XPointFixed p1;
- XPointFixed p2;
-
- _XLinearGradient_size = $ - .
-}
-
-
-struc _XRadialGradient
-{
-
- XCircle inner;
- XCircle outer;
-
- _XRadialGradient_size = $ - .
-}
-
-
-struc _XConicalGradient
-{
-
- XPointFixed center;
- XFixed angle; ; in degrees
-
- _XConicalGradient_size = $ - .
-}
-
-
-
-
-
-
-
-
-
-
-PictStandardARGB32 = 0
-
-PictStandardRGB24 = 1
-
-PictStandardA8 = 2
-
-PictStandardA4 = 3
-
-PictStandardA1 = 4
-
-PictStandardNUM = 5
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-end if
DELETED freshlib/equates/Linux/_XLib.inc
Index: freshlib/equates/Linux/_XLib.inc
==================================================================
--- freshlib/equates/Linux/_XLib.inc
+++ /dev/null
@@ -1,1506 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: XLib specific constants and structures.
-;
-; Target OS: Linux
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-
-; X Protocol
- X_PROTOCOL = 11
- X_PROTOCOL_REVISION = 0
-
-;X Constants
-
-None = 0
-ParentRelative = 1
-CopyFromParent = 0
-PointerWindow = 0
-InputFocus = 1
-PointerRoot = 1
-AnyPropertyType = 0
-AnyKey = 0
-AnyButton = 0
-AllTemporary = 0
-CurrentTime = 0
-NoSymbol = 0
-
-;Event Masks
-
-NoEventMask = 0h
-KeyPressMask = 1h
-KeyReleaseMask = 2h
-ButtonPressMask = 4h
-ButtonReleaseMask = 8h
-EnterWindowMask = 10h
-LeaveWindowMask = 20h
-PointerMotionMask = 40h
-PointerMotionHintMask = 80h
-Button1MotionMask = 100h
-Button2MotionMask = 200h
-Button3MotionMask = 400h
-Button4MotionMask = 800h
-Button5MotionMask = 1000h
-ButtonMotionMask = 2000h
-KeymapStateMask = 4000h
-ExposureMask = 8000h
-VisibilityChangeMask = 10000h
-StructureNotifyMask = 20000h
-ResizeRedirectMask = 40000h
-SubstructureNotifyMask = 80000h
-SubstructureRedirectMask = 100000h
-FocusChangeMask = 200000h
-PropertyChangeMask = 400000h
-ColormapChangeMask = 800000h
-OwnerGrabButtonMask = 1000000h
-
-AllEventsMask = 1fbff7fh ;1ffffffh
-
-
-
-
-;Event Names
-
-KeyPress = 2
-KeyRelease = 3
-ButtonPress = 4
-ButtonRelease = 5
-MotionNotify = 6
-EnterNotify = 7
-LeaveNotify = 8
-FocusIn = 9
-FocusOut = 10
-KeymapNotify = 11
-Expose = 12
-GraphicsExpose = 13
-NoExpose = 14
-VisibilityNotify = 15
-CreateNotify = 16
-DestroyNotify = 17
-UnmapNotify = 18
-MapNotify = 19
-MapRequest = 20
-ReparentNotify = 21
-ConfigureNotify = 22
-ConfigureRequest = 23
-GravityNotify = 24
-ResizeRequest = 25
-CirculateNotify = 26
-CirculateRequest = 27
-PropertyNotify = 28
-SelectionClear = 29
-SelectionRequest = 30
-SelectionNotify = 31
-ColormapNotify = 32
-ClientMessage = 33
-MappingNotify = 34
-LASTEvent = 35
-
-;Key Masks
-
-ShiftMask = 1h
-LockMask = 2h
-ControlMask = 4h
-Mod1Mask = 8h
-Mod2Mask = 10h
-Mod3Mask = 20h
-Mod4Mask = 40h
-Mod5Mask = 80h
-
-;Modifier Names
-
-ShiftMapIndex = 0
-LockMapIndex = 1
-ControlMapIndex = 2
-Mod1MapIndex = 3
-Mod2MapIndex = 4
-Mod3MapIndex = 5
-Mod4MapIndex = 6
-Mod5MapIndex = 7
-
-;Button Masks
-
-Button1Mask = 100h
-Button2Mask = 200h
-Button3Mask = 400h
-Button4Mask = 800h
-Button5Mask = 1000h
-AnyModifier = 10000h
-
-;Button Names
-
-Button1 = 1
-Button2 = 2
-Button3 = 3
-Button4 = 4
-Button5 = 5
-
-;Notify Modes
-NotifyNormal = 0
-NotifyGrab = 1
-NotifyUngrab = 2
-NotifyWhileGrabbed = 3
-NotifyHint = 1
-
-;Notify Detail
-
-NotifyAncestor = 0
-NotifyVirtual = 1
-NotifyInferior = 2
-NotifyNonlinear = 3
-NotifyNonlinearVirtual = 4
-NotifyPointer = 5
-NotifyPointerRoot = 6
-NotifyDetailNone = 7
-
-;Visibility Notify
-
-VisibilityUnobscured = 0
-VisibilityPartiallyObscured = 1
-VisibilityFullyObscured = 2
-
-;Circulation request
-
-PlaceOnTop = 0
-PlaceOnBottom = 1
-
-;Protocol Families
-
-FamilyInternet = 0
-FamilyDECnet = 1
-FamilyChaos = 2
-FamilyInternet6 = 6
-
-;Unspecific authentication families
-
-FamilyServerInterpreted = 5
-
-;Property Notification
-
-PropertyNewValue = 0
-PropertyDelete = 1
-
-;Color Map notification
-
-ColormapUninstalled = 0
-ColormapInstalled = 1
-
-;Grab Modes
-GrabModeSync = 0
-GrabModeAsync = 1
-
-;Grab reply status
-GrabSuccess = 0
-AlreadyGrabbed = 1
-GrabInvalidTime = 2
-GrabNotViewable = 3
-GrabFrozen = 4
-
-;AllowEvents modes
-AsyncPointer = 0
-SyncPointer = 1
-ReplayPointer = 2
-AsyncKeyboard = 3
-SyncKeyboard = 4
-ReplayKeyboard = 5
-AsyncBoth = 6
-SyncBoth = 7
-
-;InputFocus specific
-
-RevertToNone = None
-RevertToPointerRoot = PointerRoot
-RevertToParent = 2
-
-;Error Codes
-Success = 0
-BadRequest = 1
-BadValue = 2
-BadWindow = 3
-BadPixmap = 4
-BadAtom = 5
-BadCursor = 6
-BadFont = 7
-BadMatch = 8
-BadDrawable = 9
-BadAccess = 10
-BadAlloc = 11
-BadColor = 12
-BadGC = 13
-BadIDChoice = 14
-BadName = 15
-BadLength = 16
-BadImplementation = 17
-FirstExtensionError = 128
-LastExtensionError = 255
-
-;Window Classes
-
-InputOutput = 1
-InputOnly = 2
-
-;Window Attributes
-CWBackPixmap = 1h
-CWBackPixel = 2h
-CWBorderPixmap = 4h
-CWBorderPixel = 8h
-CWBitGravity = 10h
-CWWinGravity = 20h
-CWBackingStore = 40h
-CWBackingPlanes = 80h
-CWBackingPixel = 100h
-CWOverrideRedirect = 200h
-CWSaveUnder = 400h
-CWEventMask = 800h
-CWDontPropagate = 1000h
-CWColormap = 2000h
-CWCursor = 4000h
-
-;ConfigureWindow Structure
-CWX = 1h
-CWY = 2h
-CWWidth = 4h
-CWHeight = 8h
-CWBorderWidth = 10h
-CWSibling = 20h
-CWStackMode = 40h
-
-;Bit Gravity
-ForgetGravity = 0
-NorthWestGravity = 1
-NorthGravity = 2
-NorthEastGravity = 3
-WestGravity = 4
-CenterGravity = 5
-EastGravity = 6
-SouthWestGravity = 7
-SouthGravity = 8
-SouthEastGravity = 9
-StaticGravity = 10
-
-;Window Gravity
-UnmapGravity = 0
-
-;CreateWindow backing-store hint
-NotUseful = 0
-WhenMapped = 1
-Always = 2
-
-;GetWindowAttributes reply
-IsUnmapped = 0
-IsUnviewable = 1
-IsViewable = 2
-
-;Used in ChangeSaveSet
-SetModeInsert = 0
-SetModeDelete = 1
-
-;Used in ChangeCloseDownMode
-DestroyAll = 0
-RetainPermanent = 1
-RetainTemporary = 2
-
-;Window stacking method (in configureWindow)
-Above = 0
-Below = 1
-TopIf = 2
-BottomIf = 3
-Opposite = 4
-
-;Circulation direction
-RaiseLowest = 0
-LowerHighest = 1
-
-;Property modes
-PropModeReplace = 0
-PropModePrepend = 1
-PropModeAppend = 2
-
-;Graphics Functions
-GXclear = 0
-GXand = 1
-GXandReverse = 2
-GXcopy = 3
-GXandInverted = 4
-GXnoop = 5
-GXxor = 6
-GXor = 7
-GXnor = 8
-GXequiv = 9
-GXinvert = 10
-GXorReverse = 11
-GXcopyInverted = 12
-GXorInverted = 13
-GXnand = 14
-GXset = 15
-
-;LineStyle
-LineSolid = 0
-LineOnOffDash = 1
-LineDoubleDash = 2
-
-;capStyle
-CapNotLast = 0
-CapButt = 1
-CapRound = 2
-CapProjecting = 3
-
-;joinStyle
-JoinMiter = 0
-JoinRound = 1
-JoinBevel = 2
-
-;fillStyle
-FillSolid = 0
-FillTiled = 1
-FillStippled = 2
-FillOpaqueStippled = 3
-
-;fillRule
-
-EvenOddRule = 0
-WindingRule = 1
-
-;subwindow mode
-
-ClipByChildren = 0
-IncludeInferiors = 1
-
-;SetClipRectangles ordering
-
-Unsorted = 0
-YSorted = 1
-YXSorted = 2
-YXBanded = 3
-
-;CoordinateMode for drawing routines
-
-CoordModeOrigin = 0
-CoordModePrevious = 1
-
-;Polygon shapes
-
-Complex = 0
-Nonconvex = 1
-Convex = 2
-
-;Arc modes for PolyFillArc
-
-ArcChord = 0
-ArcPieSlice = 1
-
-;GC components
-
-GCFunction = 1h
-GCPlaneMask = 2h
-GCForeground = 4h
-GCBackground = 8h
-GCLineWidth = 10h
-GCLineStyle = 20h
-GCCapStyle = 40h
-GCJoinStyle = 80h
-GCFillStyle = 100h
-GCFillRule = 200h
-GCTile = 400h
-GCStipple = 800h
-GCTileStipXOrigin = 1000h
-GCTileStipYOrigin = 2000h
-GCFont = 4000h
-GCSubwindowMode = 8000h
-GCGraphicsExposures = 10000h
-GCClipXOrigin = 20000h
-GCClipYOrigin = 40000h
-GCClipMask = 80000h
-GCDashOffset = 100000h
-GCDashList = 200000h
-GCArcMode = 400000h
-
-GCLastBit = 22
-
-GCAll = (1 shl (GCLastBit+1)) -1
-
-struct XGCValues
- .function dd ? ; logical operation
- .plane_mask dd ? ; plane mask
- .foreground dd ? ; foreground pixel
- .background dd ? ; background pixel
- .line_width dd ? ; line width (in pixels)
- .line_style dd ? ; LineSolid, LineOnOffDash, LineDoubleDash
- .cap_style dd ? ; CapNotLast, CapButt, CapRound, CapProjecting
- .join_style dd ? ; JoinMiter, JoinRound, JoinBevel
- .fill_style dd ? ; FillSolid, FillTiled, FillStippled FillOpaqueStippled
- .fill_rule dd ? ; EvenOddRule, WindingRule
- .arc_mode dd ? ; ArcChord, ArcPieSlice
- .tile dd ? ; tile pixmap for tiling operations
- .stipple dd ? ; stipple 1 plane pixmap for stippling
- .ts_x_origin dd ? ; offset for tile or stipple operations
- .ts_y_origin dd ?
- .font dd ? ; default text font for text operations
- .subwindow_mode dd ? ; ClipByChildren, IncludeInferiors
- .fraphics_exposures dd ? ; boolean, should exposures be generated
- .clip_x_origin dd ? ; origin for clipping
- .clip_y_origin dd ?
- .clip_mask dd ? ; bitmap clipping; other calls for rects
- .dash_offset dd ? ; patterned/dashed line information
- .dashes dd ?
-ends
-
-
-;used in QueryFont -- draw direction
-
-FontLeftToRight = 0
-FontRightToLeft = 1
-
-FontChange = 255
-
-;ImageFormat -- PutImage, GetImage
-
-XYBitmap = 0
-XYPixmap = 1
-ZPixmap = 2
-
-;For CreateColormap
-
-AllocNone = 0
-AllocAll = 1
-
-
-;Flags used in StoreNamedColor, StoreColors
-
-DoRed = 1h
-DoGreen = 2h
-DoBlue = 4h
-
-;QueryBestSize Class
-
-CursorShape = 0
-TileShape = 1
-StippleShape = 2
-
-;Keyboard pointer stuff
-
-AutoRepeatModeOff = 0
-AutoRepeatModeOn = 1
-AutoRepeatModeDefault = 2
-
-LedModeOff = 0
-LedModeOn = 1
-
-;masks for ChangeKeyboardControl
-
-KBKeyClickPercent = 1h
-KBBellPercent = 2h
-KBBellPitch = 4h
-KBBellDuration = 8h
-KBLed = 10h
-KBLedMode = 20h
-KBKey = 40h
-KBAutoRepeatMode = 80h
-
-MappingSuccess = 0
-MappingBusy = 1
-MappingFailed = 2
-
-MappingModifier = 0
-MappingKeyboard = 1
-MappingPointer = 2
-
-;Screensaver stuff
-
-DontPreferBlanking = 0
-PreferBlanking = 1
-DefaultBlanking = 2
-
-DisableScreenSaver = 0
-DisableScreenInterval = 0
-
-DontAllowExposures = 0
-AllowExposures = 1
-DefaultExposures = 2
-
-;for ForceScreenSaver
-
-ScreenSaverReset = 0
-ScreenSaverActive = 1
-
-;for ChangeHosts
-
-HostInsert = 0
-HostDelete = 1
-
-;for ChangeAccessControl
-
-EnableAccess = 1
-DisableAccess = 0
-
-;display classes
-
-StaticGray = 0
-GrayScale = 1
-StaticColor = 2
-PseudoColor = 3
-TrueColor = 4
-DirectColor = 5
-
-
-;Byte order used in imageByteOrder and bitmapBitOrder
-
-LSBFirst = 0
-MSBFirst = 1
-
-;Keyboard and Pointer Event Structures
-
-struct XButtonEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .window rd 1
- .root rd 1
- .subwindow rd 1
- .time rd 1
- .x rd 1
- .y rd 1
- .x_root rd 1
- .y_root rd 1
- .state rd 1
- .button rd 1
- .same_screen rd 1
-ends
-
-
-virtual at 0
-XButtonPressedEvent XButtonEvent
-end virtual
-
-virtual at 0
-XButtonReleasedEvent XButtonEvent
-end virtual
-
-struct XKeyEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .window rd 1
- .root rd 1
- .subwindow rd 1
- .time rd 1
- .x rd 1
- .y rd 1
- .x_root rd 1
- .y_root rd 1
- .state rd 1
- .keycode rd 1
- .same_screen rd 1
-ends
-
-
-virtual at 0
-XKeyPressedEvent XKeyEvent
-end virtual
-
-virtual at 0
-XKeyReleasedEvent XKeyEvent
-end virtual
-
-
-struct XMotionEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .window rd 1
- .root rd 1
- .subwindow rd 1
- .time rd 1
- .x rd 1
- .y rd 1
- .x_root rd 1
- .y_root rd 1
- .state rd 1
- .is_hint rb 1
- .same_screen rd 1
-ends
-
-
-virtual at 0
-XPointerMovedEvent XMotionEvent
-end virtual
-
-;Window Entry/Exit Events
-
-struct XCrossingEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .window rd 1
- .root rd 1
- .subwindow rd 1
- .time rd 1
- .x rd 1
- .y rd 1
- .x_root rd 1
- .y_root rd 1
- .mode rd 1
- .detail rd 1
- .same_screen rd 1
- .focus rd 1
- .state rd 1
-ends
-
-virtual at 0
-XEnterWindowEvent XCrossingEvent
-end virtual
-
-virtual at 0
-XLeaveWindowEvent XCrossingEvent
-end virtual
-
-; Input Focus Events
-
-struct XFocusChangeEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .window rd 1
- .mode rd 1
- .detail rd 1
-ends
-
-
-
-virtual at 0
-XFocusInEvent XFocusChangeEvent
-end virtual
-
-virtual at 0
-XFocusOutEvent XFocusChangeEvent
-end virtual
-
-; Keymap Notification Events
-
-struct XKeymapEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .window rd 1
- .key_vector rb 32
-ends
-
-; Exposure/Update Events
-
-struct XExposeEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .window rd 1
- .x rd 1
- .y rd 1
- .width rd 1
- .height rd 1
- .count rd 1
-ends
-
-
-struct XGraphicsExposeEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .drawable rd 1
- .x rd 1
- .y rd 1
- .width rd 1
- .height rd 1
- .count rd 1
- .major_code rd 1
- .minor_code rd 1
-ends
-
-
-struct XNoExposeEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .drawable rd 1
- .major_code rd 1
- .minor_code rd 1
-ends
-
-
-; CirculateNotify Events
-
-struct XCirculateEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .event rd 1
- .window rd 1
- .place rd 1
-ends
-
-
-struct XCirculateRequestEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .parent rd 1
- .window rd 1
- .place rd 1
-ends
-
-; Configuration Change Events
-
-struct XConfigureEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .event rd 1
- .window rd 1
- .x rd 1
- .y rd 1
- .width rd 1
- .height rd 1
- .border_width rd 1
- .above rd 1
- .override_redirect rd 1
-ends
-
-struct XConfigureRequestEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .parent rd 1
- .window rd 1
- .x rd 1
- .y rd 1
- .width rd 1
- .height rd 1
- .border_width rd 1
- .above rd 1
- .detail rd 1
- .value_mask rd 1
-ends
-
-struct XPropertyEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .window rd 1
- .atom rd 1
- .time rd 1
- .state rd 1
-ends
-
-struct XResizeEvent
- .type rd 1
- .serial rd 1
- .display rd 1
- .window rd 1
- .width rd 1
- .height rd 1
-ends
-
-struct XColormapEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .window rd 1
- .colormap rd 1
- .new rd 1
- .state rd 1
-ends
-
-; Creation/Destruction Notifications
-
-struct XCreateWindowEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .parent rd 1
- .window rd 1
- .x rd 1
- .y rd 1
- .width rd 1
- .heigth rd 1
- .border_width rd 1
- .override_redirect rd 1
-ends
-
-
-struct XDestroyWindowEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .event rd 1
- .window rd 1
-ends
-
-; Parent Movement Events
-
-struct XGravityEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .event rd 1
- .window rd 1
- .x rd 1
- .y rd 1
-ends
-
-; Mapping Events
-
-struct XMapEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .event rd 1
- .window rd 1
- .override_redirect rd 1
-ends
-
-struct XMappingEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .window rd 1
- .request rd 1
- .first_keycode rd 1
- .count rd 1
-ends
-
-
-struct XMapRequestEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .parent rd 1
- .window rd 1
-ends
-
-; Parent Change Events
-
-struct XReparentEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .event rd 1
- .window rd 1
- .parent rd 1
- .x rd 1
- .y rd 1
- .override_redirect rd 1
-ends
-
-struct XSelectionClearEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .window rd 1
- .selection rd 1
- .time rd 1
-ends
-
-struct XSelectionRequestEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .owner rd 1
- .requestor rd 1
- .selection rd 1
- .target rd 1
- .property rd 1
- .time rd 1
-ends
-
-struct XSelectionEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .requestor rd 1
- .selection rd 1
- .target rd 1
- .property rd 1
- .time rd 1
-ends
-
-; Hidden Window Events
-
-struct XUnmapEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .event rd 1
- .window rd 1
- .from_configure rd 1
-ends
-
-struct XVisibilityEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .window rd 1
- .state rd 1
-ends
-
-; Client Messages (XSendEvent)
-
-struct XClientMessageEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .window rd 1
- .message_type rd 1
- .format rd 1
- .data rb 20
-ends
-
-
-struct XErrorEvent
- .type dd ?
- .display dd ?
- .resourceid dd ?
- .serial dd ?
- .error_code db ?
- .request_code db ?
- .minor_code db ?
-ends
-
-
-
-struct XAnyEvent
- .type rd 1
- .serial rd 1
- .send_event rd 1
- .display rd 1
- .window rd 1
-ends
-
-
-struct XEvent
- .xany XAnyEvent
- .pad rb 24*4 - sizeof.XAnyEvent
-
- virtual at .xany
- . XAnyEvent
- end virtual
-
-
- virtual at .xany
- .xkey XKeyEvent
- end virtual
-
- virtual at .xany
- .xbutton XButtonEvent
- end virtual
-
- virtual at .xany
- .xmotion XMotionEvent
- end virtual
-
- virtual at .xany
- .xcrossing XCrossingEvent
- end virtual
-
- virtual at .xany
- .xfocus XFocusChangeEvent
- end virtual
-
- virtual at .xany
- .xexpose XExposeEvent
- end virtual
-
- virtual at .xany
- .xgraphicsexpose XGraphicsExposeEvent
- end virtual
-
- virtual at .xany
- .xnoexpose XNoExposeEvent
- end virtual
-
- virtual at .xany
- .xvisibility XVisibilityEvent
- end virtual
-
- virtual at .xany
- .xcreatewindow XCreateWindowEvent
- end virtual
-
- virtual at .xany
- .xdestroywindow XDestroyWindowEvent
- end virtual
-
- virtual at .xany
- .xunmap XUnmapEvent
- end virtual
-
- virtual at .xany
- .xmap XMapEvent
- end virtual
-
- virtual at .xany
- .xmaprequest XMapRequestEvent
- end virtual
-
- virtual at .xany
- .xreparent XReparentEvent
- end virtual
-
- virtual at .xany
- .xconfigure XConfigureEvent
- end virtual
-
- virtual at .xany
- .xgravity XGravityEvent
- end virtual
-
- virtual at .xany
- .xresizerequest XResizeEvent
- end virtual
-
- virtual at .xany
- .xconfigurerequest XConfigureRequestEvent
- end virtual
-
- virtual at .xany
- .xcirculate XCirculateEvent
- end virtual
-
- virtual at .xany
- .xcirculaterequest XCirculateRequestEvent
- end virtual
-
- virtual at .xany
- .xproperty XPropertyEvent
- end virtual
-
- virtual at .xany
- .xselectionclear XSelectionClearEvent
- end virtual
-
- virtual at .xany
- .xselectionrequest XSelectionRequestEvent
- end virtual
-
- virtual at .xany
- .xselection XSelectionEvent
- end virtual
-
- virtual at .xany
- .xcolormap XColormapEvent
- end virtual
-
- virtual at .xany
- .xclient XClientMessageEvent
- end virtual
-
- virtual at .xany
- .xmapping XMappingEvent
- end virtual
-
- virtual at .xany
- .xerror XErrorEvent
- end virtual
-
- virtual at .xany
- .xkeymap XKeymapEvent
- end virtual
-ends
-
-
-; Misc. Structures
-
-struct XKeyboardControl
- .key_click_percent rd 1
- .bell_percent rd 1
- .bell_pitch rd 1
- .bell_duration rd 1
- .led rd 1
- .led_mode rd 1
- .key rd 1
- .auto_repeat_mode rd 1
-ends
-
-
-
-struct XModifierKeymap
- .max_keypermod rd 1
- .modifiermap rd 1
-ends
-
-
-
-
-struct XWindowAttributes
- .x dd ? ; location of window
- .y dd ? ;
- .width dd ? ; width and height of window
- .height dd ? ;
- .border_width dd ? ; border width of window
- .depth dd ? ; depth of window
- .pVisual dd ? ; the associated visual structure
- .root dd ? ; root of screen containing window
- .class dd ? ; InputOutput, InputOnly
-
- .bit_gravity dd ? ; one of the bit gravity values
- .win_gravity dd ? ; one of the window gravity values
- .backing_store dd ? ; NotUseful, WhenMapped, Always
- .backing_planes dd ? ; planes to be preserved if possible
- .backing_pixel dd ? ; value to be used when restoring planes
- .save_under dd ? ; boolean, should bits under be saved?
- .colormap dd ? ; color map to be associated with window
- .map_installed dd ? ; boolean, is color map currently installed
- .map_state dd ? ; IsUnmapped, IsUnviewable, IsViewable
- .all_event_masks dd ? ; set of events all people have interest in
- .your_event_mask dd ? ; my event mask
- .do_not_propagate_mask dd ? ; set of events that should not propagate
- .override_redirect dd ? ; boolean value for override-redirect
- .pScreen dd ? ; back pointer to correct screen
-ends
-
-
-struct XSetWindowAttributes
- .background_pixmap dd ? ; background, None, or ParentRelative
- .background_pixel dd ? ; background pixel
- .border_pixmap dd ? ; border of the window or CopyFromParent
- .border_pixel dd ? ; border pixel value
- .bit_gravity dd ? ; one of bit gravity values
- .win_gravity dd ? ; one of the window gravity values
- .backing_store dd ? ; NotUseful, WhenMapped, Always
- .backing_planes dd ? ; planes to be preserved if possible
- .backing_pixel dd ? ; value to use in restoring planes
- .save_under dd ? ; should bits under be saved? (popups)
- .event_mask dd ? ; set of events that should be saved
- .do_not_propagate_mask dd ? ; set of events that should not propagate
- .override_redirect dd ? ; boolean value for override_redirect
- .colormap dd ? ; color map to be associated with window
- .cursor dd ? ; cursor to be displayed (or None)
-ends
-
-
-
-struct XCharStruct
- .lbearing dw ? ; origin to left edge of raster
- .rbearing dw ? ; origin to right edge of raster
- .width dw ? ; advance to next char's origin
- .ascent dw ? ; baseline to top edge of raster
- .descent dw ? ; baseline to bottom edge of raster
- .attributes dw ? ; per char flags (not predefined)
-ends
-
-
-struct XFontStruct
- .ext_data dd ? ; hook for extension to hang data
- .fid dd ? ; Font id for this font
- .direction dd ? ; hint about the direction font is painted
- .min_char_or_byte2 dd ? ; first character
- .max_char_or_byte2 dd ? ; last character
- .min_byte1 dd ? ; first row that exists
- .max_byte1 dd ? ; last row that exists
- .all_chars_exist dd ? ; flag if all characters have nonzero size
- .default_char dd ? ; char to print for undefined character
- .n_properties dd ? ; how many properties there are
- .properties dd ? ; pointer to array of additional properties
- .min_bounds XCharStruct ; minimum bounds over all existing char
- .max_bounds XCharStruct ; maximum bounds over all existing char
- .per_char dd ? ; first_char to last_char information
- .ascent dd ? ; logical extent above baseline for spacing
- .descent dd ? ; logical decent below baseline for spacing
-ends
-
-
-struct XWindowChanges
- .x dd ?
- .y dd ?
- .width dd ?
- .height dd ?
- .border_width dd ?
- .sibling dd ?
- .stack_mode dd ?
-ends
-
-
-struct XImage
- .width dd ? ; size of image
- .height dd ?
- .xoffset dd ? ; number of pixels offset in X direction
- .format dd ? ; XYBitmap, XYPixmap, ZPixmap
- .pData dd ? ; pointer to image data
- .byte_order dd ? ; data byte order, LSBFirst=0, MSBFirst=1
- .bitmap_unit dd ? ; quantity of scan line 8, 16, 32
- .bitmap_bit_order dd ? ; LSBFirst, MSBFirst
- .bitmap_pad dd ? ; 8, 16, 32 either XY or ZPixmap
- .depth dd ? ; depth of image
- .bytes_per_line dd ? ; accelerator to next line
- .bits_per_pixel dd ? ; bits per pixel (ZPixmap)
- .red_mask dd ? ; bits in z arrangment
- .green_mask dd ? ; bits in z arrangment
- .blue_mask dd ? ; bits in z arrangment
- .ptrObData dd ? ; hook for object routines to hang on
-
- .funcCreateImage dd ? ; image manipulation routines
- .funcDestroyImage dd ? ;
- .funcGetPixel dd ?
- .funcPutPixel dd ?
- .funcSubImage dd ?
- .funcAddPixel dd ?
-ends
-
-
-struct XWMHints
- .flags dd ?
- .input dd ?
- .initial_state dd ?
- .icon_pixmap dd ?
- .icon_window dd ?
- .icon_x dd ?
- .icon_y dd ?
- .icon_mask dd ?
- .window_group dd ?
-ends
-
-
-InputHint = 1
-StateHint = 2
-IconPixmapHint = 4
-IconWindowHint = 8
-IconPositionHint= 16
-IconMaskHint = 32
-WindowGroupHint = 64
-UrgencyHint = 128
-AllHints = InputHint or StateHint or IconPixmapHint or IconWindowHint or IconPositionHint or IconMaskHint or WindowGroupHint or UrgencyHint
-
-
-WithdrawnState = 0
-NormalState = 1
-IconicState = 3
-
-
-; RequestCodes
-Xrequests = 0
-.CreateWindow =1
-.ChangeWindowAttributes =2
-.GetWindowAttributes =3
-.DestroyWindow =4
-.DestroySubwindows =5
-.ChangeSaveSet =6
-.ReparentWindow =7
-.MapWindow =8
-.MapSubwindows =9
-.UnmapWindow =10
-.UnmapSubwindows =11
-.ConfigureWindow =12
-.CirculateWindow =13
-.GetGeometry =14
-.QueryTree =15
-.InternAtom =16
-.GetAtomName =17
-.ChangeProperty =18
-.DeleteProperty =19
-.GetProperty =20
-.ListProperties =21
-.SetSelectionOwner =22
-.GetSelectionOwner =23
-.ConvertSelection =24
-.SendEvent =25
-.GrabPointer =26
-.UngrabPointer =27
-.GrabButton =28
-.UngrabButton =29
-.ChangeActivePointerGrab =30
-.GrabKeyboard =31
-.UngrabKeyboard =32
-.GrabKey =33
-.UngrabKey =34
-.AllowEvents =35
-.GrabServer =36
-.UngrabServer =37
-.QueryPointer =38
-.GetMotionEvents =39
-.TranslateCoords =40
-.WarpPointer =41
-.SetInputFocus =42
-.GetInputFocus =43
-.QueryKeymap =44
-.OpenFont =45
-.CloseFont =46
-.QueryFont =47
-.QueryTextExtents =48
-.ListFonts =49
-.ListFontsWithInfo =50
-.SetFontPath =51
-.GetFontPath =52
-.CreatePixmap =53
-.FreePixmap =54
-.CreateGC =55
-.ChangeGC =56
-.CopyGC =57
-.SetDashes =58
-.SetClipRectangles =59
-.FreeGC =60
-.ClearArea =61
-.CopyArea =62
-.CopyPlane =63
-.PolyPoint =64
-.PolyLine =65
-.PolySegment =66
-.PolyRectangle =67
-.PolyArc =68
-.FillPoly =69
-.PolyFillRectangle =70
-.PolyFillArc =71
-.PutImage =72
-.GetImage =73
-.PolyText8 =74
-.PolyText16 =75
-.ImageText8 =76
-.ImageText16 =77
-.CreateColormap =78
-.FreeColormap =79
-.CopyColormapAndFree =80
-.InstallColormap =81
-.UninstallColormap =82
-.ListInstalledColormaps =83
-.AllocColor =84
-.AllocNamedColor =85
-.AllocColorCells =86
-.AllocColorPlanes =87
-.FreeColors =88
-.StoreColors =89
-.StoreNamedColor =90
-.QueryColors =91
-.LookupColor =92
-.CreateCursor =93
-.CreateGlyphCursor =94
-.FreeCursor =95
-.RecolorCursor =96
-.QueryBestSize =97
-.QueryExtension =98
-.ListExtensions =99
-.ChangeKeyboardMapping =100
-.GetKeyboardMapping =101
-.ChangeKeyboardControl =102
-.GetKeyboardControl =103
-.Bell =104
-.ChangePointerControl =105
-.GetPointerControl =106
-.SetScreenSaver =107
-.GetScreenSaver =108
-.ChangeHosts =109
-.ListHosts =110
-.SetAccessControl =111
-.SetCloseDownMode =112
-.KillClient =113
-.RotateProperties =114
-.ForceScreenSaver =115
-.SetPointerMapping =116
-.GetPointerMapping =117
-.SetModifierMapping =118
-.GetModifierMapping =119
-.NoOperation =127
-
-
-; Predefined atoms from the X server.
-
-XA_PRIMARY = 1
-XA_SECONDARY = 2
-XA_ARC = 3
-XA_ATOM = 4
-XA_BITMAP = 5
-XA_CARDINAL = 6
-XA_COLORMAP = 7
-XA_CURSOR = 8
-XA_CUT_BUFFER0 = 9
-XA_CUT_BUFFER1 = 10
-XA_CUT_BUFFER2 = 11
-XA_CUT_BUFFER3 = 12
-XA_CUT_BUFFER4 = 13
-XA_CUT_BUFFER5 = 14
-XA_CUT_BUFFER6 = 15
-XA_CUT_BUFFER7 = 16
-XA_DRAWABLE = 17
-XA_FONT = 18
-XA_INTEGER = 19
-XA_PIXMAP = 20
-XA_POINT = 21
-XA_RECTANGLE = 22
-XA_RESOURCE_MANAGER = 23
-XA_RGB_COLOR_MAP = 24
-XA_RGB_BEST_MAP = 25
-XA_RGB_BLUE_MAP = 26
-XA_RGB_DEFAULT_MAP = 27
-XA_RGB_GRAY_MAP = 28
-XA_RGB_GREEN_MAP = 29
-XA_RGB_RED_MAP = 30
-XA_STRING = 31
-XA_VISUALID = 32
-XA_WINDOW = 33
-XA_WM_COMMAND = 34
-XA_WM_HINTS = 35
-XA_WM_CLIENT_MACHINE = 36
-XA_WM_ICON_NAME = 37
-XA_WM_ICON_SIZE = 38
-XA_WM_NAME = 39
-XA_WM_NORMAL_HINTS = 40
-XA_WM_SIZE_HINTS = 41
-XA_WM_ZOOM_HINTS = 42
-XA_MIN_SPACE = 43
-XA_NORM_SPACE = 44
-XA_MAX_SPACE = 45
-XA_END_SPACE = 46
-XA_SUPERSCRIPT_X = 47
-XA_SUPERSCRIPT_Y = 48
-XA_SUBSCRIPT_X = 49
-XA_SUBSCRIPT_Y = 50
-XA_UNDERLINE_POSITION = 51
-XA_UNDERLINE_THICKNESS = 52
-XA_STRIKEOUT_ASCENT = 53
-XA_STRIKEOUT_DESCENT = 54
-XA_ITALIC_ANGLE = 55
-XA_X_HEIGHT = 56
-XA_QUAD_WIDTH = 57
-XA_WEIGHT = 58
-XA_POINT_SIZE = 59
-XA_RESOLUTION = 60
-XA_COPYRIGHT = 61
-XA_NOTICE = 62
-XA_FONT_NAME = 63
-XA_FAMILY_NAME = 64
-XA_FULL_NAME = 65
-XA_CAP_HEIGHT = 66
-XA_WM_CLASS = 67
-XA_WM_TRANSIENT_FOR = 68
-
-XA_LAST_PREDEFINED = 68
DELETED freshlib/equates/Linux/_geometry.inc
Index: freshlib/equates/Linux/_geometry.inc
==================================================================
--- freshlib/equates/Linux/_geometry.inc
+++ /dev/null
@@ -1,33 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Different geometry structures.
-;
-; Target OS: Linux
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-
-struct RECT
- .left dd ?
- .top dd ?
- .right dd ?
- .bottom dd ?
-ends
-
-struct POINT
- .x dd ?
- .y dd ?
-ends
-
-struct XRectangle
- .x dw ?
- .y dw ?
- .width dw ?
- .height dw ?
-ends
DELETED freshlib/equates/Linux/_linux.inc
Index: freshlib/equates/Linux/_linux.inc
==================================================================
--- freshlib/equates/Linux/_linux.inc
+++ /dev/null
@@ -1,968 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Common Linux equates.
-;
-; Target OS: Linux
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-; Error numbers from the kernel
-
-EPERM = 1 ; Operation not permitted
-ENOENT = 2 ; No such file or directory
-ESRCH = 3 ; No such process
-EINTR = 4 ; Interrupted system call
-EIO = 5 ; I/O error
-ENXIO = 6 ; No such device or address
-E2BIG = 7 ; Argument list too long
-ENOEXEC = 8 ; Exec format error
-EBADF = 9 ; Bad file number
-ECHILD = 10 ; No child processes
-EAGAIN = 11 ; Try again
-ENOMEM = 12 ; Out of memory
-EACCES = 13 ; Permission denied
-EFAULT = 14 ; Bad address
-ENOTBLK = 15 ; Block device required
-EBUSY = 16 ; Device or resource busy
-EEXIST = 17 ; File exists
-EXDEV = 18 ; Cross-device link
-ENODEV = 19 ; No such device
-ENOTDIR = 20 ; Not a directory
-EISDIR = 21 ; Is a directory
-EINVAL = 22 ; Invalid argument
-ENFILE = 23 ; File table overflow
-EMFILE = 24 ; Too many open files
-ENOTTY = 25 ; Not a typewriter
-ETXTBSY = 26 ; Text file busy
-EFBIG = 27 ; File too large
-ENOSPC = 28 ; No space left on device
-ESPIPE = 29 ; Illegal seek
-EROFS = 30 ; Read-only file system
-EMLINK = 31 ; Too many links
-EPIPE = 32 ; Broken pipe
-EDOM = 33 ; Math argument out of domain of func
-ERANGE = 34 ; Math result not representable
-
-EDEADLK = 35 ; Resource deadlock would occur
-ENAMETOOLONG = 36 ; File name too long
-ENOLCK = 37 ; No record locks available
-ENOSYS = 38 ; Function not implemented
-ENOTEMPTY = 39 ; Directory not empty
-ELOOP = 40 ; Too many symbolic links encountered
-EWOULDBLOCK = EAGAIN ; Operation would block
-ENOMSG = 42 ; No message of desired type
-EIDRM = 43 ; Identifier removed
-ECHRNG = 44 ; Channel number out of range
-EL2NSYNC = 45 ; Level 2 not synchronized
-EL3HLT = 46 ; Level 3 halted
-EL3RST = 47 ; Level 3 reset
-ELNRNG = 48 ; Link number out of range
-EUNATCH = 49 ; Protocol driver not attached
-ENOCSI = 50 ; No CSI structure available
-EL2HLT = 51 ; Level 2 halted
-EBADE = 52 ; Invalid exchange
-EBADR = 53 ; Invalid request descriptor
-EXFULL = 54 ; Exchange full
-ENOANO = 55 ; No anode
-EBADRQC = 56 ; Invalid request code
-EBADSLT = 57 ; Invalid slot
-
-EDEADLOCK = EDEADLK
-
-EBFONT = 59 ; Bad font file format
-ENOSTR = 60 ; Device not a stream
-ENODATA = 61 ; No data available
-ETIME = 62 ; Timer expired
-ENOSR = 63 ; Out of streams resources
-ENONET = 64 ; Machine is not on the network
-ENOPKG = 65 ; Package not installed
-EREMOTE = 66 ; Object is remote
-ENOLINK = 67 ; Link has been severed
-EADV = 68 ; Advertise error
-ESRMNT = 69 ; Srmount error
-ECOMM = 70 ; Communication error on send
-EPROTO = 71 ; Protocol error
-EMULTIHOP = 72 ; Multihop attempted
-EDOTDOT = 73 ; RFS specific error
-EBADMSG = 74 ; Not a data message
-EOVERFLOW = 75 ; Value too large for defined data type
-ENOTUNIQ = 76 ; Name not unique on network
-EBADFD = 77 ; File descriptor in bad state
-EREMCHG = 78 ; Remote address changed
-ELIBACC = 79 ; Can not access a needed shared library
-ELIBBAD = 80 ; Accessing a corrupted shared library
-ELIBSCN = 81 ; .lib section in a.out corrupted
-ELIBMAX = 82 ; Attempting to link in too many shared libraries
-ELIBEXEC = 83 ; Cannot exec a shared library directly
-EILSEQ = 84 ; Illegal byte sequence
-ERESTART = 85 ; Interrupted system call should be restarted
-ESTRPIPE = 86 ; Streams pipe error
-EUSERS = 87 ; Too many users
-ENOTSOCK = 88 ; Socket operation on non-socket
-EDESTADDRREQ = 89 ; Destination address required
-EMSGSIZE = 90 ; Message too long
-EPROTOTYPE = 91 ; Protocol wrong type for socket
-ENOPROTOOPT = 92 ; Protocol not available
-EPROTONOSUPPORT =93 ; Protocol not supported
-ESOCKTNOSUPPORT =94 ; Socket type not supported
-EOPNOTSUPP =95 ; Operation not supported on transport endpoint
-EPFNOSUPPORT = 96 ; Protocol family not supported
-EAFNOSUPPORT = 97 ; Address family not supported by protocol
-EADDRINUSE = 98 ; Address already in use
-EADDRNOTAVAIL = 99 ; Cannot assign requested address
-ENETDOWN = 100 ; Network is down
-ENETUNREACH = 101 ; Network is unreachable
-ENETRESET = 102 ; Network dropped connection because of reset
-ECONNABORTED = 103 ; Software caused connection abort
-ECONNRESET = 104 ; Connection reset by peer
-ENOBUFS = 105 ; No buffer space available
-EISCONN = 106 ; Transport endpoint is already connected
-ENOTCONN = 107 ; Transport endpoint is not connected
-ESHUTDOWN = 108 ; Cannot send after transport endpoint shutdown
-ETOOMANYREFS = 109 ; Too many references: cannot splice
-ETIMEDOUT = 110 ; Connection timed out
-ECONNREFUSED = 111 ; Connection refused
-EHOSTDOWN = 112 ; Host is down
-EHOSTUNREACH = 113 ; No route to host
-EALREADY = 114 ; Operation already in progress
-EINPROGRESS = 115 ; Operation now in progress
-ESTALE = 116 ; Stale NFS file handle
-EUCLEAN = 117 ; Structure needs cleaning
-ENOTNAM = 118 ; Not a XENIX named type file
-ENAVAIL = 119 ; No XENIX semaphores available
-EISNAM = 120 ; Is a named type file
-EREMOTEIO = 121 ; Remote I/O error
-EDQUOT = 122 ; Quota exceeded
-
-ENOMEDIUM = 123 ; No medium found
-EMEDIUMTYPE = 124 ; Wrong medium type
-ECANCELED = 125 ; Operation Canceled
-ENOKEY = 126 ; Required key not available
-EKEYEXPIRED = 127 ; Key has expired
-EKEYREVOKED = 128 ; Key has been revoked
-EKEYREJECTED = 129 ; Key was rejected by service
-
-; for robust mutexes
-EOWNERDEAD = 130 ; Owner died
-ENOTRECOVERABLE= 131 ; State not recoverable
-
-
-
-
-
-; System functions ( int $80 )
-
-; Name EAX
-
-sys_restart_syscall = $00
-sys_exit = $01
-sys_fork = $02
-sys_read = $03
-sys_write = $04
-sys_open = $05
-sys_close = $06
-sys_waitpid = $07
-sys_creat = $08
-sys_link = $09
-sys_unlink = $0a
-sys_execve = $0b
-sys_chdir = $0c
-sys_time = $0d
-sys_mknod = $0e
-sys_chmod = $0f
-sys_lchown16 = $10
-sys_stat = $12
-sys_lseek = $13
-sys_getpid = $14
-sys_mount = $15
-sys_oldumount = $16
-sys_setuid16 = $17
-sys_getuid16 = $18
-sys_stime = $19
-sys_ptrace = $1a
-sys_alarm = $1b
-sys_fstat = $1c
-sys_pause = $1d
-sys_utime = $1e
-sys_access = $21
-sys_nice = $22
-sys_sync = $24
-sys_kill = $25
-sys_rename = $26
-sys_mkdir = $27
-sys_rmdir = $28
-sys_dup = $29
-sys_pipe = $2a
-sys_times = $2b
-sys_brk = $2d
-sys_setgid16 = $2e
-sys_getgid16 = $2f
-sys_signal = $30
-sys_geteuid16 = $31
-sys_getegid16 = $32
-sys_acct = $33
-sys_umount = $34
-sys_ioctl = $36
-sys_fcntl = $37
-sys_setpgid = $39
-sys_olduname = $3b
-sys_umask = $3c
-sys_chroot = $3d
-sys_ustat = $3e
-sys_dup2 = $3f
-sys_getppid = $40
-sys_getpgrp = $41
-sys_setsid = $42
-sys_sigaction = $43
-sys_sgetmask = $44
-sys_ssetmask = $45
-sys_setreuid16 = $46
-sys_setregid16 = $47
-sys_sigsuspend = $48
-sys_sigpending = $49
-sys_sethostname = $4a
-sys_setrlimit = $4b
-sys_old_getrlimit = $4c
-sys_getrusage = $4d
-sys_gettimeofday = $4e
-sys_settimeofday = $4f
-sys_getgroups16 = $50
-sys_setgroups16 = $51
-sys_old_select = $52
-sys_symlink = $53
-sys_lstat = $54
-sys_readlink = $55
-sys_uselib = $56
-sys_swapon = $57
-sys_reboot = $58
-sys_old_readdir = $59
-sys_old_mmap = $5a
-sys_munmap = $5b
-sys_truncate = $5c
-sys_ftruncate = $5d
-sys_fchmod = $5e
-sys_fchown16 = $5f
-sys_getpriority = $60
-sys_setpriority = $61
-sys_statfs = $63
-sys_fstatfs = $64
-sys_ioperm = $65
-sys_socketcall = $66
-sys_syslog = $67
-sys_setitimer = $68
-sys_getitimer = $69
-sys_newstat = $6a
-sys_newlstat = $6b
-sys_newfstat = $6c
-sys_uname = $6d
-sys_iopl = $6e
-sys_vhangup = $6f
-sys_vm86old = $71
-sys_wait4 = $72
-sys_swapoff = $73
-sys_sysinfo = $74
-sys_ipc = $75
-sys_fsync = $76
-sys_sigreturn = $77
-sys_clone = $78
-sys_setdomainname = $79
-sys_newuname = $7a
-sys_modify_ldt = $7b
-sys_adjtimex = $7c
-sys_mprotect = $7d
-sys_sigprocmask = $7e
-sys_init_module = $80
-sys_delete_module = $81
-sys_quotactl = $83
-sys_getpgid = $84
-sys_fchdir = $85
-sys_bdflush = $86
-sys_sysfs = $87
-sys_personality = $88
-sys_setfsuid16 = $8a
-sys_setfsgid16 = $8b
-sys_llseek = $8c
-sys_getdents = $8d
-sys_select = $8e
-sys_flock = $8f
-sys_msync = $90
-sys_readv = $91
-sys_writev = $92
-sys_getsid = $93
-sys_fdatasync = $94
-sys_sysctl = $95
-sys_mlock = $96
-sys_munlock = $97
-sys_mlockall = $98
-sys_munlockall = $99
-sys_sched_setparam = $9a
-sys_sched_getparam = $9b
-sys_sched_setscheduler = $9c
-sys_sched_getscheduler = $9d
-sys_sched_yield = $9e
-sys_sched_get_priority_m = $9f
-sys_sched_get_priority_m = $a0
-sys_sched_rr_get_interva = $a1
-sys_nanosleep = $a2
-sys_mremap = $a3
-sys_setresuid16 = $a4
-sys_getresuid16 = $a5
-sys_vm86 = $a6
-sys_poll = $a8
-sys_nfsservctl = $a9
-sys_setresgid16 = $aa
-sys_getresgid16 = $ab
-sys_prctl = $ac
-sys_rt_sigreturn = $ad
-sys_rt_sigaction = $ae
-sys_rt_sigprocmask = $af
-sys_rt_sigpending = $b0
-sys_rt_sigtimedwait = $b1
-sys_rt_sigqueueinfo = $b2
-sys_rt_sigsuspend = $b3
-sys_pread64 = $b4
-sys_pwrite64 = $b5
-sys_chown16 = $b6
-sys_getcwd = $b7
-sys_capget = $b8
-sys_capset = $b9
-sys_sigaltstack = $ba
-sys_sendfile = $bb
-sys_vfork = $be
-sys_getrlimit = $bf
-sys_mmap_pgoff = $c0
-sys_truncate64 = $c1
-sys_ftruncate64 = $c2
-sys_stat64 = $c3
-sys_lstat64 = $c4
-sys_fstat64 = $c5
-sys_lchown = $c6
-sys_getuid = $c7
-sys_getgid = $c8
-sys_geteuid = $c9
-sys_getegid = $ca
-sys_setreuid = $cb
-sys_setregid = $cc
-sys_getgroups = $cd
-sys_setgroups = $ce
-sys_fchown = $cf
-sys_setresuid = $d0
-sys_getresuid = $d1
-sys_setresgid = $d2
-sys_getresgid = $d3
-sys_chown = $d4
-sys_setuid = $d5
-sys_setgid = $d6
-sys_setfsuid = $d7
-sys_setfsgid = $d8
-sys_pivot_root = $d9
-sys_mincore = $da
-sys_madvise = $db
-sys_getdents64 = $dc
-sys_fcntl64 = $dd
-sys_gettid = $e0
-sys_readahead = $e1
-sys_setxattr = $e2
-sys_lsetxattr = $e3
-sys_fsetxattr = $e4
-sys_getxattr = $e5
-sys_lgetxattr = $e6
-sys_fgetxattr = $e7
-sys_listxattr = $e8
-sys_llistxattr = $e9
-sys_flistxattr = $ea
-sys_removexattr = $eb
-sys_lremovexattr = $ec
-sys_fremovexattr = $ed
-sys_tkill = $ee
-sys_sendfile64 = $ef
-sys_futex = $f0
-sys_sched_setaffinity = $f1
-sys_sched_getaffinity = $f2
-sys_set_thread_area = $f3
-sys_get_thread_area = $f4
-sys_io_setup = $f5
-sys_io_destroy = $f6
-sys_io_getevents = $f7
-sys_io_submit = $f8
-sys_io_cancel = $f9
-sys_fadvise64 = $fa
-sys_exit_group = $fc
-sys_lookup_dcookie = $fd
-sys_epoll_create = $fe
-sys_epoll_ctl = $ff
-sys_epoll_wait = $100
-sys_remap_file_pages = $101
-sys_set_tid_address = $102
-sys_timer_create = $103
-sys_timer_settime = $104
-sys_timer_gettime = $105
-sys_timer_getoverrun = $106
-sys_timer_delete = $107
-sys_clock_settime = $108
-sys_clock_gettime = $109
-sys_clock_getres = $10a
-sys_clock_nanosleep = $10b
-sys_statfs64 = $10c
-sys_fstatfs64 = $10d
-sys_tgkill = $10e
-sys_utimes = $10f
-sys_fadvise64_64 = $110
-sys_mbind = $112
-sys_get_mempolicy = $113
-sys_set_mempolicy = $114
-sys_mq_open = $115
-sys_mq_unlink = $116
-sys_mq_timedsend = $117
-sys_mq_timedreceive = $118
-sys_mq_notify = $119
-sys_mq_getsetattr = $11a
-sys_kexec_load = $11b
-sys_waitid = $11c
-sys_add_key = $11e
-sys_request_key = $11f
-sys_keyctl = $120
-sys_ioprio_set = $121
-sys_ioprio_get = $122
-sys_inotify_init = $123
-sys_inotify_add_watch = $124
-sys_inotify_rm_watch = $125
-sys_migrate_pages = $126
-sys_openat = $127
-sys_mkdirat = $128
-sys_mknodat = $129
-sys_fchownat = $12a
-sys_futimesat = $12b
-sys_fstatat64 = $12c
-sys_unlinkat = $12d
-sys_renameat = $12e
-sys_linkat = $12f
-sys_symlinkat = $130
-sys_readlinkat = $131
-sys_fchmodat = $132
-sys_faccessat = $133
-sys_pselect6 = $134
-sys_ppoll = $135
-sys_unshare = $136
-sys_set_robust_list = $137
-sys_get_robust_list = $138
-sys_splice = $139
-sys_sync_file_range = $13a
-sys_tee = $13b
-sys_vmsplice = $13c
-sys_move_pages = $13d
-sys_getcpu = $13e
-sys_epoll_pwait = $13f
-sys_utimensat = $140
-sys_signalfd = $141
-sys_timerfd_create = $142
-sys_eventfd = $143
-sys_fallocate = $144
-sys_timerfd_settime = $145
-sys_timerfd_gettime = $146
-sys_signalfd4 = $147
-sys_eventfd2 = $148
-sys_epoll_create1 = $149
-sys_dup3 = $14a
-sys_pipe2 = $14b
-sys_inotify_init1 = $14c
-sys_preadv = $14d
-sys_pwritev = $14e
-sys_rt_tgsigqueueinfo = $14f
-sys_perf_event_open = $150
-sys_recvmmsg = $151
-
-;socket commands
-
-SYS_SOCKET = 1
-SYS_BIND = 2
-SYS_CONNECT = 3
-SYS_LISTEN = 4
-SYS_ACCEPT = 5
-SYS_GETSOCKNAME = 6
-SYS_GETPEERNAME = 7
-SYS_SOCKETPAIR = 8
-SYS_SEND = 9
-SYS_RECV = 10
-SYS_SENDTO = 11
-SYS_RECVFROM = 12
-SYS_SHUTDOWN = 13
-SYS_SETSOCKOPT = 14
-SYS_GETSOCKOPT = 15
-SYS_SENDMSG = 16
-SYS_RECVMSG = 17
-
-;socket constants
-
-AF_UNSPEC = 0
-AF_UNIX = 1
-AF_LOCAL = 1
-AF_INET = 2
-AF_AX25 = 3
-AF_IPX = 4
-AF_APPLETALK = 5
-AF_NETROM = 6
-AF_BRIDGE = 7
-AF_ATMPVC = 8
-AF_X25 = 9
-AF_INET6 = 10
-AF_ROSE = 11
-AF_DECnet = 12
-AF_NETBEUI = 13
-AF_SECURITY = 14
-AF_KEY = 15
-AF_NETLINK = 16
-AF_ROUTE = AF_NETLINK
-AF_PACKET = 17
-AF_ASH = 18
-AF_ECONET = 19
-AF_ATMSVC = 20
-AF_SNA = 22
-AF_IRDA = 23
-AF_PPPOX = 24
-AF_WANPIPE = 25
-AF_LLC = 26
-AF_TIPC = 30
-AF_BLUETOOTH = 31
-AF_MAX = 32
-
-PF_UNSPEC = AF_UNSPEC
-PF_UNIX = AF_UNIX
-PF_LOCAL = AF_LOCAL
-PF_INET = AF_INET
-PF_AX25 = AF_AX25
-PF_IPX = AF_IPX
-PF_APPLETALK = AF_APPLETALK
-PF_NETROM = AF_NETROM
-PF_BRIDGE = AF_BRIDGE
-PF_ATMPVC = AF_ATMPVC
-PF_X25 = AF_X25
-PF_INET6 = AF_INET6
-PF_ROSE = AF_ROSE
-PF_DECnet = AF_DECnet
-PF_NETBEUI = AF_NETBEUI
-PF_SECURITY = AF_SECURITY
-PF_KEY = AF_KEY
-PF_NETLINK = AF_NETLINK
-PF_ROUTE = AF_ROUTE
-PF_PACKET = AF_PACKET
-PF_ASH = AF_ASH
-PF_ECONET = AF_ECONET
-PF_ATMSVC = AF_ATMSVC
-PF_SNA = AF_SNA
-PF_IRDA = AF_IRDA
-PF_PPPOX = AF_PPPOX
-PF_WANPIPE = AF_WANPIPE
-PF_LLC = AF_LLC
-PF_TIPC = AF_TIPC
-PF_BLUETOOTH = AF_BLUETOOTH
-PF_MAX = AF_MAX
-
-SOCK_STREAM = 1
-SOCK_DGRAM = 2
-SOCK_RAW = 3
-SOCK_RDM = 4
-SOCK_SEQPACKET = 5
-SOCK_DCCP = 6
-SOCK_PACKET = 10
-
-
-; socket flags
-MSG_OOB = 1
-MSG_PEEK = 2
-MSG_DONTROUTE = 4
-MSG_TRYHARD = 4
-MSG_CTRUNC = 8
-MSG_PROBE = 0x10
-MSG_TRUNC = 0x20
-MSG_DONTWAIT = 0x40
-MSG_EOR = 0x80
-MSG_WAITALL = 0x100
-MSG_FIN = 0x200
-MSG_SYN = 0x400
-MSG_CONFIRM = 0x800
-MSG_RST = 0x1000
-MSG_ERRQUEUE = 0x2000
-MSG_NOSIGNAL = 0x4000
-MSG_MORE = 0x8000
-
-
-SOL_SOCKET = 1
-
-SO_DEBUG = 1
-SO_REUSEADDR = 2
-SO_TYPE = 3
-SO_ERROR = 4
-SO_DONTROUTE = 5
-SO_BROADCAST = 6
-SO_SNDBUF = 7
-SO_RCVBUF = 8
-SO_SNDBUFFORCE = 32
-SO_RCVBUFFORCE = 33
-SO_KEEPALIVE = 9
-SO_OOBINLINE = 10
-SO_NO_CHECK = 11
-SO_PRIORITY = 12
-SO_LINGER = 13
-SO_BSDCOMPAT = 14
-SO_PASSCRED = 16
-SO_PEERCRED = 17
-SO_RCVLOWAT = 18
-SO_SNDLOWAT = 19
-SO_RCVTIMEO = 20
-SO_SNDTIMEO = 21
-
-
-
-; Signal values
-; default action is: "Term" - terminate; "Core" - terminate with core dump; "Ign" - ignore; "Stop" - stop the process; "Cont" - continue the process.
-
-macro signal name, value {
- name = value
- .mask = 1 shl value
-}
-
-signal SIGHUP , 1 ; Term Hangup detected on controlling terminal or death of controlling process
-signal SIGINT , 2 ; Term Interrupt from keyboard
-signal SIGQUIT , 3 ; Core Quit from keyboard
-signal SIGILL , 4 ; Core Illegal Instruction
-signal SIGTRAP , 5 ; Core Trace/breakpoint trap
-signal SIGABRT , 6 ; Core Abort signal from abort(3)
-signal SIGIOT , 6 ; Core IOT trap. A synonym for SIGABRT
-signal SIGBUS , 7 ; Core Bus error (bad memory access)
-signal SIGFPE , 8 ; Core Floating point exception
-signal SIGKILL , 9 ; Term Kill signal
-signal SIGUSR1 , 10 ; Term User-defined signal 1
-signal SIGSEGV , 11 ; Core Invalid memory reference
-signal SIGUSR2 , 12 ; Term User-defined signal 2
-signal SIGPIPE , 13 ; Term Broken pipe: write to pipe with no readers
-signal SIGALRM , 14 ; Term Timer signal from alarm(2)
-signal SIGTERM , 15 ; Term Termination signal
-signal SIGSTKFLT, 16 ; Term Stack fault on coprocessor (unused)
-signal SIGCHLD , 17 ; Ign Child stopped or terminated
-signal SIGCONT , 18 ; Cont Continue if stopped
-signal SIGSTOP , 19 ; Stop Stop process
-signal SIGTSTP , 20 ; Stop Stop typed at tty
-signal SIGTTIN , 21 ; Stop tty input for background process
-signal SIGTTOU , 22 ; Stop tty output for background process
-signal SIGURG , 23 ; Ign Urgent condition on socket (4.2BSD)
-signal SIGXCPU , 24 ; Core CPU time limit exceeded (4.2BSD)
-signal SIGXFSZ , 25 ; Core File size limit exceeded (4.2BSD)
-signal SIGVTALRM, 26 ; Term Virtual alarm clock (4.2BSD)
-signal SIGPROF , 27 ; Term Profiling timer expired
-signal SIGWINCH , 28 ; Ign Window resize signal (4.3BSD, Sun)
-signal SIGIO , 29 ; Term I/O now possible (4.2BSD)
-signal SIGPWR , 30 ; Term Power failure (System V)
-signal SIGSYS , 31 ; Core Bad argument to routine (SVr4)
-signal SIGUNUSED, 31 ; Core Synonymous with SIGSYS
-
-SIGRTMIN = 34
-SIGRTMAX = 64
-
-; signal flags
-
-SA_ONSTACK = $00000001 ; Call the signal handler on an alternate signal stack provided by
- ; sigaltstack(2). If an alternate stack is not available, the
- ; default stack will be used. This flag is only meaningful when
- ; establishing a signal handler.
-
-
-
-SA_RESETHAND = $00000004 ; Restore the signal action to the default state once the signal
- ; handler has been called. This flag is only meaningful when
- ; establishing a signal handler. SA_ONESHOT is an obsolete,
- ; nonstandard synonym for this flag.
-
-
-SA_NOCLDSTOP = $00000008 ; If signum is SIGCHLD, do not receive notification when child
- ; processes stop (i.e., when they receive one of SIGSTOP, SIGTSTP,
- ; SIGTTIN or SIGTTOU) or resume (i.e., they receive SIGCONT) (see
- ; wait(2)). This flag is only meaningful when establishing a handler
- ; for SIGCHLD.
-
-
-SA_SIGINFO = $00000010 ; The signal handler takes 3 arguments, not one. In this case,
- ; sa_sigaction should be set instead of sa_handler. This flag is
- ; only meaningful when establishing a signal handler.
-
-
-SA_NODEFER = $00000020 ; Do not prevent the signal from being received from within its own
- ; signal handler. This flag is only meaningful when establishing a
- ; signal handler. SA_NOMASK is an obsolete, nonstandard synonym for
- ; this flag.
-
-
-SA_RESTART = $00000040 ; Provide behavior compatible with BSD signal semantics by making
- ; certain system calls restartable across signals. This flag is only
- ; meaningful when establishing a signal handler. See signal(7) for a
- ; discussion of system call restarting.
-
-
-SA_NOCLDWAIT = $00000080 ; If signum is SIGCHLD, do not transform children into zombies when
- ; they terminate. See also waitpid(2). This flag is only meaningful
- ; when establishing a handler for SIGCHLD, or when setting that
- ; signal's disposition to SIG_DFL.
- ;
- ; If the SA_NOCLDWAIT flag is set when establishing a handler for
- ; SIGCHLD, POSIX.1 leaves it unspecified whether a SIGCHLD signal is
- ; generated when a child process terminates. On Linux, a SIGCHLD
- ; signal is generated in this case; on some other implementations, it
- ; is not.
-
-
-SA_NOMASK = SA_NODEFER
-SA_ONESHOT = SA_RESETHAND
-SA_INTERRUPT = $20000000 ; dummy -- ignored
-SA_RESTORER = $04000000 ; obsolete -- ignored
-
-; Signals hanlers constants
-
-SIG_DFL = 0 ; default signal handling
-SIG_IGN = 1 ; ignore signal
-SIG_ERR = -1 ; error return from signal
-
-
-; Interval timers structures
-
-ITIMER_REAL = 0
-ITIMER_VIRTUAL = 1
-ITIMER_PROF = 2
-
-
-struct lnx_sigaction
- .sa_handler dd ? ; SIG_DFL, SIG_IGN or ptr proc Handler, .signal
- .sa_sigaction dd ? ; ptr proc SigAction, .signal, .ptrSignalInfo, .ptr
- .sa_mask dd ? ; mask of the signals
- .sa_flags dd ? ;
- .sa_restorer dd ? ; obsolete, don't use
-ends
-
-
-
-struct lnx_timeval
- .tv_sec dd ?
- .tv_usec dd ?
-ends
-
-struct lnx_timezone
- .tz_minuteswest dd ?
- .tz_dsttime dd ?
-ends
-
-
-
-struct lnx_itimerval
- .it_interval lnx_timeval
- .it_value lnx_timeval
-ends
-
-
-; structures and equates for timer_xxxx POSIX functions
-
-
-CLOCK_REALTIME = 0 ; Identifier for system-wide realtime clock.
-CLOCK_MONOTONIC = 1 ; Monotonic system-wide clock.
-CLOCK_PROCESS_CPUTIME_ID = 2 ; High-resolution timer from the CPU.
-CLOCK_THREAD_CPUTIME_ID = 3 ; Thread-specific CPU-time clock.
-
-SIGEV_SIGNAL = 0 ; Notify via signal.
-SIGEV_NONE = 1 ; Other notification: meaningless.
-SIGEV_THREAD = 2 ; Deliver via thread creation.
-SIGEV_THREAD_ID = 4 ; Send signal to specific thread.
-
-
-struct lnx_sigevent
- .notify dd ?
- .signo dd ?
- .value dd ?
- .ptr_notify_proc dd ?
- .ptr_notify_attr dd ?
- .notify_thread_id dd ?
-ends
-
-struct lnx_timespec
- .tv_sec dd ? ; time in seconds
- .tv_nsec dd ? ; time is nano seconds
-ends
-
-
-struct lnx_itimerspec
- .it_interval lnx_timespec
- .it_value lnx_timespec
-ends
-
-
-; sys_clone function flags
-
-CLONE_VM = $00000100 ; set if VM shared between processes
-CLONE_FS = $00000200 ; set if fs info shared between processes
-CLONE_FILES = $00000400 ; set if open files shared between processes
-CLONE_SIGHAND = $00000800 ; set if signal handlers and blocked signals shared
-CLONE_PTRACE = $00002000 ; set if we want to let tracing continue on the child too
-CLONE_VFORK = $00004000 ; set if the parent wants the child to wake it up on mm_release
-CLONE_PARENT = $00008000 ; set if we want to have the same parent as the cloner
-CLONE_THREAD = $00010000 ; Same thread group?
-CLONE_NEWNS = $00020000 ; New namespace group?
-CLONE_SYSVSEM = $00040000 ; share system V SEM_UNDO semantics
-CLONE_SETTLS = $00080000 ; create a new TLS for the child
-CLONE_PARENT_SETTID = $00100000 ; set the TID in the parent
-CLONE_CHILD_CLEARTID = $00200000 ; clear the TID in the child
-CLONE_DETACHED = $00400000 ; Unused, ignored
-CLONE_UNTRACED = $00800000 ; set if the tracing process can't force CLONE_PTRACE on this clone
-CLONE_CHILD_SETTID = $01000000 ; set the TID in the child
-CLONE_STOPPED = $02000000 ; Start in stopped state
-CLONE_NEWUTS = $04000000 ; New utsname group?
-CLONE_NEWIPC = $08000000 ; New ipcs
-CLONE_NEWUSER = $10000000 ; New user namespace
-CLONE_NEWPID = $20000000 ; New pid namespace
-CLONE_NEWNET = $40000000 ; New network namespace
-CLONE_IO = $80000000 ; Clone io context
-
-
-; Memory constants
-
-; Protections are chosen from these bits, OR'd together. The
-; implementation does not necessarily support PROT_EXEC or PROT_WRITE
-; without PROT_READ. The only guarantees are that no writing will be
-; allowed without PROT_WRITE and no access will be allowed for PROT_NONE.
-
-PROT_READ = $1 ; Page can be read.
-PROT_WRITE = $2 ; Page can be written.
-PROT_EXEC = $4 ; Page can be executed.
-PROT_NONE = $0 ; Page can not be accessed.
-PROT_GROWSDOWN = $01000000 ; Extend change to start of
- ; growsdown vma (mprotect only).
-PROT_GROWSUP = $02000000 ; Extend change to start of
- ; growsup vma (mprotect only).
-
-; Sharing types (must choose one and only one of these).
-MAP_SHARED = $01 ; Share changes.
-MAP_PRIVATE = $02 ; Changes are private.
-MAP_TYPE = $0f ; Mask for type of mapping.
-
-
-; Other flags.
-MAP_FIXED = $10 ; Interpret addr exactly.
-MAP_ANONYMOUS = $20 ; Don't use a file.
-MAP_32BIT = $40 ; Only give out 32-bit addresses.
-
-
-; These are Linux-specific.
-MAP_GROWSDOWN = $00100 ; Stack-like segment.
-MAP_DENYWRITE = $00800 ; ETXTBSY
-MAP_EXECUTABLE = $01000 ; Mark it as an executable.
-MAP_LOCKED = $02000 ; Lock the mapping.
-MAP_NORESERVE = $04000 ; Don't check for reservations.
-MAP_POPULATE = $08000 ; Populate (prefault) pagetables.
-MAP_NONBLOCK = $10000 ; Do not block on IO.
-MAP_STACK = $20000 ; Allocation is for a stack.
-
-
-; Flags to `msync'.
-MS_ASYNC = 1 ; Sync memory asynchronously.
-MS_SYNC = 4 ; Synchronous memory sync.
-MS_INVALIDATE = 2 ; Invalidate the caches.
-
-
-; Flags for `mlockall'.
-MCL_CURRENT = 1 ; Lock all currently mapped pages.
-MCL_FUTURE = 2 ; Lock all additions to address space.
-
-; Flags for `mremap'.
-MREMAP_MAYMOVE = 1
-MREMAP_FIXED = 2
-
-; Advice to `madvise'.
-MADV_NORMAL = 0 ; No further special treatment.
-MADV_RANDOM = 1 ; Expect random page references.
-MADV_SEQUENTIAL = 2 ; Expect sequential page references.
-MADV_WILLNEED = 3 ; Will need these pages.
-MADV_DONTNEED = 4 ; Don't need these pages.
-MADV_REMOVE = 9 ; Remove these pages and resources.
-MADV_DONTFORK = 10 ; Do not inherit across fork.
-MADV_DOFORK = 11 ; Do inherit across fork.
-
-
-; The POSIX people had to invent similar names for the same things.
-POSIX_MADV_NORMAL = 0 ; No further special treatment.
-POSIX_MADV_RANDOM = 1 ; Expect random page references.
-POSIX_MADV_SEQUENTIAL = 2 ; Expect sequential page references.
-POSIX_MADV_WILLNEED = 3 ; Will need these pages.
-POSIX_MADV_DONTNEED = 4 ; Don't need these pages.
-
-
-
-; sys_futex constants
-
-
-FUTEX_WAIT = 0
-FUTEX_WAKE = 1
-FUTEX_FD = 2
-FUTEX_REQUEUE = 3
-FUTEX_CMP_REQUEUE = 4
-FUTEX_WAKE_OP = 5
-FUTEX_LOCK_PI = 6
-FUTEX_UNLOCK_PI = 7
-FUTEX_TRYLOCK_PI = 8
-FUTEX_WAIT_BITSET = 9
-FUTEX_WAKE_BITSET = 10
-
-
-; sys_fstat and similar structures
-
-struct STAT
- .st_dev dw ? ; ID of device containing file
- .pad1 dw ?
- .st_ino dd ? ; inode number
- .st_mode dw ? ; protection
- .st_nlink dw ? ; number of hard links
- .st_uid dw ? ; user ID of owner
- .st_gid dw ? ; group ID of owner
- .st_rdev dw ? ; device ID (if special file)
- .pad2 dw ?
- .st_size dd ? ; total size, in bytes
- .st_blksize dd ? ; block size
- .st_blocks dd ?
-
- .st_atime dd ? ; time of last access
- .unused1 dd ?
-
- .st_mtime dd ? ; time of last modification
- .unused2 dd ?
-
- .st_ctime dd ? ; time of last status change
- .unused3 dd ?
- .unused4 dd ?
- .unused5 dd ?
-ends
-
-
-; sys_getdents
-
-; it is variable length structure.
-struct linux_dirent
- .d_ino dd ?
- .d_off dd ?
- .d_reclen dw ?
- label .d_name byte
-ends
-
-; file types for the above structure.
-; this value is written at the last byte of the structure. (linux_dirent.d_reclen-1)
-
-DT_UNKNOWN = 0
-DT_FIFO = 1
-DT_CHR = 2
-DT_DIR = 4
-DT_BLK = 6
-DT_REG = 8 ; regular file
-DT_LNK = 10
-DT_SOCK = 12
-DT_WHT = 14
-
DELETED freshlib/equates/Linux/_pthreads.inc
Index: freshlib/equates/Linux/_pthreads.inc
==================================================================
--- freshlib/equates/Linux/_pthreads.inc
+++ /dev/null
@@ -1,23 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Equates for pthread library.
-;
-; Target OS: Linux
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-; mutex types.
-
-PTHREAD_MUTEX_NORMAL = 0
-PTHREAD_MUTEX_RECURSIVE = 1
-PTHREAD_MUTEX_ERRORCHECK = 2
-PTHREAD_MUTEX_ERRORCHECK_NP = PTHREAD_MUTEX_ERRORCHECK
-PTHREAD_MUTEX_RECURSIVE_NP = PTHREAD_MUTEX_RECURSIVE
-PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL
-
DELETED freshlib/equates/Linux/_xft.inc
Index: freshlib/equates/Linux/_xft.inc
==================================================================
--- freshlib/equates/Linux/_xft.inc
+++ /dev/null
@@ -1,129 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: XFT library constants and structures.
-;
-; Target OS: Linux
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-
-
-struct XRenderColor
- .red dw ?
- .green dw ?
- .blue dw ?
- .alpha dw ?
-ends
-
-
-XFT_MAJOR = 2
-XFT_MINOR = 1
-XFT_REVISION = 8
-XftVersion equ XFT_VERSION
-
-XFT_CORE equ "core"
-XFT_RENDER equ "render"
-XFT_XLFD equ "xlfd"
-XFT_MAX_GLYPH_MEMORY equ "maxglyphmemory"
-XFT_MAX_UNREF_FONTS equ "maxunreffonts"
-
-
-FcTypeVoid = 0
-FcTypeInteger = 1
-FcTypeDouble = 2
-FcTypeString = 3
-FcTypeBool = 4
-FcTypeMatrix = 5
-FcTypeCharSet = 6
-FcTypeFTFace = 7
-FcTypeLangSet = 8
-
-XftTypeVoid = FcTypeVoid
-XftTypeInteger = FcTypeInteger
-XftTypeDouble = FcTypeDouble
-XftTypeString = FcTypeString
-XftTypeBool = FcTypeBool
-XftTypeMatrix = FcTypeMatrix
-XftTypeCharSet = FcTypeCharSet
-XftTypeFTFace = FcTypeFTFace
-XftTypeLangSet = FcTypeLangSet
-
-FC_SLANT_ROMAN = 0
-FC_SLANT_ITALIC = 100
-FC_SLANT_OBLIQUE = 110
-
-XFT_SLANT_ROMAN = FC_SLANT_ROMAN
-XFT_SLANT_ITALIC = FC_SLANT_ITALIC
-XFT_SLANT_OBLIQUE = FC_SLANT_OBLIQUE
-
-FC_PROPORTIONAL = 0
-FC_DUAL = 90
-FC_MONO = 100
-FC_CHARCELL = 110
-
-XFT_PROPORTIONAL = FC_PROPORTIONAL
-XFT_DUAL = FC_DUAL
-XFT_MONO = FC_MONO
-XFT_CHARCELL = FC_CHARCELL
-
-
-struct _XftFont
- .ascent dd ?
- .descent dd ?
- .height dd ?
- .max_advance_width dd ?
- .charset dd ?
- .pattern dd ?
-ends
-
-
-struct _XftColor
- .pixel dd ?
- .color XRenderColor
-ends
-
-
-struct _XftCharSpec
- .ucs4 dd ?
- .x: dw ?
- .y: dw ?
-ends
-
-
-struct _XftCharFontSpec
- .font dd ?
- .ucs4 dd ?
- .x dw ?
- .y dw ?
-ends
-
-
-struct _XftGlyphSpec
- .glyph dd ?
- .x dw ?
- .y dw ?
-ends
-
-
-struct _XftGlyphFontSpec
- .font dd ?
- .glyph dd ?
- .x dw ?
- .y dw ?
-ends
-
-
-struct _XGlyphInfo
- .width dw ?
- .height dw ?
- .x dw ?
- .y dw ?
- .xOff dw ?
- .yOff dw ?
-ends
DELETED freshlib/equates/Linux/allequates.inc
Index: freshlib/equates/Linux/allequates.inc
==================================================================
--- freshlib/equates/Linux/allequates.inc
+++ /dev/null
@@ -1,20 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Combined include of all Linux equates.
-;
-; Target OS: Linux
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-; Linux programming constants
-include '_geometry.inc'
-include '_linux.inc'
-include '_XLib.inc'
-include '_xft.inc'
-include '_pthreads.inc'
DELETED freshlib/equates/Win32/_COMCTL32.INC
Index: freshlib/equates/Win32/_COMCTL32.INC
==================================================================
--- freshlib/equates/Win32/_COMCTL32.INC
+++ /dev/null
@@ -1,1891 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: COMCTL32.DLL structures and constants
-;
-; Target OS: Win32
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-struct PROPSHEETPAGE
- .dwSize dd ?
- .dwFlags dd ?
- .hInstance dd ?
- .pszTemplate dd ?
- .pszIcon dd ?
- .pszTitle dd ?
- .pfnDlgProc dd ?
- .lParam dd ?
- .pfnCallback dd ?
- .pcRefParent dd ?
-ends
-
-struct PROPSHEETHEADER
- .dwSize dd ?
- .dwFlags dd ?
- .hwndParent dd ?
- .hInstance dd ?
- .pszIcon dd ?
- .pszCaption dd ?
- .nPages dd ?
- .pStartPage dd ?
-ends
-
-struct IMAGEINFO
- .hbmImage dd ?
- .hbmMask dd ?
- .Unused1 dd ?
- .Unused2 dd ?
- .rcImage dd ?
-ends
-
-struct HDITEM
- .mask dd ?
- .cxy dd ?
- .pszText dd ?
- .hbm dd ?
- .cchTextMax dd ?
- .fmt dd ?
- .lParam dd ?
-ends
-
-struct HDLAYOUT
- .prc dd ?
- .pwpos dd ?
-ends
-
-struct HDHITTESTINFO
- .pt POINT
- .flags dd ?
- .iItem dd ?
-ends
-
-struct HDNOTIFY
- .hdr NMHDR
- .iItem dd ?
- .iButton dd ?
- .pitem dd ?
-ends
-
-struct TBBUTTON
- .iBitmap dd ?
- .idCommand dd ?
- .fsState db ?
- .fsStyle db ?
- dw ?
- .dwData dd ?
- .iString dd ?
-ends
-
-struct COLORMAP
- .from dd ?
- .to dd ?
-ends
-
-struct TBADDBITMAP
- .hInst dd ?
- .nID dd ?
-ends
-
-struct TBSAVEPARAMS
- .hkr dd ?
- .pszSubKey dd ?
- .pszValueName dd ?
-ends
-
-struct TBREPLACEBITMAP
- .hInstOld dd ?
- .nIDOld dd ?
- .hInstNew dd ?
- .nIDNew dd ?
- .nButtons dd ?
-ends
-
-struct NMTOOLBAR
- .hdr NMHDR
- .iItem dd ?
- .tbButton TBBUTTON
- .cchText dd ?
- .pszText dd ?
-ends
-
-struct REBARINFO
- .cbSize dd ?
- .fMask dd ?
- .himl dd ?
-ends
-
-struct REBARBANDINFO
- .cbSize dd ?
- .fMask dd ?
- .fStyle dd ?
- .clrFore dd ?
- .clrBack dd ?
- .lpText dd ?
- .cch dd ?
- .iImage dd ?
- .hwndChild dd ?
- .cxMinChild dd ?
- .cyMinChild dd ?
- .cx dd ?
- .hbmBack dd ?
- .wID dd ?
-ends
-
-struct TOOLINFO
- .cbSize dd ?
- .uFlags dd ?
- .hwnd dd ?
- .uId dd ?
- .Rect RECT
- .hInst dd ?
- .lpszText dd ?
-ends
-
-struct TTHITTESTINFO
- .hwnd dd ?
- .pt POINT
- .ti TOOLINFO
-ends
-
-struct TOOLTOPTEXT
- .hdr NMHDR
- .lpszText dd ?
- .szText rb 80
- .hinst dd ?
- .uFlags dd ?
-ends
-
-struct UDACCEL
- .nSec dd ?
- .nInc dd ?
-ends
-
-struct NMUPDOWN
- .hdr NMHDR
- .iPos dd ?
- .iDelta dd ?
-ends
-
-struct LVITEM
- .mask dd ?
- .iItem dd ?
- .iSubItem dd ?
- .state dd ?
- .stateMask dd ?
- .pszText dd ?
- .cchTextMax dd ?
- .iImage dd ?
- .lParam dd ?
- .iIndent dd ?
-ends
-
-struct LVFINDINFO
- .flags dd ?
- .psz dd ?
- .lParam dd ?
- .pt POINT
- .vkDirection dd ?
-ends
-
-struct LVHITTESTINFO
- .pt POINT
- .flags dd ?
- .iItem dd ?
-ends
-
-struct LVCOLUMN
- .mask dd ?
- .fmt dd ?
- .cx dd ?
- .pszText dd ?
- .cchTextMax dd ?
- .iSubItem dd ?
-ends
-
-struct NMLISTVIEW
- .hdr NMHDR
- .iItem dd ?
- .iSubItem dd ?
- .uNewState dd ?
- .uOldState dd ?
- .uChanged dd ?
- .ptAction POINT
- .lParam dd ?
-ends
-
-struct NMCACHEHINT
- .hdr NMHDR
- .iFrom dd ?
- .iTo dd ?
-ends
-
-struct NMFINDITEM
- .hdr NMHDR
- .iStart dd ?
- .lvfi LVFINDINFO
-ends
-
-struct LVDISPINFO
- .hdr NMHDR
- .item LVITEM
-ends
-
-struct LVKEYDOWN
- .hdr NMHDR
- .wVKey dw ?
- .flags dd ?
-ends
-
-struct TVITEM
- .mask dd ?
- .hItem dd ?
- .state dd ?
- .stateMask dd ?
- .pszText dd ?
- .cchTextMax dd ?
- .iImage dd ?
- .iSelectedImage dd ?
- .cChildren dd ?
- .lParam dd ?
-ends
-
-struct TVINSERTSTRUCT
- .hParent dd ?
- .hInsertAfter dd ?
- .item TVITEM
-ends
-
-struct TVHITTESTINFO
- .pt POINT
- .flags dd ?
- .hItem dd ?
-ends
-
-struct TVSORTCB
- .hParent dd ?
- .lpfnCompare dd ?
- .lParam dd ?
-ends
-
-struct NMTREEVIEW
- .hdr NMHDR
- .action dd ?
- .itemOld TVITEM
- .itemNew TVITEM
- .ptDrag POINT
-ends
-
-struct TVDISPINFO
- .hdr NMHDR
- .item TVITEM
-ends
-
-struct TVKEYDOWN
- .hdr NMHDR
- .wVKey dw ?
- .flags dd ?
-ends
-
-struct TCITEMHEADER
- .mask dd ?
- .lpReserved1 dd ?
- .lpReserved2 dd ?
- .pszText dd ?
- .cchTextMax dd ?
- .iImage dd ?
-ends
-
-struct TCITEM
- .mask dd ?
- .lpReserved1 dd ?
- .lpReserved2 dd ?
- .pszText dd ?
- .cchTextMax dd ?
- .iImage dd ?
- .lParam dd ?
-ends
-
-struct TCHITTESTINFO
- .pt POINT
- .flags dd ?
-ends
-
-struct TCKEYDOWN
- .hdr NMHDR
- .wVKey dw ?
- .flags dd ?
-ends
-
-struct MCHITTESTINFO
- .cbSize dd ?
- .pt POINT
- .uHit dd ?
- .st SYSTEMTIME
-ends
-
-struct NMSELCHANGE
- .nmhdr NMHDR
- .stSelStart SYSTEMTIME
- .stSelEnd SYSTEMTIME
-ends
-
-struct NMDAYSTATE
- .nmhdr NMHDR
- .stStart SYSTEMTIME
- .cDayState dd ?
- .prgDayState dd ?
-ends
-
-struct NMDATETIMECHANGE
- .nmhdr NMHDR
- .dwFlags dd ?
- .st SYSTEMTIME
-ends
-
-struct NMDATETIMESTRING
- .nmhdr NMHDR
- .pszUserString dd ?
- .st SYSTEMTIME
- .dwFlags dd ?
-ends
-
-struct NMDATETIMEWMKEYDOWN
- .nmhdr NMHDR
- .nVirtKey dd ?
- .pszFormat dd ?
- .st SYSTEMTIME
-ends
-
-struct NMDATETIMEFORMAT
- .nmhdr NMHDR
- .pszFormat dd ?
- .st SYSTEMTIME
- .pszDisplay dd ?
- .szDisplay rb 64
-ends
-
-struct NMDATETIMEFORMATQUERY
- .nmhdr NMHDR
- .pszFormat dd ?
- .szMax SIZE
-ends
-
-struct NMCUSTOMDRAW
- .hdr NMHDR
- .dwDrawStage dd ?
- .hdc dd ?
- .rc RECT
- .dwItemSpec dd ?
- .uItemState dd ?
- .lItemlParam dd ?
-ends
-
-struct NMLVCUSTOMDRAW
- .nmcd NMCUSTOMDRAW
- .clrText dd ?
- .clrTextBk dd ?
- .iSubItem dd ?
- .dwItemType dd ?
- .clrFace dd ?
- .iIconEffect dd ?
- .iIconPhase dd ?
- .iPartId dd ?
- .iStateId dd ?
- .rcText RECT
- .uAlign dd ?
-ends
-
-struct INITCOMMONCONTROLSEX
- .dwSize dd ?
- .dwICC dd ?
-ends
-
-; Common control window classes
-
-HOTKEY_CLASS equ 'msctls_hotkey32'
-PROGRESS_CLASS equ 'msctls_progress32'
-STATUS_CLASS equ 'msctls_statusbar32'
-TRACKBAR_CLASS equ 'msctls_trackbar32'
-UPDOWN_CLASS equ 'msctls_updown32'
-TOOLTIPS_CLASS equ 'tooltips_class32'
-ANIMATE_CLASS equ 'SysAnimate32'
-HEADER_CLASS equ 'SysHeader32'
-LISTVIEW_CLASS equ 'SysListView32'
-TREEVIEW_CLASS equ 'SysTreeView32'
-TABCONTROL_CLASS equ 'SysTabControl32'
-MONTHCAL_CLASS equ 'SysMonthCal32'
-DATETIMEPICK_CLASS equ 'SysDateTimePick32'
-TOOLBAR_CLASS equ 'ToolbarWindow32'
-REBAR_CLASS equ 'ReBarWindow32'
-
-; Ranges for control message IDs
-
-LVM_FIRST = 1000h
-TV_FIRST = 1100h
-HDM_FIRST = 1200h
-TCM_FIRST = 1300h
-MCM_FIRST = 1000h
-DTM_FIRST = 1000h
-CCM_FIRST = 2000h
-
-; Ranges for control notification IDs
-
-NM_FIRST = 0
-LVN_FIRST = -100
-PSN_FIRST = -200
-HDN_FIRST = -300
-TVN_FIRST = -400
-TTN_FIRST = -520
-TCN_FIRST = -550
-CDN_FIRST = -601
-TBN_FIRST = -700
-UDN_FIRST = -721
-MCN_FIRST = -750
-DTN_FIRST = -760
-CBEN_FIRST = -800
-RBN_FIRST = -831
-
-; Generic notifications
-
-NM_OUTOFMEMORY = NM_FIRST - 1
-NM_CLICK = NM_FIRST - 2
-NM_DBLCLK = NM_FIRST - 3
-NM_RETURN = NM_FIRST - 4
-NM_RCLICK = NM_FIRST - 5
-NM_RDBLCLK = NM_FIRST - 6
-NM_SETFOCUS = NM_FIRST - 7
-NM_KILLFOCUS = NM_FIRST - 8
-NM_CUSTOMDRAW = NM_FIRST - 12
-
-; Common control styles
-
-CCS_TOP = 01h
-CCS_NOMOVEY = 02h
-CCS_BOTTOM = 03h
-CCS_NORESIZE = 04h
-CCS_NOPARENTALIGN = 08h
-CCS_ADJUSTABLE = 20h
-CCS_NODIVIDER = 40h
-CCS_VERT = 80h
-CCS_LEFT = CCS_VERT or CCS_TOP
-CCS_RIGHT = CCS_VERT or CCS_BOTTOM
-CCS_NOMOVEX = CCS_VERT or CCS_NOMOVEY
-
-; Owner-drawn control types
-
-ODT_HEADER = 100
-ODT_TAB = 101
-ODT_LISTVIEW = 102
-
-; InitCommonControlsEx classes
-
-ICC_ANIMATE_CLASS = 0080h
-ICC_BAR_CLASSES = 0004h
-ICC_COOL_CLASSES = 0400h
-ICC_DATE_CLASSES = 0100h
-ICC_HOTKEY_CLASS = 0040h
-ICC_INTERNET_CLASSES = 0800h
-ICC_LISTVIEW_CLASSES = 0001h
-ICC_PAGESCROLLER_CLASS = 1000h
-ICC_PROGRESS_CLASS = 0020h
-ICC_TAB_CLASSES = 0008h
-ICC_TREEVIEW_CLASSES = 0002h
-ICC_UPDOWN_CLASS = 0010h
-ICC_USEREX_CLASSES = 0200h
-ICC_WIN95_CLASSES = 00FFh
-
-; Shared messages
-
-CCM_SETCOLORSCHEME = CCM_FIRST + 2
-CCM_GETCOLORSCHEME = CCM_FIRST + 3
-CCM_GETDROPTARGET = CCM_FIRST + 4
-CCM_SETUNICODEFORMAT = CCM_FIRST + 5
-CCM_GETUNICODEFORMAT = CCM_FIRST + 6
-
-; Property sheet page flags
-
-PSP_DEFAULT = 0000h
-PSP_DLGINDIRECT = 0001h
-PSP_USEHICON = 0002h
-PSP_USEICONID = 0004h
-PSP_USETITLE = 0008h
-PSP_HASHELP = 0020h
-PSP_USEREFPARENT = 0040h
-PSP_USECALLBACK = 0080h
-
-; Property sheet page actions
-
-PSPCB_RELEASE = 1
-PSPCB_CREATE = 2
-
-; Property sheet header flags
-
-PSH_DEFAULT = 0000h
-PSH_PROPTITLE = 0001h
-PSH_USEHICON = 0002h
-PSH_USEICONID = 0004h
-PSH_PROPSHEETPAGE = 0008h
-PSH_MULTILINETABS = 0010h
-PSH_WIZARD = 0020h
-PSH_USEPSTARTPAGE = 0040h
-PSH_NOAPPLYNOW = 0080h
-PSH_USECALLBACK = 0100h
-PSH_HASHELP = 0200h
-PSH_MODELESS = 0400h
-
-; Property sheet actions
-
-PSCB_INITIALIZED = 1
-
-; Property sheet notifications
-
-PSN_SETACTIVE = PSN_FIRST - 0
-PSN_KILLACTIVE = PSN_FIRST - 1
-PSN_APPLY = PSN_FIRST - 2
-PSN_RESET = PSN_FIRST - 3
-PSN_HELP = PSN_FIRST - 5
-PSN_WIZBACK = PSN_FIRST - 6
-PSN_WIZNEXT = PSN_FIRST - 7
-PSN_WIZFINISH = PSN_FIRST - 8
-PSN_QUERYCANCEL = PSN_FIRST - 9
-
-; Property sheet return values
-
-PSNRET_NOERROR = 0
-PSNRET_INVALID = 1
-PSNRET_INVALID_NOCHANGEPAGE = 2
-
-; Property sheet messages
-
-PSM_SETCURSEL = WM_USER + 101
-PSM_REMOVEPAGE = WM_USER + 102
-PSM_ADDPAGE = WM_USER + 103
-PSM_CHANGED = WM_USER + 104
-PSM_RESTARTWINDOWS = WM_USER + 105
-PSM_REBOOTSYSTEM = WM_USER + 106
-PSM_CANCELTOCLOSE = WM_USER + 107
-PSM_QUERYSIBLINGS = WM_USER + 108
-PSM_UNCHANGED = WM_USER + 109
-PSM_APPLY = WM_USER + 110
-PSM_SETTITLE = WM_USER + 111
-PSM_SETTITLEW = WM_USER + 120
-PSM_SETWIZBUTTONS = WM_USER + 112
-PSM_PRESSBUTTON = WM_USER + 113
-PSM_SETCURSELID = WM_USER + 114
-PSM_SETFINISHTEXT = WM_USER + 115
-PSM_SETFINISHTEXTW = WM_USER + 121
-PSM_GETTABCONTROL = WM_USER + 116
-PSM_ISDIALOGMESSAGE = WM_USER + 117
-
-; Property sheet buttons
-
-PSBTN_BACK = 0
-PSBTN_NEXT = 1
-PSBTN_FINISH = 2
-PSBTN_OK = 3
-PSBTN_APPLYNOW = 4
-PSBTN_CANCEL = 5
-PSBTN_HELP = 6
-PSWIZB_BACK = 1
-PSWIZB_NEXT = 2
-PSWIZB_FINISH = 4
-PSWIZB_DISABLEDFINISH = 8
-ID_PSRESTARTWINDOWS = 2
-ID_PSREBOOTSYSTEM = ID_PSRESTARTWINDOWS or 1
-
-; Property sheet sizes
-
-PROP_SM_CXDLG = 212
-PROP_SM_CYDLG = 188
-PROP_MED_CXDLG = 227
-PROP_MED_CYDLG = 215
-PROP_LG_CXDLG = 252
-PROP_LG_CYDLG = 218
-WIZ_CXDLG = 276
-WIZ_CYDLG = 140
-WIZ_CXBMP = 80
-WIZ_BODYX = 92
-WIZ_BODYCX = 184
-
-; Image list types
-
-ILC_MASK = 001h
-ILC_COLOR = 0FEh
-ILC_COLORDDB = 0FEh
-ILC_COLOR4 = 004h
-ILC_COLOR8 = 008h
-ILC_COLOR16 = 010h
-ILC_COLOR24 = 018h
-ILC_COLOR32 = 020h
-ILC_PALETTE = 800h
-
-; Image list color values
-
-CLR_NONE = 0FFFFFFFFh
-CLR_DEFAULT = 0FF000000h
-CLR_HILIGHT = CLR_DEFAULT
-
-; Image list drawing styles
-
-ILD_NORMAL = 0000h
-ILD_TRANSPARENT = 0001h
-ILD_MASK = 0010h
-ILD_IMAGE = 0020h
-ILD_BLEND25 = 0002h
-ILD_BLEND50 = 0004h
-ILD_OVERLAYMASK = 0F00h
-ILD_SELECTED = ILD_BLEND50
-ILD_FOCUS = ILD_BLEND25
-ILD_BLEND = ILD_BLEND50
-
-; Header control styles
-
-HDS_HORZ = 00h
-HDS_BUTTONS = 02h
-HDS_HOTTRACK = 04h
-HDS_HIDDEN = 08h
-HDS_DRAGDROP = 40h
-HDS_FULLDRAG = 80h
-
-; Header control structure flags
-
-HDI_WIDTH = 01h
-HDI_HEIGHT = HDI_WIDTH
-HDI_TEXT = 02h
-HDI_FORMAT = 04h
-HDI_LPARAM = 08h
-HDI_BITMAP = 10h
-
-; Header control flags
-
-HDF_LEFT = 0000h
-HDF_RIGHT = 0001h
-HDF_CENTER = 0002h
-HDF_JUSTIFYMASK = 0003h
-HDF_RTLREADING = 0004h
-HDF_BITMAP = 2000h
-HDF_STRING = 4000h
-HDF_OWNERDRAW = 8000h
-
-; Header control messages
-
-HDM_GETITEMCOUNT = HDM_FIRST + 0
-HDM_INSERTITEMA = HDM_FIRST + 1
-HDM_DELETEITEM = HDM_FIRST + 2
-HDM_GETITEMA = HDM_FIRST + 3
-HDM_SETITEMA = HDM_FIRST + 4
-HDM_LAYOUT = HDM_FIRST + 5
-HDM_HITTEST = HDM_FIRST + 6
-HDM_INSERTITEMW = HDM_FIRST + 10
-HDM_GETITEMW = HDM_FIRST + 11
-HDM_SETITEMW = HDM_FIRST + 12
-HDM_INSERTITEM = HDM_INSERTITEMA
-HDM_GETITEM = HDM_GETITEMA
-HDM_SETITEM = HDM_SETITEMA
-
-; Hit test result flags
-
-HHT_NOWHERE = 001h
-HHT_ONHEADER = 002h
-HHT_ONDIVIDER = 004h
-HHT_ONDIVOPEN = 008h
-HHT_ABOVE = 100h
-HHT_BELOW = 200h
-HHT_TORIGHT = 400h
-HHT_TOLEFT = 800h
-
-; Header control notifications
-
-HDN_ITEMCHANGINGA = HDN_FIRST - 0
-HDN_ITEMCHANGEDA = HDN_FIRST - 1
-HDN_ITEMCLICKA = HDN_FIRST - 2
-HDN_ITEMDBLCLICKA = HDN_FIRST - 3
-HDN_DIVIDERDBLCLICKA = HDN_FIRST - 5
-HDN_BEGINTRACKA = HDN_FIRST - 6
-HDN_ENDTRACKA = HDN_FIRST - 7
-HDN_TRACKA = HDN_FIRST - 8
-HDN_ITEMCHANGINGW = HDN_FIRST - 20
-HDN_ITEMCHANGEDW = HDN_FIRST - 21
-HDN_ITEMCLICKW = HDN_FIRST - 22
-HDN_ITEMDBLCLICKW = HDN_FIRST - 23
-HDN_DIVIDERDBLCLICKW = HDN_FIRST - 25
-HDN_BEGINTRACKW = HDN_FIRST - 26
-HDN_ENDTRACKW = HDN_FIRST - 27
-HDN_TRACKW = HDN_FIRST - 28
-HDN_ITEMCHANGING = HDN_ITEMCHANGINGA
-HDN_ITEMCHANGED = HDN_ITEMCHANGEDA
-HDN_ITEMCLICK = HDN_ITEMCLICKA
-HDN_ITEMDBLCLICK = HDN_ITEMDBLCLICKA
-HDN_DIVIDERDBLCLICK = HDN_DIVIDERDBLCLICKA
-HDN_BEGINTRACK = HDN_BEGINTRACKA
-HDN_ENDTRACK = HDN_ENDTRACKA
-HDN_TRACK = HDN_TRACKA
-
-; Toolbar bitmap flags
-
-CMB_MASKED = 2
-
-; Toolbar button states
-
-TBSTATE_CHECKED = 01h
-TBSTATE_PRESSED = 02h
-TBSTATE_ENABLED = 04h
-TBSTATE_HIDDEN = 08h
-TBSTATE_INDETERMINATE = 10h
-TBSTATE_WRAP = 20h
-TBSTATE_ELLIPSES = 40h
-
-; Toolbar button styles
-
-TBSTYLE_BUTTON = 0000h
-TBSTYLE_SEP = 0001h
-TBSTYLE_CHECK = 0002h
-TBSTYLE_GROUP = 0004h
-TBSTYLE_CHECKGROUP = TBSTYLE_GROUP or TBSTYLE_CHECK
-TBSTYLE_DROPDOWN = 0008h
-TBSTYLE_AUTOSIZE = 0010h ; automatically calculate width of the button
-TBSTYLE_NOPREFIX = 0020h ; if this button should not have accel prefix
-
-TBSTYLE_TOOLTIPS = 0100h
-TBSTYLE_WRAPABLE = 0200h
-TBSTYLE_ALTDRAG = 0400h
-TBSTYLE_FLAT = 0800h
-TBSTYLE_LIST = 1000h
-TBSTYLE_CUSTOMERASE = 2000h
-TBSTYLE_TRANSPARENT = 8000h
-
-; Toolbar button extended styles
-
-TBSTYLE_EX_DRAWDDARROWS = 0001h
-
-; Toolbar messages
-
-TB_ENABLEBUTTON = WM_USER + 1
-TB_CHECKBUTTON = WM_USER + 2
-TB_PRESSBUTTON = WM_USER + 3
-TB_HIDEBUTTON = WM_USER + 4
-TB_INDETERMINATE = WM_USER + 5
-TB_ISBUTTONENABLED = WM_USER + 9
-TB_ISBUTTONCHECKED = WM_USER + 10
-TB_ISBUTTONPRESSED = WM_USER + 11
-TB_ISBUTTONHIDDEN = WM_USER + 12
-TB_ISBUTTONINDETERMINATE = WM_USER + 13
-TB_SETSTATE = WM_USER + 17
-TB_GETSTATE = WM_USER + 18
-TB_ADDBITMAP = WM_USER + 19
-TB_ADDBUTTONS = WM_USER + 20
-TB_INSERTBUTTON = WM_USER + 21
-TB_DELETEBUTTON = WM_USER + 22
-TB_GETBUTTON = WM_USER + 23
-TB_BUTTONCOUNT = WM_USER + 24
-TB_COMMANDTOINDEX = WM_USER + 25
-TB_SAVERESTOREA = WM_USER + 26
-TB_ADDSTRINGA = WM_USER + 28
-TB_CUSTOMIZE = WM_USER + 27
-TB_GETITEMRECT = WM_USER + 29
-TB_BUTTONSTRUCTSIZE = WM_USER + 30
-TB_SETBUTTONSIZE = WM_USER + 31
-TB_SETBITMAPSIZE = WM_USER + 32
-TB_AUTOSIZE = WM_USER + 33
-TB_GETTOOLTIPS = WM_USER + 35
-TB_SETTOOLTIPS = WM_USER + 36
-TB_SETPARENT = WM_USER + 37
-TB_SETROWS = WM_USER + 39
-TB_GETROWS = WM_USER + 40
-TB_GETBITMAPFLAGS = WM_USER + 41
-TB_SETCMDID = WM_USER + 42
-TB_CHANGEBITMAP = WM_USER + 43
-TB_GETBITMAP = WM_USER + 44
-TB_GETBUTTONTEXTA = WM_USER + 45
-TB_REPLACEBITMAP = WM_USER + 46
-TB_SETINDENT = WM_USER + 47
-TB_SETIMAGELIST = WM_USER + 48
-TB_GETIMAGELIST = WM_USER + 49
-TB_LOADIMAGES = WM_USER + 50
-TB_GETRECT = WM_USER + 51
-TB_SETHOTIMAGELIST = WM_USER + 52
-TB_GETHOTIMAGELIST = WM_USER + 53
-TB_SETDISABLEDIMAGELIST = WM_USER + 54
-TB_GETDISABLEDIMAGELIST = WM_USER + 55
-TB_SETSTYLE = WM_USER + 56
-TB_GETSTYLE = WM_USER + 57
-TB_GETBUTTONSIZE = WM_USER + 58
-TB_SETBUTTONWIDTH = WM_USER + 59
-TB_SETMAXTEXTROWS = WM_USER + 60
-TB_GETTEXTROWS = WM_USER + 61
-TB_GETBUTTONTEXTW = WM_USER + 75
-TB_SAVERESTOREW = WM_USER + 76
-TB_ADDSTRINGW = WM_USER + 77
-TB_SETEXTENDEDSTYLE = WM_USER + 84
-TB_GETEXTENDEDSTYLE = WM_USER + 85
-TB_GETBUTTONTEXT = TB_GETBUTTONTEXTA
-TB_SAVERESTORE = TB_SAVERESTOREA
-TB_ADDSTRING = TB_ADDSTRINGA
-
-; System-defined button bitmaps
-
-HINST_COMMCTRL = -1
-IDB_STD_SMALL_COLOR = 0
-IDB_STD_LARGE_COLOR = 1
-IDB_VIEW_SMALL_COLOR = 4
-IDB_VIEW_LARGE_COLOR = 5
-IDB_HIST_SMALL_COLOR = 8
-IDB_HIST_LARGE_COLOR = 9
-
-; Icon indexes for standard bitmap
-
-STD_CUT = 0
-STD_COPY = 1
-STD_PASTE = 2
-STD_UNDO = 3
-STD_REDOW = 4
-STD_DELETE = 5
-STD_FILENEW = 6
-STD_FILEOPEN = 7
-STD_FILESAVE = 8
-STD_PRINTPRE = 9
-STD_PROPERTIES = 10
-STD_HELP = 11
-STD_FIND = 12
-STD_REPLACE = 13
-STD_PRINT = 14
-
-; Icon indexes for standard view bitmap
-
-VIEW_LARGEICONS = 0
-VIEW_SMALLICONS = 1
-VIEW_LIST = 2
-VIEW_DETAILS = 3
-VIEW_SORTNAME = 4
-VIEW_SORTSIZE = 5
-VIEW_SORTDATE = 6
-VIEW_SORTTYPE = 7
-VIEW_PARENTFOLDER = 8
-VIEW_NETCONNECT = 9
-VIEW_NETDISCONNECT = 10
-VIEW_NEWFOLDER = 11
-
-; Icon indexes for history bitmap
-
-HIST_BACK = 0
-HIST_FORWARD = 1
-HIST_FAVORITES = 2
-HIST_ADDTOFAVORITES = 3
-HIST_VIEWTREE = 4
-
-; Toolbar bitmap flags
-
-TBBF_LARGE = 1
-
-; Toolbar notifications
-
-TBN_GETBUTTONINFOA = TBN_FIRST - 0
-TBN_BEGINDRAG = TBN_FIRST - 1
-TBN_ENDDRAG = TBN_FIRST - 2
-TBN_BEGINADJUST = TBN_FIRST - 3
-TBN_ENDADJUST = TBN_FIRST - 4
-TBN_RESET = TBN_FIRST - 5
-TBN_QUERYINSERT = TBN_FIRST - 6
-TBN_QUERYDELETE = TBN_FIRST - 7
-TBN_TOOLBARCHANGE = TBN_FIRST - 8
-TBN_CUSTHELP = TBN_FIRST - 9
-TBN_DROPDOWN = TBN_FIRST - 10
-TBN_CLOSEUP = TBN_FIRST - 11
-TBN_GETBUTTONINFOW = TBN_FIRST - 20
-TBN_GETBUTTONINFO = TBN_GETBUTTONINFOA
-
-; ReBar styles
-
-RBS_TOOLTIPS = 100h
-RBS_VARHEIGHT = 200h
-RBS_BANDBORDERS = 400h
-RBS_FIXEDORDER = 800h
-RBS_REGISTERDROP = 1000h
-RBS_AUTOSIZE = 2000h
-RBS_VERTICALGRIPPER = 4000h
-RBS_DBLCLKTOGGLE = 8000h
-
-; ReBar band info structure flags
-
-RBBIM_STYLE = 001h
-RBBIM_COLORS = 002h
-RBBIM_TEXT = 004h
-RBBIM_IMAGE = 008h
-RBBIM_CHILD = 010h
-RBBIM_CHILDSIZE = 020h
-RBBIM_SIZE = 040h
-RBBIM_BACKGROUND = 080h
-RBBIM_ID = 100h
-RBBIM_IDEALSIZE = 200h
-RBBIM_LPARAM = 400h
-RBBIM_HEADERSIZE = 800h
-
-; ReBar band styles
-
-RBBS_BREAK = 001h
-RBBS_FIXEDSIZE = 002h
-RBBS_CHILDEDGE = 004h
-RBBS_HIDDEN = 008h
-RBBS_NOVERT = 010h
-RBBS_FIXEDBMP = 020h
-RBBS_VARIABLEHEIGHT = 040h
-RBBS_GRIPPERALWAYS = 080h
-RBBS_NOGRIPPER = 100h
-
-; ReBar messages
-
-RB_INSERTBANDA = WM_USER + 1
-RB_DELETEBAND = WM_USER + 2
-RB_GETBARINFO = WM_USER + 3
-RB_SETBARINFO = WM_USER + 4
-RB_GETBANDINFO = WM_USER + 5
-RB_SETBANDINFOA = WM_USER + 6
-RB_SETPARENT = WM_USER + 7
-RB_INSERTBANDW = WM_USER + 10
-RB_SETBANDINFOW = WM_USER + 11
-RB_GETBANDCOUNT = WM_USER + 12
-RB_GETROWCOUNT = WM_USER + 13
-RB_GETROWHEIGHT = WM_USER + 14
-RB_IDTOINDEX = WM_USER + 16
-RB_GETTOOLTIPS = WM_USER + 17
-RB_SETTOOLTIPS = WM_USER + 18
-RB_SETBKCOLOR = WM_USER + 19
-RB_GETBKCOLOR = WM_USER + 20
-RB_SETTEXTCOLOR = WM_USER + 21
-RB_GETTEXTCOLOR = WM_USER + 22
-RB_SIZETORECT = WM_USER + 23
-RB_BEGINDRAG = WM_USER + 24
-RB_ENDDRAG = WM_USER + 25
-RB_DRAGMOVE = WM_USER + 26
-RB_GETBARHEIGHT = WM_USER + 27
-RB_GETBANDINFOW = WM_USER + 28
-RB_GETBANDINFOA = WM_USER + 29
-RB_MINIMIZEBAND = WM_USER + 30
-RB_MAXIMIZEBAND = WM_USER + 31
-RB_GETDROPTARGET = CCM_GETDROPTARGET
-RB_GETBANDBORDERS = WM_USER + 34
-RB_SHOWBAND = WM_USER + 35
-RB_SETPALETTE = WM_USER + 37
-RB_GETPALETTE = WM_USER + 38
-RB_MOVEBAND = WM_USER + 39
-RB_SETUNICODEFORMAT = CCM_SETUNICODEFORMAT
-RB_GETUNICODEFORMAT = CCM_GETUNICODEFORMAT
-RB_INSERTBAND = RB_INSERTBANDA
-RB_SETBANDINFO = RB_SETBANDINFOA
-
-; ReBar notifications
-
-RBN_HEIGHTCHANGE = RBN_FIRST - 0
-RBN_GETOBJECT = RBN_FIRST - 1
-RBN_LAYOUTCHANGED = RBN_FIRST - 2
-RBN_AUTOSIZE = RBN_FIRST - 3
-RBN_BEGINDRAG = RBN_FIRST - 4
-RBN_ENDDRAG = RBN_FIRST - 5
-RBN_DELETINGBAND = RBN_FIRST - 6
-RBN_DELETEDBAND = RBN_FIRST - 7
-RBN_CHILDSIZE = RBN_FIRST - 8
-
-; Tooltip styles
-
-TTS_ALWAYSTIP = 1
-TTS_NOPREFIX = 2
-
-; Tooltip flags
-
-TTF_IDISHWND = 01h
-TTF_CENTERTIP = 02h
-TTF_RTLREADING = 04h
-TTF_SUBCLASS = 10h
-
-; Tooltip durations
-
-TTDT_AUTOMATIC = 0
-TTDT_RESHOW = 1
-TTDT_AUTOPOP = 2
-TTDT_INITIAL = 3
-
-; Tooltip messages
-
-TTM_ACTIVATE = WM_USER + 1
-TTM_SETDELAYTIME = WM_USER + 3
-TTM_ADDTOOLA = WM_USER + 4
-TTM_DELTOOLA = WM_USER + 5
-TTM_NEWTOOLRECTA = WM_USER + 6
-TTM_RELAYEVENT = WM_USER + 7
-TTM_GETTOOLINFOA = WM_USER + 8
-TTM_SETTOOLINFOA = WM_USER + 9
-TTM_HITTESTA = WM_USER + 10
-TTM_GETTEXTA = WM_USER + 11
-TTM_UPDATETIPTEXTA = WM_USER + 12
-TTM_GETTOOLCOUNT = WM_USER + 13
-TTM_ENUMTOOLSA = WM_USER + 14
-TTM_GETCURRENTTOOLA = WM_USER + 15
-TTM_WINDOWFROMPOINT = WM_USER + 16
-TTM_ADDTOOLW = WM_USER + 50
-TTM_DELTOOLW = WM_USER + 51
-TTM_NEWTOOLRECTW = WM_USER + 52
-TTM_GETTOOLINFOW = WM_USER + 53
-TTM_SETTOOLINFOW = WM_USER + 54
-TTM_HITTESTW = WM_USER + 55
-TTM_GETTEXTW = WM_USER + 56
-TTM_UPDATETIPTEXTW = WM_USER + 57
-TTM_ENUMTOOLSW = WM_USER + 58
-TTM_GETCURRENTTOOLW = WM_USER + 59
-TTM_ADDTOOL = TTM_ADDTOOLA
-TTM_DELTOOL = TTM_DELTOOLA
-TTM_NEWTOOLRECT = TTM_NEWTOOLRECTA
-TTM_GETTOOLINFO = TTM_GETTOOLINFOA
-TTM_SETTOOLINFO = TTM_SETTOOLINFOA
-TTM_HITTEST = TTM_HITTESTA
-TTM_GETTEXT = TTM_GETTEXTA
-TTM_UPDATETIPTEXT = TTM_UPDATETIPTEXTA
-TTM_ENUMTOOLS = TTM_ENUMTOOLSA
-TTM_GETCURRENTTOOL = TTM_GETCURRENTTOOLA
-
-; Tooltip notifications
-
-TTN_NEEDTEXTA = TTN_FIRST - 0
-TTN_SHOW = TTN_FIRST - 1
-TTN_POP = TTN_FIRST - 2
-TTN_NEEDTEXTW = TTN_FIRST - 10
-TTN_NEEDTEXT = TTN_NEEDTEXTA
-
-; tooltip structures
-
-struct TOOLTIPTEXT
- .hdr NMHDR
- .lpszText dd ?
- .char rb 80
- .hinst dd ?
- .uFlags dd ?
-ends
-
-
-
-
-
-; Status bar styles
-
-SBARS_SIZEGRIP = 100h
-
-; Status bar messages
-
-SB_SETTEXTA = WM_USER + 1
-SB_GETTEXTA = WM_USER + 2
-SB_GETTEXTLENGTHA = WM_USER + 3
-SB_SETPARTS = WM_USER + 4
-SB_GETPARTS = WM_USER + 6
-SB_GETBORDERS = WM_USER + 7
-SB_SETMINHEIGHT = WM_USER + 8
-SB_SIMPLE = WM_USER + 9
-SB_GETRECT = WM_USER + 10
-SB_SETTEXTW = WM_USER + 11
-SB_GETTEXTW = WM_USER + 13
-SB_GETTEXTLENGTHW = WM_USER + 12
-SB_SETTEXT = SB_SETTEXTA
-SB_GETTEXT = SB_GETTEXTA
-SB_GETTEXTLENGTH = SB_GETTEXTLENGTHA
-
-; Status bar drawing types
-
-SBT_OWNERDRAW = 1000h
-SBT_NOBORDERS = 0100h
-SBT_POPOUT = 0200h
-SBT_RTLREADING = 0400h
-
-; Trackbar styles
-
-TBS_AUTOTICKS = 01h
-TBS_VERT = 02h
-TBS_HORZ = 00h
-TBS_TOP = 04h
-TBS_BOTTOM = 00h
-TBS_LEFT = 04h
-TBS_RIGHT = 00h
-TBS_BOTH = 08h
-TBS_NOTICKS = 10h
-TBS_ENABLESELRANGE = 20h
-TBS_FIXEDLENGTH = 40h
-TBS_NOTHUMB = 80h
-
-; Trackbar messages
-
-TBM_GETPOS = WM_USER + 0
-TBM_GETRANGEMIN = WM_USER + 1
-TBM_GETRANGEMAX = WM_USER + 2
-TBM_GETTIC = WM_USER + 3
-TBM_SETTIC = WM_USER + 4
-TBM_SETPOS = WM_USER + 5
-TBM_SETRANGE = WM_USER + 6
-TBM_SETRANGEMIN = WM_USER + 7
-TBM_SETRANGEMAX = WM_USER + 8
-TBM_CLEARTICS = WM_USER + 9
-TBM_SETSEL = WM_USER + 10
-TBM_SETSELSTART = WM_USER + 11
-TBM_SETSELEND = WM_USER + 12
-TBM_GETPTICS = WM_USER + 14
-TBM_GETTICPOS = WM_USER + 15
-TBM_GETNUMTICS = WM_USER + 16
-TBM_GETSELSTART = WM_USER + 17
-TBM_GETSELEND = WM_USER + 18
-TBM_CLEARSEL = WM_USER + 19
-TBM_SETTICFREQ = WM_USER + 20
-TBM_SETPAGESIZE = WM_USER + 21
-TBM_GETPAGESIZE = WM_USER + 22
-TBM_SETLINESIZE = WM_USER + 23
-TBM_GETLINESIZE = WM_USER + 24
-TBM_GETTHUMBRECT = WM_USER + 25
-TBM_GETCHANNELRECT = WM_USER + 26
-TBM_SETTHUMBLENGTH = WM_USER + 27
-TBM_GETTHUMBLENGTH = WM_USER + 28
-
-; Trackbar notifications
-
-TB_LINEUP = 0
-TB_LINEDOWN = 1
-TB_PAGEUP = 2
-TB_PAGEDOWN = 3
-TB_THUMBPOSITION = 4
-TB_THUMBTRACK = 5
-TB_TOP = 6
-TB_BOTTOM = 7
-TB_ENDTRACK = 8
-
-; Up-down control styles
-
-UDS_WRAP = 01h
-UDS_SETBUDDYINT = 02h
-UDS_ALIGNRIGHT = 04h
-UDS_ALIGNLEFT = 08h
-UDS_AUTOBUDDY = 10h
-UDS_ARROWKEYS = 20h
-UDS_HORZ = 40h
-UDS_NOTHOUSANDS = 80h
-
-; Up-down control messages
-
-UDM_SETRANGE = WM_USER + 101
-UDM_GETRANGE = WM_USER + 102
-UDM_SETPOS = WM_USER + 103
-UDM_GETPOS = WM_USER + 104
-UDM_SETBUDDY = WM_USER + 105
-UDM_GETBUDDY = WM_USER + 106
-UDM_SETACCEL = WM_USER + 107
-UDM_GETACCEL = WM_USER + 108
-UDM_SETBASE = WM_USER + 109
-UDM_GETBASE = WM_USER + 110
-
-; Up-down control notifications
-
-UDN_DELTAPOS = UDN_FIRST - 1
-
-; Progress bar messages
-
-PBM_SETRANGE = WM_USER + 1
-PBM_SETPOS = WM_USER + 2
-PBM_DELTAPOS = WM_USER + 3
-PBM_SETSTEP = WM_USER + 4
-PBM_STEPIT = WM_USER + 5
-PBM_SETRANGE32 = WM_USER + 6
-PBM_GETRANGE = WM_USER + 7
-PBM_GETPOS = WM_USER + 8
-
-; Progress bar styles
-
-PBS_SMOOTH = 1
-PBS_VERTICAL = 4
-
-
-; Hot-key control messages
-
-HKM_SETHOTKEY = WM_USER + 1
-HKM_GETHOTKEY = WM_USER + 2
-HKM_SETRULES = WM_USER + 3
-
-; Hot key flags
-
-HOTKEYF_SHIFT = 1
-HOTKEYF_CONTROL = 2
-HOTKEYF_ALT = 4
-HOTKEYF_EXT = 8
-
-; Key combination flags
-
-HKCOMB_NONE = 01h
-HKCOMB_S = 02h
-HKCOMB_C = 04h
-HKCOMB_A = 08h
-HKCOMB_SC = 10h
-HKCOMB_SA = 20h
-HKCOMB_CA = 40h
-HKCOMB_SCA = 80h
-
-; List view styles
-
-LVS_ICON = 0000h
-LVS_REPORT = 0001h
-LVS_SMALLICON = 0002h
-LVS_LIST = 0003h
-LVS_TYPEMASK = 0003h
-LVS_SINGLESEL = 0004h
-LVS_SHOWSELALWAYS = 0008h
-LVS_SORTASCENDING = 0010h
-LVS_SORTDESCENDING = 0020h
-LVS_SHAREIMAGELISTS = 0040h
-LVS_NOLABELWRAP = 0080h
-LVS_AUTOARRANGE = 0100h
-LVS_EDITLABELS = 0200h
-LVS_OWNERDATA = 1000h
-LVS_NOSCROLL = 2000h
-LVS_ALIGNTOP = 0000h
-LVS_ALIGNLEFT = 0800h
-LVS_OWNERDRAWFIXED = 0400h
-LVS_NOCOLUMNHEADER = 4000h
-LVS_NOSORTHEADER = 8000h
-
-; List view extended styles
-
-LVS_EX_GRIDLINES = 0001h
-LVS_EX_SUBITEMIMAGES = 0002h
-LVS_EX_CHECKBOXES = 0004h
-LVS_EX_TRACKSELECT = 0008h
-LVS_EX_HEADERDRAGDROP = 0010h
-LVS_EX_FULLROWSELECT = 0020h
-LVS_EX_ONECLICKACTIVATE = 0040h
-LVS_EX_TWOCLICKACTIVATE = 0080h
-LVS_EX_FLATSB = 0100h
-LVS_EX_REGIONAL = 0200h
-LVS_EX_INFOTIP = 0400h
-LVS_EX_UNDERLINEHOT = 0800h
-LVS_EX_UNDERLINECOLD = 1000h
-LVS_EX_MULTIWORKAREAS = 2000h
-LVS_EX_LABELTIP = 4000h
-LVS_EX_BORDERSELECT = 8000h
-
-; List view messages
-
-LVM_GETBKCOLOR = LVM_FIRST + 0
-LVM_SETBKCOLOR = LVM_FIRST + 1
-LVM_GETIMAGELIST = LVM_FIRST + 2
-LVM_SETIMAGELIST = LVM_FIRST + 3
-LVM_GETITEMCOUNT = LVM_FIRST + 4
-LVM_GETITEMA = LVM_FIRST + 5
-LVM_SETITEMA = LVM_FIRST + 6
-LVM_INSERTITEMA = LVM_FIRST + 7
-LVM_DELETEITEM = LVM_FIRST + 8
-LVM_DELETEALLITEMS = LVM_FIRST + 9
-LVM_GETCALLBACKMASK = LVM_FIRST + 10
-LVM_SETCALLBACKMASK = LVM_FIRST + 11
-LVM_GETNEXTITEM = LVM_FIRST + 12
-LVM_FINDITEMA = LVM_FIRST + 13
-LVM_GETITEMRECT = LVM_FIRST + 14
-LVM_SETITEMPOSITION = LVM_FIRST + 15
-LVM_GETITEMPOSITION = LVM_FIRST + 16
-LVM_GETSTRINGWIDTHA = LVM_FIRST + 17
-LVM_HITTEST = LVM_FIRST + 18
-LVM_ENSUREVISIBLE = LVM_FIRST + 19
-LVM_SCROLL = LVM_FIRST + 20
-LVM_REDRAWITEMS = LVM_FIRST + 21
-LVM_ARRANGE = LVM_FIRST + 22
-LVM_EDITLABELA = LVM_FIRST + 23
-LVM_GETEDITCONTROL = LVM_FIRST + 24
-LVM_GETCOLUMNA = LVM_FIRST + 25
-LVM_SETCOLUMNA = LVM_FIRST + 26
-LVM_INSERTCOLUMNA = LVM_FIRST + 27
-LVM_DELETECOLUMN = LVM_FIRST + 28
-LVM_GETCOLUMNWIDTH = LVM_FIRST + 29
-LVM_SETCOLUMNWIDTH = LVM_FIRST + 30
-LVM_CREATEDRAGIMAGE = LVM_FIRST + 33
-LVM_GETVIEWRECT = LVM_FIRST + 34
-LVM_GETTEXTCOLOR = LVM_FIRST + 35
-LVM_SETTEXTCOLOR = LVM_FIRST + 36
-LVM_GETTEXTBKCOLOR = LVM_FIRST + 37
-LVM_SETTEXTBKCOLOR = LVM_FIRST + 38
-LVM_GETTOPINDEX = LVM_FIRST + 39
-LVM_GETCOUNTPERPAGE = LVM_FIRST + 40
-LVM_GETORIGIN = LVM_FIRST + 41
-LVM_UPDATE = LVM_FIRST + 42
-LVM_SETITEMSTATE = LVM_FIRST + 43
-LVM_GETITEMSTATE = LVM_FIRST + 44
-LVM_GETITEMTEXTA = LVM_FIRST + 45
-LVM_SETITEMTEXTA = LVM_FIRST + 46
-LVM_SETITEMCOUNT = LVM_FIRST + 47
-LVM_SORTITEMS = LVM_FIRST + 48
-LVM_SETITEMPOSITION32 = LVM_FIRST + 49
-LVM_GETSELECTEDCOUNT = LVM_FIRST + 50
-LVM_GETITEMSPACING = LVM_FIRST + 51
-LVM_GETISEARCHSTRINGA = LVM_FIRST + 52
-LVM_SETICONSPACING = LVM_FIRST + 53
-LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 54
-LVM_GETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 55
-LVM_GETSUBITEMRECT = LVM_FIRST + 56
-LVM_SUBITEMHITTEST = LVM_FIRST + 57
-LVM_SETCOLUMNORDERARRAY = LVM_FIRST + 58
-LVM_GETCOLUMNORDERARRAY = LVM_FIRST + 59
-LVM_SETHOTITEM = LVM_FIRST + 60
-LVM_GETHOTITEM = LVM_FIRST + 61
-LVM_SETHOTCURSOR = LVM_FIRST + 62
-LVM_GETHOTCURSOR = LVM_FIRST + 63
-LVM_APPROXIMATEVIEWRECT = LVM_FIRST + 64
-LVM_SETWORKAREA = LVM_FIRST + 65
-LVM_GETITEMW = LVM_FIRST + 75
-LVM_SETITEMW = LVM_FIRST + 76
-LVM_INSERTITEMW = LVM_FIRST + 77
-LVM_FINDITEMW = LVM_FIRST + 83
-LVM_GETSTRINGWIDTHW = LVM_FIRST + 87
-LVM_GETCOLUMNW = LVM_FIRST + 95
-LVM_SETCOLUMNW = LVM_FIRST + 96
-LVM_INSERTCOLUMNW = LVM_FIRST + 97
-LVM_GETITEMTEXTW = LVM_FIRST + 115
-LVM_SETITEMTEXTW = LVM_FIRST + 116
-LVM_GETISEARCHSTRINGW = LVM_FIRST + 117
-LVM_EDITLABELW = LVM_FIRST + 118
-LVM_GETITEM = LVM_GETITEMA
-LVM_SETITEM = LVM_SETITEMA
-LVM_INSERTITEM = LVM_INSERTITEMA
-LVM_FINDITEM = LVM_FINDITEMA
-LVM_GETSTRINGWIDTH = LVM_GETSTRINGWIDTHA
-LVM_GETCOLUMN = LVM_GETCOLUMNA
-LVM_SETCOLUMN = LVM_SETCOLUMNA
-LVM_INSERTCOLUMN = LVM_INSERTCOLUMNA
-LVM_GETITEMTEXT = LVM_GETITEMTEXTA
-LVM_SETITEMTEXT = LVM_SETITEMTEXTA
-LVM_GETISEARCHSTRING = LVM_GETISEARCHSTRINGA
-LVM_EDITLABEL = LVM_EDITLABELA
-
-; List view image list types
-
-LVSIL_NORMAL = 0
-LVSIL_SMALL = 1
-LVSIL_STATE = 2
-
-; List view item structure flags
-
-LVIF_TEXT = 0001h
-LVIF_IMAGE = 0002h
-LVIF_PARAM = 0004h
-LVIF_STATE = 0008h
-LVIF_INDENT = 0010h
-LVIF_DI_SETITEM = 1000h
-
-; List view item states
-
-LVIS_FOCUSED = 00001h
-LVIS_SELECTED = 00002h
-LVIS_CUT = 00004h
-LVIS_DROPHILITED = 00008h
-LVIS_OVERLAYMASK = 00F00h
-LVIS_STATEIMAGEMASK = 0F000h
-
-; List view callback item values
-
-LPSTR_TEXTCALLBACK = -1
-I_IMAGECALLBACK = -1
-I_CHILDRENCALLBACK = -1
-
-; List view next item relations
-
-LVNI_ALL = 000h
-LVNI_FOCUSED = 001h
-LVNI_SELECTED = 002h
-LVNI_CUT = 004h
-LVNI_DROPHILITED = 008h
-LVNI_ABOVE = 100h
-LVNI_BELOW = 200h
-LVNI_TOLEFT = 400h
-LVNI_TORIGHT = 800h
-
-; List view search types
-
-LVFI_PARAM = 01h
-LVFI_STRING = 02h
-LVFI_PARTIAL = 08h
-LVFI_WRAP = 20h
-LVFI_NEARESTXY = 40h
-
-; List view item rectangle types
-
-LVIR_BOUNDS = 0
-LVIR_ICON = 1
-LVIR_LABEL = 2
-LVIR_SELECTBOUNDS = 3
-
-; List view hit test flags
-
-LVHT_NOWHERE = 01h
-LVHT_ONITEMICON = 02h
-LVHT_ONITEMLABEL = 04h
-LVHT_ONITEMSTATEICON= 08h
-LVHT_ONITEM = LVHT_ONITEMICON or LVHT_ONITEMLABEL or LVHT_ONITEMSTATEICON
-LVHT_ABOVE = 08h
-LVHT_BELOW = 10h
-LVHT_TORIGHT = 20h
-LVHT_TOLEFT = 40h
-
-; List view alignment values
-
-LVA_DEFAULT = 000h
-LVA_ALIGNLEFT = 001h
-LVA_ALIGNTOP = 002h
-LVA_ALIGNRIGHT = 003h
-LVA_ALIGNBOTTOM = 004h
-LVA_SNAPTOGRID = 005h
-LVA_SORTASCENDING = 100h
-LVA_SORTDESCENDING = 200h
-
-; List view column structure flags
-
-LVCF_FMT = 1
-LVCF_WIDTH = 2
-LVCF_TEXT = 4
-LVCF_SUBITEM = 8
-
-; List view column alignment values
-
-LVCFMT_LEFT = 0
-LVCFMT_RIGHT = 1
-LVCFMT_CENTER = 2
-LVCFMT_JUSTIFYMASK = 3
-
-; List view column width values
-
-LVSCW_AUTOSIZE = -1
-LVSCW_AUTOSIZE_USEHEADER = -2
-
-; List view notifications
-
-LVN_ITEMCHANGING = LVN_FIRST - 0
-LVN_ITEMCHANGED = LVN_FIRST - 1
-LVN_INSERTITEM = LVN_FIRST - 2
-LVN_DELETEITEM = LVN_FIRST - 3
-LVN_DELETEALLITEMS = LVN_FIRST - 4
-LVN_BEGINLABELEDITA = LVN_FIRST - 5
-LVN_ENDLABELEDITA = LVN_FIRST - 6
-LVN_COLUMNCLICK = LVN_FIRST - 8
-LVN_BEGINDRAG = LVN_FIRST - 9
-LVN_BEGINRDRAG = LVN_FIRST - 11
-LVN_ODCACHEHINT = LVN_FIRST - 13
-LVN_ITEMACTIVATE = LVN_FIRST - 14
-LVN_GETDISPINFOA = LVN_FIRST - 50
-LVN_SETDISPINFOA = LVN_FIRST - 51
-LVN_ODFINDITEMA = LVN_FIRST - 52
-LVN_KEYDOWN = LVN_FIRST - 55
-LVN_BEGINLABELEDITW = LVN_FIRST - 75
-LVN_ENDLABELEDITW = LVN_FIRST - 76
-LVN_GETDISPINFOW = LVN_FIRST - 77
-LVN_SETDISPINFOW = LVN_FIRST - 78
-LVN_ODFINDITEMW = LVN_FIRST - 79
-LVN_BEGINLABELEDIT = LVN_BEGINLABELEDITA
-LVN_ENDLABELEDIT = LVN_ENDLABELEDITA
-LVN_GETDISPINFO = LVN_GETDISPINFOA
-LVN_SETDISPINFO = LVN_SETDISPINFOA
-LVN_ODFINDITEM = LVN_ODFINDITEMA
-
-; Tree view styles
-
-TVS_HASBUTTONS = 01h
-TVS_HASLINES = 02h
-TVS_LINESATROOT = 04h
-TVS_EDITLABELS = 08h
-TVS_DISABLEDRAGDROP = 10h
-TVS_SHOWSELALWAYS = 20h
-TVS_RTLREADING = 40h
-TVS_NOTOOLTIPS = 80h
-TVS_CHECKBOXES = 100h
-TVS_TRACKSELECT = 200h
-TVS_SINGLEEXPAND = 400h
-TVS_INFOTIP = 800h
-TVS_FULLROWSELECT = 1000h
-TVS_NOSCROLL = 2000h
-TVS_NONEVENHEIGHT = 4000h
-TVS_NOHSCROLL = 8000h
-
-; Tree view item structure flags
-
-TVIF_TEXT = 0001h
-TVIF_IMAGE = 0002h
-TVIF_PARAM = 0004h
-TVIF_STATE = 0008h
-TVIF_HANDLE = 0010h
-TVIF_SELECTEDIMAGE = 0020h
-TVIF_CHILDREN = 0040h
-TVIF_DI_SETITEM = 1000h
-
-; Tree view item states
-
-TVIS_FOCUSED = 00001h
-TVIS_SELECTED = 00002h
-TVIS_CUT = 00004h
-TVIS_DROPHILITED = 00008h
-TVIS_BOLD = 00010h
-TVIS_EXPANDED = 00020h
-TVIS_EXPANDEDONCE = 00040h
-TVIS_EXPANDPARTIAL = 00080h
-TVIS_OVERLAYMASK = 00F00h
-TVIS_STATEIMAGEMASK = 0F000h
-TVIS_USERMASK = 0F000h
-
-; Tree view predefined item values
-
-TVI_ROOT = 0FFFF0000h
-TVI_FIRST = 0FFFF0001h
-TVI_LAST = 0FFFF0002h
-TVI_SORT = 0FFFF0003h
-
-; Tree view messages
-
-TVM_INSERTITEMA = TV_FIRST + 0
-TVM_DELETEITEM = TV_FIRST + 1
-TVM_EXPAND = TV_FIRST + 2
-TVM_GETITEMRECT = TV_FIRST + 4
-TVM_GETCOUNT = TV_FIRST + 5
-TVM_GETINDENT = TV_FIRST + 6
-TVM_SETINDENT = TV_FIRST + 7
-TVM_GETIMAGELIST = TV_FIRST + 8
-TVM_SETIMAGELIST = TV_FIRST + 9
-TVM_GETNEXTITEM = TV_FIRST + 10
-TVM_SELECTITEM = TV_FIRST + 11
-TVM_GETITEMA = TV_FIRST + 12
-TVM_SETITEMA = TV_FIRST + 13
-TVM_EDITLABELA = TV_FIRST + 14
-TVM_GETEDITCONTROL = TV_FIRST + 15
-TVM_GETVISIBLECOUNT = TV_FIRST + 16
-TVM_HITTEST = TV_FIRST + 17
-TVM_CREATEDRAGIMAGE = TV_FIRST + 18
-TVM_SORTCHILDREN = TV_FIRST + 19
-TVM_ENSUREVISIBLE = TV_FIRST + 20
-TVM_SORTCHILDRENCB = TV_FIRST + 21
-TVM_ENDEDITLABELNOW = TV_FIRST + 22
-TVM_GETISEARCHSTRINGA = TV_FIRST + 23
-TVM_INSERTITEMW = TV_FIRST + 50
-TVM_GETITEMW = TV_FIRST + 62
-TVM_SETITEMW = TV_FIRST + 63
-TVM_GETISEARCHSTRINGW = TV_FIRST + 64
-TVM_EDITLABELW = TV_FIRST + 65
-TVM_INSERTITEM = TVM_INSERTITEMA
-TVM_GETITEM = TVM_GETITEMA
-TVM_SETITEM = TVM_SETITEMA
-TVM_GETISEARCHSTRING = TVM_GETISEARCHSTRINGA
-TVM_EDITLABEL = TVM_EDITLABELA
-
-; Tree view action flags
-
-TVE_COLLAPSE = 0001h
-TVE_EXPAND = 0002h
-TVE_TOGGLE = 0003h
-TVE_EXPANDPARTIAL = 4000h
-TVE_COLLAPSERESET = 8000h
-
-; Tree view image list types
-
-TVSIL_NORMAL = 0
-TVSIL_STATE = 2
-
-; Tree view next item types
-
-TVGN_ROOT = 0
-TVGN_NEXT = 1
-TVGN_PREVIOUS = 2
-TVGN_PARENT = 3
-TVGN_CHILD = 4
-TVGN_FIRSTVISIBLE = 5
-TVGN_NEXTVISIBLE = 6
-TVGN_PREVIOUSVISIBLE = 7
-TVGN_DROPHILITE = 8
-TVGN_CARET = 9
-
-; Tree view hit test flags
-
-TVHT_NOWHERE = 001h
-TVHT_ONITEMICON = 002h
-TVHT_ONITEMLABEL = 004h
-TVHT_ONITEMINDENT = 008h
-TVHT_ONITEMBUTTON = 010h
-TVHT_ONITEMRIGHT = 020h
-TVHT_ONITEMSTATEICON = 040h
-TVHT_ONITEM = TVHT_ONITEMICON or TVHT_ONITEMLABEL or TVHT_ONITEMSTATEICON
-TVHT_ABOVE = 100h
-TVHT_BELOW = 200h
-TVHT_TORIGHT = 400h
-TVHT_TOLEFT = 800h
-
-; Tree view notifications
-
-TVN_SELCHANGINGA = TVN_FIRST - 1
-TVN_SELCHANGEDA = TVN_FIRST - 2
-TVN_GETDISPINFOA = TVN_FIRST - 3
-TVN_SETDISPINFOA = TVN_FIRST - 4
-TVN_ITEMEXPANDINGA = TVN_FIRST - 5
-TVN_ITEMEXPANDEDA = TVN_FIRST - 6
-TVN_BEGINDRAGA = TVN_FIRST - 7
-TVN_BEGINRDRAGA = TVN_FIRST - 8
-TVN_DELETEITEMA = TVN_FIRST - 9
-TVN_BEGINLABELEDITA = TVN_FIRST - 10
-TVN_ENDLABELEDITA = TVN_FIRST - 11
-TVN_KEYDOWN = TVN_FIRST - 12
-TVN_SELCHANGINGW = TVN_FIRST - 50
-TVN_SELCHANGEDW = TVN_FIRST - 51
-TVN_GETDISPINFOW = TVN_FIRST - 52
-TVN_SETDISPINFOW = TVN_FIRST - 53
-TVN_ITEMEXPANDINGW = TVN_FIRST - 54
-TVN_ITEMEXPANDEDW = TVN_FIRST - 55
-TVN_BEGINDRAGW = TVN_FIRST - 56
-TVN_BEGINRDRAGW = TVN_FIRST - 57
-TVN_DELETEITEMW = TVN_FIRST - 58
-TVN_BEGINLABELEDITW = TVN_FIRST - 59
-TVN_ENDLABELEDITW = TVN_FIRST - 60
-TVN_SELCHANGING = TVN_SELCHANGINGA
-TVN_SELCHANGED = TVN_SELCHANGEDA
-TVN_GETDISPINFO = TVN_GETDISPINFOA
-TVN_SETDISPINFO = TVN_SETDISPINFOA
-TVN_ITEMEXPANDING = TVN_ITEMEXPANDINGA
-TVN_ITEMEXPANDED = TVN_ITEMEXPANDEDA
-TVN_BEGINDRAG = TVN_BEGINDRAGA
-TVN_BEGINRDRAG = TVN_BEGINRDRAGA
-TVN_DELETEITEM = TVN_DELETEITEMA
-TVN_BEGINLABELEDIT = TVN_BEGINLABELEDITA
-TVN_ENDLABELEDIT = TVN_ENDLABELEDITA
-
-; Tree view action flags
-
-TVC_UNKNOWN = 0
-TVC_BYMOUSE = 1
-TVC_BYKEYBOARD = 2
-
-; Tab control styles
-
-TCS_SCROLLOPPOSITE = 0001h
-TCS_BOTTOM = 0002h
-TCS_RIGHT = 0002h
-TCS_FORCEICONLEFT = 0010h
-TCS_FORCELABELLEFT = 0020h
-TCS_HOTTRACK = 0040h
-TCS_VERTICAL = 0080h
-TCS_TABS = 0000h
-TCS_BUTTONS = 0100h
-TCS_SINGLELINE = 0000h
-TCS_MULTILINE = 0200h
-TCS_RIGHTJUSTIFY = 0000h
-TCS_FIXEDWIDTH = 0400h
-TCS_RAGGEDRIGHT = 0800h
-TCS_FOCUSONBUTTONDOWN = 1000h
-TCS_OWNERDRAWFIXED = 2000h
-TCS_TOOLTIPS = 4000h
-TCS_FOCUSNEVER = 8000h
-
-; Tab control messages
-
-TCM_GETIMAGELIST = TCM_FIRST + 2
-TCM_SETIMAGELIST = TCM_FIRST + 3
-TCM_GETITEMCOUNT = TCM_FIRST + 4
-TCM_GETITEMA = TCM_FIRST + 5
-TCM_SETITEMA = TCM_FIRST + 6
-TCM_INSERTITEMA = TCM_FIRST + 7
-TCM_DELETEITEM = TCM_FIRST + 8
-TCM_DELETEALLITEMS = TCM_FIRST + 9
-TCM_GETITEMRECT = TCM_FIRST + 10
-TCM_GETCURSEL = TCM_FIRST + 11
-TCM_SETCURSEL = TCM_FIRST + 12
-TCM_HITTEST = TCM_FIRST + 13
-TCM_SETITEMEXTRA = TCM_FIRST + 14
-TCM_ADJUSTRECT = TCM_FIRST + 40
-TCM_SETITEMSIZE = TCM_FIRST + 41
-TCM_REMOVEIMAGE = TCM_FIRST + 42
-TCM_SETPADDING = TCM_FIRST + 43
-TCM_GETROWCOUNT = TCM_FIRST + 44
-TCM_GETTOOLTIPS = TCM_FIRST + 45
-TCM_SETTOOLTIPS = TCM_FIRST + 46
-TCM_GETCURFOCUS = TCM_FIRST + 47
-TCM_SETCURFOCUS = TCM_FIRST + 48
-TCM_GETITEMW = TCM_FIRST + 60
-TCM_SETITEMW = TCM_FIRST + 61
-TCM_INSERTITEMW = TCM_FIRST + 62
-TCM_GETITEM = TCM_GETITEMA
-TCM_SETITEM = TCM_SETITEMA
-TCM_INSERTITEM = TCM_INSERTITEMA
-
-; Tab control item structure flags
-
-TCIF_TEXT = 1
-TCIF_IMAGE = 2
-TCIF_RTLREADING = 4
-TCIF_PARAM = 8
-
-; Tab control hit test flags
-
-TCHT_NOWHERE = 1
-TCHT_ONITEMICON = 2
-TCHT_ONITEMLABEL = 4
-TCHT_ONITEM = TCHT_ONITEMICON or TCHT_ONITEMLABEL
-
-; Tab control notifications
-
-TCN_KEYDOWN = TCN_FIRST - 0
-TCN_SELCHANGE = TCN_FIRST - 1
-TCN_SELCHANGING = TCN_FIRST - 2
-
-; Animation control styles
-
-ACS_CENTER = 1
-ACS_TRANSPARENT = 2
-ACS_AUTOPLAY = 4
-ACS_TIMER = 8
-
-; Animation control messages
-
-ACM_OPENA = WM_USER + 100
-ACM_PLAY = WM_USER + 101
-ACM_STOP = WM_USER + 102
-ACM_OPENW = WM_USER + 103
-ACM_OPEN = ACM_OPENA
-
-; Animation control notifications
-
-ACN_START = 1
-ACN_STOP = 2
-
-; Month calendar styles
-
-MCS_DAYSTATE = 1
-MCS_MULTISELECT = 2
-MCS_WEEKNUMBERS = 4
-MCS_NOTODAY = 8
-
-; Month calendar messages
-
-MCM_GETCURSEL = MCM_FIRST + 1
-MCM_SETCURSEL = MCM_FIRST + 2
-MCM_GETMAXSELCOUNT = MCM_FIRST + 3
-MCM_SETMAXSELCOUNT = MCM_FIRST + 4
-MCM_GETSELRANGE = MCM_FIRST + 5
-MCM_SETSELRANGE = MCM_FIRST + 6
-MCM_GETMONTHRANGE = MCM_FIRST + 7
-MCM_SETDAYSTATE = MCM_FIRST + 8
-MCM_GETMINREQRECT = MCM_FIRST + 9
-MCM_SETCOLOR = MCM_FIRST + 10
-MCM_GETCOLOR = MCM_FIRST + 11
-MCM_SETTODAY = MCM_FIRST + 12
-MCM_GETTODAY = MCM_FIRST + 13
-MCM_HITTEST = MCM_FIRST + 14
-MCM_SETFIRSTDAYOFWEEK = MCM_FIRST + 15
-MCM_GETFIRSTDAYOFWEEK = MCM_FIRST + 16
-MCM_GETRANGE = MCM_FIRST + 17
-MCM_SETRANGE = MCM_FIRST + 18
-MCM_GETMONTHDELTA = MCM_FIRST + 19
-MCM_SETMONTHDELTA = MCM_FIRST + 20
-
-; Month calendar hit test flags
-
-MCHT_TITLE = 0010000h
-MCHT_CALENDAR = 0020000h
-MCHT_TODAYLINK = 0030000h
-MCHT_NEXT = 1000000h
-MCHT_PREV = 2000000h
-MCHT_NOWHERE = 0000000h
-MCHT_TITLEBK = MCHT_TITLE
-MCHT_TITLEMONTH = MCHT_TITLE or 1
-MCHT_TITLEYEAR = MCHT_TITLE or 2
-MCHT_TITLEBTNNEXT = MCHT_TITLE or MCHT_NEXT or 3
-MCHT_TITLEBTNPREV = MCHT_TITLE or MCHT_PREV or 3
-MCHT_CALENDARBK = MCHT_CALENDAR
-MCHT_CALENDARDATE = MCHT_CALENDAR or 1
-MCHT_CALENDARDATENEXT = MCHT_CALENDARDATE or MCHT_NEXT
-MCHT_CALENDARDATEPREV = MCHT_CALENDARDATE or MCHT_PREV
-MCHT_CALENDARDAY = MCHT_CALENDAR or 2
-MCHT_CALENDARWEEKNUM = MCHT_CALENDAR or 3
-
-; Month calendar color codes
-
-MCSC_BACKGROUND = 0
-MCSC_TEXT = 1
-MCSC_TITLEBK = 2
-MCSC_TITLETEXT = 3
-MCSC_MONTHBK = 4
-MCSC_TRAILINGTEXT = 5
-
-; Month calendar notifications
-
-MCN_SELCHANGE = MCN_FIRST + 1
-MCN_GETDAYSTATE = MCN_FIRST + 3
-MCN_SELECT = MCN_FIRST + 4
-
-; Date-time pick control messages
-
-DTM_GETSYSTEMTIME = DTM_FIRST + 1
-DTM_SETSYSTEMTIME = DTM_FIRST + 2
-DTM_GETRANGE = DTM_FIRST + 3
-DTM_SETRANGE = DTM_FIRST + 4
-DTM_SETFORMATA = DTM_FIRST + 5
-DTM_SETMCCOLOR = DTM_FIRST + 6
-DTM_GETMCCOLOR = DTM_FIRST + 7
-DTM_GETMONTHCAL = DTM_FIRST + 8
-DTM_SETMCFONT = DTM_FIRST + 9
-DTM_GETMCFONT = DTM_FIRST + 10
-DTM_SETFORMATW = DTM_FIRST + 50
-DTM_SETFORMAT = DTM_SETFORMATA
-
-; Date-time pick control styles
-
-DTS_UPDOWN = 01h
-DTS_SHOWNONE = 02h
-DTS_SHORTDATEFORMAT = 00h
-DTS_LONGDATEFORMAT = 04h
-DTS_TIMEFORMAT = 09h
-DTS_APPCANPARSE = 10h
-DTS_RIGHTALIGN = 20h
-
-; Date-time pick control notifications
-
-DTN_DATETIMECHANGE = DTN_FIRST + 1
-DTN_USERSTRINGA = DTN_FIRST + 2
-DTN_WMKEYDOWNA = DTN_FIRST + 3
-DTN_FORMATA = DTN_FIRST + 4
-DTN_FORMATQUERYA = DTN_FIRST + 5
-DTN_DROPDOWN = DTN_FIRST + 6
-DTN_CLOSEUP = DTN_FIRST + 7
-DTN_USERSTRINGW = DTN_FIRST + 15
-DTN_WMKEYDOWNW = DTN_FIRST + 16
-DTN_FORMATW = DTN_FIRST + 17
-DTN_FORMATQUERYW = DTN_FIRST + 18
-DTN_USERSTRING = DTN_USERSTRINGA
-DTN_WMKEYDOWN = DTN_WMKEYDOWNA
-DTN_FORMAT = DTN_FORMATA
-DTN_FORMATQUERY = DTN_FORMATQUERYA
-
-; ImageList_LoadImage types
-
-IMAGE_BITMAP = 0
-IMAGE_ICON = 1
-IMAGE_CURSOR = 2
-IMAGE_ENHMETAFILE = 3
-
-; ImageList_LoadImage flags
-
-LR_DEFAULTCOLOR = 0000h
-LR_MONOCHROME = 0001h
-LR_COLOR = 0002h
-LR_COPYRETURNORG = 0004h
-LR_COPYDELETEORG = 0008h
-LR_LOADFROMFILE = 0010h
-LR_LOADTRANSPARENT = 0020h
-LR_DEFAULTSIZE = 0040h
-LR_VGACOLOR = 0080h
-LR_LOADMAP3DCOLORS = 1000h
-LR_CREATEDIBSECTION = 2000h
-LR_COPYFROMRESOURCE = 4000h
-LR_SHARED = 8000h
-
-; IP control messages
-
-IPM_CLEARADDRESS = WM_USER + 100
-IPM_SETADDRESS = WM_USER + 101
-IPM_GETADDRESS = WM_USER + 102
-IPM_SETRANGE = WM_USER + 103
-IPM_SETFOCUS = WM_USER + 104
-IPM_ISBLANK = WM_USER + 105
DELETED freshlib/equates/Win32/_COMDLG32.INC
Index: freshlib/equates/Win32/_COMDLG32.INC
==================================================================
--- freshlib/equates/Win32/_COMDLG32.INC
+++ /dev/null
@@ -1,346 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: COMDLG32.DLL structures and constants
-;
-; Target OS: Win32
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-
-
-struct OPENFILENAME
- .lStructSize dd ?
- .hwndOwner dd ?
- .hInstance dd ?
- .lpstrFilter dd ?
- .lpstrCustomFilter dd ?
- .nMaxCustFilter dd ?
- .nFilterIndex dd ?
- .lpstrFile dd ?
- .nMaxFile dd ?
- .lpstrFileTitle dd ?
- .nMaxFileTitle dd ?
- .lpstrInitialDir dd ?
- .lpstrTitle dd ?
- .Flags dd ?
- .nFileOffset dw ?
- .nFileExtension dw ?
- .lpstrDefExt dd ?
- .lCustData dd ?
- .lpfnHook dd ?
- .lpTemplateName dd ?
-ends
-
-struct CHOOSECOLOR
- .lStructSize dd ?
- .hwndOwner dd ?
- .hInstance dd ?
- .rgbResult dd ?
- .lpCustColors dd ?
- .Flags dd ?
- .lCustData dd ?
- .lpfnHook dd ?
- .lpTemplateName dd ?
-ends
-
-struct FINDREPLACE
- .lStructSize dd ?
- .hwndOwner dd ?
- .hInstance dd ?
- .Flags dd ?
- .lpstrFindWhat dd ?
- .lpstrReplaceWith dd ?
- .wFindWhatLen dw ?
- .wReplaceWithLen dw ?
- .lCustData dd ?
- .lpfnHook dd ?
- .lpTemplateName dd ?
-ends
-
-struct CHOOSEFONT
- .lStructSize dd ?
- .hwndOwner dd ?
- .hDC dd ?
- .lpLogFont dd ?
- .iPointSize dd ?
- .Flags dd ?
- .rgbColors dd ?
- .lCustData dd ?
- .lpfnHook dd ?
- .lpTemplateName dd ?
- .hInstance dd ?
- .lpszStyle dd ?
- .nFontType dw ?
- .wReserved dw ?
- .nSizeMin dd ?
- .nSizeMax dd ?
-ends
-
-struct PRINTDLG
- .lStructSize dd ?
- .hwndOwner dd ?
- .hDevMode dd ?
- .hDevNames dd ?
- .hDC dd ?
- .Flags dd ?
- .nFromPage dw ?
- .nToPage dw ?
- .nMinPage dw ?
- .nMaxPage dw ?
- .nCopies dw ?
- .hInstance dd ?
- .lCustData dd ?
- .lpfnPrintHook dd ?
- .lpfnSetupHook dd ?
- .lpPrintTemplateName dd ?
- .lpSetupTemplateName dd ?
- .hPrintTemplate dd ?
- .hSetupTemplate dd ?
-ends
-
-struct DEVNAMES
- .wDriverOffset dw ?
- .wDeviceOffset dw ?
- .wOutputOffset dw ?
- .wDefault dw ?
-ends
-
-struct PAGESETUPDLG
- .lStructSize dd ?
- .hwndOwner dd ?
- .hDevMode dd ?
- .hDevNames dd ?
- .Flags dd ?
- .ptPaperSize POINT
- .rtMinMargin RECT
- .rtMargin RECT
- .hInstance dd ?
- .lCustData dd ?
- .lpfnPageSetupHook dd ?
- .lpfnPagePaintHook dd ?
- .lpPageSetupTemplateName dd ?
- .hPageSetupTemplate dd ?
-ends
-
-; OPENFILENAME flags
-
-OFN_READONLY = 000001h
-OFN_OVERWRITEPROMPT = 000002h
-OFN_HIDEREADONLY = 000004h
-OFN_NOCHANGEDIR = 000008h
-OFN_SHOWHELP = 000010h
-OFN_ENABLEHOOK = 000020h
-OFN_ENABLETEMPLATE = 000040h
-OFN_ENABLETEMPLATEHANDLE = 000080h
-OFN_NOVALIDATE = 000100h
-OFN_ALLOWMULTISELECT = 000200h
-OFN_EXTENSIONDIFFERENT = 000400h
-OFN_PATHMUSTEXIST = 000800h
-OFN_FILEMUSTEXIST = 001000h
-OFN_CREATEPROMPT = 002000h
-OFN_SHAREAWARE = 004000h
-OFN_NOREADONLYRETURN = 008000h
-OFN_NOTESTFILECREATE = 010000h
-OFN_NONETWORKBUTTON = 020000h
-OFN_NOLONGNAMES = 040000h
-OFN_EXPLORER = 080000h
-OFN_NODEREFERENCELINKS = 100000h
-OFN_LONGNAMES = 200000h
-
-; Common dialog notifications
-
-CDN_FIRST = -601
-CDN_LAST = -699
-CDN_INITDONE = CDN_FIRST - 0
-CDN_SELCHANGE = CDN_FIRST - 1
-CDN_FOLDERCHANGE = CDN_FIRST - 2
-CDN_SHAREVIOLATION = CDN_FIRST - 3
-CDN_HELP = CDN_FIRST - 4
-CDN_FILEOK = CDN_FIRST - 5
-CDN_TYPECHANGE = CDN_FIRST - 6
-
-; Common dialog messages
-
-CDM_FIRST = WM_USER + 100
-CDM_LAST = WM_USER + 200
-CDM_GETSPEC = CDM_FIRST + 0
-CDM_GETFILEPATH = CDM_FIRST + 1
-CDM_GETFOLDERPATH = CDM_FIRST + 2
-CDM_GETFOLDERIDLIST = CDM_FIRST + 3
-CDM_SETCONTROLTEXT = CDM_FIRST + 4
-CDM_HIDECONTROL = CDM_FIRST + 5
-CDM_SETDEFEXT = CDM_FIRST + 6
-
-; CHOOSECOLOR flags
-
-CC_RGBINIT = 001h
-CC_FULLOPEN = 002h
-CC_PREVENTFULLOPEN = 004h
-CC_SHOWHELP = 008h
-CC_ENABLEHOOK = 010h
-CC_ENABLETEMPLATE = 020h
-CC_ENABLETEMPLATEHANDLE = 040h
-CC_SOLIDCOLOR = 080h
-CC_ANYCOLOR = 100h
-
-; FINDREPLACE flags
-
-FR_DOWN = 00001h
-FR_WHOLEWORD = 00002h
-FR_MATCHCASE = 00004h
-FR_FINDNEXT = 00008h
-FR_REPLACE = 00010h
-FR_REPLACEALL = 00020h
-FR_DIALOGTERM = 00040h
-FR_SHOWHELP = 00080h
-FR_ENABLEHOOK = 00100h
-FR_ENABLETEMPLATE = 00200h
-FR_NOUPDOWN = 00400h
-FR_NOMATCHCASE = 00800h
-FR_NOWHOLEWORD = 01000h
-FR_ENABLETEMPLATEHANDLE = 02000h
-FR_HIDEUPDOWN = 04000h
-FR_HIDEMATCHCASE = 08000h
-FR_HIDEWHOLEWORD = 10000h
-
-; CHOOSEFONT flags
-
-CF_SCREENFONTS = 0000001h
-CF_PRINTERFONTS = 0000002h
-CF_BOTH = CF_SCREENFONTS or CF_PRINTERFONTS
-CF_SHOWHELP = 0000004h
-CF_ENABLEHOOK = 0000008h
-CF_ENABLETEMPLATE = 0000010h
-CF_ENABLETEMPLATEHANDLE = 0000020h
-CF_INITTOLOGFONTSTRUCT = 0000040h
-CF_USESTYLE = 0000080h
-CF_EFFECTS = 0000100h
-CF_APPLY = 0000200h
-CF_ANSIONLY = 0000400h
-CF_SCRIPTSONLY = CF_ANSIONLY
-CF_NOVECTORFONTS = 0000800h
-CF_NOOEMFONTS = CF_NOVECTORFONTS
-CF_NOSIMULATIONS = 0001000h
-CF_LIMITSIZE = 0002000h
-CF_FIXEDPITCHONLY = 0004000h
-CF_WYSIWYG = 0008000h
-CF_FORCEFONTEXIST = 0010000h
-CF_SCALABLEONLY = 0020000h
-CF_TTONLY = 0040000h
-CF_NOFACESEL = 0080000h
-CF_NOSTYLESEL = 0100000h
-CF_NOSIZESEL = 0200000h
-CF_SELECTSCRIPT = 0400000h
-CF_NOSCRIPTSEL = 0800000h
-CF_NOVERTFONTS = 1000000h
-
-; ChooseFont messages
-
-WM_CHOOSEFONT_GETLOGFONT = WM_USER + 1
-WM_CHOOSEFONT_SETLOGFONT = WM_USER + 101
-WM_CHOOSEFONT_SETFLAGS = WM_USER + 102
-
-; PRINTDLG flags
-
-PD_ALLPAGES = 000000h
-PD_SELECTION = 000001h
-PD_PAGENUMS = 000002h
-PD_NOSELECTION = 000004h
-PD_NOPAGENUMS = 000008h
-PD_COLLATE = 000010h
-PD_PRINTTOFILE = 000020h
-PD_PRINTSETUP = 000040h
-PD_NOWARNING = 000080h
-PD_RETURNDC = 000100h
-PD_RETURNIC = 000200h
-PD_RETURNDEFAULT = 000400h
-PD_SHOWHELP = 000800h
-PD_ENABLEPRINTHOOK = 001000h
-PD_ENABLESETUPHOOK = 002000h
-PD_ENABLEPRINTTEMPLATE = 004000h
-PD_ENABLESETUPTEMPLATE = 008000h
-PD_ENABLEPRINTTEMPLATEHANDLE = 010000h
-PD_ENABLESETUPTEMPLATEHANDLE = 020000h
-PD_USEDEVMODECOPIES = 040000h
-PD_USEDEVMODECOPIESANDCOLLATE = 040000h
-PD_DISABLEPRINTTOFILE = 080000h
-PD_HIDEPRINTTOFILE = 100000h
-PD_NONETWORKBUTTON = 200000h
-
-; PAGESETUPDLG flags
-
-PSD_DEFAULTMINMARGINS = 000000h
-PSD_INWININIINTLMEASURE = 000000h
-PSD_MINMARGINS = 000001h
-PSD_MARGINS = 000002h
-PSD_INTHOUSANDTHSOFINCHES = 000004h
-PSD_INHUNDREDTHSOFMILLIMETERS = 000008h
-PSD_DISABLEMARGINS = 000010h
-PSD_DISABLEPRINTER = 000020h
-PSD_NOWARNING = 000080h
-PSD_DISABLEORIENTATION = 000100h
-PSD_RETURNDEFAULT = 000400h
-PSD_DISABLEPAPER = 000200h
-PSD_SHOWHELP = 000800h
-PSD_ENABLEPAGESETUPHOOK = 002000h
-PSD_ENABLEPAGESETUPTEMPLATE = 008000h
-PSD_ENABLEPAGESETUPTEMPLATEHANDLE = 020000h
-PSD_ENABLEPAGEPAINTHOOK = 040000h
-PSD_DISABLEPAGEPAINTING = 080000h
-PSD_NONETWORKBUTTON = 200000h
-
-; PageSetupDlg messages
-
-WM_PSD_PAGESETUPDLG = WM_USER
-WM_PSD_FULLPAGERECT = WM_USER + 1
-WM_PSD_MINMARGINRECT = WM_USER + 2
-WM_PSD_MARGINRECT = WM_USER + 3
-WM_PSD_GREEKTEXTRECT = WM_USER + 4
-WM_PSD_ENVSTAMPRECT = WM_USER + 5
-WM_PSD_YAFULLPAGERECT = WM_USER + 6
-
-; Common dialog error codes
-
-CDERR_DIALOGFAILURE = 0FFFFh
-CDERR_GENERALCODES = 00000h
-CDERR_STRUCTSIZE = 00001h
-CDERR_INITIALIZATION = 00002h
-CDERR_NOTEMPLATE = 00003h
-CDERR_NOHINSTANCE = 00004h
-CDERR_LOADSTRFAILURE = 00005h
-CDERR_FINDRESFAILURE = 00006h
-CDERR_LOADRESFAILURE = 00007h
-CDERR_LOCKRESFAILURE = 00008h
-CDERR_MEMALLOCFAILURE = 00009h
-CDERR_MEMLOCKFAILURE = 0000Ah
-CDERR_NOHOOK = 0000Bh
-CDERR_REGISTERMSGFAIL = 0000Ch
-PDERR_PRINTERCODES = 01000h
-PDERR_SETUPFAILURE = 01001h
-PDERR_PARSEFAILURE = 01002h
-PDERR_RETDEFFAILURE = 01003h
-PDERR_LOADDRVFAILURE = 01004h
-PDERR_GETDEVMODEFAIL = 01005h
-PDERR_INITFAILURE = 01006h
-PDERR_NODEVICES = 01007h
-PDERR_NODEFAULTPRN = 01008h
-PDERR_DNDMMISMATCH = 01009h
-PDERR_CREATEICFAILURE = 0100Ah
-PDERR_PRINTERNOTFOUND = 0100Bh
-PDERR_DEFAULTDIFFERENT = 0100Ch
-CFERR_CHOOSEFONTCODES = 02000h
-CFERR_NOFONTS = 02001h
-CFERR_MAXLESSTHANMIN = 02002h
-FNERR_FILENAMECODES = 03000h
-FNERR_SUBCLASSFAILURE = 03001h
-FNERR_INVALIDFILENAME = 03002h
-FNERR_BUFFERTOOSMALL = 03003h
-FRERR_FINDREPLACECODES = 04000h
-FRERR_BUFFERLENGTHZERO = 04001h
-CCERR_CHOOSECOLORCODES = 05000h
DELETED freshlib/equates/Win32/_GDI32.INC
Index: freshlib/equates/Win32/_GDI32.INC
==================================================================
--- freshlib/equates/Win32/_GDI32.INC
+++ /dev/null
@@ -1,498 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: GDI32.DLL structures and constants
-;
-; Target OS: Win32
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-struct SIZE
- .cx dd ?
- .cy dd ?
-ends
-
-struct BITMAP
- .bmType dd ?
- .bmWidth dd ?
- .bmHeight dd ?
- .bmWidthBytes dd ?
- .bmPlanes dw ?
- .bmBitsPixel dw ?
- .bmBits dd ?
-ends
-
-struct BITMAPCOREHEADER
- .bcSize dd ?
- .bcWidth dw ?
- .bcHeight dw ?
- .bcPlanes dw ?
- .bcBitCount dw ?
-ends
-
-struct BITMAPINFOHEADER
- .biSize dd ?
- .biWidth dd ?
- .biHeight dd ?
- .biPlanes dw ?
- .biBitCount dw ?
- .biCompression dd ?
- .biSizeImage dd ?
- .biXPelsPerMeter dd ?
- .biYPelsPerMeter dd ?
- .biClrUsed dd ?
- .biClrImportant dd ?
-ends
-
-struct BITMAPFILEHEADER
- .bfType dw ?
- .bfSize dd ?
- .bfReserved1 dw ?
- .bfReserved2 dw ?
- .bfOffBits dd ?
-ends
-
-struct TEXTMETRIC
- .tmHeight dd ?
- .tmAscent dd ?
- .tmDescent dd ?
- .tmInternalLeading dd ?
- .tmExternalLeading dd ?
- .tmAveCharWidth dd ?
- .tmMaxCharWidth dd ?
- .tmWeight dd ?
- .tmOverhang dd ?
- .tmDigitizedAspectX dd ?
- .tmDigitizedAspectY dd ?
- .tmFirstChar db ?
- .tmLastChar db ?
- .tmDefaultChar db ?
- .tmBreakChar db ?
- .tmItalic db ?
- .tmUnderlined db ?
- .tmStruckOut db ?
- .tmPitchAndFamily db ?
- .tmCharSet db ?
- .__align rb 7
-ends
-
-struct LOGBRUSH
- .lbStyle dd ?
- .lbColor dd ?
- .lbHatch dd ?
-ends
-
-struct LOGPEN
- .lopnStyle dd ?
- .lopnWidth POINT
- .lopnColor dd ?
-ends
-
-struct EXTLOGPEN
- .elpPenStyle dd ?
- .elpWidth dd ?
- .elpBrushStyle dd ?
- .elpColor dd ?
- .elpHatch dd ?
- .elpNumEntries dd ?
- .elpStyleEntry dd ?
-ends
-
-struct LOGFONT
- .lfHeight dd ?
- .lfWidth dd ?
- .lfEscapement dd ?
- .lfOrientation dd ?
- .lfWeight dd ?
- .lfItalic db ?
- .lfUnderline db ?
- .lfStrikeOut db ?
- .lfCharSet db ?
- .lfOutPrecision db ?
- .lfClipPrecision db ?
- .lfQuality db ?
- .lfPitchAndFamily db ?
- .lfFaceName rb 32
-ends
-
-struct ENUMLOGFONT
- .elfLogFont LOGFONT
- .elfFullName rb 64
- .elfStyle rb 32
-ends
-
-struct ENUMLOGFONTEX
- .elfLogFont LOGFONT
- .elfFullName rb 64
- .elfStyle rb 32
- .elfScript rb 32
-ends
-
-struct PIXELFORMATDESCRIPTOR
- .nSize dw ?
- .nVersion dw ?
- .dwFlags dd ?
- .iPixelType db ?
- .cColorBits db ?
- .cRedBits db ?
- .cRedShift db ?
- .cGreenBits db ?
- .cGreenShift db ?
- .cBlueBits db ?
- .cBlueShift db ?
- .cAlphaBits db ?
- .cAlphaShift db ?
- .cAccumBits db ?
- .cAccumRedBits db ?
- .cAccumGreenBits db ?
- .cAccumBlueBits db ?
- .cAccumAlphaBits db ?
- .cDepthBits db ?
- .cStencilBits db ?
- .cAuxBuffers db ?
- .iLayerType db ?
- .bReserved db ?
- .dwLayerMask dd ?
- .dwVisibleMask dd ?
- .dwDamageMask dd ?
-ends
-
-; General constants
-
-GDI_ERROR = 0FFFFFFFFh
-HGDI_ERROR = 0FFFFFFFFh
-
-; Binary raster operations
-
-R2_BLACK = 1
-R2_NOTMERGEPEN = 2
-R2_MASKNOTPEN = 3
-R2_NOTCOPYPEN = 4
-R2_MASKPENNOT = 5
-R2_NOT = 6
-R2_XORPEN = 7
-R2_NOTMASKPEN = 8
-R2_MASKPEN = 9
-R2_NOTXORPEN = 10
-R2_NOP = 11
-R2_MERGENOTPEN = 12
-R2_COPYPEN = 13
-R2_MERGEPENNOT = 14
-R2_MERGEPEN = 15
-R2_WHITE = 16
-
-; Raster operations
-
-SRCCOPY = 00CC0020h
-SRCPAINT = 00EE0086h
-SRCAND = 008800C6h
-SRCINVERT = 00660046h
-SRCERASE = 00440328h
-NOTSRCCOPY = 00330008h
-NOTSRCERASE = 001100A6h
-MERGECOPY = 00C000CAh
-MERGEPAINT = 00BB0226h
-PATCOPY = 00F00021h
-PATPAINT = 00FB0A09h
-PATINVERT = 005A0049h
-DSTINVERT = 00550009h
-BLACKNESS = 00000042h
-WHITENESS = 00FF0062h
-
-; Region flags
-
-ERROR = 0
-NULLREGION = 1
-SIMPLEREGION = 2
-COMPLEXREGION = 3
-
-; CombineRgn styles
-
-RGN_AND = 1
-RGN_OR = 2
-RGN_XOR = 3
-RGN_DIFF = 4
-RGN_COPY = 5
-
-; StretchBlt modes
-
-BLACKONWHITE = 1
-WHITEONBLACK = 2
-COLORONCOLOR = 3
-HALFTONE = 4
-STRETCH_ANDSCANS = BLACKONWHITE
-STRETCH_ORSCANS = WHITEONBLACK
-STRETCH_DELETESCANS = COLORONCOLOR
-STRETCH_HALFTONE = HALFTONE
-
-; PolyFill modes
-
-ALTERNATE = 1
-WINDING = 2
-
-; Background modes
-
-TRANSPARENT = 1
-OPAQUE = 2
-
-; Point types
-
-PT_CLOSEFIGURE = 1
-PT_LINETO = 2
-PT_BEZIERTO = 4
-PT_MOVETO = 6
-
-; Mapping modes
-
-MM_TEXT = 1
-MM_LOMETRIC = 2
-MM_HIMETRIC = 3
-MM_LOENGLISH = 4
-MM_HIENGLISH = 5
-MM_TWIPS = 6
-MM_ISOTROPIC = 7
-MM_ANISOTROPIC = 8
-
-; Coordinate modes
-
-ABSOLUTE = 1
-RELATIVE = 2
-
-; Stock logical objects
-
-WHITE_BRUSH = 0
-LTGRAY_BRUSH = 1
-GRAY_BRUSH = 2
-DKGRAY_BRUSH = 3
-BLACK_BRUSH = 4
-NULL_BRUSH = 5
-HOLLOW_BRUSH = NULL_BRUSH
-WHITE_PEN = 6
-BLACK_PEN = 7
-NULL_PEN = 8
-OEM_FIXED_FONT = 10
-ANSI_FIXED_FONT = 11
-ANSI_VAR_FONT = 12
-SYSTEM_FONT = 13
-DEVICE_DEFAULT_FONT = 14
-DEFAULT_PALETTE = 15
-SYSTEM_FIXED_FONT = 16
-DEFAULT_GUI_FONT = 17
-
-; Brush styles
-
-BS_SOLID = 0
-BS_NULL = 1
-BS_HOLLOW = BS_NULL
-BS_HATCHED = 2
-BS_PATTERN = 3
-BS_INDEXED = 4
-BS_DIBPATTERN = 5
-BS_DIBPATTERNPT = 6
-BS_PATTERN8X8 = 7
-BS_DIBPATTERN8X8 = 8
-BS_MONOPATTERN = 9
-
-; Hatch styles
-
-HS_HORIZONTAL = 0
-HS_VERTICAL = 1
-HS_FDIAGONAL = 2
-HS_BDIAGONAL = 3
-HS_CROSS = 4
-HS_DIAGCROSS = 5
-
-; Pen styles
-
-PS_SOLID = 0
-PS_DASH = 1
-PS_DOT = 2
-PS_DASHDOT = 3
-PS_DASHDOTDOT = 4
-PS_NULL = 5
-PS_INSIDEFRAME = 6
-PS_USERSTYLE = 7
-PS_ALTERNATE = 8
-PS_ENDCAP_ROUND = 0
-PS_ENDCAP_SQUARE = 100h
-PS_ENDCAP_FLAT = 200h
-PS_JOIN_ROUND = 0
-PS_JOIN_BEVEL = 1000h
-PS_JOIN_MITER = 2000h
-PS_COSMETIC = 0
-PS_GEOMETRIC = 010000h
-
-; Arc directions
-
-AD_COUNTERCLOCKWISE = 1
-AD_CLOCKWISE = 2
-
-; Text alignment options
-
-TA_NOUPDATECP = 0
-TA_UPDATECP = 1
-TA_LEFT = 0
-TA_RIGHT = 2
-TA_CENTER = 6
-TA_TOP = 0
-TA_BOTTOM = 8
-TA_BASELINE = 24
-TA_RTLREADING = 100h
-VTA_BASELINE = TA_BASELINE
-VTA_LEFT = TA_BOTTOM
-VTA_RIGHT = TA_TOP
-VTA_CENTER = TA_CENTER
-VTA_BOTTOM = TA_RIGHT
-VTA_TOP = TA_LEFT
-
-; ExtTextOut options
-
-ETO_OPAQUE = 0002h
-ETO_CLIPPED = 0004h
-ETO_GLYPH_INDEX = 0010h
-ETO_RTLREADING = 0080h
-ETO_IGNORELANGUAGE = 1000h
-
-; Bitmap compression types
-
-BI_RGB = 0
-BI_RLE8 = 1
-BI_RLE4 = 2
-BI_BITFIELDS = 3
-
-; tmPitchAndFamily flags
-
-TMPF_FIXED_PITCH = 1
-TMPF_VECTOR = 2
-TMPF_TRUETYPE = 4
-TMPF_DEVICE = 8
-
-; Font output precision values
-
-OUT_DEFAULT_PRECIS = 0
-OUT_STRING_PRECIS = 1
-OUT_CHARACTER_PRECIS = 2
-OUT_STROKE_PRECIS = 3
-OUT_TT_PRECIS = 4
-OUT_DEVICE_PRECIS = 5
-OUT_RASTER_PRECIS = 6
-OUT_TT_ONLY_PRECIS = 7
-OUT_OUTLINE_PRECIS = 8
-OUT_SCREEN_OUTLINE_PRECIS = 9
-
-; Font clipping precision values
-
-CLIP_DEFAULT_PRECIS = 0
-CLIP_CHARACTER_PRECIS = 1
-CLIP_STROKE_PRECIS = 2
-CLIP_LH_ANGLES = 10h
-CLIP_TT_ALWAYS = 20h
-CLIP_EMBEDDED = 80h
-
-; Font output quality values
-
-DEFAULT_QUALITY = 0
-DRAFT_QUALITY = 1
-PROOF_QUALITY = 2
-NONANTIALIASED_QUALITY = 3
-ANTIALIASED_QUALITY = 4
-
-; Font pitch values
-
-DEFAULT_PITCH = 0
-FIXED_PITCH = 1
-VARIABLE_PITCH = 2
-MONO_FONT = 8
-
-; Font families
-
-FF_DONTCARE = 00h
-FF_ROMAN = 10h
-FF_SWISS = 20h
-FF_MODERN = 30h
-FF_SCRIPT = 40h
-FF_DECORATIVE = 50h
-
-; Font weights
-
-FW_DONTCARE = 0
-FW_THIN = 100
-FW_EXTRALIGHT = 200
-FW_LIGHT = 300
-FW_NORMAL = 400
-FW_MEDIUM = 500
-FW_SEMIBOLD = 600
-FW_BOLD = 700
-FW_EXTRABOLD = 800
-FW_HEAVY = 900
-FW_ULTRALIGHT = FW_EXTRALIGHT
-FW_REGULAR = FW_NORMAL
-FW_DEMIBOLD = FW_SEMIBOLD
-FW_ULTRABOLD = FW_EXTRABOLD
-FW_BLACK = FW_HEAVY
-
-; Character set values
-
-ANSI_CHARSET = 0
-DEFAULT_CHARSET = 1
-SYMBOL_CHARSET = 2
-SHIFTJIS_CHARSET = 128
-HANGEUL_CHARSET = 129
-GB2312_CHARSET = 134
-CHINESEBIG5_CHARSET = 136
-OEM_CHARSET = 255
-JOHAB_CHARSET = 130
-HEBREW_CHARSET = 177
-ARABIC_CHARSET = 178
-GREEK_CHARSET = 161
-TURKISH_CHARSET = 162
-VIETNAMESE_CHARSET = 163
-THAI_CHARSET = 222
-EASTEUROPE_CHARSET = 238
-RUSSIAN_CHARSET = 204
-MAC_CHARSET = 77
-BALTIC_CHARSET = 186
-
-; Pixel format constants
-
-PFD_TYPE_RGBA = 0
-PFD_TYPE_COLORINDEX = 1
-PFD_MAIN_PLANE = 0
-PFD_OVERLAY_PLANE = 1
-PFD_UNDERLAY_PLANE = -1
-PFD_DOUBLEBUFFER = 1
-PFD_STEREO = 2
-PFD_DRAW_TO_WINDOW = 4
-PFD_DRAW_TO_BITMAP = 8
-PFD_SUPPORT_GDI = 10h
-PFD_SUPPORT_OPENGL = 20h
-PFD_GENERIC_FORMAT = 40h
-PFD_NEED_PALETTE = 80h
-PFD_NEED_SYSTEM_PALETTE = 100h
-PFD_SWAP_EXCHANGE = 200h
-PFD_SWAP_COPY = 400h
-PFD_SWAP_LAYER_BUFFERS = 800h
-PFD_GENERIC_ACCELERATED = 1000h
-PFD_DEPTH_DONTCARE = 20000000h
-PFD_DOUBLEBUFFER_DONTCARE = 40000000h
-PFD_STEREO_DONTCARE = 80000000h
-
-DIB_RGB_COLORS = 0
-DIB_PAL_COLORS = 1
-
-; Object types for GetCurrentObject
-
-OBJ_PEN = 1
-OBJ_BRUSH = 2
-OBJ_PAL = 5
-OBJ_FONT = 6
-OBJ_BITMAP = 7
-
-; Additional constants for GetObjectType
-OBJ_DC = $03
-OBJ_MEMDC = $0a
DELETED freshlib/equates/Win32/_HTMLHELP.INC
Index: freshlib/equates/Win32/_HTMLHELP.INC
==================================================================
--- freshlib/equates/Win32/_HTMLHELP.INC
+++ /dev/null
@@ -1,339 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: HtmlHelp constants and structures.
-;
-; Target OS: Win32
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-; Commands to pass to HtmlHelp()
-
-HH_DISPLAY_TOPIC = 0x0000
-HH_HELP_FINDER = 0x0000 ; WinHelp equivalent
-HH_DISPLAY_TOC = 0x0001
-HH_DISPLAY_INDEX = 0x0002
-HH_DISPLAY_SEARCH = 0x0003
-HH_SET_WIN_TYPE = 0x0004
-HH_GET_WIN_TYPE = 0x0005
-HH_GET_WIN_HANDLE = 0x0006
-HH_ENUM_INFO_TYPE = 0x0007 ; Get Info type name, call repeatedly to enumerate, -1 at end
-HH_SET_INFO_TYPE = 0x0008 ; Add Info type to filter.
-HH_SYNC = 0x0009
-HH_RESERVED1 = 0x000A
-HH_RESERVED2 = 0x000B
-HH_RESERVED3 = 0x000C
-HH_KEYWORD_LOOKUP = 0x000D
-HH_DISPLAY_TEXT_POPUP = 0x000E ; display string resource id or text in a popup window
-HH_HELP_CONTEXT = 0x000F ; display mapped numeric value in dwData
-HH_TP_HELP_CONTEXTMENU = 0x0010 ; text popup help, same as WinHelp HELP_CONTEXTMENU
-HH_TP_HELP_WM_HELP = 0x0011 ; text popup help, same as WinHelp HELP_WM_HELP
-HH_CLOSE_ALL = 0x0012 ; close all windows opened directly or indirectly by the caller
-HH_ALINK_LOOKUP = 0x0013 ; ALink version of HH_KEYWORD_LOOKUP
-HH_GET_LAST_ERROR = 0x0014 ; not currently implemented // See HHERROR.h
-HH_ENUM_CATEGORY = 0x0015 ; Get category name, call repeatedly to enumerate, -1 at end
-HH_ENUM_CATEGORY_IT = 0x0016 ; Get category info type members, call repeatedly to enumerate, -1 at end
-HH_RESET_IT_FILTER = 0x0017 ; Clear the info type filter of all info types.
-HH_SET_INCLUSIVE_FILTER = 0x0018 ; set inclusive filtering method for untyped topics to be included in display
-HH_SET_EXCLUSIVE_FILTER = 0x0019 ; set exclusive filtering method for untyped topics to be excluded from display
-HH_INITIALIZE = 0x001C ; Initializes the help system.
-HH_UNINITIALIZE = 0x001D ; Uninitializes the help system.
-HH_PRETRANSLATEMESSAGE = 0x00fd ; Pumps messages. (NULL, NULL, MSG*).
-HH_SET_GLOBAL_PROPERTY = 0x00fc ; Set a global property. (NULL, NULL, HH_GPROP)
-
-HHWIN_PROP_TAB_AUTOHIDESHOW = 1 shl 0 ; Automatically hide/show tri-pane window
-HHWIN_PROP_ONTOP = 1 shl 1 ; Top-most window
-HHWIN_PROP_NOTITLEBAR = 1 shl 2 ; no title bar
-HHWIN_PROP_NODEF_STYLES = 1 shl 3 ; no default window styles (only HH_WINTYPE.dwStyles)
-HHWIN_PROP_NODEF_EXSTYLES = 1 shl 4 ; no default extended window styles (only HH_WINTYPE.dwExStyles)
-HHWIN_PROP_TRI_PANE = 1 shl 5 ; use a tri-pane window
-HHWIN_PROP_NOTB_TEXT = 1 shl 6 ; no text on toolbar buttons
-HHWIN_PROP_POST_QUIT = 1 shl 7 ; post WM_QUIT message when window closes
-HHWIN_PROP_AUTO_SYNC = 1 shl 8 ; automatically ssync contents and index
-HHWIN_PROP_TRACKING = 1 shl 9 ; send tracking notification messages
-HHWIN_PROP_TAB_SEARCH = 1 shl 10 ; include search tab in navigation pane
-HHWIN_PROP_TAB_HISTORY = 1 shl 11 ; include history tab in navigation pane
-HHWIN_PROP_TAB_FAVORITES = 1 shl 12 ; include favorites tab in navigation pane
-HHWIN_PROP_CHANGE_TITLE = 1 shl 13 ; Put current HTML title in title bar
-HHWIN_PROP_NAV_ONLY_WIN = 1 shl 14 ; Only display the navigation window
-HHWIN_PROP_NO_TOOLBAR = 1 shl 15 ; Don't display a toolbar
-HHWIN_PROP_MENU = 1 shl 16 ; Menu
-HHWIN_PROP_TAB_ADVSEARCH = 1 shl 17 ; Advanced FTS UI.
-HHWIN_PROP_USER_POS = 1 shl 18 ; After initial creation, user controls window size/position
-HHWIN_PROP_TAB_CUSTOM1 = 1 shl 19 ; Use custom tab #1
-HHWIN_PROP_TAB_CUSTOM2 = 1 shl 20 ; Use custom tab #2
-HHWIN_PROP_TAB_CUSTOM3 = 1 shl 21 ; Use custom tab #3
-HHWIN_PROP_TAB_CUSTOM4 = 1 shl 22 ; Use custom tab #4
-HHWIN_PROP_TAB_CUSTOM5 = 1 shl 23 ; Use custom tab #5
-HHWIN_PROP_TAB_CUSTOM6 = 1 shl 24 ; Use custom tab #6
-HHWIN_PROP_TAB_CUSTOM7 = 1 shl 25 ; Use custom tab #7
-HHWIN_PROP_TAB_CUSTOM8 = 1 shl 26 ; Use custom tab #8
-HHWIN_PROP_TAB_CUSTOM9 = 1 shl 27 ; Use custom tab #9
-HHWIN_TB_MARGIN = 1 shl 28 ; the window type has a margin
-
-HHWIN_PARAM_PROPERTIES = 1 shl 1 ; valid fsWinProperties
-HHWIN_PARAM_STYLES = 1 shl 2 ; valid dwStyles
-HHWIN_PARAM_EXSTYLES = 1 shl 3 ; valid dwExStyles
-HHWIN_PARAM_RECT = 1 shl 4 ; valid rcWindowPos
-HHWIN_PARAM_NAV_WIDTH = 1 shl 5 ; valid iNavWidth
-HHWIN_PARAM_SHOWSTATE = 1 shl 6 ; valid nShowState
-HHWIN_PARAM_INFOTYPES = 1 shl 7 ; valid apInfoTypes
-HHWIN_PARAM_TB_FLAGS = 1 shl 8 ; valid fsToolBarFlags
-HHWIN_PARAM_EXPANSION = 1 shl 9 ; valid fNotExpanded
-HHWIN_PARAM_TABPOS = 1 shl 10 ; valid tabpos
-HHWIN_PARAM_TABORDER = 1 shl 11 ; valid taborder
-HHWIN_PARAM_HISTORY_COUNT = 1 shl 12 ; valid cHistory
-HHWIN_PARAM_CUR_TAB = 1 shl 13 ; valid curNavType
-
-HHWIN_BUTTON_EXPAND = 1 shl 1 ; Expand/contract button
-HHWIN_BUTTON_BACK = 1 shl 2 ; Back button
-HHWIN_BUTTON_FORWARD = 1 shl 3 ; Forward button
-HHWIN_BUTTON_STOP = 1 shl 4 ; Stop button
-HHWIN_BUTTON_REFRESH = 1 shl 5 ; Refresh button
-HHWIN_BUTTON_HOME = 1 shl 6 ; Home button
-HHWIN_BUTTON_BROWSE_FWD = 1 shl 7 ; not implemented
-HHWIN_BUTTON_BROWSE_BCK = 1 shl 8 ; not implemented
-HHWIN_BUTTON_NOTES = 1 shl 9 ; not implemented
-HHWIN_BUTTON_CONTENTS = 1 shl 10 ; not implemented
-HHWIN_BUTTON_SYNC = 1 shl 11 ; Sync button
-HHWIN_BUTTON_OPTIONS = 1 shl 12 ; Options button
-HHWIN_BUTTON_PRINT = 1 shl 13 ; Print button
-HHWIN_BUTTON_INDEX = 1 shl 14 ; not implemented
-HHWIN_BUTTON_SEARCH = 1 shl 15 ; not implemented
-HHWIN_BUTTON_HISTORY = 1 shl 16 ; not implemented
-HHWIN_BUTTON_FAVORITES = 1 shl 17 ; not implemented
-HHWIN_BUTTON_JUMP1 = 1 shl 18
-HHWIN_BUTTON_JUMP2 = 1 shl 19
-HHWIN_BUTTON_ZOOM = 1 shl 20
-HHWIN_BUTTON_TOC_NEXT = 1 shl 21
-HHWIN_BUTTON_TOC_PREV = 1 shl 22
-
-HHWIN_DEF_BUTTONS =HHWIN_BUTTON_EXPAND or HHWIN_BUTTON_BACK or HHWIN_BUTTON_OPTIONS or HHWIN_BUTTON_PRINT
-
-; Button IDs
-IDTB_EXPAND = 200
-IDTB_CONTRACT = 201
-IDTB_STOP = 202
-IDTB_REFRESH = 203
-IDTB_BACK = 204
-IDTB_HOME = 205
-IDTB_SYNC = 206
-IDTB_PRINT = 207
-IDTB_OPTIONS = 208
-IDTB_FORWARD = 209
-IDTB_NOTES = 210 ; not implemented
-IDTB_BROWSE_FWD = 211
-IDTB_BROWSE_BACK = 212
-IDTB_CONTENTS = 213 ; not implemented
-IDTB_INDEX = 214 ; not implemented
-IDTB_SEARCH = 215 ; not implemented
-IDTB_HISTORY = 216 ; not implemented
-IDTB_FAVORITES = 217 ; not implemented
-IDTB_JUMP1 = 218
-IDTB_JUMP2 = 219
-IDTB_CUSTOMIZE = 221
-IDTB_ZOOM = 222
-IDTB_TOC_NEXT = 223
-IDTB_TOC_PREV = 224
-
-; Notification codes
-
-HHN_FIRST = 0-860
-HHN_LAST = 0-879
-
-HHN_NAVCOMPLETE = HHN_FIRST-0
-HHN_TRACK = HHN_FIRST-1
-HHN_WINDOW_CREATE = HHN_FIRST-2
-
-struct HHN_NOTIFY
- .hdr dd ?
- .pszUrl dd ? ; Multi-byte, null-terminated string
-ends
-
-struct HH_POPUP
- .cbStruct dd ? ; sizeof this structure
- .hinst dd ? ; instance handle for string resource
- .idString dd ? ; string resource id, or text id if pszFile is specified in HtmlHelp call
- .pszText dd ? ; used if idString is zero
- .pt POINT ; top center of popup window
- .clrForeground dd ? ; use -1 for default
- .clrBackground dd ? ; use -1 for default
- .rcMargins RECT ; amount of space between edges of window and text, -1 for each member to ignore
- .pszFont dd ? ; facename, point size, char set, BOLD ITALIC UNDERLINE
-ends
-
-struct HH_AKLINK
- .cbStruct dd ? ; sizeof this structure
- .fReserved dd ? ; must be FALSE (really!)
- .pszKeywords dd ? ; semi-colon separated keywords
- .pszUrl dd ? ; URL to jump to if no keywords found (may be NULL)
- .pszMsgText dd ? ; Message text to display in MessageBox if pszUrl is NULL and no keyword match
- .pszMsgTitle dd ? ; Message text to display in MessageBox if pszUrl is NULL and no keyword match
- .pszWindow dd ? ; Window to display URL in
- .fIndexOnFail dd ? ; Displays index if keyword lookup fails.
-ends
-
-
-HHWIN_NAVTYPE_TOC = 0
-HHWIN_NAVTYPE_INDEX = 1
-HHWIN_NAVTYPE_SEARCH = 2
-HHWIN_NAVTYPE_FAVORITES = 3
-HHWIN_NAVTYPE_HISTORY = 4 ; not implemented
-HHWIN_NAVTYPE_AUTHOR = 5
-HHWIN_NAVTYPE_CUSTOM_FIRST = 11
-
-
-IT_INCLUSIVE = 0
-IT_EXCLUSIVE = 1
-IT_HIDDEN = 2
-
-
-struct HH_ENUM_IT
- .cbStruct dd ? ; size of this structure
- .iType dd ? ; the type of the information type ie. Inclusive, Exclusive, or Hidden
- .pszCatName dd ? ; Set to the name of the Category to enumerate the info types in a category; else NULL
- .pszITName dd ? ; volitile pointer to the name of the infotype. Allocated by call. Caller responsible for freeing
- .pszITDescription dd ? ; volitile pointer to the description of the infotype.
-ends
-
-struct HH_ENUM_CAT
- .cbStruct dd ? ; size of this structure
- .pszCatName dd ? ; volitile pointer to the category name
- .pszCatDescription dd ? ; volitile pointer to the category description
-ends
-
-struct HH_SET_INFOTYPE
- .cbStruct dd ? ; the size of this structure
- .pszCatName dd ? ; the name of the category, if any, the InfoType is a member of.
- .pszInfoTypeName dd ? ; the name of the info type to add to the filter
-ends
-
-
-HHWIN_NAVTAB_TOP = 0
-HHWIN_NAVTAB_LEFT = 1
-HHWIN_NAVTAB_BOTTOM = 2
-
-
-HH_MAX_TABS = 19 ; maximum number of tabs
-
-
-HH_TAB_CONTENTS = 0
-HH_TAB_INDEX = 1
-HH_TAB_SEARCH = 2
-HH_TAB_FAVORITES = 3
-HH_TAB_HISTORY = 4
-HH_TAB_AUTHOR = 5
-HH_TAB_CUSTOM_FIRST = 11
-HH_TAB_CUSTOM_LAST = HH_MAX_TABS
-
-
-HH_MAX_TABS_CUSTOM = HH_TAB_CUSTOM_LAST - HH_TAB_CUSTOM_FIRST + 1
-
-; HH_DISPLAY_SEARCH Command Related Structures and Constants
-
-HH_FTS_DEFAULT_PROXIMITY = -1
-
-struct HH_FTS_QUERY
- .cbStruct dd ? ; Sizeof structure in bytes.
- .fUniCodeStrings dd ? ; TRUE if all strings are unicode.
- .pszSearchQuery dd ? ; String containing the search query.
- .iProximity dd ? ; Word proximity.
- .fStemmedSearch dd ? ; TRUE for StemmedSearch only.
- .fTitleOnly dd ? ; TRUE for Title search only.
- .fExecute dd ? ; TRUE to initiate the search.
- .pszWindow dd ? ; Window to display in
-ends
-
-; HH_WINTYPE Structure
-
-struct HH_WINTYPE
- .cbStruct dd ? ; IN: size of this structure including all Information Types
- .fUniCodeStrings dd ? ; IN/OUT: TRUE if all strings are in UNICODE
- .pszType dd ? ; IN/OUT: Name of a type of window
- .fsValidMembers dd ? ; IN: Bit flag of valid members (HHWIN_PARAM_)
- .fsWinProperties dd ? ; IN/OUT: Properties/attributes of the window (HHWIN_)
- .pszCaption dd ? ; IN/OUT: Window title
- .dwStyles dd ? ; IN/OUT: Window styles
- .dwExStyles dd ? ; IN/OUT: Extended Window styles
- .rcWindowPos RECT ; IN: Starting position, OUT: current position
- .nShowState dd ? ; IN: show state (e.g., SW_SHOW)
- .hwndHelp dd ? ; OUT: window handle
- .hwndCaller dd ? ; OUT: who called this window
- .paInfoTypes dd ? ; IN: Pointer to an array of Information Types
- ; The following members are only valid if HHWIN_PROP_TRI_PANE is set
- .hwndToolBar dd ? ; OUT: toolbar window in tri-pane window
- .hwndNavigation dd ? ; OUT: navigation window in tri-pane window
- .hwndHTML dd ? ; OUT: window displaying HTML in tri-pane window
- .iNavWidth dd ? ; IN/OUT: width of navigation window
- .rcHTML RECT ; OUT: HTML window coordinates
- .pszToc dd ? ; IN: Location of the table of contents file
- .pszIndex dd ? ; IN: Location of the index file
- .pszFile dd ? ; IN: Default location of the html file
- .pszHome dd ? ; IN/OUT: html file to display when Home button is clicked
- .fsToolBarFlags dd ? ; IN: flags controling the appearance of the toolbar
- .fNotExpanded dd ? ; IN: TRUE/FALSE to contract or expand, OUT: current state
- .curNavType dd ? ; IN/OUT: UI to display in the navigational pane
- .tabpos dd ? ; IN/OUT: HHWIN_NAVTAB_TOP, HHWIN_NAVTAB_LEFT, or HHWIN_NAVTAB_BOTTOM
- .idNotify dd ? ; IN: ID to use for WM_NOTIFY messages
- .tabOrder rb HH_MAX_TABS + 1 ; IN/OUT: tab order: Contents, Index, Search, History, Favorites, Reserved 1-5, Custom tabs
- .cHistory dd ? ; IN/OUT: number of history items to keep (default is 30)
- .pszJump1 dd ? ; Text for HHWIN_BUTTON_JUMP1
- .pszJump2 dd ? ; Text for HHWIN_BUTTON_JUMP2
- .pszUrlJump1 dd ? ; URL for HHWIN_BUTTON_JUMP1
- .pszUrlJump2 dd ? ; URL for HHWIN_BUTTON_JUMP2
- .rcMinSize RECT ; Minimum size for window (ignored in version 1)
- .cbInfoTypes dd ? ; size of paInfoTypes;
- .pszCustomTabs dd ? ; multiple zero-terminated strings
-ends
-
-HHACT_TAB_CONTENTS = 0
-HHACT_TAB_INDEX = 1
-HHACT_TAB_SEARCH = 2
-HHACT_TAB_HISTORY = 3
-HHACT_TAB_FAVORITES = 4
-
-HHACT_EXPAND = 0
-HHACT_CONTRACT = 1
-HHACT_BACK = 2
-HHACT_FORWARD = 3
-HHACT_STOP = 4
-HHACT_REFRESH = 5
-HHACT_HOME = 6
-HHACT_SYNC = 7
-HHACT_OPTIONS = 8
-HHACT_PRINT = 9
-HHACT_HIGHLIGHT = 10
-HHACT_CUSTOMIZE = 11
-HHACT_JUMP1 = 12
-HHACT_JUMP2 = 13
-HHACT_ZOOM = 14
-HHACT_TOC_NEXT = 15
-HHACT_TOC_PREV = 16
-HHACT_NOTES = 17
-HHACT_LAST_ENUM = 18
-
-
-struct HHNTRACK
- .hdr dd ?
- .pszCurUrl dd ? ; Multi-byte, null-terminated string
- .idAction dd ? ; HHACT_ value
- .phhWinType dd ? ; Current window type structure
-ends
-
-
-HH_GPROPID_SINGLETHREAD=1 ; VARIANT_BOOL: True for single thread
-HH_GPROPID_TOOLBAR_MARGIN=2 ; long: Provides a left/right margin around the toolbar.
-HH_GPROPID_UI_LANGUAGE=3 ; long: LangId of the UI.
-HH_GPROPID_CURRENT_SUBSET=4 ; BSTR: Current subset.
-HH_GPROPID_CONTENT_LANGUAGE=5 ; long: LandId for desired content.
-
-
-struct HH_GLOBAL_PROPERTY
- .id dd ?
- .var dd ?
-ends
DELETED freshlib/equates/Win32/_KERNEL32.INC
Index: freshlib/equates/Win32/_KERNEL32.INC
==================================================================
--- freshlib/equates/Win32/_KERNEL32.INC
+++ /dev/null
@@ -1,816 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: KERNEL32.DLL structures and constants
-;
-; Target OS: Win32
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-
-struct SYSTEM_INFO
- .wProcessorArchitecture dw ?
- .wReserved dw ?
- .dwPageSize dd ?
- .lpMinimumApplicationAddress dd ?
- .lpMaximumApplicationAddress dd ?
- .dwActiveProcessorMask dd ?
- .dwNumberOfProcessors dd ?
- .dwProcessorType dd ?
- .dwAllocationGranularity dd ?
- .wProcessorLevel dw ?
- .wProcessorRevision dw ?
-ends
-
-struct OSVERSIONINFO
- .dwOSVersionInfoSize dd ?
- .dwMajorVersion dd ?
- .dwMinorVersion dd ?
- .dwBuildNumber dd ?
- .dwPlatformId dd ?
- .szCSDVersion rb 128
-ends
-
-struct MEMORYSTATUS
- .dwiLength dd ?
- .dwMemoryLoad dd ?
- .dwTotalPhys dd ?
- .dwAvailPhys dd ?
- .dwTotalPageFile dd ?
- .dwAvailPageFile dd ?
- .dwTotalVirtual dd ?
- .dwAvailVirtual dd ?
-ends
-
-struct STARTUPINFO
- .cb dd ?
- .lpReserved dd ?
- .lpDesktop dd ?
- .lpTitle dd ?
- .dwX dd ?
- .dwY dd ?
- .dwXSize dd ?
- .dwYSize dd ?
- .dwXCountChars dd ?
- .dwYCountChars dd ?
- .dwFillAttribute dd ?
- .dwFlags dd ?
- .wShowWindow dw ?
- .cbReserved2 dw ?
- .lpReserved2 dd ?
- .hStdInput dd ?
- .hStdOutput dd ?
- .hStdError dd ?
-ends
-
-struct PROCESS_INFORMATION
- .hProcess dd ?
- .hThread dd ?
- .dwProcessId dd ?
- .dwThreadId dd ?
-ends
-
-struct FILETIME
- .dwLowDateTime dd ?
- .dwHighDateTime dd ?
-ends
-
-struct SYSTEMTIME
- .wYear dw ?
- .wMonth dw ?
- .wDayOfWeek dw ?
- .wDay dw ?
- .wHour dw ?
- .wMinute dw ?
- .wSecond dw ?
- .wMilliseconds dw ?
-ends
-
-struct BY_HANDLE_FILE_INFORMATION
- .dwFileAttributes dd ?
- .ftCreationTime FILETIME
- .ftLastAccessTime FILETIME
- .ftLastWriteTime FILETIME
- .dwVolumeSerialNumber dd ?
- .nFileSizeHigh dd ?
- .nFileSizeLow dd ?
- .nNumberOfLinks dd ?
- .nFileIndexHigh dd ?
- .nFileIndexLow dd ?
-ends
-
-struct FINDDATA
- .dwFileAttributes dd ?
- .ftCreationTime FILETIME
- .ftLastAccessTime FILETIME
- .ftLastWriteTime FILETIME
- .nFileSizeHigh dd ?
- .nFileSizeLow dd ?
- .dwReserved0 dd ?
- .dwReserved1 dd ?
- .cFileName rb 260
- .cAlternateFileName rb 14
-ends
-
-struct FINDDATAW
- .dwFileAttributes dd ?
- .ftCreationTime FILETIME
- .ftLastAccessTime FILETIME
- .ftLastWriteTime FILETIME
- .nFileSizeHigh dd ?
- .nFileSizeLow dd ?
- .dwReserved0 dd ?
- .dwReserved1 dd ?
- .cFileName rw 260
- .cAlternateFileName rw 14
-ends
-
-; findnext error
-
-ERROR_NO_MORE_FILES = 18
-
-
-struct PROCESSINFO
- .hProcess dd ?
- .hThread dd ?
- .dwProcessId dd ?
- .dwThreadId dd ?
-ends
-
-
-
-struct TIME_ZONE_INFORMATION
- .bias dd ?
- .StandardName rw 32
- .StandardDate SYSTEMTIME
- .StandardBias dd ?
- .DaylightName rw 32
- .DaylightDate SYSTEMTIME
- .DaylightBias dd ?
-ends
-
-TIME_ZODE_ID_UNKNOWN = 0
-TIME_ZONE_ID_STANDARD = 1
-TIME_ZONE_ID_DAYLIGHT = 2
-
-
-; General constants
-
-NULL = 0
-TRUE = 1
-FALSE = 0
-
-MAX_PATH = 260
-
-
-; Access rights
-
-DELETE_RIGHT = 00010000h
-READ_CONTROL = 00020000h
-WRITE_DAC = 00040000h
-WRITE_OWNER = 00080000h
-SYNCHRONIZE = 00100000h
-STANDARD_RIGHTS_READ = READ_CONTROL
-STANDARD_RIGHTS_WRITE = READ_CONTROL
-STANDARD_RIGHTS_EXECUTE = READ_CONTROL
-STANDARD_RIGHTS_REQUIRED = 000F0000h
-STANDARD_RIGHTS_ALL = 001F0000h
-SPECIFIC_RIGHTS_ALL = 0000FFFFh
-ACCESS_SYSTEM_SECURITY = 01000000h
-MAXIMUM_ALLOWED = 02000000h
-GENERIC_READ = 80000000h
-GENERIC_WRITE = 40000000h
-GENERIC_EXECUTE = 20000000h
-GENERIC_ALL = 10000000h
-PROCESS_TERMINATE = 00000001h
-PROCESS_CREATE_THREAD = 00000002h
-PROCESS_VM_OPERATION = 00000008h
-PROCESS_VM_READ = 00000010h
-PROCESS_VM_WRITE = 00000020h
-PROCESS_DUP_HANDLE = 00000040h
-PROCESS_CREATE_PROCESS = 00000080h
-PROCESS_SET_QUOTA = 00000100h
-PROCESS_SET_INFORMATION = 00000200h
-PROCESS_QUERY_INFORMATION = 00000400h
-PROCESS_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED or SYNCHRONIZE or 0FFFh
-FILE_SHARE_READ = 00000001h
-FILE_SHARE_WRITE = 00000002h
-FILE_SHARE_DELETE = 00000004h
-
-; CreateFile actions
-
-CREATE_NEW = 1
-CREATE_ALWAYS = 2
-OPEN_EXISTING = 3
-OPEN_ALWAYS = 4
-TRUNCATE_EXISTING = 5
-
-; OpenFile modes
-
-OF_READ = 0000h
-OF_WRITE = 0001h
-OF_READWRITE = 0002h
-OF_SHARE_COMPAT = 0000h
-OF_SHARE_EXCLUSIVE = 0010h
-OF_SHARE_DENY_WRITE = 0020h
-OF_SHARE_DENY_READ = 0030h
-OF_SHARE_DENY_NONE = 0040h
-OF_PARSE = 0100h
-OF_DELETE = 0200h
-OF_VERIFY = 0400h
-OF_CANCEL = 0800h
-OF_CREATE = 1000h
-OF_PROMPT = 2000h
-OF_EXIST = 4000h
-OF_REOPEN = 8000h
-
-; SetFilePointer methods
-
-FILE_BEGIN = 0
-FILE_CURRENT = 1
-FILE_END = 2
-
-; File attributes
-
-FILE_ATTRIBUTE_READONLY = 001h
-FILE_ATTRIBUTE_HIDDEN = 002h
-FILE_ATTRIBUTE_SYSTEM = 004h
-FILE_ATTRIBUTE_DIRECTORY = 010h
-FILE_ATTRIBUTE_ARCHIVE = 020h
-FILE_ATTRIBUTE_NORMAL = 080h
-FILE_ATTRIBUTE_TEMPORARY = 100h
-FILE_ATTRIBUTE_COMPRESSED = 800h
-
-; File flags
-
-FILE_FLAG_WRITE_THROUGH = 80000000h
-FILE_FLAG_OVERLAPPED = 40000000h
-FILE_FLAG_NO_BUFFERING = 20000000h
-FILE_FLAG_RANDOM_ACCESS = 10000000h
-FILE_FLAG_SEQUENTIAL_SCAN = 08000000h
-FILE_FLAG_DELETE_ON_CLOSE = 04000000h
-FILE_FLAG_BACKUP_SEMANTICS = 02000000h
-FILE_FLAG_POSIX_SEMANTICS = 01000000h
-
-; Notify filters
-
-FILE_NOTIFY_CHANGE_FILE_NAME = 001h
-FILE_NOTIFY_CHANGE_DIR_NAME = 002h
-FILE_NOTIFY_CHANGE_ATTRIBUTES = 004h
-FILE_NOTIFY_CHANGE_SIZE = 008h
-FILE_NOTIFY_CHANGE_LAST_WRITE = 010h
-FILE_NOTIFY_CHANGE_SECURITY = 100h
-
-; File types
-
-FILE_TYPE_UNKNOWN = 0
-FILE_TYPE_DISK = 1
-FILE_TYPE_CHAR = 2
-FILE_TYPE_PIPE = 3
-FILE_TYPE_REMOTE = 8000h
-
-; LockFileEx flags
-
-LOCKFILE_FAIL_IMMEDIATELY = 1
-LOCKFILE_EXCLUSIVE_LOCK = 2
-
-; MoveFileEx flags
-
-MOVEFILE_REPLACE_EXISTING = 1
-MOVEFILE_COPY_ALLOWED = 2
-MOVEFILE_DELAY_UNTIL_REBOOT = 4
-MOVEFILE_WRITE_THROUGH = 8
-
-; FindFirstFileEx flags
-
-FIND_FIRST_EX_CASE_SENSITIVE = 1
-
-; Device handles
-
-INVALID_HANDLE_VALUE = -1
-STD_INPUT_HANDLE = -10
-STD_OUTPUT_HANDLE = -11
-STD_ERROR_HANDLE = -12
-
-; DuplicateHandle options
-
-DUPLICATE_CLOSE_SOURCE = 1
-DUPLICATE_SAME_ACCESS = 2
-
-; File mapping acccess rights
-
-SECTION_QUERY = 01h
-SECTION_MAP_WRITE = 02h
-SECTION_MAP_READ = 04h
-SECTION_MAP_EXECUTE = 08h
-SECTION_EXTEND_SIZE = 10h
-SECTION_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED or SECTION_QUERY or SECTION_MAP_WRITE or SECTION_MAP_READ or SECTION_MAP_EXECUTE or SECTION_EXTEND_SIZE
-FILE_MAP_COPY = SECTION_QUERY
-FILE_MAP_WRITE = SECTION_MAP_WRITE
-FILE_MAP_READ = SECTION_MAP_READ
-FILE_MAP_ALL_ACCESS = SECTION_ALL_ACCESS
-
-; File system flags
-
-FILE_CASE_SENSITIVE_SEARCH = 0001h
-FILE_CASE_PRESERVED_NAMES = 0002h
-FILE_UNICODE_ON_DISK = 0004h
-FILE_PERSISTENT_ACLS = 0008h
-FILE_FILE_COMPRESSION = 0010h
-FILE_VOLUME_IS_COMPRESSED = 8000h
-FS_CASE_IS_PRESERVED = FILE_CASE_PRESERVED_NAMES
-FS_CASE_SENSITIVE = FILE_CASE_SENSITIVE_SEARCH
-FS_UNICODE_STORED_ON_DISK = FILE_UNICODE_ON_DISK
-FS_PERSISTENT_ACLS = FILE_PERSISTENT_ACLS
-
-; Drive types
-
-DRIVE_UNKNOWN = 0
-DRIVE_NO_ROOT_DIR = 1
-DRIVE_REMOVABLE = 2
-DRIVE_FIXED = 3
-DRIVE_REMOTE = 4
-DRIVE_CDROM = 5
-DRIVE_RAMDISK = 6
-
-; Pipe modes
-
-PIPE_ACCESS_INBOUND = 1
-PIPE_ACCESS_OUTBOUND = 2
-PIPE_ACCESS_DUPLEX = 3
-PIPE_CLIENT_END = 0
-PIPE_SERVER_END = 1
-PIPE_WAIT = 0
-PIPE_NOWAIT = 1
-PIPE_READMODE_BYTE = 0
-PIPE_READMODE_MESSAGE = 2
-PIPE_TYPE_BYTE = 0
-PIPE_TYPE_MESSAGE = 4
-PIPE_UNLIMITED_INSTANCES = 255
-
-; file/pipe error codes
-
-ERROR_MORE_DATA = 234
-
-; Global memory flags
-
-GMEM_FIXED = 0000h
-GMEM_MOVEABLE = 0002h
-GMEM_NOCOMPACT = 0010h
-GMEM_NODISCARD = 0020h
-GMEM_ZEROINIT = 0040h
-GMEM_MODIFY = 0080h
-GMEM_DISCARDABLE = 0100h
-GMEM_NOT_BANKED = 1000h
-GMEM_SHARE = 2000h
-GMEM_DDESHARE = 2000h
-GMEM_NOTIFY = 4000h
-GMEM_LOWER = GMEM_NOT_BANKED
-GMEM_VALID_FLAGS = 7F72h
-GMEM_INVALID_HANDLE = 8000h
-GMEM_DISCARDED = 4000h
-GMEM_LOCKCOUNT = 0FFh
-GHND = GMEM_MOVEABLE + GMEM_ZEROINIT
-GPTR = GMEM_FIXED + GMEM_ZEROINIT
-
-; Local memory flags
-
-LMEM_FIXED = 0000h
-LMEM_MOVEABLE = 0002h
-LMEM_NOCOMPACT = 0010h
-LMEM_NODISCARD = 0020h
-LMEM_ZEROINIT = 0040h
-LMEM_MODIFY = 0080h
-LMEM_DISCARDABLE = 0F00h
-LMEM_VALID_FLAGS = 0F72h
-LMEM_INVALID_HANDLE = 8000h
-LHND = LMEM_MOVEABLE + LMEM_ZEROINIT
-LPTR = LMEM_FIXED + LMEM_ZEROINIT
-LMEM_DISCARDED = 4000h
-LMEM_LOCKCOUNT = 00FFh
-
-; Page access flags
-
-PAGE_NOACCESS = 001h
-PAGE_READONLY = 002h
-PAGE_READWRITE = 004h
-PAGE_WRITECOPY = 008h
-PAGE_EXECUTE = 010h
-PAGE_EXECUTE_READ = 020h
-PAGE_EXECUTE_READWRITE = 040h
-PAGE_EXECUTE_WRITECOPY = 080h
-PAGE_GUARD = 100h
-PAGE_NOCACHE = 200h
-
-; Memory allocation flags
-
-MEM_COMMIT = 001000h
-MEM_RESERVE = 002000h
-MEM_DECOMMIT = 004000h
-MEM_RELEASE = 008000h
-MEM_FREE = 010000h
-MEM_PRIVATE = 020000h
-MEM_MAPPED = 040000h
-MEM_RESET = 080000h
-MEM_TOP_DOWN = 100000h
-
-; Heap allocation flags
-
-HEAP_NO_SERIALIZE = 1
-HEAP_GENERATE_EXCEPTIONS = 4
-HEAP_ZERO_MEMORY = 8
-
-; Platform identifiers
-
-VER_PLATFORM_WIN32s = 0
-VER_PLATFORM_WIN32_WINDOWS = 1
-VER_PLATFORM_WIN32_NT = 2
-
-; GetBinaryType return values
-
-SCS_32BIT_BINARY = 0
-SCS_DOS_BINARY = 1
-SCS_WOW_BINARY = 2
-SCS_PIF_BINARY = 3
-SCS_POSIX_BINARY = 4
-SCS_OS216_BINARY = 5
-
-; CreateProcess flags
-
-DEBUG_PROCESS = 001h
-DEBUG_ONLY_THIS_PROCESS = 002h
-CREATE_SUSPENDED = 004h
-DETACHED_PROCESS = 008h
-CREATE_NEW_CONSOLE = 010h
-NORMAL_PRIORITY_CLASS = 020h
-IDLE_PRIORITY_CLASS = 040h
-HIGH_PRIORITY_CLASS = 080h
-REALTIME_PRIORITY_CLASS = 100h
-CREATE_NEW_PROCESS_GROUP = 200h
-CREATE_SEPARATE_WOW_VDM = 800h
-
-; Thread priority values
-
-THREAD_BASE_PRIORITY_MIN = -2
-THREAD_BASE_PRIORITY_MAX = 2
-THREAD_BASE_PRIORITY_LOWRT = 15
-THREAD_BASE_PRIORITY_IDLE = -15
-THREAD_PRIORITY_LOWEST = THREAD_BASE_PRIORITY_MIN
-THREAD_PRIORITY_BELOW_NORMAL = THREAD_PRIORITY_LOWEST + 1
-THREAD_PRIORITY_NORMAL = 0
-THREAD_PRIORITY_HIGHEST = THREAD_BASE_PRIORITY_MAX
-THREAD_PRIORITY_ABOVE_NORMAL = THREAD_PRIORITY_HIGHEST - 1
-THREAD_PRIORITY_ERROR_RETURN = 7FFFFFFFh
-THREAD_PRIORITY_TIME_CRITICAL = THREAD_BASE_PRIORITY_LOWRT
-THREAD_PRIORITY_IDLE = THREAD_BASE_PRIORITY_IDLE
-
-; Startup flags
-
-STARTF_USESHOWWINDOW = 001h
-STARTF_USESIZE = 002h
-STARTF_USEPOSITION = 004h
-STARTF_USECOUNTCHARS = 008h
-STARTF_USEFILLATTRIBUTE = 010h
-STARTF_RUNFULLSCREEN = 020h
-STARTF_FORCEONFEEDBACK = 040h
-STARTF_FORCEOFFFEEDBACK = 080h
-STARTF_USESTDHANDLES = 100h
-
-; Shutdown flags
-
-SHUTDOWN_NORETRY = 1h
-
-; LoadLibraryEx flags
-
-DONT_RESOLVE_DLL_REFERENCES = 1
-LOAD_LIBRARY_AS_DATAFILE = 2
-LOAD_WITH_ALTERED_SEARCH_PATH = 8
-
-; DLL entry-point calls
-
-DLL_PROCESS_DETACH = 0
-DLL_PROCESS_ATTACH = 1
-DLL_THREAD_ATTACH = 2
-DLL_THREAD_DETACH = 3
-
-; Status codes
-
-STATUS_WAIT_0 = 000000000h
-STATUS_ABANDONED_WAIT_0 = 000000080h
-STATUS_USER_APC = 0000000C0h
-STATUS_TIMEOUT = 000000102h
-STATUS_PENDING = 000000103h
-STATUS_DATATYPE_MISALIGNMENT = 080000002h
-STATUS_BREAKPOINT = 080000003h
-STATUS_SINGLE_STEP = 080000004h
-STATUS_ACCESS_VIOLATION = 0C0000005h
-STATUS_IN_PAGE_ERROR = 0C0000006h
-STATUS_NO_MEMORY = 0C0000017h
-STATUS_ILLEGAL_INSTRUCTION = 0C000001Dh
-STATUS_NONCONTINUABLE_EXCEPTION = 0C0000025h
-STATUS_INVALID_DISPOSITION = 0C0000026h
-STATUS_ARRAY_BOUNDS_EXCEEDED = 0C000008Ch
-STATUS_FLOAT_DENORMAL_OPERAND = 0C000008Dh
-STATUS_FLOAT_DIVIDE_BY_ZERO = 0C000008Eh
-STATUS_FLOAT_INEXACT_RESULT = 0C000008Fh
-STATUS_FLOAT_INVALID_OPERATION = 0C0000090h
-STATUS_FLOAT_OVERFLOW = 0C0000091h
-STATUS_FLOAT_STACK_CHECK = 0C0000092h
-STATUS_FLOAT_UNDERFLOW = 0C0000093h
-STATUS_INTEGER_DIVIDE_BY_ZERO = 0C0000094h
-STATUS_INTEGER_OVERFLOW = 0C0000095h
-STATUS_PRIVILEGED_INSTRUCTION = 0C0000096h
-STATUS_STACK_OVERFLOW = 0C00000FDh
-STATUS_CONTROL_C_EXIT = 0C000013Ah
-WAIT_FAILED = -1
-WAIT_OBJECT_0 = STATUS_WAIT_0
-WAIT_ABANDONED = STATUS_ABANDONED_WAIT_0
-WAIT_ABANDONED_0 = STATUS_ABANDONED_WAIT_0
-WAIT_TIMEOUT = STATUS_TIMEOUT
-WAIT_IO_COMPLETION = STATUS_USER_APC
-STILL_ACTIVE = STATUS_PENDING
-
-; Exception codes
-
-EXCEPTION_CONTINUABLE = 0
-EXCEPTION_NONCONTINUABLE = 1
-EXCEPTION_ACCESS_VIOLATION = STATUS_ACCESS_VIOLATION
-EXCEPTION_DATATYPE_MISALIGNMENT = STATUS_DATATYPE_MISALIGNMENT
-EXCEPTION_BREAKPOINT = STATUS_BREAKPOINT
-EXCEPTION_SINGLE_STEP = STATUS_SINGLE_STEP
-EXCEPTION_ARRAY_BOUNDS_EXCEEDED = STATUS_ARRAY_BOUNDS_EXCEEDED
-EXCEPTION_FLT_DENORMAL_OPERAND = STATUS_FLOAT_DENORMAL_OPERAND
-EXCEPTION_FLT_DIVIDE_BY_ZERO = STATUS_FLOAT_DIVIDE_BY_ZERO
-EXCEPTION_FLT_INEXACT_RESULT = STATUS_FLOAT_INEXACT_RESULT
-EXCEPTION_FLT_INVALID_OPERATION = STATUS_FLOAT_INVALID_OPERATION
-EXCEPTION_FLT_OVERFLOW = STATUS_FLOAT_OVERFLOW
-EXCEPTION_FLT_STACK_CHECK = STATUS_FLOAT_STACK_CHECK
-EXCEPTION_FLT_UNDERFLOW = STATUS_FLOAT_UNDERFLOW
-EXCEPTION_INT_DIVIDE_BY_ZERO = STATUS_INTEGER_DIVIDE_BY_ZERO
-EXCEPTION_INT_OVERFLOW = STATUS_INTEGER_OVERFLOW
-EXCEPTION_ILLEGAL_INSTRUCTION = STATUS_ILLEGAL_INSTRUCTION
-EXCEPTION_PRIV_INSTRUCTION = STATUS_PRIVILEGED_INSTRUCTION
-EXCEPTION_IN_PAGE_ERROR = STATUS_IN_PAGE_ERROR
-
-; Registry options
-
-REG_OPTION_RESERVED = 0
-REG_OPTION_NON_VOLATILE = 0
-REG_OPTION_VOLATILE = 1
-REG_OPTION_CREATE_LINK = 2
-REG_OPTION_BACKUP_RESTORE = 4
-REG_CREATED_NEW_KEY = 1
-REG_OPENED_EXISTING_KEY = 2
-REG_WHOLE_HIVE_VOLATILE = 1
-REG_REFRESH_HIVE = 2
-REG_NOTIFY_CHANGE_NAME = 1
-REG_NOTIFY_CHANGE_ATTRIBUTES = 2
-REG_NOTIFY_CHANGE_LAST_SET = 4
-REG_NOTIFY_CHANGE_SECURITY = 8
-REG_LEGAL_CHANGE_FILTER = REG_NOTIFY_CHANGE_NAME or REG_NOTIFY_CHANGE_ATTRIBUTES or REG_NOTIFY_CHANGE_LAST_SET or REG_NOTIFY_CHANGE_SECURITY
-REG_LEGAL_OPTION = REG_OPTION_RESERVED or REG_OPTION_NON_VOLATILE or REG_OPTION_VOLATILE or REG_OPTION_CREATE_LINK or REG_OPTION_BACKUP_RESTORE
-REG_NONE = 0
-REG_SZ = 1
-REG_EXPAND_SZ = 2
-REG_BINARY = 3
-REG_DWORD = 4
-REG_DWORD_LITTLE_ENDIAN = 4
-REG_DWORD_BIG_ENDIAN = 5
-REG_LINK = 6
-REG_MULTI_SZ = 7
-REG_RESOURCE_LIST = 8
-REG_FULL_RESOURCE_DESCRIPTOR = 9
-REG_RESOURCE_REQUIREMENTS_LIST = 10
-
-; Registry access modes
-
-KEY_QUERY_VALUE = 1
-KEY_SET_VALUE = 2
-KEY_CREATE_SUB_KEY = 4
-KEY_ENUMERATE_SUB_KEYS = 8
-KEY_NOTIFY = 10h
-KEY_CREATE_LINK = 20h
-KEY_READ = STANDARD_RIGHTS_READ or KEY_QUERY_VALUE or KEY_ENUMERATE_SUB_KEYS or KEY_NOTIFY and not SYNCHRONIZE
-KEY_WRITE = STANDARD_RIGHTS_WRITE or KEY_SET_VALUE or KEY_CREATE_SUB_KEY and not SYNCHRONIZE
-KEY_EXECUTE = KEY_READ
-KEY_ALL_ACCESS = STANDARD_RIGHTS_ALL or KEY_QUERY_VALUE or KEY_SET_VALUE or KEY_CREATE_SUB_KEY or KEY_ENUMERATE_SUB_KEYS or KEY_NOTIFY or KEY_CREATE_LINK and not SYNCHRONIZE
-
-; Predefined registry keys
-
-HKEY_CLASSES_ROOT = 80000000h
-HKEY_CURRENT_USER = 80000001h
-HKEY_LOCAL_MACHINE = 80000002h
-HKEY_USERS = 80000003h
-HKEY_PERFORMANCE_DATA = 80000004h
-HKEY_CURRENT_CONFIG = 80000005h
-HKEY_DYN_DATA = 80000006h
-
-; FormatMessage flags
-
-FORMAT_MESSAGE_ALLOCATE_BUFFER = 0100h
-FORMAT_MESSAGE_IGNORE_INSERTS = 0200h
-FORMAT_MESSAGE_FROM_STRING = 0400h
-FORMAT_MESSAGE_FROM_HMODULE = 0800h
-FORMAT_MESSAGE_FROM_SYSTEM = 1000h
-FORMAT_MESSAGE_ARGUMENT_ARRAY = 2000h
-FORMAT_MESSAGE_MAX_WIDTH_MASK = 00FFh
-
-; Language identifiers
-
-LANG_NEUTRAL = 00h
-LANG_BULGARIAN = 02h
-LANG_CHINESE = 04h
-LANG_CROATIAN = 1Ah
-LANG_CZECH = 05h
-LANG_DANISH = 06h
-LANG_DUTCH = 13h
-LANG_ENGLISH = 09h
-LANG_FINNISH = 0Bh
-LANG_FRENCH = 0Ch
-LANG_GERMAN = 07h
-LANG_GREEK = 08h
-LANG_HUNGARIAN = 0Eh
-LANG_ICELANDIC = 0Fh
-LANG_ITALIAN = 10h
-LANG_JAPANESE = 11h
-LANG_KOREAN = 12h
-LANG_NORWEGIAN = 14h
-LANG_POLISH = 15h
-LANG_PORTUGUESE = 16h
-LANG_ROMANIAN = 18h
-LANG_RUSSIAN = 19h
-LANG_SLOVAK = 1Bh
-LANG_SLOVENIAN = 24h
-LANG_SPANISH = 0Ah
-LANG_SWEDISH = 1Dh
-LANG_THAI = 1Eh
-LANG_TURKISH = 1Fh
-
-; Sublanguage identifiers
-
-SUBLANG_NEUTRAL = 00h shl 10
-SUBLANG_DEFAULT = 01h shl 10
-SUBLANG_SYS_DEFAULT = 02h shl 10
-SUBLANG_CHINESE_TRADITIONAL = 01h shl 10
-SUBLANG_CHINESE_SIMPLIFIED = 02h shl 10
-SUBLANG_CHINESE_HONGKONG = 03h shl 10
-SUBLANG_CHINESE_SINGAPORE = 04h shl 10
-SUBLANG_DUTCH = 01h shl 10
-SUBLANG_DUTCH_BELGIAN = 02h shl 10
-SUBLANG_ENGLISH_US = 01h shl 10
-SUBLANG_ENGLISH_UK = 02h shl 10
-SUBLANG_ENGLISH_AUS = 03h shl 10
-SUBLANG_ENGLISH_CAN = 04h shl 10
-SUBLANG_ENGLISH_NZ = 05h shl 10
-SUBLANG_ENGLISH_EIRE = 06h shl 10
-SUBLANG_FRENCH = 01h shl 10
-SUBLANG_FRENCH_BELGIAN = 02h shl 10
-SUBLANG_FRENCH_CANADIAN = 03h shl 10
-SUBLANG_FRENCH_SWISS = 04h shl 10
-SUBLANG_GERMAN = 01h shl 10
-SUBLANG_GERMAN_SWISS = 02h shl 10
-SUBLANG_GERMAN_AUSTRIAN = 03h shl 10
-SUBLANG_ITALIAN = 01h shl 10
-SUBLANG_ITALIAN_SWISS = 02h shl 10
-SUBLANG_NORWEGIAN_BOKMAL = 01h shl 10
-SUBLANG_NORWEGIAN_NYNORSK = 02h shl 10
-SUBLANG_PORTUGUESE = 02h shl 10
-SUBLANG_PORTUGUESE_BRAZILIAN = 01h shl 10
-SUBLANG_SPANISH = 01h shl 10
-SUBLANG_SPANISH_MEXICAN = 02h shl 10
-SUBLANG_SPANISH_MODERN = 03h shl 10
-
-; Sorting identifiers
-
-SORT_DEFAULT = 0 shl 16
-SORT_JAPANESE_XJIS = 0 shl 16
-SORT_JAPANESE_UNICODE = 1 shl 16
-SORT_CHINESE_BIG5 = 0 shl 16
-SORT_CHINESE_PRCP = 0 shl 16
-SORT_CHINESE_UNICODE = 1 shl 16
-SORT_CHINESE_PRC = 2 shl 16
-SORT_CHINESE_BOPOMOFO = 3 shl 16
-SORT_KOREAN_KSC = 0 shl 16
-SORT_KOREAN_UNICODE = 1 shl 16
-SORT_GERMAN_PHONE_BOOK = 1 shl 16
-SORT_HUNGARIAN_DEFAULT = 0 shl 16
-SORT_HUNGARIAN_TECHNICAL = 1 shl 16
-
-; Resource types
-
-RT_CURSOR = 1
-RT_BITMAP = 2
-RT_ICON = 3
-RT_MENU = 4
-RT_DIALOG = 5
-RT_STRING = 6
-RT_FONTDIR = 7
-RT_FONT = 8
-RT_ACCELERATOR = 9
-RT_RCDATA = 10
-RT_MESSAGETABLE = 11
-RT_GROUP_CURSOR = 12
-RT_GROUP_ICON = 14
-RT_VERSION = 16
-RT_DLGINCLUDE = 17
-RT_PLUGPLAY = 19
-RT_VXD = 20
-RT_ANICURSOR = 21
-RT_ANIICON = 22
-
-; Clipboard formats
-
-CF_TEXT = 001h
-CF_BITMAP = 002h
-CF_METAFILEPICT = 003h
-CF_SYLK = 004h
-CF_DIF = 005h
-CF_TIFF = 006h
-CF_OEMTEXT = 007h
-CF_DIB = 008h
-CF_PALETTE = 009h
-CF_PENDATA = 00Ah
-CF_RIFF = 00Bh
-CF_WAVE = 00Ch
-CF_UNICODETEXT = 00Dh
-CF_ENHMETAFILE = 00Eh
-CF_HDROP = 00Fh
-CF_LOCALE = 010h
-CF_OWNERDISPLAY = 080h
-CF_DSPTEXT = 081h
-CF_DSPBITMAP = 082h
-CF_DSPMETAFILEPICT = 083h
-CF_DSPENHMETAFILE = 08Eh
-CF_PRIVATEFIRST = 200h
-CF_PRIVATELAST = 2FFh
-CF_GDIOBJFIRST = 300h
-CF_GDIOBJLAST = 3FFh
-
-; OS types for version info
-
-VOS_UNKNOWN = 00000000h
-VOS_DOS = 00010000h
-VOS_OS216 = 00020000h
-VOS_OS232 = 00030000h
-VOS_NT = 00040000h
-VOS__BASE = 00000000h
-VOS__WINDOWS16 = 00000001h
-VOS__PM16 = 00000002h
-VOS__PM32 = 00000003h
-VOS__WINDOWS32 = 00000004h
-VOS_DOS_WINDOWS16 = 00010001h
-VOS_DOS_WINDOWS32 = 00010004h
-VOS_OS216_PM16 = 00020002h
-VOS_OS232_PM32 = 00030003h
-VOS_NT_WINDOWS32 = 00040004h
-
-; File types for version info
-
-VFT_UNKNOWN = 00000000h
-VFT_APP = 00000001h
-VFT_DLL = 00000002h
-VFT_DRV = 00000003h
-VFT_FONT = 00000004h
-VFT_VXD = 00000005h
-VFT_STATIC_LIB = 00000007h
-
-; File subtypes for version info
-
-VFT2_UNKNOWN = 00000000h
-VFT2_DRV_PRINTER = 00000001h
-VFT2_DRV_KEYBOARD = 00000002h
-VFT2_DRV_LANGUAGE = 00000003h
-VFT2_DRV_DISPLAY = 00000004h
-VFT2_DRV_MOUSE = 00000005h
-VFT2_DRV_NETWORK = 00000006h
-VFT2_DRV_SYSTEM = 00000007h
-VFT2_DRV_INSTALLABLE = 00000008h
-VFT2_DRV_SOUND = 00000009h
-VFT2_DRV_COMM = 0000000Ah
-VFT2_DRV_INPUTMETHOD = 0000000Bh
-VFT2_DRV_VERSIONED_PRINTER = 0000000Ch
-VFT2_FONT_RASTER = 00000001h
-VFT2_FONT_VECTOR = 00000002h
-VFT2_FONT_TRUETYPE = 00000003h
-
-
-; MultiByteToWideChar constants
-
-CP_ACP = 0
-CP_OEMCP = 1
-CP_MACCP = 2
-CP_THREAD_ACP = 3
-CP_SYMBOL = 42
-CP_UTF7 = 65000
-CP_UTF8 = 65001
-
-; .flags:
-MB_PRECOMPOSED = $00000001 ; use precomposed chars
-MB_COMPOSITE = $00000002 ; use composite chars
-MB_USEGLYPHCHARS = $00000004 ; use glyph chars, not ctrl chars
-MB_ERR_INVALID_CHARS = $00000008 ; error for invalid chars
DELETED freshlib/equates/Win32/_ODBC32.INC
Index: freshlib/equates/Win32/_ODBC32.INC
==================================================================
--- freshlib/equates/Win32/_ODBC32.INC
+++ /dev/null
@@ -1,1486 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: ODBC constants and structures.
-;
-; Target OS: Win32
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-SQL_NULL_DATA = -1
-SQL_DATA_AT_EXEC = -2
-SQL_SUCCESS = 0
-SQL_SUCCESS_WITH_INFO = 1
-SQL_NODATA = 100
-SQL_ERROR = -1
-SQL_INVALID_HANDLE = -2
-SQL_STILL_EXECUTING = 2
-SQL_NEED_DATA = 99
-SQL_NTS = -3
-SQL_NTSL = -3
-SQL_MAX_MESSAGE_LENGTH = 512
-SQL_DATE_LEN = 10
-SQL_TIME_LEN = 8
-SQL_TIMESTAMP_LEN = 19
-SQL_HANDLE_ENV = 1
-SQL_HANDLE_DBC = 2
-SQL_HANDLE_STMT = 3
-SQL_HANDLE_DESC = 4
-SQL_ATTR_OUTPUT_NTS = 10001
-SQL_ATTR_AUTO_IPD = 10001
-SQL_ATTR_METADATA_ID = 10014
-SQL_ATTR_APP_ROW_DESC = 10010
-SQL_ATTR_APP_PARAM_DESC = 10011
-SQL_ATTR_IMP_ROW_DESC = 10012
-SQL_ATTR_IMP_PARAM_DESC = 10013
-SQL_ATTR_CURSOR_SCROLLABLE = -1
-SQL_ATTR_CURSOR_SENSITIVITY = -2
-SQL_NONSCROLLABLE = 0
-SQL_SCROLLABLE = 1
-SQL_DESC_COUNT = 1001
-SQL_DESC_TYPE = 1002
-SQL_DESC_LENGTH = 1003
-SQL_DESC_OCTET_LENGTH_PTR = 1004
-SQL_DESC_PRECISION = 1005
-SQL_DESC_SCALE = 1006
-SQL_DESC_DATETIME_INTERVAL_CODE = 1007
-SQL_DESC_NULLABLE = 1008
-SQL_DESC_INDICATOR_PTR = 1009
-SQL_DESC_DATA_PTR = 1010
-SQL_DESC_NAME = 1011
-SQL_DESC_UNNAMED = 1012
-SQL_DESC_OCTET_LENGTH = 1013
-SQL_DESC_ALLOC_TYPE = 1099
-SQL_DIAG_RETURNCODE = 1
-SQL_DIAG_NUMBER = 2
-SQL_DIAG_ROW_COUNT = 3
-SQL_DIAG_SQLSTATE = 4
-SQL_DIAG_NATIVE = 5
-SQL_DIAG_MESSAGE_TEXT = 6
-SQL_DIAG_DYNAMIC_FUNCTION = 7
-SQL_DIAG_CLASS_ORIGIN = 8
-SQL_DIAG_SUBCLASS_ORIGIN = 9
-SQL_DIAG_CONNECTION_NAME = 10
-SQL_DIAG_SERVER_NAME = 11
-SQL_DIAG_DYNAMIC_FUNCTION_CODE = 12
-SQL_DIAG_ALTER_DOMAIN = 3
-SQL_DIAG_ALTER_TABLE = 4
-SQL_DIAG_CALL = 7
-SQL_DIAG_CREATE_ASSERTION = 6
-SQL_DIAG_CREATE_CHARACTER_SET = 8
-SQL_DIAG_CREATE_COLLATION = 10
-SQL_DIAG_CREATE_DOMAIN = 23
-SQL_DIAG_CREATE_INDEX = -1
-SQL_DIAG_CREATE_SCHEMA = 64
-SQL_DIAG_CREATE_TABLE = 77
-SQL_DIAG_CREATE_TRANSLATION = 79
-SQL_DIAG_CREATE_VIEW = 84
-SQL_DIAG_DELETE_WHERE = 19
-SQL_DIAG_DROP_ASSERTION = 24
-SQL_DIAG_DROP_CHARACTER_SET = 25
-SQL_DIAG_DROP_COLLATION = 26
-SQL_DIAG_DROP_DOMAIN = 27
-SQL_DIAG_DROP_INDEX = -2
-SQL_DIAG_DROP_SCHEMA = 31
-SQL_DIAG_DROP_TABLE = 32
-SQL_DIAG_DROP_TRANSLATION = 33
-SQL_DIAG_DROP_VIEW = 36
-SQL_DIAG_DYNAMIC_DELETE_CURSOR = 38
-SQL_DIAG_DYNAMIC_UPDATE_CURSOR = 81
-SQL_DIAG_GRANT = 48
-SQL_DIAG_INSERT = 50
-SQL_DIAG_REVOKE = 59
-SQL_DIAG_SELECT_CURSOR = 85
-SQL_DIAG_UNKNOWN_STATEMENT = 0
-SQL_DIAG_UPDATE_WHERE = 82
-SQL_UNKNOWN_TYPE = 0
-SQL_CHAR = 1
-SQL_NUMERIC = 2
-SQL_DECIMAL = 3
-SQL_INTEGER = 4
-SQL_SMALLINT = 5
-SQL_FLOAT = 6
-SQL_REAL = 7
-SQL_DOUBLE = 8
-SQL_DATETIME = 9
-SQL_VARCHAR = 12
-SQL_TYPE_DATE = 91
-SQL_TYPE_TIME = 92
-SQL_TYPE_TIMESTAMP = 93
-SQL_UNSPECIFIED = 0
-SQL_INSENSITIVE = 1
-SQL_SENSITIVE = 2
-SQL_ALL_TYPES = 0
-SQL_DEFAULT = 99
-SQL_ARD_TYPE = -99
-SQL_CODE_DATE = 1
-SQL_CODE_TIME = 2
-SQL_CODE_TIMESTAMP = 3
-SQL_FALSE = 0
-SQL_TRUE = 1
-SQL_NO_NULLS = 0
-SQL_NULLABLE = 1
-SQL_NULLABLE_UNKNOWN = 2
-SQL_PRED_NONE = 0
-SQL_PRED_CHAR = 1
-SQL_PRED_BASIC = 2
-SQL_NAMED = 0
-SQL_UNNAMED = 1
-SQL_DESC_ALLOC_AUTO = 1
-SQL_DESC_ALLOC_USER = 2
-SQL_CLOSE = 0
-SQL_DROP = 1
-SQL_UNBIND = 2
-SQL_RESET_PARAMS = 3
-SQL_FETCH_NEXT = 1
-SQL_FETCH_FIRST = 2
-SQL_FETCH_LAST = 3
-SQL_FETCH_PRIOR = 4
-SQL_FETCH_ABSOLUTE = 5
-SQL_FETCH_RELATIVE = 6
-SQL_COMMIT = 0
-SQL_ROLLBACK = 1
-SQL_NULL_HENV = 0
-SQL_NULL_HDBC = 0
-SQL_NULL_HSTMT = 0
-SQL_NULL_HDESC = 0
-SQL_NULL_HANDLE = 0
-SQL_SCOPE_CURROW = 0
-SQL_SCOPE_TRANSACTION = 1
-SQL_SCOPE_SESSION = 2
-SQL_PC_UNKNOWN = 0
-SQL_PC_NON_PSEUDO = 1
-SQL_PC_PSEUDO = 2
-SQL_ROW_IDENTIFIER = 1
-SQL_INDEX_UNIQUE = 0
-SQL_INDEX_ALL = 1
-SQL_INDEX_CLUSTERED = 1
-SQL_INDEX_HASHED = 2
-SQL_INDEX_OTHER = 3
-SQL_API_SQLALLOCCONNECT = 1
-SQL_API_SQLALLOCENV = 2
-SQL_API_SQLALLOCHANDLE = 1001
-SQL_API_SQLALLOCSTMT = 3
-SQL_API_SQLBINDCOL = 4
-SQL_API_SQLBINDPARAM = 1002
-SQL_API_SQLCANCEL = 5
-SQL_API_SQLCLOSECURSOR = 1003
-SQL_API_SQLCOLATTRIBUTE = 6
-SQL_API_SQLCOLUMNS = 40
-SQL_API_SQLCONNECT = 7
-SQL_API_SQLCOPYDESC = 1004
-SQL_API_SQLDATASOURCES = 57
-SQL_API_SQLDESCRIBECOL = 8
-SQL_API_SQLDISCONNECT = 9
-SQL_API_SQLENDTRAN = 1005
-SQL_API_SQLERROR = 10
-SQL_API_SQLEXECDIRECT = 11
-SQL_API_SQLEXECUTE = 12
-SQL_API_SQLFETCH = 13
-SQL_API_SQLFETCHSCROLL = 1021
-SQL_API_SQLFREECONNECT = 14
-SQL_API_SQLFREEENV = 15
-SQL_API_SQLFREEHANDLE = 1006
-SQL_API_SQLFREESTMT = 16
-SQL_API_SQLGETCONNECTATTR = 1007
-SQL_API_SQLGETCONNECTOPTION = 42
-SQL_API_SQLGETCURSORNAME = 17
-SQL_API_SQLGETDATA = 43
-SQL_API_SQLGETDESCFIELD = 1008
-SQL_API_SQLGETDESCREC = 1009
-SQL_API_SQLGETDIAGFIELD = 1010
-SQL_API_SQLGETDIAGREC = 1011
-SQL_API_SQLGETENVATTR = 1012
-SQL_API_SQLGETFUNCTIONS = 44
-SQL_API_SQLGETINFO = 45
-SQL_API_SQLGETSTMTATTR = 1014
-SQL_API_SQLGETSTMTOPTION = 46
-SQL_API_SQLGETTYPEINFO = 47
-SQL_API_SQLNUMRESULTCOLS = 18
-SQL_API_SQLPARAMDATA = 48
-SQL_API_SQLPREPARE = 19
-SQL_API_SQLPUTDATA = 49
-SQL_API_SQLROWCOUNT = 20
-SQL_API_SQLSETCONNECTATTR = 1016
-SQL_API_SQLSETCONNECTOPTION = 50
-SQL_API_SQLSETCURSORNAME = 21
-SQL_API_SQLSETDESCFIELD = 1017
-SQL_API_SQLSETDESCREC = 1018
-SQL_API_SQLSETENVATTR = 1019
-SQL_API_SQLSETPARAM = 22
-SQL_API_SQLSETSTMTATTR = 1020
-SQL_API_SQLSETSTMTOPTION = 51
-SQL_API_SQLSPECIALCOLUMNS = 52
-SQL_API_SQLSTATISTICS = 53
-SQL_API_SQLTABLES = 54
-SQL_API_SQLTRANSACT = 23
-SQL_MAX_DRIVER_CONNECTIONS = 0
-SQL_MAXIMUM_DRIVER_CONNECTIONS = SQL_MAX_DRIVER_CONNECTIONS
-SQL_MAX_CONCURRENT_ACTIVITIES = 1
-SQL_MAXIMUM_CONCURRENT_ACTIVITIES = SQL_MAX_CONCURRENT_ACTIVITIES
-SQL_DATA_SOURCE_NAME = 2
-SQL_FETCH_DIRECTION = 8
-SQL_SERVER_NAME = 13
-SQL_SEARCH_PATTERN_ESCAPE = 14
-SQL_DBMS_NAME = 17
-SQL_DBMS_VER = 18
-SQL_ACCESSIBLE_TABLES = 19
-SQL_ACCESSIBLE_PROCEDURES = 20
-SQL_CURSOR_COMMIT_BEHAVIOR = 23
-SQL_DATA_SOURCE_READ_ONLY = 25
-SQL_DEFAULT_TXN_ISOLATION = 26
-SQL_IDENTIFIER_CASE = 28
-SQL_IDENTIFIER_QUOTE_CHAR = 29
-SQL_MAX_COLUMN_NAME_LEN = 30
-SQL_MAXIMUM_COLUMN_NAME_LENGTH = SQL_MAX_COLUMN_NAME_LEN
-SQL_MAX_CURSOR_NAME_LEN = 31
-SQL_MAXIMUM_CURSOR_NAME_LENGTH = SQL_MAX_CURSOR_NAME_LEN
-SQL_MAX_SCHEMA_NAME_LEN = 32
-SQL_MAXIMUM_SCHEMA_NAME_LENGTH = SQL_MAX_SCHEMA_NAME_LEN
-SQL_MAX_CATALOG_NAME_LEN = 34
-SQL_MAXIMUM_CATALOG_NAME_LENGTH = SQL_MAX_CATALOG_NAME_LEN
-SQL_MAX_TABLE_NAME_LEN = 35
-SQL_SCROLL_CONCURRENCY = 43
-SQL_TXN_CAPABLE = 46
-SQL_TRANSACTION_CAPABLE = SQL_TXN_CAPABLE
-SQL_USER_NAME = 47
-SQL_TXN_ISOLATION_OPTION = 72
-SQL_TRANSACTION_ISOLATION_OPTION = SQL_TXN_ISOLATION_OPTION
-SQL_INTEGRITY = 73
-SQL_GETDATA_EXTENSIONS = 81
-SQL_NULL_COLLATION = 85
-SQL_ALTER_TABLE = 86
-SQL_ORDER_BY_COLUMNS_IN_SELECT = 90
-SQL_SPECIAL_CHARACTERS = 94
-SQL_MAX_COLUMNS_IN_GROUP_BY = 97
-SQL_MAXIMUM_COLUMNS_IN_GROUP_BY = SQL_MAX_COLUMNS_IN_GROUP_BY
-SQL_MAX_COLUMNS_IN_INDEX = 98
-SQL_MAXIMUM_COLUMNS_IN_INDEX = SQL_MAX_COLUMNS_IN_INDEX
-SQL_MAX_COLUMNS_IN_ORDER_BY = 99
-SQL_MAXIMUM_COLUMNS_IN_ORDER_BY = SQL_MAX_COLUMNS_IN_ORDER_BY
-SQL_MAX_COLUMNS_IN_SELECT = 100
-SQL_MAXIMUM_COLUMNS_IN_SELECT = SQL_MAX_COLUMNS_IN_SELECT
-SQL_MAX_COLUMNS_IN_TABLE = 101
-SQL_MAX_INDEX_SIZE = 102
-SQL_MAXIMUM_INDEX_SIZE = SQL_MAX_INDEX_SIZE
-SQL_MAX_ROW_SIZE = 104
-SQL_MAXIMUM_ROW_SIZE = SQL_MAX_ROW_SIZE
-SQL_MAX_STATEMENT_LEN = 105
-SQL_MAXIMUM_STATEMENT_LENGTH = SQL_MAX_STATEMENT_LEN
-SQL_MAX_TABLES_IN_SELECT = 106
-SQL_MAXIMUM_TABLES_IN_SELECT = SQL_MAX_TABLES_IN_SELECT
-SQL_MAX_USER_NAME_LEN = 107
-SQL_MAXIMUM_USER_NAME_LENGTH = SQL_MAX_USER_NAME_LEN
-SQL_OJ_CAPABILITIES = 115
-SQL_OUTER_JOIN_CAPABILITIES = SQL_OJ_CAPABILITIES
-SQL_XOPEN_CLI_YEAR = 10000
-SQL_CURSOR_SENSITIVITY = 10001
-SQL_DESCRIBE_PARAMETER = 10002
-SQL_CATALOG_NAME = 10003
-SQL_COLLATION_SEQ = 10004
-SQL_MAX_IDENTIFIER_LEN = 10005
-SQL_MAXIMUM_IDENTIFIER_LENGTH = SQL_MAX_IDENTIFIER_LEN
-SQL_AT_ADD_COLUMN = 1
-SQL_AT_DROP_COLUMN = 2
-SQL_AT_ADD_CONSTRAINT = 8
-SQL_AT_COLUMN_SINGLE = 20h
-SQL_AT_ADD_COLUMN_DEFAULT = 40h
-SQL_AT_ADD_COLUMN_COLLATION = 80h
-SQL_AT_SET_COLUMN_DEFAULT = 100h
-SQL_AT_DROP_COLUMN_DEFAULT = 200h
-SQL_AT_DROP_COLUMN_CASCADE = 400h
-SQL_AT_DROP_COLUMN_RESTRICT = 800h
-SQL_AT_ADD_TABLE_CONSTRAINT = 1000h
-SQL_AT_DROP_TABLE_CONSTRAINT_CASCADE = 2000h
-SQL_AT_DROP_TABLE_CONSTRAINT_RESTRICT = 4000h
-SQL_AT_CONSTRAINT_NAME_DEFINITION = 8000h
-SQL_AT_CONSTRAINT_INITIALLY_DEFERRED = 10000h
-SQL_AT_CONSTRAINT_INITIALLY_IMMEDIATE = 20000h
-SQL_AT_CONSTRAINT_DEFERRABLE = 40000h
-SQL_AT_CONSTRAINT_NON_DEFERRABLE = 80000h
-SQL_AM_NONE = 0
-SQL_AM_CONNECTION = 1
-SQL_AM_STATEMENT = 2
-SQL_CB_DELETE = 0
-SQL_CB_CLOSE = 1
-SQL_CB_PRESERVE = 2
-SQL_FD_FETCH_NEXT = 1
-SQL_FD_FETCH_FIRST = 2
-SQL_FD_FETCH_LAST = 4
-SQL_FD_FETCH_PRIOR = 8
-SQL_FD_FETCH_ABSOLUTE = 10h
-SQL_FD_FETCH_RELATIVE = 20h
-SQL_GD_ANY_COLUMN = 1
-SQL_GD_ANY_ORDER = 2
-SQL_IC_UPPER = 1
-SQL_IC_LOWER = 2
-SQL_IC_SENSITIVE = 3
-SQL_IC_MIXED = 4
-SQL_OJ_LEFT = 1
-SQL_OJ_RIGHT = 2
-SQL_OJ_FULL = 4
-SQL_OJ_NESTED = 8
-SQL_OJ_NOT_ORDERED = 10h
-SQL_OJ_INNER = 20h
-SQL_OJ_ALL_COMPARISON_OPS = 40h
-SQL_SCCO_READ_ONLY = 1
-SQL_SCCO_LOCK = 2
-SQL_SCCO_OPT_ROWVER = 4
-SQL_SCCO_OPT_VALUES = 8
-SQL_TC_NONE = 0
-SQL_TC_DML = 1
-SQL_TC_ALL = 2
-SQL_TC_DDL_COMMIT = 3
-SQL_TC_DDL_IGNORE = 4
-SQL_TXN_READ_UNCOMMITTED = 1
-SQL_TRANSACTION_READ_UNCOMMITTED = SQL_TXN_READ_UNCOMMITTED
-SQL_TXN_READ_COMMITTED = 2
-SQL_TRANSACTION_READ_COMMITTED = SQL_TXN_READ_COMMITTED
-SQL_TXN_REPEATABLE_READ = 4
-SQL_TRANSACTION_REPEATABLE_READ = SQL_TXN_REPEATABLE_READ
-SQL_TXN_SERIALIZABLE = 8
-SQL_TRANSACTION_SERIALIZABLE = SQL_TXN_SERIALIZABLE
-SQL_NC_HIGH = 0
-SQL_NC_LOW = 1
-
-
-SQL_SPEC_MAJOR = 3
-SQL_SPEC_MINOR = 51
-SQL_SPEC_STRING = "03.51"
-SQL_SQLSTATE_SIZE = 5
-SQL_MAX_DSN_LENGTH = 32
-SQL_MAX_OPTION_STRING_LENGTH = 256
-SQL_NODATAFOUND = SQL_NODATA
-SQL_HANDLE_SENV = 5
-SQL_ATTR_ODBC_VERSION = 200
-SQL_ATTR_CONNECTION_POOLING = 201
-SQL_ATTR_CP_MATCH = 202
-SQL_CP_OFF = 0
-SQL_CP_ONE_PER_DRIVER = 1
-SQL_CP_ONE_PER_HENV = 2
-SQL_CP_DEFAULT = SQL_CP_OFF
-SQL_CP_STRICT_MATCH = 0
-SQL_CP_RELAXED_MATCH = 1
-SQL_CP_MATCH_DEFAULT = SQL_CP_STRICT_MATCH
-SQL_OV_ODBC2 = 2
-SQL_OV_ODBC3 = 3
-SQL_ACCESS_MODE = 101
-SQL_AUTOCOMMIT = 102
-SQL_LOGIN_TIMEOUT = 103
-SQL_OPT_TRACE = 104
-SQL_OPT_TRACEFILE = 105
-SQL_TRANSLATE_DLL = 106
-SQL_TRANSLATE_OPTION = 107
-SQL_TXN_ISOLATION = 108
-SQL_CURRENT_QUALIFIER = 109
-SQL_ODBC_CURSORS = 110
-SQL_QUIET_MODE = 111
-SQL_PACKET_SIZE = 112
-SQL_ATTR_ACCESS_MODE = SQL_ACCESS_MODE
-SQL_ATTR_AUTOCOMMIT = SQL_AUTOCOMMIT
-SQL_ATTR_CONNECTION_TIMEOUT = 113
-SQL_ATTR_CURRENT_CATALOG = SQL_CURRENT_QUALIFIER
-SQL_ATTR_DISCONNECT_BEHAVIOR = 114
-SQL_ATTR_ENLIST_IN_DTC = 1207
-SQL_ATTR_ENLIST_IN_XA = 1208
-SQL_ATTR_LOGIN_TIMEOUT = SQL_LOGIN_TIMEOUT
-SQL_ATTR_ODBC_CURSORS = SQL_ODBC_CURSORS
-SQL_ATTR_PACKET_SIZE = SQL_PACKET_SIZE
-SQL_ATTR_QUIET_MODE = SQL_QUIET_MODE
-SQL_ATTR_TRACE = SQL_OPT_TRACE
-SQL_ATTR_TRACEFILE = SQL_OPT_TRACEFILE
-SQL_ATTR_TRANSLATE_LIB = SQL_TRANSLATE_DLL
-SQL_ATTR_TRANSLATE_OPTION = SQL_TRANSLATE_OPTION
-SQL_ATTR_TXN_ISOLATION = SQL_TXN_ISOLATION
-SQL_ATTR_CONNECTION_DEAD = 1209
-SQL_ATTR_ANSI_APP = 115
-SQL_MODE_READ_WRITE = 0
-SQL_MODE_READ_ONLY = 1
-SQL_MODE_DEFAULT = SQL_MODE_READ_WRITE
-SQL_AUTOCOMMIT_OFF = 0
-SQL_AUTOCOMMIT_ON = 1
-SQL_AUTOCOMMIT_DEFAULT = SQL_AUTOCOMMIT_ON
-SQL_LOGIN_TIMEOUT_DEFAULT = 15
-SQL_OPT_TRACE_OFF = 0
-SQL_OPT_TRACE_ON = 1
-SQL_OPT_TRACE_DEFAULT = SQL_OPT_TRACE_OFF
-SQL_OPT_TRACE_FILE_DEFAULT equ "\\SQL.LOG"
-SQL_CUR_USE_IF_NEEDED = 0
-SQL_CUR_USE_ODBC = 1
-SQL_CUR_USE_DRIVER = 2
-SQL_CUR_DEFAULT = SQL_CUR_USE_DRIVER
-SQL_DB_RETURN_TO_POOL = 0
-SQL_DB_DISCONNECT = 1
-SQL_DB_DEFAULT = SQL_DB_RETURN_TO_POOL
-SQL_DTC_DONE = 0
-SQL_CD_TRUE = 1
-SQL_CD_FALSE = 0
-SQL_AA_TRUE = 1
-SQL_AA_FALSE = 0
-SQL_QUERY_TIMEOUT = 0
-SQL_MAX_ROWS = 1
-SQL_NOSCAN = 2
-SQL_MAX_LENGTH = 3
-SQL_ASYNC_ENABLE = 4
-SQL_BIND_TYPE = 5
-SQL_CURSOR_TYPE = 6
-SQL_CONCURRENCY = 7
-SQL_KEYSET_SIZE = 8
-SQL_ROWSET_SIZE = 9
-SQL_SIMULATE_CURSOR = 10
-SQL_RETRIEVE_DATA = 11
-SQL_USE_BOOKMARKS = 12
-SQL_GET_BOOKMARK = 13
-SQL_ROW_NUMBER = 14
-SQL_ATTR_ASYNC_ENABLE = 4
-SQL_ATTR_CONCURRENCY = SQL_CONCURRENCY
-SQL_ATTR_CURSOR_TYPE = SQL_CURSOR_TYPE
-SQL_ATTR_ENABLE_AUTO_IPD = 15
-SQL_ATTR_FETCH_BOOKMARK_PTR = 16
-SQL_ATTR_KEYSET_SIZE = SQL_KEYSET_SIZE
-SQL_ATTR_MAX_LENGTH = SQL_MAX_LENGTH
-SQL_ATTR_MAX_ROWS = SQL_MAX_ROWS
-SQL_ATTR_NOSCAN = SQL_NOSCAN
-SQL_ATTR_PARAM_BIND_OFFSET_PTR = 17
-SQL_ATTR_PARAM_BIND_TYPE = 18
-SQL_ATTR_PARAM_OPERATION_PTR = 19
-SQL_ATTR_PARAM_STATUS_PTR = 20
-SQL_ATTR_PARAMS_PROCESSED_PTR = 21
-SQL_ATTR_PARAMSET_SIZE = 22
-SQL_ATTR_QUERY_TIMEOUT = SQL_QUERY_TIMEOUT
-SQL_ATTR_RETRIEVE_DATA = SQL_RETRIEVE_DATA
-SQL_ATTR_ROW_BIND_OFFSET_PTR = 23
-SQL_ATTR_ROW_BIND_TYPE = SQL_BIND_TYPE
-SQL_ATTR_ROW_NUMBER = SQL_ROW_NUMBER
-SQL_ATTR_ROW_OPERATION_PTR = 24
-SQL_ATTR_ROW_STATUS_PTR = 25
-SQL_ATTR_ROWS_FETCHED_PTR = 26
-SQL_ATTR_ROW_ARRAY_SIZE = 27
-SQL_ATTR_SIMULATE_CURSOR = SQL_SIMULATE_CURSOR
-SQL_ATTR_USE_BOOKMARKS = SQL_USE_BOOKMARKS
-SQL_COL_PRED_CHAR = SQL_LIKE_ONLY
-SQL_COL_PRED_BASIC = SQL_ALL_EXCEPT_LIKE
-SQL_IS_POINTER = -4
-SQL_IS_UINTEGER = -5
-SQL_IS_INTEGER = -6
-SQL_IS_USMALLINT = -7
-SQL_IS_SMALLINT = -8
-SQL_PARAM_BIND_BY_COLUMN = 0
-SQL_PARAM_BIND_TYPE_DEFAULT = SQL_PARAM_BIND_BY_COLUMN
-SQL_QUERY_TIMEOUT_DEFAULT = 0
-SQL_MAX_ROWS_DEFAULT = 0
-SQL_NOSCAN_OFF = 0
-SQL_NOSCAN_ON = 1
-SQL_NOSCAN_DEFAULT = SQL_NOSCAN_OFF
-SQL_MAX_LENGTH_DEFAULT = 0
-SQL_ASYNC_ENABLE_OFF = 0
-SQL_ASYNC_ENABLE_ON = 1
-SQL_ASYNC_ENABLE_DEFAULT = SQL_ASYNC_ENABLE_OFF
-SQL_BIND_BY_COLUMN = 0
-SQL_BIND_TYPE_DEFAULT = SQL_BIND_BY_COLUMN
-SQL_CONCUR_READ_ONLY = 1
-SQL_CONCUR_LOCK = 2
-SQL_CONCUR_ROWVER = 3
-SQL_CONCUR_VALUES = 4
-SQL_CONCUR_DEFAULT = SQL_CONCUR_READ_ONLY
-SQL_CURSOR_FORWARD_ONLY = 0
-SQL_CURSOR_KEYSET_DRIVEN = 1
-SQL_CURSOR_DYNAMIC = 2
-SQL_CURSOR_STATIC = 3
-SQL_CURSOR_TYPE_DEFAULT = SQL_CURSOR_FORWARD_ONLY
-SQL_ROWSET_SIZE_DEFAULT = 1
-SQL_KEYSET_SIZE_DEFAULT = 0
-SQL_SC_NON_UNIQUE = 0
-SQL_SC_TRY_UNIQUE = 1
-SQL_SC_UNIQUE = 2
-SQL_RD_OFF = 0
-SQL_RD_ON = 1
-SQL_RD_DEFAULT = SQL_RD_ON
-SQL_UB_OFF = 0
-SQL_UB_ON = 01
-SQL_UB_DEFAULT = SQL_UB_OFF
-SQL_UB_FIXED = SQL_UB_ON
-SQL_UB_VARIABLE = 2
-SQL_DESC_ARRAY_SIZE = 20
-SQL_DESC_ARRAY_STATUS_PTR = 21
-SQL_DESC_AUTO_UNIQUE_VALUE = SQL_COLUMN_AUTO_INCREMENT
-SQL_DESC_BASE_COLUMN_NAME = 22
-SQL_DESC_BASE_TABLE_NAME = 23
-SQL_DESC_BIND_OFFSET_PTR = 24
-SQL_DESC_BIND_TYPE = 25
-SQL_DESC_CASE_SENSITIVE = SQL_COLUMN_CASE_SENSITIVE
-SQL_DESC_CATALOG_NAME = SQL_COLUMN_QUALIFIER_NAME
-SQL_DESC_CONCISE_TYPE = SQL_COLUMN_TYPE
-SQL_DESC_DATETIME_INTERVAL_PRECISION = 26
-SQL_DESC_DISPLAY_SIZE = SQL_COLUMN_DISPLAY_SIZE
-SQL_DESC_FIXED_PREC_SCALE = SQL_COLUMN_MONEY
-SQL_DESC_LABEL = SQL_COLUMN_LABEL
-SQL_DESC_LITERAL_PREFIX = 27
-SQL_DESC_LITERAL_SUFFIX = 28
-SQL_DESC_LOCAL_TYPE_NAME = 29
-SQL_DESC_MAXIMUM_SCALE = 30
-SQL_DESC_MINIMUM_SCALE = 31
-SQL_DESC_NUM_PREC_RADIX = 32
-SQL_DESC_PARAMETER_TYPE = 33
-SQL_DESC_ROWS_PROCESSED_PTR = 34
-SQL_DESC_ROWVER = 35
-SQL_DESC_SCHEMA_NAME = SQL_COLUMN_OWNER_NAME
-SQL_DESC_SEARCHABLE = SQL_COLUMN_SEARCHABLE
-SQL_DESC_TYPE_NAME = SQL_COLUMN_TYPE_NAME
-SQL_DESC_TABLE_NAME = SQL_COLUMN_TABLE_NAME
-SQL_DESC_UNSIGNED = SQL_COLUMN_UNSIGNED
-SQL_DESC_UPDATABLE = SQL_COLUMN_UPDATABLE
-SQL_DIAG_CURSOR_ROW_COUNT = -1249
-SQL_DIAG_ROW_NUMBER = -1248
-SQL_DIAG_COLUMN_NUMBER = -1247
-SQL_DATE = 9
-SQL_INTERVAL = 10
-SQL_TIME = 10
-SQL_TIMESTAMP = 11
-SQL_LONGVARCHAR = -1
-SQL_BINARY = -2
-SQL_VARBINARY = -3
-SQL_LONGVARBINARY = -4
-SQL_BIGINT = -5
-SQL_TINYINT = -6
-SQL_BIT = -7
-SQL_GUID = -11
-SQL_CODE_YEAR = 1
-SQL_CODE_MONTH = 2
-SQL_CODE_DAY = 3
-SQL_CODE_HOUR = 4
-SQL_CODE_MINUTE = 5
-SQL_CODE_SECOND = 6
-SQL_CODE_YEAR_TO_MONTH = 7
-SQL_CODE_DAY_TO_HOUR = 8
-SQL_CODE_DAY_TO_MINUTE = 9
-SQL_CODE_DAY_TO_SECOND = 10
-SQL_CODE_HOUR_TO_MINUTE = 11
-SQL_CODE_HOUR_TO_SECOND = 12
-SQL_CODE_MINUTE_TO_SECOND = 13
-SQL_INTERVAL_YEAR = 100 + SQL_CODE_YEAR
-SQL_INTERVAL_MONTH = 100 + SQL_CODE_MONTH
-SQL_INTERVAL_DAY = 100 + SQL_CODE_DAY
-SQL_INTERVAL_HOUR = 100 + SQL_CODE_HOUR
-SQL_INTERVAL_MINUTE = 100 + SQL_CODE_MINUTE
-SQL_INTERVAL_SECOND = 100 + SQL_CODE_SECOND
-SQL_INTERVAL_YEAR_TO_MONTH = 100 + SQL_CODE_YEAR_TO_MONTH
-SQL_INTERVAL_DAY_TO_HOUR = 100 + SQL_CODE_DAY_TO_HOUR
-SQL_INTERVAL_DAY_TO_MINUTE = 100 + SQL_CODE_DAY_TO_MINUTE
-SQL_INTERVAL_DAY_TO_SECOND = 100 + SQL_CODE_DAY_TO_SECOND
-SQL_INTERVAL_HOUR_TO_MINUTE = 100 + SQL_CODE_HOUR_TO_MINUTE
-SQL_INTERVAL_HOUR_TO_SECOND = 100 + SQL_CODE_HOUR_TO_SECOND
-SQL_INTERVAL_MINUTE_TO_SECOND = 100 + SQL_CODE_MINUTE_TO_SECOND
-
-;???? SQL_UNICODE = SQL_WCHAR
-;???? SQL_UNICODE_VARCHAR = SQL_WVARCHAR
-;???? SQL_UNICODE_LONGVARCHAR = SQL_WLONGVARCHAR
-;???? SQL_UNICODE_CHAR = SQL_WCHAR
-
-SQL_C_CHAR = SQL_CHAR
-SQL_C_LONG = SQL_INTEGER
-SQL_C_SHORT = SQL_SMALLINT
-SQL_C_FLOAT = SQL_REAL
-SQL_C_DOUBLE = SQL_DOUBLE
-SQL_C_NUMERIC = SQL_NUMERIC
-SQL_C_DEFAULT = 99
-SQL_SIGNED_OFFSET = -20
-SQL_UNSIGNED_OFFSET = -22
-SQL_C_DATE = SQL_DATE
-SQL_C_TIME = SQL_TIME
-SQL_C_TIMESTAMP = SQL_TIMESTAMP
-SQL_C_TYPE_DATE = SQL_TYPE_DATE
-SQL_C_TYPE_TIME = SQL_TYPE_TIME
-SQL_C_TYPE_TIMESTAMP = SQL_TYPE_TIMESTAMP
-SQL_C_INTERVAL_YEAR = SQL_INTERVAL_YEAR
-SQL_C_INTERVAL_MONTH = SQL_INTERVAL_MONTH
-SQL_C_INTERVAL_DAY = SQL_INTERVAL_DAY
-SQL_C_INTERVAL_HOUR = SQL_INTERVAL_HOUR
-SQL_C_INTERVAL_MINUTE = SQL_INTERVAL_MINUTE
-SQL_C_INTERVAL_SECOND = SQL_INTERVAL_SECOND
-SQL_C_INTERVAL_YEAR_TO_MONTH = SQL_INTERVAL_YEAR_TO_MONTH
-SQL_C_INTERVAL_DAY_TO_HOUR = SQL_INTERVAL_DAY_TO_HOUR
-SQL_C_INTERVAL_DAY_TO_MINUTE = SQL_INTERVAL_DAY_TO_MINUTE
-SQL_C_INTERVAL_DAY_TO_SECOND = SQL_INTERVAL_DAY_TO_SECOND
-SQL_C_INTERVAL_HOUR_TO_MINUTE = SQL_INTERVAL_HOUR_TO_MINUTE
-SQL_C_INTERVAL_HOUR_TO_SECOND = SQL_INTERVAL_HOUR_TO_SECOND
-SQL_C_INTERVAL_MINUTE_TO_SECOND = SQL_INTERVAL_MINUTE_TO_SECOND
-SQL_C_BINARY = SQL_BINARY
-SQL_C_BIT = SQL_BIT
-SQL_C_SBIGINT = SQL_BIGINT+SQL_SIGNED_OFFSET
-SQL_C_UBIGINT = SQL_BIGINT+SQL_UNSIGNED_OFFSET
-SQL_C_TINYINT = SQL_TINYINT
-SQL_C_SLONG = SQL_C_LONG+SQL_SIGNED_OFFSET
-SQL_C_SSHORT = SQL_C_SHORT+SQL_SIGNED_OFFSET
-SQL_C_STINYINT = SQL_TINYINT+SQL_SIGNED_OFFSET
-SQL_C_ULONG = SQL_C_LONG+SQL_UNSIGNED_OFFSET
-SQL_C_USHORT = SQL_C_SHORT+SQL_UNSIGNED_OFFSET
-SQL_C_UTINYINT = SQL_TINYINT+SQL_UNSIGNED_OFFSET
-SQL_C_BOOKMARK = SQL_C_ULONG
-SQL_C_GUID = SQL_GUID
-SQL_TYPE_NULL = 0
-SQL_C_VARBOOKMARK = SQL_C_BINARY
-SQL_NO_ROW_NUMBER = -1
-SQL_NO_COLUMN_NUMBER = -1
-SQL_ROW_NUMBER_UNKNOWN = -2
-SQL_COLUMN_NUMBER_UNKNOWN = -2
-SQL_DEFAULT_PARAM = -5
-SQL_IGNORE = -6
-SQL_COLUMN_IGNORE = SQL_IGNORE
-SQL_LEN_DATA_AT_EXEC_OFFSET = -100
-SQL_LEN_BINARY_ATTR_OFFSET = -100
-SQL_PARAM_TYPE_DEFAULT = SQL_PARAM_INPUT_OUTPUT
-SQL_SETPARAM_VALUE_MAX = -1
-SQL_COLUMN_COUNT = 0
-SQL_COLUMN_NAME = 1
-SQL_COLUMN_TYPE = 2
-SQL_COLUMN_LENGTH = 3
-SQL_COLUMN_PRECISION = 4
-SQL_COLUMN_SCALE = 5
-SQL_COLUMN_DISPLAY_SIZE = 6
-SQL_COLUMN_NULLABLE = 7
-SQL_COLUMN_UNSIGNED = 8
-SQL_COLUMN_MONEY = 9
-SQL_COLUMN_UPDATABLE = 10
-SQL_COLUMN_AUTO_INCREMENT = 11
-SQL_COLUMN_CASE_SENSITIVE = 12
-SQL_COLUMN_SEARCHABLE = 13
-SQL_COLUMN_TYPE_NAME = 14
-SQL_COLUMN_TABLE_NAME = 15
-SQL_COLUMN_OWNER_NAME = 16
-SQL_COLUMN_QUALIFIER_NAME = 17
-SQL_COLUMN_LABEL = 18
-SQL_COLATT_OPT_MAX = SQL_COLUMN_LABEL
-SQL_COLATT_OPT_MIN = SQL_COLUMN_COUNT
-SQL_ATTR_READONLY = 0
-SQL_ATTR_WRITE = 1
-SQL_ATTR_READWRITE_UNKNOWN = 2
-SQL_UNSEARCHABLE = 0
-SQL_LIKE_ONLY = 1
-SQL_ALL_EXCEPT_LIKE = 2
-SQL_SEARCHABLE = 3
-SQL_PRED_SEARCHABLE = SQL_SEARCHABLE
-SQL_NO_TOTAL = -4
-SQL_API_SQLALLOCHANDLESTD = 73
-SQL_API_SQLBULKOPERATIONS = 24
-SQL_API_SQLBINDPARAMETER = 72
-SQL_API_SQLBROWSECONNECT = 55
-SQL_API_SQLCOLATTRIBUTES = 6
-SQL_API_SQLCOLUMNPRIVILEGES = 56
-SQL_API_SQLDESCRIBEPARAM = 58
-SQL_API_SQLDRIVERCONNECT = 41
-SQL_API_SQLDRIVERS = 71
-SQL_API_SQLEXTENDEDFETCH = 59
-SQL_API_SQLFOREIGNKEYS = 60
-SQL_API_SQLMORERESULTS = 61
-SQL_API_SQLNATIVESQL = 62
-SQL_API_SQLNUMPARAMS = 63
-SQL_API_SQLPARAMOPTIONS = 64
-SQL_API_SQLPRIMARYKEYS = 65
-SQL_API_SQLPROCEDURECOLUMNS = 66
-SQL_API_SQLPROCEDURES = 67
-SQL_API_SQLSETPOS = 68
-SQL_API_SQLSETSCROLLOPTIONS = 69
-SQL_API_SQLTABLEPRIVILEGES = 70
-SQL_API_ALL_FUNCTIONS = 0
-SQL_API_LOADBYORDINAL = 199
-SQL_API_ODBC3_ALL_FUNCTIONS = 999
-SQL_API_ODBC3_ALL_FUNCTIONS_SIZE = 250
-SQL_INFO_FIRST = 0
-SQL_ACTIVE_CONNECTIONS = 0
-SQL_ACTIVE_STATEMENTS = 1
-SQL_DRIVER_HDBC = 3
-SQL_DRIVER_HENV = 4
-SQL_DRIVER_HSTMT = 5
-SQL_DRIVER_NAME = 6
-SQL_DRIVER_VER = 7
-SQL_ODBC_API_CONFORMANCE = 9
-SQL_ODBC_VER = 10
-SQL_ROW_UPDATES = 11
-SQL_ODBC_SAG_CLI_CONFORMANCE = 12
-SQL_ODBC_SQL_CONFORMANCE = 15
-SQL_PROCEDURES = 21
-SQL_CONCAT_NULL_BEHAVIOR = 22
-SQL_CURSOR_ROLLBACK_BEHAVIOR = 24
-SQL_EXPRESSIONS_IN_ORDERBY = 27
-SQL_MAX_OWNER_NAME_LEN = 32
-SQL_MAX_PROCEDURE_NAME_LEN = 33
-SQL_MAX_QUALIFIER_NAME_LEN = 34
-SQL_MULT_RESULT_SETS = 36
-SQL_MULTIPLE_ACTIVE_TXN = 37
-SQL_OUTER_JOINS = 38
-SQL_OWNER_TERM = 39
-SQL_PROCEDURE_TERM = 40
-SQL_QUALIFIER_NAME_SEPARATOR = 41
-SQL_QUALIFIER_TERM = 42
-SQL_SCROLL_OPTIONS = 44
-SQL_TABLE_TERM = 45
-SQL_CONVERT_FUNCTIONS = 48
-SQL_NUMERIC_FUNCTIONS = 49
-SQL_STRING_FUNCTIONS = 50
-SQL_SYSTEM_FUNCTIONS = 51
-SQL_TIMEDATE_FUNCTIONS = 52
-SQL_CONVERT_BIGINT = 53
-SQL_CONVERT_BINARY = 54
-SQL_CONVERT_BIT = 55
-SQL_CONVERT_CHAR = 56
-SQL_CONVERT_DATE = 57
-SQL_CONVERT_DECIMAL = 58
-SQL_CONVERT_DOUBLE = 59
-SQL_CONVERT_FLOAT = 60
-SQL_CONVERT_INTEGER = 61
-SQL_CONVERT_LONGVARCHAR = 62
-SQL_CONVERT_NUMERIC = 63
-SQL_CONVERT_REAL = 64
-SQL_CONVERT_SMALLINT = 65
-SQL_CONVERT_TIME = 66
-SQL_CONVERT_TIMESTAMP = 67
-SQL_CONVERT_TINYINT = 68
-SQL_CONVERT_VARBINARY = 69
-SQL_CONVERT_VARCHAR = 70
-SQL_CONVERT_LONGVARBINARY = 71
-SQL_ODBC_SQL_OPT_IEF = 73
-SQL_CORRELATION_NAME = 74
-SQL_NON_NULLABLE_COLUMNS = 75
-SQL_DRIVER_HLIB = 76
-SQL_DRIVER_ODBC_VER = 77
-SQL_LOCK_TYPES = 78
-SQL_POS_OPERATIONS = 79
-SQL_POSITIONED_STATEMENTS = 80
-SQL_BOOKMARK_PERSISTENCE = 82
-SQL_STATIC_SENSITIVITY = 83
-SQL_FILE_USAGE = 84
-SQL_COLUMN_ALIAS = 87
-SQL_GROUP_BY = 88
-SQL_KEYWORDS = 89
-SQL_OWNER_USAGE = 91
-SQL_QUALIFIER_USAGE = 92
-SQL_QUOTED_IDENTIFIER_CASE = 93
-SQL_SUBQUERIES = 95
-SQL_UNION = 96
-SQL_MAX_ROW_SIZE_INCLUDES_LONG = 103
-SQL_MAX_CHAR_LITERAL_LEN = 108
-SQL_TIMEDATE_ADD_INTERVALS = 109
-SQL_TIMEDATE_DIFF_INTERVALS = 110
-SQL_NEED_LONG_DATA_LEN = 111
-SQL_MAX_BINARY_LITERAL_LEN = 112
-SQL_LIKE_ESCAPE_CLAUSE = 113
-SQL_QUALIFIER_LOCATION = 114
-SQL_ACTIVE_ENVIRONMENTS = 116
-SQL_ALTER_DOMAIN = 117
-SQL_SQL_CONFORMANCE = 118
-SQL_DATETIME_LITERALS = 119
-SQL_ASYNC_MODE = 10021
-SQL_BATCH_ROW_COUNT = 120
-SQL_BATCH_SUPPORT = 121
-SQL_CATALOG_LOCATION = SQL_QUALIFIER_LOCATION
-SQL_CATALOG_NAME_SEPARATOR = SQL_QUALIFIER_NAME_SEPARATOR
-SQL_CATALOG_TERM = SQL_QUALIFIER_TERM
-SQL_CATALOG_USAGE = SQL_QUALIFIER_USAGE
-SQL_CONVERT_WCHAR = 122
-SQL_CONVERT_INTERVAL_DAY_TIME = 123
-SQL_CONVERT_INTERVAL_YEAR_MONTH = 124
-SQL_CONVERT_WLONGVARCHAR = 125
-SQL_CONVERT_WVARCHAR = 126
-SQL_CREATE_ASSERTION = 127
-SQL_CREATE_CHARACTER_SET = 128
-SQL_CREATE_COLLATION = 129
-SQL_CREATE_DOMAIN = 130
-SQL_CREATE_SCHEMA = 131
-SQL_CREATE_TABLE = 132
-SQL_CREATE_TRANSLATION = 133
-SQL_CREATE_VIEW = 134
-SQL_DRIVER_HDESC = 135
-SQL_DROP_ASSERTION = 136
-SQL_DROP_CHARACTER_SET = 137
-SQL_DROP_COLLATION = 138
-SQL_DROP_DOMAIN = 139
-SQL_DROP_SCHEMA = 140
-SQL_DROP_TABLE = 141
-SQL_DROP_TRANSLATION = 142
-SQL_DROP_VIEW = 143
-SQL_DYNAMIC_CURSOR_ATTRIBUTES1 = 144
-SQL_DYNAMIC_CURSOR_ATTRIBUTES2 = 145
-SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1 = 146
-SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2 = 147
-SQL_INDEX_KEYWORDS = 148
-SQL_INFO_SCHEMA_VIEWS = 149
-SQL_KEYSET_CURSOR_ATTRIBUTES1 = 150
-SQL_KEYSET_CURSOR_ATTRIBUTES2 = 151
-SQL_MAX_ASYNC_CONCURRENT_STATEMENTS = 10022
-SQL_ODBC_INTERFACE_CONFORMANCE = 152
-SQL_PARAM_ARRAY_ROW_COUNTS = 153
-SQL_PARAM_ARRAY_SELECTS = 154
-SQL_SCHEMA_TERM = SQL_OWNER_TERM
-SQL_SCHEMA_USAGE = SQL_OWNER_USAGE
-SQL_SQL92_DATETIME_FUNCTIONS = 155
-SQL_SQL92_FOREIGN_KEY_DELETE_RULE = 156
-SQL_SQL92_FOREIGN_KEY_UPDATE_RULE = 157
-SQL_SQL92_GRANT = 158
-SQL_SQL92_NUMERIC_VALUE_FUNCTIONS = 159
-SQL_SQL92_PREDICATES = 160
-SQL_SQL92_RELATIONAL_JOIN_OPERATORS = 161
-SQL_SQL92_REVOKE = 162
-SQL_SQL92_ROW_VALUE_CONSTRUCTOR = 163
-SQL_SQL92_STRING_FUNCTIONS = 164
-SQL_SQL92_VALUE_EXPRESSIONS = 165
-SQL_STANDARD_CLI_CONFORMANCE = 166
-SQL_STATIC_CURSOR_ATTRIBUTES1 = 167
-SQL_STATIC_CURSOR_ATTRIBUTES2 = 168
-SQL_AGGREGATE_FUNCTIONS = 169
-SQL_DDL_INDEX = 170
-SQL_DM_VER = 171
-SQL_INSERT_STATEMENT = 172
-SQL_UNION_STATEMENT = SQL_UNION
-SQL_DTC_TRANSITION_COST = 1750
-SQL_AT_ADD_COLUMN_SINGLE = 20h
-SQL_CVT_CHAR = 1
-SQL_CVT_NUMERIC = 2
-SQL_CVT_DECIMAL = 4
-SQL_CVT_INTEGER = 8
-SQL_CVT_SMALLINT = 10h
-SQL_CVT_FLOAT = 20h
-SQL_CVT_REAL = 40h
-SQL_CVT_DOUBLE = 80h
-SQL_CVT_VARCHAR = 100h
-SQL_CVT_LONGVARCHAR = 200h
-SQL_CVT_BINARY = 400h
-SQL_CVT_VARBINARY = 800h
-SQL_CVT_BIT = 1000h
-SQL_CVT_TINYINT = 2000h
-SQL_CVT_BIGINT = 4000h
-SQL_CVT_DATE = 8000h
-SQL_CVT_TIME = 10000h
-SQL_CVT_TIMESTAMP = 20000h
-SQL_CVT_LONGVARBINARY = 40000h
-SQL_CVT_INTERVAL_YEAR_MONTH = 80000h
-SQL_CVT_INTERVAL_DAY_TIME = 100000h
-SQL_CVT_WCHAR = 200000h
-SQL_CVT_WLONGVARCHAR = 400000h
-SQL_CVT_WVARCHAR = 800000h
-SQL_FN_CVT_CONVERT = 1
-SQL_FN_CVT_CAST = 2
-SQL_FN_STR_CONCAT = 1
-SQL_FN_STR_INSERT = 2
-SQL_FN_STR_LEFT = 4
-SQL_FN_STR_LTRIM = 8
-SQL_FN_STR_LENGTH = 10h
-SQL_FN_STR_LOCATE = 20h
-SQL_FN_STR_LCASE = 40h
-SQL_FN_STR_REPEAT = 80h
-SQL_FN_STR_REPLACE = 100h
-SQL_FN_STR_RIGHT = 200h
-SQL_FN_STR_RTRIM = 400h
-SQL_FN_STR_SUBSTRING = 800h
-SQL_FN_STR_UCASE = 1000h
-SQL_FN_STR_ASCII = 2000h
-SQL_FN_STR_CHAR = 4000h
-SQL_FN_STR_DIFFERENCE = 8000h
-SQL_FN_STR_LOCATE_2 = 10000h
-SQL_FN_STR_SOUNDEX = 20000h
-SQL_FN_STR_SPACE = 40000h
-SQL_FN_STR_BIT_LENGTH = 80000h
-SQL_FN_STR_CHAR_LENGTH = 100000h
-SQL_FN_STR_CHARACTER_LENGTH = 200000h
-SQL_FN_STR_OCTET_LENGTH = 400000h
-SQL_FN_STR_POSITION = 800000h
-SQL_SSF_CONVERT = 1
-SQL_SSF_LOWER = 2
-SQL_SSF_UPPER = 4
-SQL_SSF_SUBSTRING = 8
-SQL_SSF_TRANSLATE = 10h
-SQL_SSF_TRIM_BOTH = 20h
-SQL_SSF_TRIM_LEADING = 40h
-SQL_SSF_TRIM_TRAILING = 80h
-SQL_FN_NUM_ABS = 1
-SQL_FN_NUM_ACOS = 2
-SQL_FN_NUM_ASIN = 4
-SQL_FN_NUM_ATAN = 8
-SQL_FN_NUM_ATAN2 = 10h
-SQL_FN_NUM_CEILING = 20h
-SQL_FN_NUM_COS = 40h
-SQL_FN_NUM_COT = 80h
-SQL_FN_NUM_EXP = 100h
-SQL_FN_NUM_FLOOR = 200h
-SQL_FN_NUM_LOG = 400h
-SQL_FN_NUM_MOD = 800h
-SQL_FN_NUM_SIGN = 1000h
-SQL_FN_NUM_SIN = 2000h
-SQL_FN_NUM_SQRT = 4000h
-SQL_FN_NUM_TAN = 8000h
-SQL_FN_NUM_PI = 10000h
-SQL_FN_NUM_RAND = 20000h
-SQL_FN_NUM_DEGREES = 40000h
-SQL_FN_NUM_LOG10 = 80000h
-SQL_FN_NUM_POWER = 100000h
-SQL_FN_NUM_RADIANS = 200000h
-SQL_FN_NUM_ROUND = 400000h
-SQL_FN_NUM_TRUNCATE = 800000h
-SQL_SNVF_BIT_LENGTH = 1
-SQL_SNVF_CHAR_LENGTH = 2
-SQL_SNVF_CHARACTER_LENGTH = 4
-SQL_SNVF_EXTRACT = 8
-SQL_SNVF_OCTET_LENGTH = 10h
-SQL_SNVF_POSITION = 20h
-SQL_FN_TD_NOW = 1
-SQL_FN_TD_CURDATE = 2
-SQL_FN_TD_DAYOFMONTH = 4
-SQL_FN_TD_DAYOFWEEK = 8
-SQL_FN_TD_DAYOFYEAR = 10h
-SQL_FN_TD_MONTH = 20h
-SQL_FN_TD_QUARTER = 40h
-SQL_FN_TD_WEEK = 80h
-SQL_FN_TD_YEAR = 100h
-SQL_FN_TD_CURTIME = 200h
-SQL_FN_TD_HOUR = 400h
-SQL_FN_TD_MINUTE = 800h
-SQL_FN_TD_SECOND = 1000h
-SQL_FN_TD_TIMESTAMPADD = 2000h
-SQL_FN_TD_TIMESTAMPDIFF = 4000h
-SQL_FN_TD_DAYNAME = 8000h
-SQL_FN_TD_MONTHNAME = 10000h
-SQL_FN_TD_CURRENT_DATE = 20000h
-SQL_FN_TD_CURRENT_TIME = 40000h
-SQL_FN_TD_CURRENT_TIMESTAMP = 80000h
-SQL_FN_TD_EXTRACT = 100000h
-SQL_SDF_CURRENT_DATE = 1
-SQL_SDF_CURRENT_TIME = 2
-SQL_SDF_CURRENT_TIMESTAMP = 4
-SQL_FN_SYS_USERNAME = 1
-SQL_FN_SYS_DBNAME = 2
-SQL_FN_SYS_IFNULL = 4
-SQL_FN_TSI_FRAC_SECOND = 1
-SQL_FN_TSI_SECOND = 2
-SQL_FN_TSI_MINUTE = 4
-SQL_FN_TSI_HOUR = 8
-SQL_FN_TSI_DAY = 10h
-SQL_FN_TSI_WEEK = 20h
-SQL_FN_TSI_MONTH = 40h
-SQL_FN_TSI_QUARTER = 80h
-SQL_FN_TSI_YEAR = 100h
-SQL_CA1_NEXT = 1
-SQL_CA1_ABSOLUTE = 2
-SQL_CA1_RELATIVE = 4
-SQL_CA1_BOOKMARK = 8
-SQL_CA1_LOCK_NO_CHANGE = 40h
-SQL_CA1_LOCK_EXCLUSIVE = 80h
-SQL_CA1_LOCK_UNLOCK = 100h
-SQL_CA1_POS_POSITION = 200h
-SQL_CA1_POS_UPDATE = 400h
-SQL_CA1_POS_DELETE = 800h
-SQL_CA1_POS_REFRESH = 1000h
-SQL_CA1_POSITIONED_UPDATE = 2000h
-SQL_CA1_POSITIONED_DELETE = 4000h
-SQL_CA1_SELECT_FOR_UPDATE = 8000h
-SQL_CA1_BULK_ADD = 10000h
-SQL_CA1_BULK_UPDATE_BY_BOOKMARK = 20000h
-SQL_CA1_BULK_DELETE_BY_BOOKMARK = 40000h
-SQL_CA1_BULK_FETCH_BY_BOOKMARK = 80000h
-SQL_CA2_READ_ONLY_CONCURRENCY = 1
-SQL_CA2_LOCK_CONCURRENCY = 2
-SQL_CA2_OPT_ROWVER_CONCURRENCY = 4
-SQL_CA2_OPT_VALUES_CONCURRENCY = 8
-SQL_CA2_SENSITIVITY_ADDITIONS = 10h
-SQL_CA2_SENSITIVITY_DELETIONS = 20h
-SQL_CA2_SENSITIVITY_UPDATES = 40h
-SQL_CA2_MAX_ROWS_SELECT = 80h
-SQL_CA2_MAX_ROWS_INSERT = 100h
-SQL_CA2_MAX_ROWS_DELETE = 200h
-SQL_CA2_MAX_ROWS_UPDATE = 400h
-SQL_CA2_MAX_ROWS_CATALOG = 800h
-SQL_CA2_MAX_ROWS_AFFECTS_ALL = SQL_CA2_MAX_ROWS_SELECT + \
- SQL_CA2_MAX_ROWS_INSERT + \
- SQL_CA2_MAX_ROWS_DELETE + \
- SQL_CA2_MAX_ROWS_UPDATE + \
- SQL_CA2_MAX_ROWS_CATALOG
-SQL_CA2_CRC_EXACT = 1000h
-SQL_CA2_CRC_APPROXIMATE = 2000h
-SQL_CA2_SIMULATE_NON_UNIQUE = 4000h
-SQL_CA2_SIMULATE_TRY_UNIQUE = 8000h
-SQL_CA2_SIMULATE_UNIQUE = 10000h
-SQL_OAC_NONE = 0
-SQL_OAC_LEVEL1 = 1
-SQL_OAC_LEVEL2 = 2
-SQL_OSCC_NOT_COMPLIANT = 0
-SQL_OSCC_COMPLIANT = 1
-SQL_OSC_MINIMUM = 0
-SQL_OSC_CORE = 1
-SQL_OSC_EXTENDED = 2
-SQL_CB_NULL = 0
-SQL_CB_NON_NULL = 1
-SQL_SO_FORWARD_ONLY = 1
-SQL_SO_KEYSET_DRIVEN = 2
-SQL_SO_DYNAMIC = 4
-SQL_SO_MIXED = 8
-SQL_SO_STATIC = 10h
-SQL_FD_FETCH_BOOKMARK = 80h
-SQL_CN_NONE = 0
-SQL_CN_DIFFERENT = 1
-SQL_CN_ANY = 2
-SQL_NNC_NULL = 0
-SQL_NNC_NON_NULL = 1
-SQL_NC_START = 2
-SQL_NC_END = 4
-SQL_FILE_NOT_SUPPORTED = 0
-SQL_FILE_TABLE = 1
-SQL_FILE_QUALIFIER = 2
-SQL_FILE_CATALOG = SQL_FILE_QUALIFIER
-SQL_GD_BLOCK = 4
-SQL_GD_BOUND = 8
-SQL_PS_POSITIONED_DELETE = 1
-SQL_PS_POSITIONED_UPDATE = 2
-SQL_PS_SELECT_FOR_UPDATE = 4
-SQL_GB_NOT_SUPPORTED = 0
-
-ALS_SELECT = 1
-SQL_GB_GROUP_BY_ = ALS_SELECT
-
-SQL_GB_GROUP_BY_CONTAINS_SELECT = 2
-SQL_GB_NO_RELATION = 3
-SQL_GB_COLLATE = 4
-SQL_OU_DML_STATEMENTS = 1
-SQL_OU_PROCEDURE_INVOCATION = 2
-SQL_OU_TABLE_DEFINITION = 4
-SQL_OU_INDEX_DEFINITION = 8
-SQL_OU_PRIVILEGE_DEFINITION = 10h
-SQL_SU_DML_STATEMENTS = SQL_OU_DML_STATEMENTS
-SQL_SU_PROCEDURE_INVOCATION = SQL_OU_PROCEDURE_INVOCATION
-SQL_SU_TABLE_DEFINITION = SQL_OU_TABLE_DEFINITION
-SQL_SU_INDEX_DEFINITION = SQL_OU_INDEX_DEFINITION
-SQL_SU_PRIVILEGE_DEFINITION = SQL_OU_PRIVILEGE_DEFINITION
-SQL_QU_DML_STATEMENTS = 1
-SQL_QU_PROCEDURE_INVOCATION = 2
-SQL_QU_TABLE_DEFINITION = 4
-SQL_QU_INDEX_DEFINITION = 8
-SQL_QU_PRIVILEGE_DEFINITION = 10h
-SQL_CU_DML_STATEMENTS = SQL_QU_DML_STATEMENTS
-SQL_CU_PROCEDURE_INVOCATION = SQL_QU_PROCEDURE_INVOCATION
-SQL_CU_TABLE_DEFINITION = SQL_QU_TABLE_DEFINITION
-SQL_CU_INDEX_DEFINITION = SQL_QU_INDEX_DEFINITION
-SQL_CU_PRIVILEGE_DEFINITION = SQL_QU_PRIVILEGE_DEFINITION
-SQL_SQ_COMPARISON = 1
-SQL_SQ_EXISTS = 2
-SQL_SQ_IN = 4
-SQL_SQ_QUANTIFIED = 8
-SQL_SQ_CORRELATED_SUBQUERIES = 10h
-SQL_U_UNION = 1
-SQL_U_UNION_ALL = 2
-SQL_BP_CLOSE = 1
-SQL_BP_DELETE = 2
-SQL_BP_DROP = 4
-SQL_BP_TRANSACTION = 8
-SQL_BP_UPDATE = 10h
-SQL_BP_OTHER_HSTMT = 20h
-SQL_BP_SCROLL = 40h
-SQL_SS_ADDITIONS = 1
-SQL_SS_DELETIONS = 2
-SQL_SS_UPDATES = 4
-SQL_CV_CREATE_VIEW = 1
-SQL_CV_CHECK_OPTION = 2
-SQL_CV_CASCADED = 4
-SQL_CV_LOCAL = 8
-SQL_LCK_NO_CHANGE = 1
-SQL_LCK_EXCLUSIVE = 2
-SQL_LCK_UNLOCK = 4
-SQL_POS_POSITION = 1
-SQL_POS_REFRESH = 2
-SQL_POS_UPDATE = 4
-SQL_POS_DELETE = 8
-SQL_POS_ADD = 10h
-SQL_QL_START = 1
-SQL_QL_END = 2
-SQL_AF_AVG = 1
-SQL_AF_COUNT = 2
-SQL_AF_MAX = 4
-SQL_AF_MIN = 8
-SQL_AF_SUM = 10h
-SQL_AF_DISTINCT = 20h
-SQL_AF_ALL = 40h
-SQL_SC_SQL92_ENTRY = 1
-SQL_SC_FIPS127_2_TRANSITIONAL = 2
-SQL_SC_SQL92_INTERMEDIATE = 4
-SQL_SC_SQL92_FULL = 8
-SQL_DL_SQL92_DATE = 1
-SQL_DL_SQL92_TIME = 2
-SQL_DL_SQL92_TIMESTAMP = 4
-SQL_DL_SQL92_INTERVAL_YEAR = 8
-SQL_DL_SQL92_INTERVAL_MONTH = 10h
-SQL_DL_SQL92_INTERVAL_DAY = 20h
-SQL_DL_SQL92_INTERVAL_HOUR = 40h
-SQL_DL_SQL92_INTERVAL_MINUTE = 80h
-SQL_DL_SQL92_INTERVAL_SECOND = 100h
-SQL_DL_SQL92_INTERVAL_YEAR_TO_MONTH = 200h
-SQL_DL_SQL92_INTERVAL_DAY_TO_HOUR = 400h
-SQL_DL_SQL92_INTERVAL_DAY_TO_MINUTE = 800h
-SQL_DL_SQL92_INTERVAL_DAY_TO_SECOND = 1000h
-SQL_DL_SQL92_INTERVAL_HOUR_TO_MINUTE = 2000h
-SQL_DL_SQL92_INTERVAL_HOUR_TO_SECOND = 4000h
-SQL_DL_SQL92_INTERVAL_MINUTE_TO_SECOND = 8000h
-SQL_CL_START = SQL_QL_START
-SQL_CL_END = SQL_QL_END
-SQL_BRC_PROCEDURES = 1
-SQL_BRC_EXPLICIT = 2
-SQL_BRC_ROLLED_UP = 4
-SQL_BS_SELECT_EXPLICIT = 1
-SQL_BS_ROW_COUNT_EXPLICIT = 2
-SQL_BS_SELECT_PROC = 4
-SQL_BS_ROW_COUNT_PROC = 8
-SQL_PARC_BATCH = 1
-SQL_PARC_NO_BATCH = 2
-SQL_PAS_BATCH = 1
-SQL_PAS_NO_BATCH = 2
-SQL_PAS_NO_SELECT = 3
-SQL_IK_NONE = 0
-SQL_IK_ASC = 1
-SQL_IK_DESC = 2
-SQL_IK_ALL = SQL_IK_ASC + SQL_IK_DESC
-SQL_ISV_ASSERTIONS = 1
-SQL_ISV_CHARACTER_SETS = 2
-SQL_ISV_CHECK_CONSTRAINTS = 4
-SQL_ISV_COLLATIONS = 8
-SQL_ISV_COLUMN_DOMAIN_USAGE = 10h
-SQL_ISV_COLUMN_PRIVILEGES = 20h
-SQL_ISV_COLUMNS = 40h
-SQL_ISV_CONSTRAINT_COLUMN_USAGE = 80h
-SQL_ISV_CONSTRAINT_TABLE_USAGE = 100h
-SQL_ISV_DOMAIN_CONSTRAINTS = 200h
-SQL_ISV_DOMAINS = 400h
-SQL_ISV_KEY_COLUMN_USAGE = 800h
-SQL_ISV_REFERENTIAL_CONSTRAINTS = 1000h
-SQL_ISV_SCHEMATA = 2000h
-SQL_ISV_SQL_LANGUAGES = 4000h
-SQL_ISV_TABLE_CONSTRAINTS = 8000h
-SQL_ISV_TABLE_PRIVILEGES = 10000h
-SQL_ISV_TABLES = 20000h
-SQL_ISV_TRANSLATIONS = 40000h
-SQL_ISV_USAGE_PRIVILEGES = 80000h
-SQL_ISV_VIEW_COLUMN_USAGE = 100000h
-SQL_ISV_VIEW_TABLE_USAGE = 200000h
-SQL_ISV_VIEWS = 400000h
-SQL_AM_NONE = 0
-SQL_AD_CONSTRAINT_NAME_DEFINITION = 1
-SQL_AD_ADD_DOMAIN_CONSTRAINT = 2
-SQL_AD_DROP_DOMAIN_CONSTRAINT = 4
-SQL_AD_ADD_DOMAIN_DEFAULT = 8
-SQL_AD_DROP_DOMAIN_DEFAULT = 10h
-SQL_AD_ADD_CONSTRAINT_INITIALLY_DEFERRED = 20h
-SQL_AD_ADD_CONSTRAINT_INITIALLY_IMMEDIATE = 40h
-SQL_AD_ADD_CONSTRAINT_DEFERRABLE = 80h
-SQL_AD_ADD_CONSTRAINT_NON_DEFERRABLE = 100h
-SQL_CS_CREATE_SCHEMA = 1
-SQL_CS_AUTHORIZATION = 2
-SQL_CS_DEFAULT_CHARACTER_SET = 4
-SQL_CTR_CREATE_TRANSLATION = 1
-SQL_CA_CREATE_ASSERTION = 1
-SQL_CA_CONSTRAINT_INITIALLY_DEFERRED = 10h
-SQL_CA_CONSTRAINT_INITIALLY_IMMEDIATE = 20h
-SQL_CA_CONSTRAINT_DEFERRABLE = 40h
-SQL_CA_CONSTRAINT_NON_DEFERRABLE = 80h
-SQL_CCS_CREATE_CHARACTER_SET = 1
-SQL_CCS_COLLATE_CLAUSE = 2
-SQL_CCS_LIMITED_COLLATION = 4
-SQL_CCOL_CREATE_COLLATION = 1
-SQL_CDO_CREATE_DOMAIN = 1
-SQL_CDO_DEFAULT = 2
-SQL_CDO_CONSTRAINT = 4
-SQL_CDO_COLLATION = 8
-SQL_CDO_CONSTRAINT_NAME_DEFINITION = 10h
-SQL_CDO_CONSTRAINT_INITIALLY_DEFERRED = 20h
-SQL_CDO_CONSTRAINT_INITIALLY_IMMEDIATE = 40h
-SQL_CDO_CONSTRAINT_DEFERRABLE = 80h
-SQL_CDO_CONSTRAINT_NON_DEFERRABLE = 100h
-SQL_CT_CREATE_TABLE = 1
-SQL_CT_COMMIT_PRESERVE = 2
-SQL_CT_COMMIT_DELETE = 4
-SQL_CT_GLOBAL_TEMPORARY = 8
-SQL_CT_LOCAL_TEMPORARY = 10h
-SQL_CT_CONSTRAINT_INITIALLY_DEFERRED = 20h
-SQL_CT_CONSTRAINT_INITIALLY_IMMEDIATE = 40h
-SQL_CT_CONSTRAINT_DEFERRABLE = 80h
-SQL_CT_CONSTRAINT_NON_DEFERRABLE = 100h
-SQL_CT_COLUMN_CONSTRAINT = 200h
-SQL_CT_COLUMN_DEFAULT = 400h
-SQL_CT_COLUMN_COLLATION = 800h
-SQL_CT_TABLE_CONSTRAINT = 1000h
-SQL_CT_CONSTRAINT_NAME_DEFINITION = 2000h
-SQL_DI_CREATE_INDEX = 1
-SQL_DI_DROP_INDEX = 2
-SQL_DC_DROP_COLLATION = 1
-SQL_DD_DROP_DOMAIN = 1
-SQL_DD_RESTRICT = 2
-SQL_DD_CASCADE = 4
-SQL_DS_DROP_SCHEMA = 1
-SQL_DS_RESTRICT = 2
-SQL_DS_CASCADE = 4
-SQL_DCS_DROP_CHARACTER_SET = 1
-SQL_DA_DROP_ASSERTION = 1
-SQL_DT_DROP_TABLE = 1
-SQL_DT_RESTRICT = 2
-SQL_DT_CASCADE = 4
-SQL_DTR_DROP_TRANSLATION = 1
-SQL_DV_DROP_VIEW = 1
-SQL_DV_RESTRICT = 2
-SQL_DV_CASCADE = 4
-SQL_IS_INSERT_LITERALS = 1
-SQL_IS_INSERT_SEARCHED = 2
-SQL_IS_SELECT_INTO = 4
-SQL_OIC_CORE = 1
-SQL_OIC_LEVEL1 = 2
-SQL_OIC_LEVEL2 = 3
-SQL_SFKD_CASCADE = 1
-SQL_SFKD_NO_ACTION = 2
-SQL_SFKD_SET_DEFAULT = 4
-SQL_SFKD_SET_NULL = 8
-SQL_SFKU_CASCADE = 1
-SQL_SFKU_NO_ACTION = 2
-SQL_SFKU_SET_DEFAULT = 4
-SQL_SFKU_SET_NULL = 8
-SQL_SG_USAGE_ON_DOMAIN = 1
-SQL_SG_USAGE_ON_CHARACTER_SET = 2
-SQL_SG_USAGE_ON_COLLATION = 4
-SQL_SG_USAGE_ON_TRANSLATION = 8
-SQL_SG_WITH_GRANT_OPTION = 10h
-SQL_SG_DELETE_TABLE = 20h
-SQL_SG_INSERT_TABLE = 40h
-SQL_SG_INSERT_COLUMN = 80h
-SQL_SG_REFERENCES_TABLE = 100h
-SQL_SG_REFERENCES_COLUMN = 200h
-SQL_SG_SELECT_TABLE = 400h
-SQL_SG_UPDATE_TABLE = 800h
-SQL_SG_UPDATE_COLUMN = 1000h
-SQL_SP_EXISTS = 1
-SQL_SP_ISNOTNULL = 2
-SQL_SP_ISNULL = 4
-SQL_SP_MATCH_FULL = 8
-SQL_SP_MATCH_PARTIAL = 10h
-SQL_SP_MATCH_UNIQUE_FULL = 20h
-SQL_SP_MATCH_UNIQUE_PARTIAL = 40h
-SQL_SP_OVERLAPS = 80h
-SQL_SP_UNIQUE = 100h
-SQL_SP_LIKE = 200h
-SQL_SP_IN = 400h
-SQL_SP_BETWEEN = 800h
-SQL_SP_COMPARISON = 1000h
-SQL_SP_QUANTIFIED_COMPARISON = 2000h
-SQL_SRJO_CORRESPONDING_CLAUSE = 1
-SQL_SRJO_CROSS_JOIN = 2
-SQL_SRJO_EXCEPT_JOIN = 4
-SQL_SRJO_FULL_OUTER_JOIN = 8
-SQL_SRJO_INNER_JOIN = 10h
-SQL_SRJO_INTERSECT_JOIN = 20h
-SQL_SRJO_LEFT_OUTER_JOIN = 40h
-SQL_SRJO_NATURAL_JOIN = 80h
-SQL_SRJO_RIGHT_OUTER_JOIN = 100h
-SQL_SRJO_UNION_JOIN = 200h
-SQL_SR_USAGE_ON_DOMAIN = 1
-SQL_SR_USAGE_ON_CHARACTER_SET = 2
-SQL_SR_USAGE_ON_COLLATION = 4
-SQL_SR_USAGE_ON_TRANSLATION = 8
-SQL_SR_GRANT_OPTION_FOR = 10h
-SQL_SR_CASCADE = 20h
-SQL_SR_RESTRICT = 40h
-SQL_SR_DELETE_TABLE = 80h
-SQL_SR_INSERT_TABLE = 100h
-SQL_SR_INSERT_COLUMN = 200h
-SQL_SR_REFERENCES_TABLE = 400h
-SQL_SR_REFERENCES_COLUMN = 800h
-SQL_SR_SELECT_TABLE = 1000h
-SQL_SR_UPDATE_TABLE = 2000h
-SQL_SR_UPDATE_COLUMN = 4000h
-SQL_SRVC_VALUE_EXPRESSION = 1
-SQL_SRVC_NULL = 2
-SQL_SRVC_DEFAULT = 4
-SQL_SRVC_ROW_SUBQUERY = 8
-SQL_SVE_CASE = 1
-SQL_SVE_CAST = 2
-SQL_SVE_COALESCE = 4
-SQL_SVE_NULLIF = 8
-SQL_SCC_XOPEN_CLI_VERSION1 = 1
-SQL_SCC_ISO92_CLI = 2
-SQL_US_UNION = SQL_U_UNION
-SQL_US_UNION_ALL = SQL_U_UNION_ALL
-SQL_DTC_ENLIST_EXPENSIVE = 1
-SQL_DTC_UNENLIST_EXPENSIVE = 2
-SQL_FETCH_FIRST_USER = 31
-SQL_FETCH_FIRST_SYSTEM = 32
-SQL_ENTIRE_ROWSET = 0
-SQL_POSITION = 0
-SQL_REFRESH = 1
-SQL_UPDATE = 2
-SQL_DELETE = 3
-SQL_ADD = 4
-SQL_SETPOS_MAX_OPTION_VALUE = SQL_ADD
-SQL_UPDATE_BY_BOOKMARK = 5
-SQL_DELETE_BY_BOOKMARK = 6
-SQL_FETCH_BY_BOOKMARK = 7
-SQL_LOCK_NO_CHANGE = 0
-SQL_LOCK_EXCLUSIVE = 1
-SQL_LOCK_UNLOCK = 2
-SQL_SETPOS_MAX_LOCK_VALUE = SQL_LOCK_UNLOCK
-SQL_BEST_ROWID = 1
-SQL_ROWVER = 2
-SQL_PC_NOT_PSEUDO = 1
-SQL_QUICK = 0
-SQL_ENSURE = 1
-SQL_TABLE_STAT = 0
-
-SQL_ALL_CATALOGS equ "%"
-SQL_ALL_SCHEMAS equ "%"
-SQL_ALL_TABLE_TYPES equ "%"
-
-SQL_DRIVER_NOPROMPT = 0
-SQL_DRIVER_COMPLETE = 1
-SQL_DRIVER_PROMPT = 2
-IRED = 3
-SQL_DRIVER_COMPLETE_R = IRED
-
-SQL_FETCH_BOOKMARK = 8
-SQL_ROW_SUCCESS = 0
-SQL_ROW_DELETED = 1
-SQL_ROW_UPDATED = 2
-SQL_ROW_NOROW = 3
-SQL_ROW_ADDED = 4
-SQL_ROW_ERROR = 5
-SQL_ROW_SUCCESS_WITH_INFO = 6
-SQL_ROW_PROCEED = 0
-SQL_ROW_IGNORE = 1
-SQL_PARAM_SUCCESS = 0
-SQL_PARAM_SUCCESS_WITH_INFO = 6
-SQL_PARAM_ERROR = 5
-SQL_PARAM_UNUSED = 7
-SQL_PARAM_DIAG_UNAVAILABLE = 1
-SQL_PARAM_PROCEED = 0
-SQL_PARAM_IGNORE = 1
-SQL_CASCADE = 0
-SQL_RESTRICT = 1
-SQL_SET_NULL = 2
-SQL_NO_ACTION = 3
-SQL_SET_DEFAULT = 4
-SQL_INITIALLY_DEFERRED = 5
-SQL_INITIALLY_IMMEDIATE = 6
-SQL_NOT_DEFERRABLE = 7
-SQL_PARAM_TYPE_UNKNOWN = 0
-SQL_PARAM_INPUT = 1
-SQL_PARAM_INPUT_OUTPUT = 2
-SQL_RESULT_COL = 3
-SQL_PARAM_OUTPUT = 4
-SQL_RETURN_VALUE = 5
-SQL_PT_UNKNOWN = 0
-SQL_PT_PROCEDURE = 1
-SQL_PT_FUNCTION = 2
-SQL_YEAR = SQL_CODE_YEAR
-SQL_MONTH = SQL_CODE_MONTH
-SQL_DAY = SQL_CODE_DAY
-SQL_HOUR = SQL_CODE_HOUR
-SQL_MINUTE = SQL_CODE_MINUTE
-SQL_SECOND = SQL_CODE_SECOND
-SQL_YEAR_TO_MONTH = SQL_CODE_YEAR_TO_MONTH
-SQL_DAY_TO_HOUR = SQL_CODE_DAY_TO_HOUR
-SQL_DAY_TO_MINUTE = SQL_CODE_DAY_TO_MINUTE
-SQL_DAY_TO_SECOND = SQL_CODE_DAY_TO_SECOND
-SQL_HOUR_TO_MINUTE = SQL_CODE_HOUR_TO_MINUTE
-SQL_HOUR_TO_SECOND = SQL_CODE_HOUR_TO_SECOND
-SQL_MINUTE_TO_SECOND = SQL_CODE_MINUTE_TO_SECOND
-SQL_DATABASE_NAME = 16
-SQL_FD_FETCH_PREV = SQL_FD_FETCH_PRIOR
-SQL_FETCH_PREV = SQL_FETCH_PRIOR
-SQL_CONCUR_TIMESTAMP = SQL_CONCUR_ROWVER
-SQL_SCCO_OPT_TIMESTAMP = SQL_SCCO_OPT_ROWVER
-SQL_CC_DELETE = SQL_CB_DELETE
-SQL_CR_DELETE = SQL_CB_DELETE
-SQL_CC_CLOSE = SQL_CB_CLOSE
-SQL_CR_CLOSE = SQL_CB_CLOSE
-SQL_CC_PRESERVE = SQL_CB_PRESERVE
-SQL_CR_PRESERVE = SQL_CB_PRESERVE
-SQL_SCROLL_FORWARD_ONLY = 0
-SQL_SCROLL_KEYSET_DRIVEN = -1
-SQL_SCROLL_DYNAMIC = -2
-SQL_SCROLL_STATIC = -3
-TRACE_VERSION = 1000
-TRACE_ON = 1
-TRACE_VS_EVENT_ON = 2
-ODBC_VS_FLAG_UNICODE_ARG = 1
-ODBC_VS_FLAG_UNICODE_COR = 2
-ODBC_VS_FLAG_RETCODE = 4
-ODBC_VS_FLAG_STOP = 8
-
-
-
-struct DATESTRUCT
- .year dw ?
- .month dw ?
- .day dw ?
-ends
-
-SQL_DATE_STRUCT equ DATESTRUCT
-
-struct TIME_STRUCT
- .hour dw ?
- .minute dw ?
- .second dw ?
-ends
-
-SQL_TIME_STRUCT equ TIME_STRUCT
-
-struct TIMESTAMPSTRUCT
- .year dw ?
- .month dw ?
- .day dw ?
- .hour dw ?
- .minute dw ?
- .second dw ?
- .fraction dd ?
-ends
-
-SQL_TIMESTAMP_STRUCT equ TIMESTAMPSTRUCT
-
-
-SQL_IS_YEAR = 1
-SQL_IS_MONTH = 2
-SQL_IS_DAY = 3
-SQL_IS_HOUR = 4
-SQL_IS_MINUTE = 5
-SQL_IS_SECOND = 6
-SQL_IS_YEAR_TO_MONTH = 7
-SQL_IS_DAY_TO_HOUR = 8
-SQL_IS_DAY_TO_MINUTE = 9
-SQL_IS_DAY_TO_SECOND = 10
-SQL_IS_HOUR_TO_MINUTE = 11
-SQL_IS_HOUR_TO_SECOND = 12
-SQL_IS_MINUTE_TO_SECOND = 13
-
-struct SQL_YEAR_MONTH_STRUCT
- .year dw ?
- .month dw ?
-ends
-
-
-struct SQL_DAY_SECOND_STRUCT
- .day dw ?
- .hour dw ?
- .minute dw ?
- .second dw ?
- .fraction dw ?
-ends
-
-
-SQL_MAX_NUMERIC_LEN = 16
-
-struct SQL_NUMERIC_STRUCT
- .precision db ?
- .scale db ?
- .sign db ?
- .val rb SQL_MAX_NUMERIC_LEN
-ends
-
-struct SQLGUID
- .Data1 dd ?
- .Data2 dw ?
- .Data3 dw ?
- .Data4 rb 8
-ends
DELETED freshlib/equates/Win32/_RichEdit32.inc
Index: freshlib/equates/Win32/_RichEdit32.inc
==================================================================
--- freshlib/equates/Win32/_RichEdit32.inc
+++ /dev/null
@@ -1,350 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: RichEdit32.dll constants and structures.
-;
-; Target OS: Win32
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-
-MAX_TAB_STOPS = 32
-
-
-struct CHARFORMAT
- .cbSize dd ?
- .dwMask dd ?
- .dwEffects dd ?
- .yHeight dd ?
- .yOffset dd ?
- .crTextColor dd ?
- .bCharSet db ?
- .bPitchAndFamily db ?
- .szFaceName rb 32
- ._wPad2 dw ?
-ends
-
-
-struct CHARFORMAT2
- .cbSize dd ?
- .dwMask dd ?
- .dwEffects dd ?
- .yHeight dd ?
- .yOffset dd ?
- .crTextColor dd ?
- .bCharSet db ?
- .bPitchAndFamily db ?
- .szFaceName rb 32
- ._wPad2 dw ?
- .wWeight dw ?
- .sSpacing dw ?
- .crBackColor dd ?
- .lcid dd ?
- .dwReserved dd ?
- .sStyle dw ?
- .wKerning dw ?
- .bUnderlineType db ?
- .bAnimation db ?
- .bRevAuthor db ?
- .bReserved1 db ?
-ends
-
-
-struct SETTEXTEX
- .flags dd ?
- .codepage dd ?
-ends
-
-struct CHARRANGE
- .cpMin dd ?
- .cpMax dd ?
-ends
-
-
-struct ENLINK
- .nmhdr NMHDR
- .msg dd ?
- .wParam dd ?
- .lParam dd ?
- .chrg CHARRANGE
-ends
-
-struct TEXTRANGE
- .chrg CHARRANGE
- .lpstrText dd ?
-ends
-
-
-struct PARAFORMAT2
- .cbSize dd ?
- .dwMask dd ?
- .wNumbering dw ?
- .wEffects dw ?
- .dxStartIndent dd ?
- .dxRightIndent dd ?
- .dxOffset dd ?
- .wAlignment dw ?
- .cTabCount dw ?
- .rgxTabs rd MAX_TAB_STOPS
- .dySpaceBefore dd ?
- .dySpaceAfter dd ?
- .dyLineSpacing dd ?
- .sStyle dw ?
- .bLineSpacingRule db ?
- .bOutlineLevel db ?
- .wShadingWeight dw ?
- .wShadingStyle dw ?
- .wNumberingStart dw ?
- .wNumberingStyle dw ?
- .wNumberingTab dw ?
- .wBorderSpace dw ?
- .wBorderWidth dw ?
- .wBorders dw ?
-ends
-
-ES_NOOLEDRAGDROP = 000000008h
-ES_DISABLENOSCROLL = 000002000h
-ES_SUNKEN = 000004000h
-ES_SAVESEL = 000008000h
-ES_SELFIME = 000040000h
-ES_NOIME = 000080000h
-ES_VERTICAL = 000400000h
-ES_SELECTIONBAR = 001000000h
-
-ES_EX_NOCALLOLEINIT = 001000000h
-
-EM_CANPASTE = WM_USER + 50
-EM_DISPLAYBAND = WM_USER + 51
-EM_EXGETSEL = WM_USER + 52
-EM_EXLIMITTEXT = WM_USER + 53
-EM_EXLINEFROMCHAR = WM_USER + 54
-EM_EXSETSEL = WM_USER + 55
-EM_FINDTEXT = WM_USER + 56
-EM_FORMATRANGE = WM_USER + 57
-EM_GETCHARFORMAT = WM_USER + 58
-EM_GETEVENTMASK = WM_USER + 59
-EM_GETOLEINTERFACE = WM_USER + 60
-EM_GETPARAFORMAT = WM_USER + 61
-EM_GETSELTEXT = WM_USER + 62
-EM_HIDESELECTION = WM_USER + 63
-EM_PASTESPECIAL = WM_USER + 64
-EM_REQUESTRESIZE = WM_USER + 65
-EM_SELECTIONTYPE = WM_USER + 66
-EM_SETBKGNDCOLOR = WM_USER + 67
-EM_SETCHARFORMAT = WM_USER + 68
-EM_SETEVENTMASK = WM_USER + 69
-EM_SETOLECALLBACK = WM_USER + 70
-EM_SETPARAFORMAT = WM_USER + 71
-EM_SETTARGETDEVICE = WM_USER + 72
-EM_STREAMIN = WM_USER + 73
-EM_STREAMOUT = WM_USER + 74
-EM_GETTEXTRANGE = WM_USER + 75
-EM_FINDWORDBREAK = WM_USER + 76
-EM_SETOPTIONS = WM_USER + 77
-EM_GETOPTIONS = WM_USER + 78
-EM_FINDTEXTEX = WM_USER + 79
-EM_GETWORDBREAKPROCEX = WM_USER + 80
-EM_SETWORDBREAKPROCEX = WM_USER + 81
-EM_SETUNDOLIMIT = WM_USER + 82
-EM_REDO = WM_USER + 84
-EM_CANREDO = WM_USER + 85
-EM_GETUNDONAME = WM_USER + 86
-EM_GETREDONAME = WM_USER + 87
-EM_STOPGROUPTYPING = WM_USER + 88
-EM_SETTEXTMODE = WM_USER + 89
-EM_GETTEXTMODE = WM_USER + 90
-EM_AUTOURLDETECT = WM_USER + 91
-EM_GETAUTOURLDETECT = WM_USER + 92
-EM_SETPALETTE = WM_USER + 93
-EM_GETTEXTEX = WM_USER + 94
-EM_GETTEXTLENGTHEX = WM_USER + 95
-EM_SHOWSCROLLBAR = WM_USER + 96
-EM_SETTEXTEX = WM_USER + 97
-EM_SETPUNCTUATION = WM_USER + 100
-EM_GETPUNCTUATION = WM_USER + 101
-EM_SETWORDWRAPMODE = WM_USER + 102
-EM_GETWORDWRAPMODE = WM_USER + 103
-EM_SETIMECOLOR = WM_USER + 104
-EM_GETIMECOLOR = WM_USER + 105
-EM_SETIMEOPTIONS = WM_USER + 106
-EM_GETIMEOPTIONS = WM_USER + 107
-EM_CONVPOSITION = WM_USER + 108
-EM_SETLANGOPTIONS = WM_USER + 120
-EM_GETLANGOPTIONS = WM_USER + 121
-EM_GETIMECOMPMODE = WM_USER + 122
-EM_FINDTEXTW = WM_USER + 123
-EM_FINDTEXTEXW = WM_USER + 124
-EM_RECONVERSION = WM_USER + 125
-EM_SETIMEMODEBIAS = WM_USER + 126
-EM_GETIMEMODEBIAS = WM_USER + 127
-EM_SETBIDIOPTIONS = WM_USER + 200
-EM_GETBIDIOPTIONS = WM_USER + 201
-EM_SETTYPOGRAPHYOPTIONS = WM_USER + 202
-EM_GETTYPOGRAPHYOPTIONS = WM_USER + 203
-EM_SETEDITSTYLE = WM_USER + 204
-EM_GETEDITSTYLE = WM_USER + 205
-EM_OUTLINE = WM_USER + 220
-EM_GETSCROLLPOS = WM_USER + 221
-EM_SETSCROLLPOS = WM_USER + 222
-EM_SETFONTSIZE = WM_USER + 223
-EM_GETZOOM = WM_USER + 224
-EM_SETZOOM = WM_USER + 225
-
-CFM_BOLD = 00000001h
-CFM_ITALIC = 00000002h
-CFM_UNDERLINE = 00000004h
-CFM_STRIKEOUT = 00000008h
-CFM_PROTECTED = 00000010h
-CFM_LINK = 00000020h
-CFM_SMALLCAPS = 00000040h
-CFM_ALLCAPS = 00000080h
-CFM_HIDDEN = 00000100h
-CFM_OUTLINE = 00000200h
-CFM_SHADOW = 00000400h
-CFM_EMBOSS = 00000800h
-CFM_IMPRINT = 00001000h
-CFM_DISABLED = 00002000h
-CFM_REVISED = 00004000h
-CFM_REVAUTHOR = 00008000h
-CFM_SUBSCRIPT = CFE_SUBSCRIPT or CFE_SUPERSCRIPT ; = 00030000h
-CFM_ANIMATION = 00040000h
-CFM_STYLE = 00080000h
-CFM_KERNING = 00100000h
-CFM_SPACING = 00200000h
-CFM_WEIGHT = 00400000h
-CFM_UNDERLINETYPE=00800000h
-; = 01000000h
-CFM_LCID = 02000000h
-CFM_BACKCOLOR = 04000000h
-CFM_CHARSET = 08000000h
-CFM_OFFSET = 10000000h
-CFM_FACE = 20000000h
-CFM_COLOR = 40000000h
-CFM_SIZE = 80000000h
-
-
-CFE_BOLD = 00000001h
-CFE_ITALIC = 00000002h
-CFE_UNDERLINE = 00000004h
-CFE_STRIKEOUT = 00000008h
-CFE_PROTECTED = 00000010h
-CFE_PROTECTED = 00000010h
-CFE_LINK = 00000020h
-CFE_ALLCAPS = CFM_ALLCAPS
-CFE_HIDDEN = CFM_HIDDEN
-CFE_OUTLINE = CFM_OUTLINE
-CFE_SHADOW = CFM_SHADOW
-CFE_EMBOSS = CFM_EMBOSS
-CFE_IMPRINT = CFM_IMPRINT
-CFE_DISABLED = CFM_DISABLED
-CFE_REVISED = CFM_REVISED
-CFE_AUTOBACKCOLOR = CFM_BACKCOLOR
-
-CFE_SUBSCRIPT = 00010000h
-CFE_SUPERSCRIPT = 00020000h
-
-CFE_AUTOCOLOR = 40000000h
-
-
-
-SCF_SELECTION = 0001h
-SCF_WORD = 0002h
-
-SF_TEXT = 0001h
-SF_RTF = 0002h
-SF_RTFNOOBJS = 0003h
-SF_TEXTIZED = 0004h
-
-SFF_SELECTION = 8000h
-SFF_PLAINRTF = 4000h
-
-ST_DEFAULT = 0
-ST_KEEPUNDO = 1
-ST_SELECTION = 2
-ST_NEWCHARS = 4
-
-
-EN_LINK = $0000070b
-
-
-ENM_NONE = 000000000h
-ENM_CHANGE = 000000001h
-ENM_UPDATE = 000000002h
-ENM_SCROLL = 000000004h
-ENM_SCROLLEVENTS = 000000008h
-ENM_DRAGDROPDONE = 000000010h
-ENM_PARAGRAPHEXPANDED = 000000020h
-ENM_PAGECHANGE = 000000040h
-ENM_KEYEVENTS = 000010000h
-ENM_MOUSEEVENTS = 000020000h
-ENM_REQUESTRESIZE = 000040000h
-ENM_SELCHANGE = 000080000h
-ENM_DROPFILES = 000100000h
-ENM_PROTECTED = 000200000h
-ENM_CORRECTTEXT = 000400000h
-ENM_IMECHANGE = 000800000h
-ENM_LANGCHANGE = 001000000h
-ENM_OBJECTPOSITIONS = 002000000h
-ENM_LINK = 004000000h
-ENM_LOWFIRTF = 008000000h
-
-TM_PLAINTEXT = 1
-TM_RICHTEXT = 2
-TM_SINGLELEVELUNDO = 4
-TM_MULTILEVELUNDO = 8
-TM_SINGLECODEPAGE = 16
-TM_MULTICODEPAGE = 32
-
-
-PFM_STARTINDENT = 000000001h
-PFM_RIGHTINDENT = 000000002h
-PFM_OFFSET = 000000004h
-PFM_ALIGNMENT = 000000008h
-PFM_TABSTOPS = 000000010h
-PFM_NUMBERING = 000000020h
-PFM_OFFSETINDENT = 080000000h
-PFM_SPACEBEFORE = 000000040h
-PFM_SPACEAFTER = 000000080h
-PFM_LINESPACING = 000000100h
-PFM_STYLE = 000000400h
-PFM_BORDER = 000000800h
-PFM_SHADING = 000001000h
-PFM_NUMBERINGSTYLE = 000002000h
-PFM_NUMBERINGTAB = 000004000h
-PFM_NUMBERINGSTART = 000008000h
-PFM_RTLPARA = 000010000h
-PFM_KEEP = 000020000h
-PFM_KEEPNEXT = 000040000h
-PFM_PAGEBREAKBEFORE = 000080000h
-PFM_NOLINENUMBER = 000100000h
-PFM_NOWIDOWCONTROL = 000200000h
-PFM_DONOTHYPHEN = 000400000h
-PFM_SIDEBYSIDE = 000800000h
-PFM_TABLE = 040000000h
-PFM_TEXTWRAPPINGBREAK = 020000000h
-PFM_TABLEROWDELIMITER = 010000000h
-PFM_COLLAPSED = 001000000h
-PFM_OUTLINELEVEL = 002000000h
-PFM_BOX = 004000000h
-PFM_RESERVED2 = 008000000h
-PFM_ALL = PFM_STARTINDENT or PFM_RIGHTINDENT or \
- PFM_OFFSET or PFM_ALIGNMENT or \
- PFM_TABSTOPS or PFM_NUMBERING or \
- PFM_OFFSETINDENT or PFM_RTLPARA
-
-PFM_EFFECTS = PFM_RTLPARA or PFM_KEEP or PFM_KEEPNEXT or \
- PFM_TABLE or PFM_PAGEBREAKBEFORE or \
- PFM_NOLINENUMBER or PFM_NOWIDOWCONTROL or \
- PFM_DONOTHYPHEN or PFM_SIDEBYSIDE or \
- PFM_TABLE or PFM_TABLEROWDELIMITER
-
-PFM_ALL2 = PFM_ALL or PFM_EFFECTS or PFM_SPACEBEFORE or \
- PFM_SPACEAFTER or PFM_LINESPACING or \
- PFM_STYLE or PFM_SHADING or PFM_BORDER or \
- PFM_NUMBERINGTAB or PFM_NUMBERINGSTART or \
- PFM_NUMBERINGSTYLE
DELETED freshlib/equates/Win32/_SHELL32.INC
Index: freshlib/equates/Win32/_SHELL32.INC
==================================================================
--- freshlib/equates/Win32/_SHELL32.INC
+++ /dev/null
@@ -1,80 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: SHELL32.DLL structures and constants
-;
-; Target OS: Win32
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-
-struct NOTIFYICONDATA
- .cbSize dd ?
- .hWnd dd ?
- .uID dd ?
- .uFlags dd ?
- .uCallbackMessage dd ?
- .hIcon dd ?
- .szTip du 64
-ends
-
-; Taskbar icon messages
-
-NIM_ADD = 0
-NIM_MODIFY = 1
-NIM_DELETE = 2
-NIM_SETFOCUS = 3
-NIM_SETVERSION = 4
-
-; Taskbar icon flags
-
-NIF_MESSAGE = 01h
-NIF_ICON = 02h
-NIF_TIP = 04h
-NIF_STATE = 08h
-NIF_INFO = 10h
-NIF_GUID = 20h
-
-
-; for SHBrowseForFolder
-
-struct BROWSEINFO
- .hwndOwner dd ?
- .pidlRoot dd ?
- .pszDisplayName dd ?
- .lpszTitle dd ?
- .ulFlags dd ?
- .lpfn dd ?
- .lParam dd ?
- .iImage dd ?
-ends
-
-BIF_RETURNONLYFSDIRS = $0001
-BIF_DONTGOBELOWDOMAIN = $0002
-BIF_STATUSTEXT = $0004
-BIF_RETURNFSANCESTORS = $0008
-BIF_EDITBOX = $0010
-BIF_VALIDATE = $0020
-
-BFFM_INITIALIZED = 1
-BFFM_SELCHANGED = 2
-BFFM_VALIDATEFAILEDA = 3 ; lParam:szPath ret:TRUE(cont), FALSE(EndDialog)
-BFFM_VALIDATEFAILEDW = 4 ; lParam:wzPath ret:TRUE(cont), FALSE(EndDialog)
-
-; messages to browser
-
-BFFM_SETSTATUSTEXTA = WM_USER + 100
-BFFM_ENABLEOK = WM_USER + 101
-BFFM_SETSELECTIONA = WM_USER + 102
-BFFM_SETSELECTIONW = WM_USER + 103
-BFFM_SETSTATUSTEXTW = WM_USER + 104
-
-BFFM_SETSTATUSTEXT = BFFM_SETSTATUSTEXTA
-BFFM_SETSELECTION = BFFM_SETSELECTIONA
-
-
DELETED freshlib/equates/Win32/_USER32.INC
Index: freshlib/equates/Win32/_USER32.INC
==================================================================
--- freshlib/equates/Win32/_USER32.INC
+++ /dev/null
@@ -1,2035 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: USER32.DLL structures and constants
-;
-; Target OS: Win32
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-
-struct POINT
- .x dd ?
- .y dd ?
-ends
-
-struct RECT
- .left dd ?
- .top dd ?
- .right dd ?
- .bottom dd ?
-ends
-
-struct WNDCLASS
- .style dd ?
- .lpfnWndProc dd ?
- .cbClsExtra dd ?
- .cbWndExtra dd ?
- .hInstance dd ?
- .hIcon dd ?
- .hCursor dd ?
- .hbrBackground dd ?
- .lpszMenuName dd ?
- .lpszClassName dd ?
-ends
-
-struct WNDCLASSEX
- .cbSize dd ?
- .style dd ?
- .lpfnWndProc dd ?
- .cbClsExtra dd ?
- .cbWndExtra dd ?
- .hInstance dd ?
- .hIcon dd ?
- .hCursor dd ?
- .hbrBackground dd ?
- .lpszMenuName dd ?
- .lpszClassName dd ?
- .hIconSm dd ?
-ends
-
-struct CREATESTRUCT
- .lpCreateParams dd ?
- .hInstance dd ?
- .hMenu dd ?
- .hwndParent dd ?
- .cy dd ?
- .cx dd ?
- .y dd ?
- .x dd ?
- .style dd ?
- .lpszName dd ?
- .lpszClass dd ?
- .dwExStyle dd ?
-ends
-
-struct CLIENTCREATESTRUCT
- .hWindowMenu dd ?
- .idFirstChild dd ?
-ends
-
-struct MDICREATESTRUCT
- .szClass dd ?
- .szTitle dd ?
- .hOwner dd ?
- .x dd ?
- .y dd ?
- .cx dd ?
- .cy dd ?
- .style dd ?
- .lParam dd ?
-ends
-
-struct SCROLLINFO
- .cbSize dd ?
- .fMask dd ?
- .nMin dd ?
- .nMax dd ?
- .nPage dd ?
- .nPos dd ?
- .nTrackPos dd ?
-ends
-
-struct MSG
- .hwnd dd ?
- .message dd ?
- .wParam dd ?
- .lParam dd ?
- .time dd ?
- .pt POINT
-ends
-
-struct MINMAXINFO
- .ptReserved POINT
- .ptMaxSize POINT
- .ptMaxPosition POINT
- .ptMinTrackSize POINT
- .ptMaxTrackSize POINT
-ends
-
-struct WINDOWPLACEMENT
- .length dd ?
- .flags dd ?
- .showCmd dd ?
- .ptMinPosition POINT
- .ptMaxPosition POINT
- .rcNormalPosition RECT
-ends
-
-struct WINDOWPOS
- .hwnd dd ?
- .hwndInsertAfter dd ?
- .x dd ?
- .y dd ?
- .cx dd ?
- .cy dd ?
- .flags dd ?
-ends
-
-struct NMHDR
- .hwndFrom dd ?
- .idFrom dd ?
- .code dd ?
-ends
-
-struct COPYDATASTRUCT
- .dwData dd ?
- .cbData dd ?
- .lpData dd ?
-ends
-
-struct ACCEL
- .fVirt dw ?
- .key dw ?
- .cmd dw ?
-ends
-
-struct PAINTSTRUCT
- .hdc dd ?
- .fErase dd ?
- .rcPaint RECT
- .fRestore dd ?
- .fIncUpdate dd ?
- .rgbReserved rb 32
-ends
-
-struct DRAWTEXTPARAMS
- .cbSize dd ?
- .iTabLength dd ?
- .iLeftMargin dd ?
- .iRightMargin dd ?
- .uiLengthDrawn dd ?
-ends
-
-struct DRAWITEMSTRUCT
- .CtlType dd ?
- .CtlID dd ?
- .itemID dd ?
- .itemAction dd ?
- .itemState dd ?
- .hwndItem dd ?
- .hDC dd ?
- .rcItem RECT
- .itemData dd ?
-ends
-
-struct MENUITEMINFO
- .cbSize dd ?
- .fMask dd ?
- .fType dd ?
- .fState dd ?
- .wID dd ?
- .hSubMenu dd ?
- .hbmpChecked dd ?
- .hbmpUnchecked dd ?
- .dwItemData dd ?
- .dwTypeData dd ?
- .cch dd ?
-ends
-
-struct MEASUREITEMSTRUCT
- .CtlType dd ?
- .CtlID dd ?
- .itemID dd ?
- .itemWidth dd ?
- .itemHeight dd ?
- .itemData dd ?
-ends
-
-struct MSGBOXPARAMS
- .cbSize dd ?
- .hwndOwner dd ?
- .hInstance dd ?
- .lpszText dd ?
- .lpszCaption dd ?
- .dwStyle dd ?
- .lpszIcon dd ?
- .dwContextHelpId dd ?
- .lpfnMsgBoxCallback dd ?
- .dwLanguageId dd ?
-ends
-
-; MessageBox type flags
-
-MB_OK = 000000h
-MB_OKCANCEL = 000001h
-MB_ABORTRETRYIGNORE = 000002h
-MB_YESNOCANCEL = 000003h
-MB_YESNO = 000004h
-MB_RETRYCANCEL = 000005h
-MB_ICONHAND = 000010h
-MB_ICONQUESTION = 000020h
-MB_ICONEXCLAMATION = 000030h
-MB_ICONASTERISK = 000040h
-MB_USERICON = 000080h
-MB_ICONWARNING = MB_ICONEXCLAMATION
-MB_ICONERROR = MB_ICONHAND
-MB_ICONINFORMATION = MB_ICONASTERISK
-MB_ICONSTOP = MB_ICONHAND
-MB_DEFBUTTON1 = 000000h
-MB_DEFBUTTON2 = 000100h
-MB_DEFBUTTON3 = 000200h
-MB_DEFBUTTON4 = 000300h
-MB_APPLMODAL = 000000h
-MB_SYSTEMMODAL = 001000h
-MB_TASKMODAL = 002000h
-MB_HELP = 004000h
-MB_NOFOCUS = 008000h
-MB_SETFOREGROUND = 010000h
-MB_DEFAULT_DESKTOP_ONLY = 020000h
-MB_TOPMOST = 040000h
-MB_RIGHT = 080000h
-MB_RTLREADING = 100000h
-MB_SERVICE_NOTIFICATION = 200000h
-
-; Conventional dialog box and message box command IDs
-
-IDOK = 1
-IDCANCEL = 2
-IDABORT = 3
-IDRETRY = 4
-IDIGNORE = 5
-IDYES = 6
-IDNO = 7
-IDCLOSE = 8
-IDHELP = 9
-
-; Class styles
-
-CS_VREDRAW = 00001h
-CS_HREDRAW = 00002h
-CS_KEYCVTWINDOW = 00004h
-CS_DBLCLKS = 00008h
-CS_OWNDC = 00020h
-CS_CLASSDC = 00040h
-CS_PARENTDC = 00080h
-CS_NOKEYCVT = 00100h
-CS_SAVEBITS = 00800h
-CS_NOCLOSE = 00200h
-CS_BYTEALIGNCLIENT = 01000h
-CS_BYTEALIGNWINDOW = 02000h
-CS_PUBLICCLASS = 04000h
-CS_GLOBALCLASS = CS_PUBLICCLASS
-CS_IME = 10000h
-
-; Windows styles
-
-WS_OVERLAPPED = $00000000
-WS_ICONICPOPUP = $C0000000
-WS_POPUP = $80000000
-WS_CHILD = $40000000
-WS_MINIMIZE = $20000000
-WS_VISIBLE = $10000000
-WS_DISABLED = $08000000
-WS_CLIPSIBLINGS = $04000000
-WS_CLIPCHILDREN = $02000000
-WS_MAXIMIZE = $01000000
-WS_CAPTION = $00C00000
-WS_BORDER = $00800000
-WS_DLGFRAME = $00400000
-WS_VSCROLL = $00200000
-WS_HSCROLL = $00100000
-WS_SYSMENU = $00080000
-WS_THICKFRAME = $00040000
-WS_HREDRAW = $00020000
-WS_VREDRAW = $00010000
-WS_GROUP = $00020000
-WS_TABSTOP = $00010000
-WS_MINIMIZEBOX = $00020000
-WS_MAXIMIZEBOX = $00010000
-
-; Common Window Styles
-
-WS_OVERLAPPEDWINDOW = WS_OVERLAPPED or WS_CAPTION or WS_SYSMENU or WS_THICKFRAME or WS_MINIMIZEBOX or WS_MAXIMIZEBOX
-WS_POPUPWINDOW = WS_POPUP or WS_BORDER or WS_SYSMENU
-WS_CHILDWINDOW = WS_CHILD
-WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW
-WS_TILED = WS_OVERLAPPED
-WS_ICONIC = WS_MINIMIZE
-WS_SIZEBOX = WS_THICKFRAME
-
-; Extended Window Styles
-
-WS_EX_DLGMODALFRAME = 00001h
-WS_EX_DRAGOBJECT = 00002h
-WS_EX_NOPARENTNOTIFY = 00004h
-WS_EX_TOPMOST = 00008h
-WS_EX_ACCEPTFILES = 00010h
-WS_EX_TRANSPARENT = 00020h
-WS_EX_MDICHILD = 00040h
-WS_EX_TOOLWINDOW = 00080h
-WS_EX_WINDOWEDGE = 00100h
-WS_EX_CLIENTEDGE = 00200h
-WS_EX_CONTEXTHELP = 00400h
-WS_EX_RIGHT = 01000h
-WS_EX_LEFT = 00000h
-WS_EX_RTLREADING = 02000h
-WS_EX_LTRREADING = 00000h
-WS_EX_LEFTSCROLLBAR = 04000h
-WS_EX_RIGHTSCROLLBAR = 00000h
-WS_EX_CONTROLPARENT = 10000h
-WS_EX_STATICEDGE = 20000h
-WS_EX_APPWINDOW = 40000h
-WS_EX_LAYERED = 80000h
-WS_EX_OVERLAPPEDWINDOW = WS_EX_WINDOWEDGE or WS_EX_CLIENTEDGE
-WS_EX_PALETTEWINDOW = WS_EX_WINDOWEDGE or WS_EX_TOOLWINDOW or WS_EX_TOPMOST
-
-; MDI client style bits
-
-MDIS_ALLCHILDSTYLES = 1
-
-; Special CreateWindow position value
-
-CW_USEDEFAULT = 8000h
-
-; Predefined window handle
-
-HWND_DESKTOP = 0
-
-; ShowWindow commands
-
-SW_HIDE = 0
-SW_SHOWNORMAL = 1
-SW_NORMAL = 1
-SW_SHOWMINIMIZED = 2
-SW_SHOWMAXIMIZED = 3
-SW_MAXIMIZE = 3
-SW_SHOWNOACTIVATE = 4
-SW_SHOW = 5
-SW_MINIMIZE = 6
-SW_SHOWMINNOACTIVE = 7
-SW_SHOWNA = 8
-SW_RESTORE = 9
-SW_SHOWDEFAULT = 10
-
-; SetWindowPos flags
-
-SWP_NOSIZE = 0001h
-SWP_NOMOVE = 0002h
-SWP_NOZORDER = 0004h
-SWP_NOREDRAW = 0008h
-SWP_NOACTIVATE = 0010h
-SWP_DRAWFRAME = 0020h
-SWP_SHOWWINDOW = 0040h
-SWP_HIDEWINDOW = 0080h
-SWP_NOCOPYBITS = 0100h
-SWP_NOREPOSITION = 0200h
-SWP_NOSENDCHANGING = 0400h
-SWP_DEFERERASE = 2000h
-SWP_ASYNCWINDOWPOS = 4000h
-
-; SetWindowPos special handle values
-
-HWND_TOP = 0
-HWND_BOTTOM = 1
-HWND_TOPMOST = -1
-HWND_NOTOPMOST = -2
-
-; GetWindow flags
-
-GW_HWNDFIRST = 0
-GW_HWNDLAST = 1
-GW_HWNDNEXT = 2
-GW_HWNDPREV = 3
-GW_OWNER = 4
-GW_CHILD = 5
-
-; RedrawWindow flags
-
-RDW_INVALIDATE = 0001h
-RDW_INTERNALPAINT = 0002h
-RDW_ERASE = 0004h
-RDW_VALIDATE = 0008h
-RDW_NOINTERNALPAINT = 0010h
-RDW_NOERASE = 0020h
-RDW_NOCHILDREN = 0040h
-RDW_ALLCHILDREN = 0080h
-RDW_UPDATENOW = 0100h
-RDW_ERASENOW = 0200h
-RDW_FRAME = 0400h
-RDW_NOFRAME = 0800h
-
-; PeekMessage Options
-
-PM_NOREMOVE = 0000h
-PM_REMOVE = 0001h
-PM_NOYIELD = 0002h
-
-; Window state messages
-
-WM_STATE = 0000h
-WM_NULL = 0000h
-WM_CREATE = 0001h
-WM_DESTROY = 0002h
-WM_MOVE = 0003h
-WM_SIZE = 0005h
-WM_ACTIVATE = 0006h
-WM_SETFOCUS = 0007h
-WM_KILLFOCUS = 0008h
-WM_ENABLE = 000Ah
-WM_SETREDRAW = 000Bh
-WM_SETTEXT = 000Ch
-WM_GETTEXT = 000Dh
-WM_GETTEXTLENGTH = 000Eh
-WM_PAINT = 000Fh
-WM_CLOSE = 0010h
-WM_QUERYENDSESSION = 0011h
-WM_QUIT = 0012h
-WM_QUERYOPEN = 0013h
-WM_ERASEBKGND = 0014h
-WM_SYSCOLORCHANGE = 0015h
-WM_ENDSESSION = 0016h
-WM_SYSTEMERROR = 0017h
-WM_SHOWWINDOW = 0018h
-WM_CTLCOLOR = 0019h
-WM_WININICHANGE = 001Ah
-WM_SETTINGCHANGE = WM_WININICHANGE
-WM_DEVMODECHANGE = 001Bh
-WM_ACTIVATEAPP = 001Ch
-WM_FONTCHANGE = 001Dh
-WM_TIMECHANGE = 001Eh
-WM_CANCELMODE = 001Fh
-WM_SETCURSOR = 0020h
-WM_MOUSEACTIVATE = 0021h
-WM_CHILDACTIVATE = 0022h
-WM_QUEUESYNC = 0023h
-WM_GETMINMAXINFO = 0024h
-WM_PAINTICON = 0026h
-WM_ICONERASEBKGND = 0027h
-WM_NEXTDLGCTL = 0028h
-WM_SPOOLERSTATUS = 002Ah
-WM_DRAWITEM = 002Bh
-WM_MEASUREITEM = 002Ch
-WM_DELETEITEM = 002Dh
-WM_VKEYTOITEM = 002Eh
-WM_CHARTOITEM = 002Fh
-WM_SETFONT = 0030h
-WM_GETFONT = 0031h
-WM_SETHOTKEY = 0032h
-WM_QUERYDRAGICON = 0037h
-WM_COMPAREITEM = 0039h
-WM_COMPACTING = 0041h
-WM_COMMNOTIFY = 0044h
-WM_WINDOWPOSCHANGING = 0046h
-WM_WINDOWPOSCHANGED = 0047h
-WM_POWER = 0048h
-WM_COPYDATA = 004Ah
-WM_CANCELJOURNAL = 004Bh
-WM_NOTIFY = 004Eh
-WM_INPUTLANGCHANGEREQUEST = 0050h
-WM_INPUTLANGCHANGE = 0051h
-WM_TCARD = 0052h
-WM_HELP = 0053h
-WM_USERCHANGED = 0054h
-WM_NOTIFYFORMAT = 0055h
-WM_CONTEXTMENU = 007Bh
-WM_STYLECHANGING = 007Ch
-WM_STYLECHANGED = 007Dh
-WM_DISPLAYCHANGE = 007Eh
-WM_GETICON = 007Fh
-WM_SETICON = 0080h
-WM_NCCREATE = 0081h
-WM_NCDESTROY = 0082h
-WM_NCCALCSIZE = 0083h
-WM_NCHITTEST = 0084h
-WM_NCPAINT = 0085h
-WM_NCACTIVATE = 0086h
-WM_GETDLGCODE = 0087h
-WM_NCMOUSEMOVE = 00A0h
-WM_NCLBUTTONDOWN = 00A1h
-WM_NCLBUTTONUP = 00A2h
-WM_NCLBUTTONDBLCLK = 00A3h
-WM_NCRBUTTONDOWN = 00A4h
-WM_NCRBUTTONUP = 00A5h
-WM_NCRBUTTONDBLCLK = 00A6h
-WM_NCMBUTTONDOWN = 00A7h
-WM_NCMBUTTONUP = 00A8h
-WM_NCMBUTTONDBLCLK = 00A9h
-WM_KEYFIRST = 0100h
-WM_KEYDOWN = 0100h
-WM_KEYUP = 0101h
-WM_CHAR = 0102h
-WM_DEADCHAR = 0103h
-WM_SYSKEYDOWN = 0104h
-WM_SYSKEYUP = 0105h
-WM_SYSCHAR = 0106h
-WM_SYSDEADCHAR = 0107h
-WM_KEYLAST = 0108h
-WM_INITDIALOG = 0110h
-WM_COMMAND = 0111h
-WM_SYSCOMMAND = 0112h
-WM_TIMER = 0113h
-WM_HSCROLL = 0114h
-WM_VSCROLL = 0115h
-WM_INITMENU = 0116h
-WM_INITMENUPOPUP = 0117h
-WM_MENUSELECT = 011Fh
-WM_MENUCHAR = 0120h
-WM_ENTERIDLE = 0121h
-WM_MENURBUTTONUP = 0122h
-WM_MENUDRAG = 0123h
-WM_MENUGETOBJECT = 0124h
-WM_UNINITMENUPOPUP = 0125h
-WM_MENUCOMMAND = 0126h
-WM_CTLCOLORMSGBOX = 0132h
-WM_CTLCOLOREDIT = 0133h
-WM_CTLCOLORLISTBOX = 0134h
-WM_CTLCOLORBTN = 0135h
-WM_CTLCOLORDLG = 0136h
-WM_CTLCOLORSCROLLBAR = 0137h
-WM_CTLCOLORSTATIC = 0138h
-WM_MOUSEFIRST = 0200h
-WM_MOUSEMOVE = 0200h
-WM_LBUTTONDOWN = 0201h
-WM_LBUTTONUP = 0202h
-WM_LBUTTONDBLCLK = 0203h
-WM_RBUTTONDOWN = 0204h
-WM_RBUTTONUP = 0205h
-WM_RBUTTONDBLCLK = 0206h
-WM_MBUTTONDOWN = 0207h
-WM_MBUTTONUP = 0208h
-WM_MBUTTONDBLCLK = 0209h
-WM_MOUSEWHEEL = 020Ah
-WM_MOUSELAST = 020Ah
-WM_PARENTNOTIFY = 0210h
-WM_ENTERMENULOOP = 0211h
-WM_EXITMENULOOP = 0212h
-WM_NEXTMENU = 0213h
-WM_SIZING = 0214h
-WM_CAPTURECHANGED = 0215h
-WM_MOVING = 0216h
-WM_POWERBROADCAST = 0218h
-WM_DEVICECHANGE = 0219h
-WM_MDICREATE = 0220h
-WM_MDIDESTROY = 0221h
-WM_MDIACTIVATE = 0222h
-WM_MDIRESTORE = 0223h
-WM_MDINEXT = 0224h
-WM_MDIMAXIMIZE = 0225h
-WM_MDITILE = 0226h
-WM_MDICASCADE = 0227h
-WM_MDIICONARRANGE = 0228h
-WM_MDIGETACTIVE = 0229h
-WM_MDISETMENU = 0230h
-WM_ENTERSIZEMOVE = 0231h
-WM_EXITSIZEMOVE = 0232h
-WM_DROPFILES = 0233h
-WM_MDIREFRESHMENU = 0234h
-WM_IME_SETCONTEXT = 0281h
-WM_IME_NOTIFY = 0282h
-WM_IME_CONTROL = 0283h
-WM_IME_COMPOSITIONFULL = 0284h
-WM_IME_SELECT = 0285h
-WM_IME_CHAR = 0286h
-WM_IME_KEYDOWN = 0290h
-WM_IME_KEYUP = 0291h
-WM_MOUSEHOVER = 02A1h
-WM_MOUSELEAVE = 02A3h
-WM_CUT = 0300h
-WM_COPY = 0301h
-WM_PASTE = 0302h
-WM_CLEAR = 0303h
-WM_UNDO = 0304h
-WM_RENDERFORMAT = 0305h
-WM_RENDERALLFORMATS = 0306h
-WM_DESTROYCLIPBOARD = 0307h
-WM_DRAWCLIPBOARD = 0308h
-WM_PAINTCLIPBOARD = 0309h
-WM_VSCROLLCLIPBOARD = 030Ah
-WM_SIZECLIPBOARD = 030Bh
-WM_ASKCBFORMATNAME = 030Ch
-WM_CHANGECBCHAIN = 030Dh
-WM_HSCROLLCLIPBOARD = 030Eh
-WM_QUERYNEWPALETTE = 030Fh
-WM_PALETTEISCHANGING = 0310h
-WM_PALETTECHANGED = 0311h
-WM_HOTKEY = 0312h
-WM_PRINT = 0317h
-WM_PRINTCLIENT = 0318h
-WM_HANDHELDFIRST = 0358h
-WM_HANDHELDLAST = 035Fh
-WM_AFXFIRST = 0360h
-WM_AFXLAST = 037Fh
-WM_PENWINFIRST = 0380h
-WM_PENWINLAST = 038Fh
-WM_COALESCE_FIRST = 0390h
-WM_COALESCE_LAST = 039Fh
-WM_USER = 0400h
-
-;WM_NCHITTEST result constants
-HTBORDER = 18
-HTBOTTOM = 15
-HTBOTTOMLEFT = 16
-HTBOTTOMRIGHT = 17
-HTCAPTION = 2
-HTCLIENT = 1
-HTERROR = -2
-HTGROWBOX = 4
-HTHSCROLL = 6
-HTLEFT = 10
-HTMAXBUTTON = 9
-HTMENU = 5
-HTMINBUTTON = 8
-HTNOWHERE = 0
-HTRIGHT = 11
-HTSYSMENU = 3
-HTTOP = 12
-HTTOPLEFT = 13
-HTTOPRIGHT = 14
-HTVSCROLL = 7
-HTTRANSPARENT = -1
-HTOBJECT = 19
-HTCLOSE = 20
-HTHELP = 21
-
-
-; WM_SIZE commands
-
-SIZE_RESTORED = 0
-SIZE_MINIMIZED = 1
-SIZE_MAXIMIZED = 2
-SIZE_MAXSHOW = 3
-SIZE_MAXHIDE = 4
-
-; WM_ACTIVATE states
-
-WA_INACTIVE = 0
-WA_ACTIVE = 1
-WA_CLICKACTIVE = 2
-
-; WM_SHOWWINDOW identifiers
-
-SW_PARENTCLOSING = 1
-SW_OTHERZOOM = 2
-SW_PARENTOPENING = 3
-SW_OTHERUNZOOM = 4
-
-; WM_MOUSEACTIVATE return codes
-
-MA_ACTIVATE = 1
-MA_ACTIVATEANDEAT = 2
-MA_NOACTIVATE = 3
-MA_NOACTIVATEANDEAT = 4
-
-; WM_MDITILE flags
-
-MDITILE_VERTICAL = 0
-MDITILE_HORIZONTAL = 1
-MDITILE_SKIPDISABLED = 2
-
-; WM_NOTIFY codes
-
-NM_OUTOFMEMORY = -1
-NM_CLICK = -2
-NM_DBLCLICK = -3
-NM_RETURN = -4
-NM_RCLICK = -5
-NM_RDBLCLK = -6
-NM_SETFOCUS = -7
-NM_KILLFOCUS = -8
-
-; WM_SETICON types
-
-ICON_SMALL = 0
-ICON_BIG = 1
-
-; WM_HOTKEY commands
-
-HOTKEYF_SHIFT = 01h
-HOTKEYF_CONTROL = 02h
-HOTKEYF_ALT = 04h
-HOTKEYF_EXT = 08h
-
-; Keystroke flags
-
-KF_EXTENDED = 0100h
-KF_DLGMODE = 0800h
-KF_MENUMODE = 1000h
-KF_ALTDOWN = 2000h
-KF_REPEAT = 4000h
-KF_UP = 8000h
-
-; Key state masks for mouse messages
-
-MK_LBUTTON = 01h
-MK_RBUTTON = 02h
-MK_SHIFT = 04h
-MK_CONTROL = 08h
-MK_MBUTTON = 10h
-
-; WM_SIZING codes
-
-WMSZ_LEFT = 1
-WMSZ_RIGHT = 2
-WMSZ_TOP = 3
-WMSZ_TOPLEFT = 4
-WMSZ_TOPRIGHT = 5
-WMSZ_BOTTOM = 6
-WMSZ_BOTTOMLEFT = 7
-WMSZ_BOTTOMRIGHT = 8
-
-; WM_HOTKEY modifiers
-
-MOD_ALT = 1
-MOD_CONTROL = 2
-MOD_SHIFT = 4
-MOD_WIN = 8
-
-; WM_PRINT flags
-
-PRF_CHECKVISIBLE = 01h
-PRF_NONCLIENT = 02h
-PRF_CLIENT = 04h
-PRF_ERASEBKGND = 08h
-PRF_CHILDREN = 10h
-PRF_OWNED = 20h
-
-; Virtual key codes
-
-VK_LBUTTON = 001h
-VK_CANCEL = 003h
-VK_RBUTTON = 002h
-VK_MBUTTON = 004h
-VK_BACK = 008h
-VK_TAB = 009h
-VK_CLEAR = 00Ch
-VK_RETURN = 00Dh
-VK_SHIFT = 010h
-VK_CONTROL = 011h
-VK_MENU = 012h
-VK_PAUSE = 013h
-VK_CAPITAL = 014h
-VK_ESCAPE = 01Bh
-VK_SPACE = 020h
-VK_PRIOR = 021h
-VK_PGUP = 021h
-VK_PGDN = 022h
-VK_NEXT = 022h
-VK_END = 023h
-VK_HOME = 024h
-VK_LEFT = 025h
-VK_UP = 026h
-VK_RIGHT = 027h
-VK_DOWN = 028h
-VK_SELECT = 029h
-VK_PRINT = 02Ah
-VK_EXECUTE = 02Bh
-VK_SNAPSHOT = 02Ch
-VK_INSERT = 02Dh
-VK_DELETE = 02Eh
-VK_HELP = 02Fh
-VK_LWIN = 05Bh
-VK_RWIN = 05Ch
-VK_APPS = 05Dh
-VK_NUMPAD0 = 060h
-VK_NUMPAD1 = 061h
-VK_NUMPAD2 = 062h
-VK_NUMPAD3 = 063h
-VK_NUMPAD4 = 064h
-VK_NUMPAD5 = 065h
-VK_NUMPAD6 = 066h
-VK_NUMPAD7 = 067h
-VK_NUMPAD8 = 068h
-VK_NUMPAD9 = 069h
-VK_MULTIPLY = 06Ah
-VK_ADD = 06Bh
-VK_SEPARATOR = 06Ch
-VK_SUBTRACT = 06Dh
-VK_DECIMAL = 06Eh
-VK_DIVIDE = 06Fh
-VK_F1 = 070h
-VK_F2 = 071h
-VK_F3 = 072h
-VK_F4 = 073h
-VK_F5 = 074h
-VK_F6 = 075h
-VK_F7 = 076h
-VK_F8 = 077h
-VK_F9 = 078h
-VK_F10 = 079h
-VK_F11 = 07Ah
-VK_F12 = 07Bh
-VK_F13 = 07Ch
-VK_F14 = 07Dh
-VK_F15 = 07Eh
-VK_F16 = 07Fh
-VK_F17 = 080h
-VK_F18 = 081h
-VK_F19 = 082h
-VK_F20 = 083h
-VK_F21 = 084h
-VK_F22 = 085h
-VK_F23 = 086h
-VK_F24 = 087h
-VK_NUMLOCK = 090h
-VK_SCROLL = 091h
-VK_LSHIFT = 0A0h
-VK_RSHIFT = 0A1h
-VK_LCONTROL = 0A2h
-VK_RCONTROL = 0A3h
-VK_LMENU = 0A4h
-VK_RMENU = 0A5h
-VK_ATTN = 0F6h
-VK_CRSEL = 0F7h
-VK_EXSEL = 0F8h
-VK_EREOF = 0F9h
-VK_PLAY = 0FAh
-VK_ZOOM = 0FBh
-VK_NONAME = 0FCh
-VK_PA1 = 0FDh
-VK_OEM_CLEAR = 0FEh
-
-; Accelerator flags
-
-FVIRTKEY = 01h
-FNOINVERT = 02h
-FSHIFT = 04h
-FCONTROL = 08h
-FALT = 10h
-
-; GetClassLong offsets
-
-GCL_MENUNAME = -8
-GCL_HBRBACKGROUND = -10
-GCL_HCURSOR = -12
-GCL_HICON = -14
-GCL_HMODULE = -16
-GCL_CBWNDEXTRA = -18
-GCL_CBCLSEXTRA = -20
-GCL_WNDPROC = -24
-GCL_STYLE = -26
-GCW_ATOM = -32
-GCL_HICONSM = -34
-
-; GetWindowLong offsets
-
-GWL_WNDPROC = -4
-GWL_HINSTANCE = -6
-GWL_HWNDPARENT = -8
-GWL_STYLE = -16
-GWL_EXSTYLE = -20
-GWL_USERDATA = -21
-GWL_ID = -12
-DWL_MSGRESULT = 0
-DWL_DLGPROC = 4
-DWL_USER = 8
-
-; GetSystemMetrics codes
-
-SM_CXSCREEN = 0
-SM_CYSCREEN = 1
-SM_CXVSCROLL = 2
-SM_CYHSCROLL = 3
-SM_CYCAPTION = 4
-SM_CXBORDER = 5
-SM_CYBORDER = 6
-SM_CXDLGFRAME = 7
-SM_CYDLGFRAME = 8
-SM_CYVTHUMB = 9
-SM_CXHTHUMB = 10
-SM_CXICON = 11
-SM_CYICON = 12
-SM_CXCURSOR = 13
-SM_CYCURSOR = 14
-SM_CYMENU = 15
-SM_CXFULLSCREEN = 16
-SM_CYFULLSCREEN = 17
-SM_CYKANJIWINDOW = 18
-SM_MOUSEPRESENT = 19
-SM_CYVSCROLL = 20
-SM_CXHSCROLL = 21
-SM_DEBUG = 22
-SM_SWAPBUTTON = 23
-SM_RESERVED1 = 24
-SM_RESERVED2 = 25
-SM_RESERVED3 = 26
-SM_RESERVED4 = 27
-SM_CXMIN = 28
-SM_CYMIN = 29
-SM_CXSIZE = 30
-SM_CYSIZE = 31
-SM_CXFRAME = 32
-SM_CYFRAME = 33
-SM_CXMINTRACK = 34
-SM_CYMINTRACK = 35
-SM_CXDOUBLECLK = 36
-SM_CYDOUBLECLK = 37
-SM_CXICONSPACING = 38
-SM_CYICONSPACING = 39
-SM_MENUDROPALIGNMENT = 40
-SM_PENWINDOWS = 41
-SM_DBCSENABLED = 42
-SM_CMOUSEBUTTONS = 43
-SM_CXFIXEDFRAME = SM_CXDLGFRAME
-SM_CYFIXEDFRAME = SM_CYDLGFRAME
-SM_CXSIZEFRAME = SM_CXFRAME
-SM_CYSIZEFRAME = SM_CYFRAME
-SM_SECURE = 44
-SM_CXEDGE = 45
-SM_CYEDGE = 46
-SM_CXMINSPACING = 47
-SM_CYMINSPACING = 48
-SM_CXSMICON = 49
-SM_CYSMICON = 50
-SM_CYSMCAPTION = 51
-SM_CXSMSIZE = 52
-SM_CYSMSIZE = 53
-SM_CXMENUSIZE = 54
-SM_CYMENUSIZE = 55
-SM_ARRANGE = 56
-SM_CXMINIMIZED = 57
-SM_CYMINIMIZED = 58
-SM_CXMAXTRACK = 59
-SM_CYMAXTRACK = 60
-SM_CXMAXIMIZED = 61
-SM_CYMAXIMIZED = 62
-SM_NETWORK = 63
-SM_CLEANBOOT = 67
-SM_CXDRAG = 68
-SM_CYDRAG = 69
-SM_SHOWSOUNDS = 70
-SM_CXMENUCHECK = 71
-SM_CYMENUCHECK = 72
-SM_SLOWMACHINE = 73
-SM_MIDEASTENABLED = 74
-SM_MOUSEWHEELPRESENT = 75
-SM_CMETRICS = 76
-
-; Predefined cursor identifiers
-
-IDC_ARROW = 32512
-IDC_IBEAM = 32513
-IDC_WAIT = 32514
-IDC_CROSS = 32515
-IDC_UPARROW = 32516
-IDC_SIZE = 32640
-IDC_ICON = 32641
-IDC_SIZENWSE = 32642
-IDC_SIZENESW = 32643
-IDC_SIZEWE = 32644
-IDC_SIZENS = 32645
-IDC_SIZEALL = 32646
-IDC_NO = 32648
-IDC_HAND = 32649
-IDC_APPSTARTING = 32650
-IDC_HELP = 32651
-
-; Predefined icon identifiers
-
-IDI_APPLICATION = 32512
-IDI_HAND = 32513
-IDI_QUESTION = 32514
-IDI_EXCLAMATION = 32515
-IDI_ASTERISK = 32516
-IDI_WINLOGO = 32517
-
-; System colors
-
-COLOR_SCROLLBAR = 0
-COLOR_BACKGROUND = 1
-COLOR_ACTIVECAPTION = 2
-COLOR_INACTIVECAPTION = 3
-COLOR_MENU = 4
-COLOR_WINDOW = 5
-COLOR_WINDOWFRAME = 6
-COLOR_MENUTEXT = 7
-COLOR_WINDOWTEXT = 8
-COLOR_CAPTIONTEXT = 9
-COLOR_ACTIVEBORDER = 10
-COLOR_INACTIVEBORDER = 11
-COLOR_APPWORKSPACE = 12
-COLOR_HIGHLIGHT = 13
-COLOR_HIGHLIGHTTEXT = 14
-COLOR_BTNFACE = 15
-COLOR_BTNSHADOW = 16
-COLOR_GRAYTEXT = 17
-COLOR_BTNTEXT = 18
-COLOR_INACTIVECAPTIONTEXT = 19
-COLOR_BTNHIGHLIGHT = 20
-COLOR_3DDKSHADOW = 21
-COLOR_3DLIGHT = 22
-COLOR_INFOTEXT = 23
-COLOR_INFOBK = 24
-COLOR_HOTLIGHT = 26
-COLOR_GRADIENTACTIVECAPTION = 27
-COLOR_GRADIENTINACTIVECAPTION = 28
-
-; Button messages
-
-BM_GETCHECK = 00F0h
-BM_SETCHECK = 00F1h
-BM_GETSTATE = 00F2h
-BM_SETSTATE = 00F3h
-BM_SETSTYLE = 00F4h
-BM_CLICK = 00F5h
-BM_GETIMAGE = 00F6h
-BM_SETIMAGE = 00F7h
-
-; Button notifications
-
-BN_CLICKED = 0
-BN_PAINT = 1
-BN_HILITE = 2
-BN_UNHILITE = 3
-BN_DISABLE = 4
-BN_DOUBLECLICKED = 5
-BN_SETFOCUS = 6
-BN_KILLFOCUS = 7
-BN_PUSHED = BN_HILITE
-BN_UNPUSHED = BN_UNHILITE
-BN_DBLCLK = BN_DOUBLECLICKED
-
-; Button styles
-
-BS_PUSHBUTTON = 0000h
-BS_DEFPUSHBUTTON = 0001h
-BS_CHECKBOX = 0002h
-BS_AUTOCHECKBOX = 0003h
-BS_RADIOBUTTON = 0004h
-BS_3STATE = 0005h
-BS_AUTO3STATE = 0006h
-BS_GROUPBOX = 0007h
-BS_USERBUTTON = 0008h
-BS_AUTORADIOBUTTON = 0009h
-BS_OWNERDRAW = 000Bh
-BS_TEXT = 0000h
-BS_LEFTTEXT = 0020h
-BS_RIGHTBUTTON = BS_LEFTTEXT
-BS_ICON = 0040h
-BS_BITMAP = 0080h
-BS_LEFT = 0100h
-BS_RIGHT = 0200h
-BS_CENTER = 0300h
-BS_TOP = 0400h
-BS_BOTTOM = 0800h
-BS_VCENTER = 0C00h
-BS_PUSHLIKE = 1000h
-BS_MULTILINE = 2000h
-BS_NOTIFY = 4000h
-BS_FLAT = 8000h
-
-; Button states
-
-BST_UNCHECKED = 0
-BST_CHECKED = 1
-BST_INDETERMINATE = 2
-BST_PUSHED = 4
-BST_FOCUS = 8
-
-; List box messages
-
-LB_ADDSTRING = 0180h
-LB_INSERTSTRING = 0181h
-LB_DELETESTRING = 0182h
-LB_SELITEMRANGEEX = 0183h
-LB_RESETCONTENT = 0184h
-LB_SETSEL = 0185h
-LB_SETCURSEL = 0186h
-LB_GETSEL = 0187h
-LB_GETCURSEL = 0188h
-LB_GETTEXT = 0189h
-LB_GETTEXTLEN = 018Ah
-LB_GETCOUNT = 018Bh
-LB_SELECTSTRING = 018Ch
-LB_DIR = 018Dh
-LB_GETTOPINDEX = 018Eh
-LB_FINDSTRING = 018Fh
-LB_GETSELCOUNT = 0190h
-LB_GETSELITEMS = 0191h
-LB_SETTABSTOPS = 0192h
-LB_GETHORIZONTALEXTENT = 0193h
-LB_SETHORIZONTALEXTENT = 0194h
-LB_SETCOLUMNWIDTH = 0195h
-LB_ADDFILE = 0196h
-LB_SETTOPINDEX = 0197h
-LB_GETITEMRECT = 0198h
-LB_GETITEMDATA = 0199h
-LB_SETITEMDATA = 019Ah
-LB_SELITEMRANGE = 019Bh
-LB_SETANCHORINDEX = 019Ch
-LB_GETANCHORINDEX = 019Dh
-LB_SETCARETINDEX = 019Eh
-LB_GETCARETINDEX = 019Fh
-LB_SETITEMHEIGHT = 01A0h
-LB_GETITEMHEIGHT = 01A1h
-LB_FINDSTRINGEXACT = 01A2h
-LB_SETLOCALE = 01A5h
-LB_GETLOCALE = 01A6h
-LB_SETCOUNT = 01A7h
-LB_INITSTORAGE = 01A8h
-LB_ITEMFROMPOINT = 01A9h
-
-; List box notifications
-
-LBN_ERRSPACE = -2
-LBN_SELCHANGE = 1
-LBN_DBLCLK = 2
-LBN_SELCANCEL = 3
-LBN_SETFOCUS = 4
-LBN_KILLFOCUS = 5
-
-; List box styles
-
-LBS_NOTIFY = 0001h
-LBS_SORT = 0002h
-LBS_NOREDRAW = 0004h
-LBS_MULTIPLESEL = 0008h
-LBS_OWNERDRAWFIXED = 0010h
-LBS_OWNERDRAWVARIABLE = 0020h
-LBS_HASSTRINGS = 0040h
-LBS_USETABSTOPS = 0080h
-LBS_NOINTEGRALHEIGHT = 0100h
-LBS_MULTICOLUMN = 0200h
-LBS_WANTKEYBOARDINPUT = 0400h
-LBS_EXTENDEDSEL = 0800h
-LBS_DISABLENOSCROLL = 1000h
-LBS_NODATA = 2000h
-LBS_NOSEL = 4000h
-LBS_STANDARD = LBS_NOTIFY or LBS_SORT or WS_VSCROLL or WS_BORDER
-
-; List box return values
-
-LB_OKAY = 0
-LB_ERR = -1
-LB_ERRSPACE = -2
-
-; Combo box messages
-
-CB_GETEDITSEL = 0140h
-CB_LIMITTEXT = 0141h
-CB_SETEDITSEL = 0142h
-CB_ADDSTRING = 0143h
-CB_DELETESTRING = 0144h
-CB_DIR = 0145h
-CB_GETCOUNT = 0146h
-CB_GETCURSEL = 0147h
-CB_GETLBTEXT = 0148h
-CB_GETLBTEXTLEN = 0149h
-CB_INSERTSTRING = 014Ah
-CB_RESETCONTENT = 014Bh
-CB_FINDSTRING = 014Ch
-CB_SELECTSTRING = 014Dh
-CB_SETCURSEL = 014Eh
-CB_SHOWDROPDOWN = 014Fh
-CB_GETITEMDATA = 0150h
-CB_SETITEMDATA = 0151h
-CB_GETDROPPEDCONTROLRECT = 0152h
-CB_SETITEMHEIGHT = 0153h
-CB_GETITEMHEIGHT = 0154h
-CB_SETEXTENDEDUI = 0155h
-CB_GETEXTENDEDUI = 0156h
-CB_GETDROPPEDSTATE = 0157h
-CB_FINDSTRINGEXACT = 0158h
-CB_SETLOCALE = 0159h
-CB_GETLOCALE = 015Ah
-CB_GETTOPINDEX = 015Bh
-CB_SETTOPINDEX = 015Ch
-CB_GETHORIZONTALEXTENT = 015Dh
-CB_SETHORIZONTALEXTENT = 015Eh
-CB_GETDROPPEDWIDTH = 015Fh
-CB_SETDROPPEDWIDTH = 0160h
-CB_INITSTORAGE = 0161h
-
-; Combo box notifications
-
-CBN_ERRSPACE = -1
-CBN_SELCHANGE = 1
-CBN_DBLCLK = 2
-CBN_SETFOCUS = 3
-CBN_KILLFOCUS = 4
-CBN_EDITCHANGE = 5
-CBN_EDITUPDATE = 6
-CBN_DROPDOWN = 7
-CBN_CLOSEUP = 8
-CBN_SELENDOK = 9
-CBN_SELENDCANCEL = 10
-
-; Combo box styles
-
-CBS_SIMPLE = 0001h
-CBS_DROPDOWN = 0002h
-CBS_DROPDOWNLIST = 0003h
-CBS_OWNERDRAWFIXED = 0010h
-CBS_OWNERDRAWVARIABLE = 0020h
-CBS_AUTOHSCROLL = 0040h
-CBS_OEMCONVERT = 0080h
-CBS_SORT = 0100h
-CBS_HASSTRINGS = 0200h
-CBS_NOINTEGRALHEIGHT = 0400h
-CBS_DISABLENOSCROLL = 0800h
-CBS_UPPERCASE = 2000h
-CBS_LOWERCASE = 4000h
-
-; Combo box return values
-
-CB_OKAY = 0
-CB_ERR = -1
-CB_ERRSPACE = -2
-
-; CB_DIR message flags
-
-DDL_READWRITE = 0h
-DDL_READONLY = 1h
-DDL_HIDDEN = 2h
-DDL_SYSTEM = 4h
-DDL_DIRECTORY = 10h
-DDL_ARCHIVE = 20h
-DDL_POSTMSGS = 2000h
-DDL_DRIVES = 4000h
-DDL_EXCLUSIVE = 8000h
-
-
-; Edit control messages
-
-EM_GETSEL = 00B0h
-EM_SETSEL = 00B1h
-EM_GETRECT = 00B2h
-EM_SETRECT = 00B3h
-EM_SETRECTNP = 00B4h
-EM_SCROLL = 00B5h
-EM_LINESCROLL = 00B6h
-EM_SCROLLCARET = 00B7h
-EM_GETMODIFY = 00B8h
-EM_SETMODIFY = 00B9h
-EM_GETLINECOUNT = 00BAh
-EM_LINEINDEX = 00BBh
-EM_SETHANDLE = 00BCh
-EM_GETHANDLE = 00BDh
-EM_GETTHUMB = 00BEh
-EM_LINELENGTH = 00C1h
-EM_REPLACESEL = 00C2h
-EM_GETLINE = 00C4h
-EM_LIMITTEXT = 00C5h
-EM_CANUNDO = 00C6h
-EM_UNDO = 00C7h
-EM_FMTLINES = 00C8h
-EM_LINEFROMCHAR = 00C9h
-EM_SETTABSTOPS = 00CBh
-EM_SETPASSWORDCHAR = 00CCh
-EM_EMPTYUNDOBUFFER = 00CDh
-EM_GETFIRSTVISIBLELINE = 00CEh
-EM_SETREADONLY = 00CFh
-EM_SETWORDBREAKPROC = 00D0h
-EM_GETWORDBREAKPROC = 00D1h
-EM_GETPASSWORDCHAR = 00D2h
-EM_SETMARGINS = 00D3h
-EM_GETMARGINS = 00D4h
-EM_SETLIMITTEXT = EM_LIMITTEXT
-EM_GETLIMITTEXT = 00D5h
-EM_POSFROMCHAR = 00D6h
-EM_CHARFROMPOS = 00D7h
-
-; Edit control EM_SETMARGIN parameters
-
-EC_LEFTMARGIN = 1
-EC_RIGHTMARGIN = 2
-EC_USEFONTINFO = 0FFFFh
-
-; Edit control notifications
-
-EN_SETFOCUS = 0100h
-EN_KILLFOCUS = 0200h
-EN_CHANGE = 0300h
-EN_UPDATE = 0400h
-EN_ERRSPACE = 0500h
-EN_MAXTEXT = 0501h
-EN_HSCROLL = 0601h
-EN_VSCROLL = 0602h
-
-; Edit control styles
-
-ES_LEFT = 0000h
-ES_CENTER = 0001h
-ES_RIGHT = 0002h
-ES_MULTILINE = 0004h
-ES_UPPERCASE = 0008h
-ES_LOWERCASE = 0010h
-ES_PASSWORD = 0020h
-ES_AUTOVSCROLL = 0040h
-ES_AUTOHSCROLL = 0080h
-ES_NOHIDESEL = 0100h
-ES_OEMCONVERT = 0400h
-ES_READONLY = 0800h
-ES_WANTRETURN = 1000h
-ES_NUMBER = 2000h
-
-; Static window messages
-
-STM_SETICON = 0170h
-STM_GETICON = 0171h
-STM_SETIMAGE = 0172h
-STM_GETIMAGE = 0173h
-
-; Static window notifications
-
-STN_CLICKED = 0
-STN_DBLCLK = 1
-STN_ENABLE = 2
-STN_DISABLE = 3
-
-; Static window styles
-
-SS_LEFT = 0000h
-SS_CENTER = 0001h
-SS_RIGHT = 0002h
-SS_ICON = 0003h
-SS_BLACKRECT = 0004h
-SS_GRAYRECT = 0005h
-SS_WHITERECT = 0006h
-SS_BLACKFRAME = 0007h
-SS_GRAYFRAME = 0008h
-SS_WHITEFRAME = 0009h
-SS_USERITEM = 000Ah
-SS_SIMPLE = 000Bh
-SS_LEFTNOWORDWRAP = 000Ch
-SS_BITMAP = 000Eh
-SS_OWNERDRAW = 000Dh
-SS_ENHMETAFILE = 000Fh
-SS_ETCHEDHORZ = 0010h
-SS_ETCHEDVERT = 0011h
-SS_ETCHEDFRAME = 0012h
-SS_TYPEMASK = 001Fh
-SS_NOPREFIX = 0080h
-SS_NOTIFY = 0100h
-SS_CENTERIMAGE = 0200h
-SS_RIGHTJUST = 0400h
-SS_REALSIZEIMAGE = 0800h
-SS_SUNKEN = 1000h
-
-; Scroll bar constants
-
-SB_HORZ = 0
-SB_VERT = 1
-SB_CTL = 2
-SB_BOTH = 3
-
-; Scroll bar messages
-
-SBM_SETPOS = 00E0h
-SBM_GETPOS = 00E1h
-SBM_SETRANGE = 00E2h
-SBM_SETRANGEREDRAW = 00E6h
-SBM_GETRANGE = 00E3h
-SBM_ENABLE_ARROWS = 00E4h
-SBM_SETSCROLLINFO = 00E9h
-SBM_GETSCROLLINFO = 00EAh
-
-; Scroll bar commands
-
-SB_LINEUP = 0
-SB_LINELEFT = 0
-SB_LINEDOWN = 1
-SB_LINERIGHT = 1
-SB_PAGEUP = 2
-SB_PAGELEFT = 2
-SB_PAGEDOWN = 3
-SB_PAGERIGHT = 3
-SB_THUMBPOSITION = 4
-SB_THUMBTRACK = 5
-SB_TOP = 6
-SB_LEFT = 6
-SB_BOTTOM = 7
-SB_RIGHT = 7
-SB_ENDSCROLL = 8
-
-; Scroll bar styles
-
-SBS_HORZ = 0000h
-SBS_VERT = 0001h
-SBS_TOPALIGN = 0002h
-SBS_LEFTALIGN = 0002h
-SBS_BOTTOMALIGN = 0004h
-SBS_RIGHTALIGN = 0004h
-SBS_SIZEBOXTOPLEFTALIGN = 0002h
-SBS_SIZEBOXBOTTOMRIGHTALIGN = 0004h
-SBS_SIZEBOX = 0008h
-SBS_SIZEGRIP = 0010h
-
-; Scroll bar info flags
-
-SIF_RANGE = 0001h
-SIF_PAGE = 0002h
-SIF_POS = 0004h
-SIF_DISABLENOSCROLL = 0008h
-SIF_TRACKPOS = 0010h
-SIF_ALL = SIF_RANGE or SIF_PAGE or SIF_POS or SIF_TRACKPOS
-
-; Dialog styles
-
-DS_ABSALIGN = 0001h
-DS_SYSMODAL = 0002h
-DS_3DLOOK = 0004h
-DS_FIXEDSYS = 0008h
-DS_NOFAILCREATE = 0010h
-DS_LOCALEDIT = 0020h
-DS_SETFONT = 0040h
-DS_MODALFRAME = 0080h
-DS_NOIDLEMSG = 0100h
-DS_SETFOREGROUND = 0200h
-DS_CONTROL = 0400h
-DS_CENTER = 0800h
-DS_CENTERMOUSE = 1000h
-DS_CONTEXTHELP = 2000h
-
-; Dialog codes
-
-DLGC_WANTARROWS = 0001h
-DLGC_WANTTAB = 0002h
-DLGC_WANTALLKEYS = 0004h
-DLGC_WANTMESSAGE = 0004h
-DLGC_HASSETSEL = 0008h
-DLGC_DEFPUSHBUTTON = 0010h
-DLGC_UNDEFPUSHBUTTON = 0020h
-DLGC_RADIOBUTTON = 0040h
-DLGC_WANTCHARS = 0080h
-DLGC_STATIC = 0100h
-DLGC_BUTTON = 2000h
-
-; Menu flags
-
-MF_INSERT = 0000h
-MF_CHANGE = 0080h
-MF_APPEND = 0100h
-MF_DELETE = 0200h
-MF_REMOVE = 1000h
-MF_BYCOMMAND = 0000h
-MF_BYPOSITION = 0400h
-MF_SEPARATOR = 0800h
-MF_UNCHECKED = 0000h
-MF_ENABLED = 0000h
-MF_GRAYED = 0001h
-MF_DISABLED = 0002h
-MF_CHECKED = 0008h
-MF_USECHECKBITMAPS = 0200h
-MF_STRING = 0000h
-MF_BITMAP = 0004h
-MF_OWNERDRAW = 0100h
-MF_POPUP = 0010h
-MF_MENUBARBREAK = 0020h
-MF_MENUBREAK = 0040h
-MF_UNHILITE = 0000h
-MF_HILITE = 0080h
-MF_DEFAULT = 1000h
-MF_SYSMENU = 2000h
-MF_HELP = 4000h
-MF_RIGHTJUSTIFY = 4000h
-MF_MOUSESELECT = 8000h
-MF_END = 0080h
-MFT_STRING = MF_STRING
-MFT_BITMAP = MF_BITMAP
-MFT_MENUBARBREAK = MF_MENUBARBREAK
-MFT_MENUBREAK = MF_MENUBREAK
-MFT_OWNERDRAW = MF_OWNERDRAW
-MFT_RADIOCHECK = 0200h
-MFT_SEPARATOR = MF_SEPARATOR
-MFT_RIGHTORDER = 2000h
-MFT_RIGHTJUSTIFY = MF_RIGHTJUSTIFY
-MFS_GRAYED = 0003h
-MFS_DISABLED = MFS_GRAYED
-MFS_CHECKED = MF_CHECKED
-MFS_HILITE = MF_HILITE
-MFS_ENABLED = MF_ENABLED
-MFS_UNCHECKED = MF_UNCHECKED
-MFS_UNHILITE = MF_UNHILITE
-MFS_DEFAULT = MF_DEFAULT
-MFR_POPUP = 0001h
-MFR_END = MF_END
-
-; System menu command values
-
-SC_SIZE = 61440
-SC_MOVE = 61456
-SC_MINIMIZE = 61472
-SC_MAXIMIZE = 61488
-SC_NEXTWINDOW = 61504
-SC_PREVWINDOW = 61520
-SC_CLOSE = 61536
-SC_VSCROLL = 61552
-SC_HSCROLL = 61568
-SC_MOUSEMENU = 61584
-SC_KEYMENU = 61696
-SC_ARRANGE = 61712
-SC_RESTORE = 61728
-SC_TASKLIST = 61744
-SC_SCREENSAVE = 61760
-SC_HOTKEY = 61776
-SC_DEFAULT = 61792
-SC_MONITORPOWER = 61808
-SC_CONTEXTHELP = 61824
-SC_SEPARATOR = 61455
-
-; Border types
-
-BDR_RAISEDOUTER = 01h
-BDR_SUNKENOUTER = 02h
-BDR_RAISEDINNER = 04h
-BDR_SUNKENINNER = 08h
-BDR_OUTER = 03h
-BDR_INNER = 0Ch
-BDR_RAISED = 05h
-BDR_SUNKEN = 0Ah
-EDGE_RAISED = BDR_RAISEDOUTER or BDR_RAISEDINNER
-EDGE_SUNKEN = BDR_SUNKENOUTER or BDR_SUNKENINNER
-EDGE_ETCHED = BDR_SUNKENOUTER or BDR_RAISEDINNER
-EDGE_BUMP = BDR_RAISEDOUTER or BDR_SUNKENINNER
-
-; Border flags
-
-BF_LEFT = 0001h
-BF_TOP = 0002h
-BF_RIGHT = 0004h
-BF_BOTTOM = 0008h
-BF_TOPLEFT = BF_TOP or BF_LEFT
-BF_TOPRIGHT = BF_TOP or BF_RIGHT
-BF_BOTTOMLEFT = BF_BOTTOM or BF_LEFT
-BF_BOTTOMRIGHT = BF_BOTTOM or BF_RIGHT
-BF_RECT = BF_LEFT or BF_TOP or BF_RIGHT or BF_BOTTOM
-BF_DIAGONAL = 0010h
-BF_DIAGONAL_ENDTOPRIGHT = BF_DIAGONAL or BF_TOP or BF_RIGHT
-BF_DIAGONAL_ENDTOPLEFT = BF_DIAGONAL or BF_TOP or BF_LEFT
-BF_DIAGONAL_ENDBOTTOMLEFT = BF_DIAGONAL or BF_BOTTOM or BF_LEFT
-BF_DIAGONAL_ENDBOTTOMRIGHT = BF_DIAGONAL or BF_BOTTOM or BF_RIGHT
-BF_MIDDLE = 0800h
-BF_SOFT = 1000h
-BF_ADJUST = 2000h
-BF_FLAT = 4000h
-BF_MONO = 8000h
-
-; Frame control types
-
-DFC_CAPTION = 1
-DFC_MENU = 2
-DFC_SCROLL = 3
-DFC_BUTTON = 4
-DFC_POPUPMENU = 5
-
-; Frame control states
-
-DFCS_CAPTIONCLOSE = 0000h
-DFCS_CAPTIONMIN = 0001h
-DFCS_CAPTIONMAX = 0002h
-DFCS_CAPTIONRESTORE = 0003h
-DFCS_CAPTIONHELP = 0004h
-DFCS_MENUARROW = 0000h
-DFCS_MENUCHECK = 0001h
-DFCS_MENUBULLET = 0002h
-DFCS_MENUARROWRIGHT = 0004h
-DFCS_SCROLLUP = 0000h
-DFCS_SCROLLDOWN = 0001h
-DFCS_SCROLLLEFT = 0002h
-DFCS_SCROLLRIGHT = 0003h
-DFCS_SCROLLCOMBOBOX = 0005h
-DFCS_SCROLLSIZEGRIP = 0008h
-DFCS_SCROLLSIZEGRIPRIGHT = 0010h
-DFCS_BUTTONCHECK = 0000h
-DFCS_BUTTONRADIOIMAGE = 0001h
-DFCS_BUTTONRADIOMASK = 0002h
-DFCS_BUTTONRADIO = 0004h
-DFCS_BUTTON3STATE = 0008h
-DFCS_BUTTONPUSH = 0010h
-DFCS_INACTIVE = 0100h
-DFCS_PUSHED = 0200h
-DFCS_CHECKED = 0400h
-DFCS_TRANSPARENT = 0800h
-DFCS_HOT = 1000h
-DFCS_ADJUSTRECT = 2000h
-DFCS_FLAT = 4000h
-DFCS_MONO = 8000h
-
-; DrawCaption flags
-
-DC_ACTIVE = 01h
-DC_SMALLCAP = 02h
-DC_ICON = 04h
-DC_TEXT = 08h
-DC_INBUTTON = 10h
-
-; DrawIconEx options
-
-DI_MASK = 1
-DI_IMAGE = 2
-DI_NORMAL = 3
-DI_COMPAT = 4
-DI_DEFAULTSIZE = 8
-
-; DrawText parameters
-
-DT_TOP = 00000h
-DT_LEFT = 00000h
-DT_CENTER = 00001h
-DT_RIGHT = 00002h
-DT_VCENTER = 00004h
-DT_BOTTOM = 00008h
-DT_WORDBREAK = 00010h
-DT_SINGLELINE = 00020h
-DT_EXPANDTABS = 00040h
-DT_TABSTOP = 00080h
-DT_NOCLIP = 00100h
-DT_EXTERNALLEADING = 00200h
-DT_CALCRECT = 00400h
-DT_NOPREFIX = 00800h
-DT_INTERNAL = 01000h
-DT_EDITCONTROL = 02000h
-DT_PATH_ELLIPSIS = 04000h
-DT_END_ELLIPSIS = 08000h
-DT_MODIFYSTRING = 10000h
-DT_RTLREADING = 20000h
-DT_WORD_ELLIPSIS = 40000h
-
-; GetDCEx flags
-
-DCX_WINDOW = 000001h
-DCX_CACHE = 000002h
-DCX_NORESETATTRS = 000004h
-DCX_CLIPCHILDREN = 000008h
-DCX_CLIPSIBLINGS = 000010h
-DCX_PARENTCLIP = 000020h
-DCX_EXCLUDERGN = 000040h
-DCX_INTERSECTRGN = 000080h
-DCX_EXCLUDEUPDATE = 000100h
-DCX_INTERSECTUPDATE = 000200h
-DCX_LOCKWINDOWUPDATE = 000400h
-DCX_VALIDATE = 200000h
-
-; SetWindowsHook codes
-
-WH_MSGFILTER = -1
-WH_JOURNALRECORD = 0
-WH_JOURNALPLAYBACK = 1
-WH_KEYBOARD = 2
-WH_GETMESSAGE = 3
-WH_CALLWNDPROC = 4
-WH_CBT = 5
-WH_SYSMSGFILTER = 6
-WH_MOUSE = 7
-WH_HARDWARE = 8
-WH_DEBUG = 9
-WH_SHELL = 10
-WH_FOREGROUNDIDLE = 11
-WH_CALLWNDPROCRET = 12
-WH_KEYBOARD_LL = 13
-WH_MOUSE_LL = 14
-
-; Hook codes
-
-HC_ACTION = 0
-HC_GETNEXT = 1
-HC_SKIP = 2
-HC_NOREMOVE = 3
-HC_SYSMODALON = 4
-HC_SYSMODALOFF = 5
-
-; CBT hook codes
-
-HCBT_MOVESIZE = 0
-HCBT_MINMAX = 1
-HCBT_QS = 2
-HCBT_CREATEWND = 3
-HCBT_DESTROYWND = 4
-HCBT_ACTIVATE = 5
-HCBT_CLICKSKIPPED = 6
-HCBT_KEYSKIPPED = 7
-HCBT_SYSCOMMAND = 8
-HCBT_SETFOCUS = 9
-
-; ExitWindowsEx flags
-
-EWX_LOGOFF = 0
-EWX_SHUTDOWN = 1
-EWX_REBOOT = 2
-EWX_FORCE = 4
-EWX_POWEROFF = 8
-
-; WinHelp commands
-
-HELP_CONTEXT = 001h
-HELP_QUIT = 002h
-HELP_INDEX = 003h
-HELP_CONTENTS = 003h
-HELP_HELPONHELP = 004h
-HELP_SETINDEX = 005h
-HELP_SETCONTENTS = 005h
-HELP_CONTEXTPOPUP = 008h
-HELP_FORCEFILE = 009h
-HELP_CONTEXTMENU = 00Ah
-HELP_FINDER = 00Bh
-HELP_WM_HELP = 00Ch
-HELP_SETPOPUP_POS = 00Dh
-HELP_KEY = 101h
-HELP_COMMAND = 102h
-HELP_PARTIALKEY = 105h
-HELP_MULTIKEY = 201h
-HELP_SETWINPOS = 203h
-
-; keybd_event flags
-
-KEYEVENTF_EXTENDEDKEY = 1h
-KEYEVENTF_KEYUP = 2h
-
-; mouse_event flags
-
-MOUSEEVENTF_MOVE = 0001h
-MOUSEEVENTF_LEFTDOWN = 0002h
-MOUSEEVENTF_LEFTUP = 0004h
-MOUSEEVENTF_RIGHTDOWN = 0008h
-MOUSEEVENTF_RIGHTUP = 0010h
-MOUSEEVENTF_MIDDLEDOWN = 0020h
-MOUSEEVENTF_MIDDLEUP = 0040h
-MOUSEEVENTF_WHEEL = 0800h
-MOUSEEVENTF_ABSOLUTE = 8000h
-
-; TrackPopupMenu flags
-
-TPM_LEFTBUTTON = 0000h
-TPM_RIGHTBUTTON = 0002h
-TPM_LEFTALIGN = 0000h
-TPM_CENTERALIGN = 0004h
-TPM_RIGHTALIGN = 0008h
-TPM_TOPALIGN = 0000h
-TPM_VCENTERALIGN = 0010h
-TPM_BOTTOMALIGN = 0020h
-TPM_HORIZONTAL = 0000h
-TPM_VERTICAL = 0040h
-TPM_NONOTIFY = 0080h
-TPM_RETURNCMD = 0100h
-TPM_RECURSE = 0001h
-TPM_HORPOSANIMATION = 0400h
-TPM_HORNEGANIMATION = 0800h
-TPM_VERPOSANIMATION = 1000h
-TPM_VERNEGANIMATION = 2000h
-TPM_NOANIMATION = 4000h
-TPM_LAYOUTRTL = 8000h
-
-; Menu item info mask values
-
-MIIM_STATE = 001h
-MIIM_ID = 002h
-MIIM_SUBMENU = 004h
-MIIM_CHECKMARKS = 008h
-MIIM_TYPE = 010h
-MIIM_DATA = 020h
-MIIM_STRING = 040h
-MIIM_BITMAP = 080h
-MIIM_FTYPE = 100h
-
-; DRAWITEMSTRUCT control types
-
-ODT_MENU = 1
-ODT_LISTBOX = 2
-ODT_COMBOBOX = 3
-ODT_BUTTON = 4
-ODT_STATIC = 5
-
-; DRAWITEMSTRUCT actions
-
-ODA_DRAWENTIRE = 1
-ODA_SELECT = 2
-ODA_FOCUS = 4
-
-; DRAWITEMSTRUCT states
-
-ODS_SELECTED = 0001h
-ODS_GRAYED = 0002h
-ODS_DISABLED = 0004h
-ODS_CHECKED = 0008h
-ODS_FOCUS = 0010h
-ODS_DEFAULT = 0020h
-ODS_COMBOBOXEDIT = 1000h
-ODS_HOTLIGHT = 0040h
-ODS_INACTIVE = 0080h
-
-; Layered window attributes
-
-LWA_COLORKEY = 1
-LWA_ALPHA = 2
-
-; UpdateLayeredWindow flags
-
-ULW_COLORKEY = 1
-ULW_ALPHA = 2
-ULW_OPAQUE = 4
-
-DLGWINDOWEXTRA = 30
-
-; SystemParametersInfo
-
-SPI_GETACCESSTIMEOUT = 60
-SPI_GETANIMATION = 72
-SPI_GETBEEP = 1
-SPI_GETBORDER = 5
-SPI_GETDEFAULTINPUTLANG = 89
-SPI_GETDRAGFULLWINDOWS = 38
-SPI_GETFASTTASKSWITCH = 35
-SPI_GETFILTERKEYS = 50
-SPI_GETFONTSMOOTHING = 74
-SPI_GETGRIDGRANULARITY = 18
-SPI_GETHIGHCONTRAST = 66
-SPI_GETICONMETRICS = 45
-SPI_GETICONTITLELOGFONT = 31
-SPI_GETICONTITLEWRAP = 25
-SPI_GETKEYBOARDDELAY = 22
-SPI_GETKEYBOARDPREF = 68
-SPI_GETKEYBOARDSPEED = 10
-SPI_GETLOWPOWERACTIVE = 83
-SPI_GETLOWPOWERTIMEOUT = 79
-SPI_GETMENUDROPALIGNMENT = 27
-SPI_GETMINIMIZEDMETRICS = 43
-SPI_GETMOUSE = 3
-SPI_GETMOUSEKEYS = 54
-SPI_GETMOUSETRAILS = 94
-SPI_GETNONCLIENTMETRICS = 41
-SPI_GETPOWEROFFACTIVE = 84
-SPI_GETPOWEROFFTIMEOUT = 80
-SPI_GETSCREENREADER = 70
-SPI_GETSCREENSAVEACTIVE = 16
-SPI_GETSCREENSAVETIMEOUT = 14
-SPI_GETSERIALKEYS = 62
-SPI_GETSHOWSOUNDS = 56
-SPI_GETSOUNDSENTRY = 64
-SPI_GETSTICKYKEYS = 58
-SPI_GETTOGGLEKEYS = 52
-SPI_GETWINDOWSEXTENSION = 92
-SPI_GETWORKAREA = 48
-SPI_ICONHORIZONTALSPACING = 13
-SPI_ICONVERTICALSPACING = 24
-SPI_LANGDRIVER = 12
-SPI_SCREENSAVERRUNNING = 97
-SPI_SETACCESSTIMEOUT = 61
-SPI_SETANIMATION = 73
-SPI_SETBEEP = 2
-SPI_SETBORDER = 6
-SPI_SETDEFAULTINPUTLANG = 90
-SPI_SETDESKPATTERN = 21
-SPI_SETDESKWALLPAPER = 20
-SPI_SETDOUBLECLICKTIME = 32
-SPI_SETDOUBLECLKHEIGHT = 30
-SPI_SETDOUBLECLKWIDTH = 29
-SPI_SETDRAGFULLWINDOWS = 37
-SPI_SETDRAGHEIGHT = 77
-SPI_SETDRAGWIDTH = 76
-SPI_SETFASTTASKSWITCH = 36
-SPI_SETFILTERKEYS = 51
-SPI_SETFONTSMOOTHING = 75
-SPI_SETGRIDGRANULARITY = 19
-SPI_SETHANDHELD = 78
-SPI_SETHIGHCONTRAST = 67
-SPI_SETICONMETRICS = 46
-SPI_SETICONTITLELOGFONT = 34
-SPI_SETICONTITLEWRAP = 26
-SPI_SETKEYBOARDDELAY = 23
-SPI_SETKEYBOARDPREF = 69
-SPI_SETKEYBOARDSPEED = 11
-SPI_SETLANGTOGGLE = 91
-SPI_SETLOWPOWERACTIVE = 85
-SPI_SETLOWPOWERTIMEOUT = 81
-SPI_SETMENUDROPALIGNMENT = 28
-SPI_SETMINIMIZEDMETRICS = 44
-SPI_SETMOUSE = 4
-SPI_SETMOUSEBUTTONSWAP = 33
-SPI_SETMOUSEKEYS = 55
-SPI_SETMOUSETRAILS = 93
-SPI_SETNONCLIENTMETRICS = 42
-SPI_SETPENWINDOWS = 49
-SPI_SETPOWEROFFACTIVE = 86
-SPI_SETPOWEROFFTIMEOUT = 82
-SPI_SETSCREENREADER = 71
-SPI_SETSCREENSAVEACTIVE = 17
-SPI_SETSCREENSAVERRUNNING = 97
-SPI_SETSCREENSAVETIMEOUT = 15
-SPI_SETSERIALKEYS = 63
-SPI_SETSHOWSOUNDS = 57
-SPI_SETSOUNDSENTRY = 65
-SPI_SETSTICKYKEYS = 59
-SPI_SETTOGGLEKEYS = 53
-SPI_SETWORKAREA = 47
-SPIF_UPDATEINIFILE = 1
-SPIF_SENDWININICHANGE = 2
-
-SPI_GETACTIVEWINDOWTRACKING = $1000
-SPI_SETACTIVEWINDOWTRACKING = $1001
-SPI_GETMENUANIMATION = $1002
-SPI_SETMENUANIMATION = $1003
-SPI_GETCOMBOBOXANIMATION = $1004
-SPI_SETCOMBOBOXANIMATION = $1005
-SPI_GETLISTBOXSMOOTHSCROLLING = $1006
-SPI_SETLISTBOXSMOOTHSCROLLING = $1007
-SPI_GETGRADIENTCAPTIONS = $1008
-SPI_SETGRADIENTCAPTIONS = $1009
-SPI_GETKEYBOARDCUES = $100A
-SPI_SETKEYBOARDCUES = $100B
-SPI_GETMENUUNDERLINES = SPI_GETKEYBOARDCUES
-SPI_SETMENUUNDERLINES = SPI_SETKEYBOARDCUES
-SPI_GETACTIVEWNDTRKZORDER = $100C
-SPI_SETACTIVEWNDTRKZORDER = $100D
-SPI_GETHOTTRACKING = $100E
-SPI_SETHOTTRACKING = $100F
-SPI_GETMENUFADE = $1012
-SPI_SETMENUFADE = $1013
-SPI_GETSELECTIONFADE = $1014
-SPI_SETSELECTIONFADE = $1015
-SPI_GETTOOLTIPANIMATION = $1016
-SPI_SETTOOLTIPANIMATION = $1017
-SPI_GETTOOLTIPFADE = $1018
-SPI_SETTOOLTIPFADE = $1019
-SPI_GETCURSORSHADOW = $101A
-SPI_SETCURSORSHADOW = $101B
-
-SPI_GETMOUSESONAR = $101C
-SPI_SETMOUSESONAR = $101D
-SPI_GETMOUSECLICKLOCK = $101E
-SPI_SETMOUSECLICKLOCK = $101F
-SPI_GETMOUSEVANISH = $1020
-SPI_SETMOUSEVANISH = $1021
-SPI_GETFLATMENU = $1022
-SPI_SETFLATMENU = $1023
-SPI_GETDROPSHADOW = $1024
-SPI_SETDROPSHADOW = $1025
-SPI_GETBLOCKSENDINPUTRESETS = $1026
-SPI_SETBLOCKSENDINPUTRESETS = $1027
-
-SPI_GETUIEFFECTS = $103E
-SPI_SETUIEFFECTS = $103F
-
-SPI_GETFOREGROUNDLOCKTIMEOUT = $2000
-SPI_SETFOREGROUNDLOCKTIMEOUT = $2001
-SPI_GETACTIVEWNDTRKTIMEOUT = $2002
-SPI_SETACTIVEWNDTRKTIMEOUT = $2003
-SPI_GETFOREGROUNDFLASHCOUNT = $2004
-SPI_SETFOREGROUNDFLASHCOUNT = $2005
-SPI_GETCARETWIDTH = $2006
-SPI_SETCARETWIDTH = $2007
-
-SPI_GETMOUSECLICKLOCKTIME = $2008
-SPI_SETMOUSECLICKLOCKTIME = $2009
-SPI_GETFONTSMOOTHINGTYPE = $200A
-SPI_SETFONTSMOOTHINGTYPE = $200B
-
-; constants for SPI_GETFONTSMOOTHINGTYPE and SPI_SETFONTSMOOTHINGTYPE:
-FE_FONTSMOOTHINGSTANDARD = $0001
-FE_FONTSMOOTHINGCLEARTYPE = $0002
-FE_FONTSMOOTHINGDOCKING = $8000
-
-SPI_GETFONTSMOOTHINGCONTRAST = $200C
-SPI_SETFONTSMOOTHINGCONTRAST = $200D
-
-SPI_GETFOCUSBORDERWIDTH = $200E
-SPI_SETFOCUSBORDERWIDTH = $200F
-SPI_GETFOCUSBORDERHEIGHT = $2010
-SPI_SETFOCUSBORDERHEIGHT = $2011
-
-SPI_GETFONTSMOOTHINGORIENTATION = $2012
-SPI_SETFONTSMOOTHINGORIENTATION = $2013
-
-; constants for SPI_GETFONTSMOOTHINGORIENTATION and SPI_SETFONTSMOOTHINGORIENTATION:
-FE_FONTSMOOTHINGORIENTATIONBGR = $0000
-FE_FONTSMOOTHINGORIENTATIONRGB = $0001
-
-;
-; Flags
-;
-SPIF_UPDATEINIFILE = $0001
-SPIF_SENDWININICHANGE = $0002
-SPIF_SENDCHANGE = SPIF_SENDWININICHANGE
-
-
-; LoadBitmap system images
-OBM_LFARROWI = 32734
-OBM_RGARROWI = 32735
-OBM_DNARROWI = 32736
-OBM_UPARROWI = 32737
-OBM_COMBO = 32738
-OBM_MNARROW = 32739
-OBM_LFARROWD = 32740
-OBM_RGARROWD = 32741
-OBM_DNARROWD = 32742
-OBM_UPARROWD = 32743
-OBM_RESTORED = 32744
-OBM_ZOOMD = 32745
-OBM_REDUCED = 32746
-OBM_RESTORE = 32747
-OBM_ZOOM = 32748
-OBM_REDUCE = 32749
-OBM_LFARROW = 32750
-OBM_RGARROW = 32751
-OBM_DNARROW = 32752
-OBM_UPARROW = 32753
-OBM_CLOSE = 32754
-
-OBM_OLD_RESTORE = 32755
-OBM_OLD_ZOOM = 32756
-OBM_OLD_REDUCE = 32757
-OBM_BTNCORNERS = 32758
-OBM_CHECKBOXES = 32759
-OBM_CHECK = 32760
-OBM_BTSIZE = 32761
-OBM_OLD_LFARROW = 32762
-OBM_OLD_RGARROW = 32763
-OBM_OLD_DNARROW = 32764
-OBM_OLD_UPARROW = 32765
-OBM_SIZE = 32766
-OBM_OLD_CLOSE = 32767
DELETED freshlib/equates/Win32/_WSOCK32.INC
Index: freshlib/equates/Win32/_WSOCK32.INC
==================================================================
--- freshlib/equates/Win32/_WSOCK32.INC
+++ /dev/null
@@ -1,170 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: WSOCK32.DLL structures and constants
-;
-; Target OS: Win32
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-
-struct WSADATA
- .wVersion dw ?
- .wHighVersion dw ?
- .szDescription rb 256+1
- .szSystemStatus rb 128+1
- .iMaxSockets dw ?
- .iMaxUdpDg dw ?
- .lpVendorInfo dd ?
-ends
-
-struct hostent
- .h_name dd ?
- .h_aliases dd ?
- .h_addrtype dw ?
- .h_length dw ?
- .h_addr_list dd ?
-ends
-
-struct sockaddr_in
- .sin_family dw ?
- .sin_port dw ?
- .sin_addr dd ?
- .sin_zero rb 8
-ends
-
-struct sockaddr
- .sa_family dw ?
- .sa_data rb 14
-ends
-
-; Socket error
-
-SOCKET_ERROR = -1
-INVALID_SOCKET = -1
-
-
-; Socket types
-
-SOCK_STREAM = 1
-SOCK_DGRAM = 2
-SOCK_RAW = 3
-SOCK_RDM = 4
-SOCK_SEQPACKET = 5
-
-; Address formats
-
-AF_UNSPEC = 0
-AF_UNIX = 1
-AF_INET = 2
-AF_IMPLINK = 3
-AF_PUP = 4
-AF_CHAOS = 5
-AF_NS = 6
-AF_IPX = 6
-AF_ISO = 7
-AF_OSI = AF_ISO
-AF_ECMA = 8
-AF_DATAKIT = 9
-AF_CCITT = 10
-AF_SNA = 11
-AF_DECnet = 12
-AF_DLI = 13
-AF_LAT = 14
-AF_HYLINK = 15
-AF_APPLETALK = 16
-AF_NETBIOS = 17
-
-; Protocol formats
-
-PF_UNSPEC = 0
-PF_UNIX = 1
-PF_INET = 2
-PF_IMPLINK = 3
-PF_PUP = 4
-PF_CHAOS = 5
-PF_NS = 6
-PF_IPX = 6
-PF_ISO = 7
-PF_OSI = PF_ISO
-PF_ECMA = 8
-PF_DATAKIT = 9
-PF_CCITT = 10
-PF_SNA = 11
-PF_DECnet = 12
-PF_DLI = 13
-PF_LAT = 14
-PF_HYLINK = 15
-PF_APPLETALK = 16
-PF_NETBIOS = 17
-
-; IP Ports
-
-IPPORT_ECHO = 7
-IPPORT_DISCARD = 9
-IPPORT_SYSTAT = 11
-IPPORT_DAYTIME = 13
-IPPORT_NETSTAT = 15
-IPPORT_FTP = 21
-IPPORT_TELNET = 23
-IPPORT_SMTP = 25
-IPPORT_TIMESERVER = 37
-IPPORT_NAMESERVER = 42
-IPPORT_WHOIS = 43
-IPPORT_MTP = 57
-IPPORT_TFTP = 69
-IPPORT_RJE = 77
-IPPORT_FINGER = 79
-IPPORT_TTYLINK = 87
-IPPORT_SUPDUP = 95
-IPPORT_EXECSERVER = 512
-IPPORT_LOGINSERVER = 513
-IPPORT_CMDSERVER = 514
-IPPORT_EFSSERVER = 520
-IPPORT_BIFFUDP = 512
-IPPORT_WHOSERVER = 513
-IPPORT_ROUTESERVER = 520
-IPPORT_RESERVED = 1024
-
-; Notifications
-
-FD_READ = 01h
-FD_WRITE = 02h
-FD_OOB = 04h
-FD_ACCEPT = 08h
-FD_CONNECT = 10h
-FD_CLOSE = 20h
-
-; commands for ioctlsocket
-
-FIONBIO = 8004667Eh
-FIONSYNC = 8004667Dh
-FIONREAD = 4004667Fh
-
-
-; flags
-
-MSG_OOB = 1
-MSG_PEEK = 2
-MSG_DONTROUTE = 4
-MSG_MAXIOVLEN = 16
-MSG_PARTIAL = 0x8000
-
-; options
-
-SOL_SOCKET = $FFFF
-
-SO_DEBUG = 1
-SO_ACCEPTCONN = 2
-SO_REUSEADDR = 4
-SO_KEEPALIVE = 8
-SO_DONTROUTE = 16
-SO_BROADCAST = 32
-SO_USELOOPBACK = 64
-SO_LINGER = 128
-SO_OOBINLINE = 256
DELETED freshlib/equates/Win32/_exceptions.inc
Index: freshlib/equates/Win32/_exceptions.inc
==================================================================
--- freshlib/equates/Win32/_exceptions.inc
+++ /dev/null
@@ -1,170 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Exception handling constants and structures.
-;
-; Target OS: Win32
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-
-EXCEPTION_MAXIMUM_PARAMETERS = 15
-
-DBG_CONTINUE = 00010002h
-DBG_TERMINATE_THREAD = 40010003h
-DBG_TERMINATE_PROCESS = 40010004h
-DBG_CONTROL_C = 40010005h
-DBG_CONTROL_BREAK = 40010008h
-DBG_EXCEPTION_NOT_HANDLED = 80010001h
-
-EXCEPTION_DEBUG_EVENT = 1
-CREATE_THREAD_DEBUG_EVENT = 2
-CREATE_PROCESS_DEBUG_EVENT = 3
-EXIT_THREAD_DEBUG_EVENT = 4
-EXIT_PROCESS_DEBUG_EVENT = 5
-LOAD_DLL_DEBUG_EVENT = 6
-UNLOAD_DLL_DEBUG_EVENT = 7
-OUTPUT_DEBUG_STRING_EVENT = 8
-RIP_EVENT = 9
-
-CONTEXT_i386 = 00010000h
-CONTEXT_i486 = 00010000h
-CONTEXT_CONTROL = CONTEXT_i386 OR 00000001h
-CONTEXT_INTEGER = CONTEXT_i386 OR 00000002h
-CONTEXT_SEGMENTS = CONTEXT_i386 OR 00000004h
-CONTEXT_FLOATING_POINT = CONTEXT_i386 OR 00000008h
-CONTEXT_DEBUG_REGISTERS = CONTEXT_i386 OR 00000010h
-CONTEXT_FULL = CONTEXT_CONTROL OR CONTEXT_INTEGER OR CONTEXT_SEGMENTS
-
-
-
-struct EXCEPTION_RECORD
- .ExceptionCode dd ?
- .ExceptionFlags dd ?
- .ptrExceptionRecord dd ?
- .ExceptionAddress dd ?
- .NumberParameters dd ?
- .ExceptionInformation rd EXCEPTION_MAXIMUM_PARAMETERS
-ends
-
-struct EXCEPTION_DEBUG_INFO
- .ExceptionRecord EXCEPTION_RECORD
- .dwFirstChance dd ?
-ends
-
-struct CREATE_THREAD_DEBUG_INFO
- .hThread dd ?
- .lpThreadLocalBase dd ?
- .lpStartAddress dd ?
-ends
-
-struct CREATE_PROCESS_DEBUG_INFO
- .hFile dd ?
- .hProcess dd ?
- .hThread dd ?
- .lpBaseOfImage dd ?
- .dwDebugInfoFileOffset dd ?
- .nDebugInfoSize dd ?
- .lpThreadLocalBase dd ?
- .lpStartAddress dd ?
- .lpImageName dd ?
- .fUnicode dw ?
-ends
-
-
-struct EXIT_THREAD_DEBUG_INFO
- .dwExitCode dd ?
-ends
-
-struct EXIT_PROCESS_DEBUG_INFO
- .dwExitCode dd ?
-ends
-
-
-struct LOAD_DLL_DEBUG_INFO
- .hFile dd ?
- .lpBaseOfDll dd ?
- .dwDebugInfoFileOffset dd ?
- .nDebugInfoSize dd ?
- .lpImageName dd ?
- .fUnicode dw ?
-ends
-
-
-struct UNLOAD_DLL_DEBUG_INFO
- .lpBaseOfDll dd ?
-ends
-
-
-struct OUTPUT_DEBUG_STRING_INFO
- .lpDebugStringData dd ?
- .fUnicode dw ?
- .nDebugStringiLength dw ?
-ends
-
-
-struct RIP_INFO
- .dwError dd ?
- .dwType dd ?
-ends
-
-
-SIZE_OF_80387_REGISTERS = 80
-MAXIMUM_SUPPORTED_EXTENSION = 512
-
-struct FLOATING_SAVE_AREA
- .ControlWord dd ?
- .StatusWord dd ?
- .TagWord dd ?
- .ErrorOffset dd ?
- .ErrorSelector dd ?
- .DataOffset dd ?
- .DataSelector dd ?
- .RegisterArea rb SIZE_OF_80387_REGISTERS
- .Cr0NpxState dd ?
-ends
-
-struct CONTEXT
- .ContextFlags dd ?
- .iDr0 dd ?
- .iDr1 dd ?
- .iDr2 dd ?
- .iDr3 dd ?
- .iDr6 dd ?
- .iDr7 dd ?
- .FloatSave FLOATING_SAVE_AREA
- .regGs dd ?
- .regFs dd ?
- .regEs dd ?
- .regDs dd ?
- .regEdi dd ?
- .regEsi dd ?
- .regEbx dd ?
- .regEdx dd ?
- .regEcx dd ?
- .regEax dd ?
- .regEbp dd ?
- .regEip dd ?
- .regCs dd ?
- .regFlag dd ?
- .regEsp dd ?
- .regSs dd ?
- .ExtendedRegisters rb MAXIMUM_SUPPORTED_EXTENSION
-ends
-
-
-struct SECURITY_ATTRIBUTES
- .nLength dd ?
- .lpSecurityDescriptor dd ?
- .bInheritHandle dd ?
-ends
-
-
-
-
-
DELETED freshlib/equates/Win32/allequates.inc
Index: freshlib/equates/Win32/allequates.inc
==================================================================
--- freshlib/equates/Win32/allequates.inc
+++ /dev/null
@@ -1,25 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Combined include of all Win32 equate files.
-;
-; Target OS: Win32
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-include '_kernel32.inc'
-include '_user32.inc'
-include '_gdi32.inc'
-include '_comctl32.inc'
-include '_comdlg32.inc'
-include '_shell32.inc'
-include '_wsock32.inc'
-include '_RichEdit32.inc'
-include '_ODBC32.inc'
-include '_HTMLHelp.inc'
-include '_exceptions.inc'
DELETED freshlib/equates/_sqlite3.inc
Index: freshlib/equates/_sqlite3.inc
==================================================================
--- freshlib/equates/_sqlite3.inc
+++ /dev/null
@@ -1,93 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: SQLite equates definitions.
-;
-; Target OS: Any
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-; SQLite result codes
-
-SQLITE_OK = 0 ; Successful result
-SQLITE_ERROR = 1 ; SQL error or missing database
-SQLITE_INTERNAL = 2 ; An internal logic error in SQLite
-SQLITE_PERM = 3 ; Access permission denied
-SQLITE_ABORT = 4 ; Callback routine requested an abort
-SQLITE_BUSY = 5 ; The database file is locked
-SQLITE_LOCKED = 6 ; A table in the database is locked
-SQLITE_NOMEM = 7 ; A malloc() failed
-SQLITE_READONLY = 8 ; Attempt to write a readonly database
-SQLITE_INTERRUPT = 9 ; Operation terminated by sqlite_interrupt()
-SQLITE_IOERR = 10 ; Some kind of disk I/O error occurred
-SQLITE_CORRUPT = 11 ; The database disk image is malformed
-SQLITE_NOTFOUND = 12 ; (Internal Only) Table or record not found
-SQLITE_FULL = 13 ; Insertion failed because database is full
-SQLITE_CANTOPEN = 14 ; Unable to open the database file
-SQLITE_PROTOCOL = 15 ; Database lock protocol error
-SQLITE_EMPTY = 16 ; (Internal Only) Database table is empty
-SQLITE_SCHEMA = 17 ; The database schema changed
-SQLITE_TOOBIG = 18 ; Too much data for one row of a table
-SQLITE_CONSTRAINT = 19 ; Abort due to constraint violation
-SQLITE_MISMATCH = 20 ; Data type mismatch
-SQLITE_MISUSE = 21 ; Library used incorrectly
-SQLITE_NOLFS = 22 ; Uses OS features not supported on host
-SQLITE_AUTH = 23 ; Authorization denied
-SQLITE_ROW = 100 ; sqlite_step() has another row ready
-SQLITE_DONE = 101 ; sqlite_step() has finished executing
-
-
-SQLITE_CREATE_INDEX = 1 ; // Index Name Table Name */
-SQLITE_CREATE_TABLE = 2 ; // Table Name NULL */
-SQLITE_CREATE_TEMP_INDEX = 3 ; // Index Name Table Name */
-SQLITE_CREATE_TEMP_TABLE = 4 ; // Table Name NULL */
-SQLITE_CREATE_TEMP_TRIGGER = 5 ; // Trigger Name Table Name */
-SQLITE_CREATE_TEMP_VIEW = 6 ; // View Name NULL */
-SQLITE_CREATE_TRIGGER = 7 ; // Trigger Name Table Name */
-SQLITE_CREATE_VIEW = 8 ; // View Name NULL */
-SQLITE_DELETE = 9 ; // Table Name NULL */
-SQLITE_DROP_INDEX = 10 ; // Index Name Table Name */
-SQLITE_DROP_TABLE = 11 ; // Table Name NULL */
-SQLITE_DROP_TEMP_INDEX = 12 ; // Index Name Table Name */
-SQLITE_DROP_TEMP_TABLE = 13 ; // Table Name NULL */
-SQLITE_DROP_TEMP_TRIGGER = 14 ; // Trigger Name Table Name */
-SQLITE_DROP_TEMP_VIEW = 15 ; // View Name NULL */
-SQLITE_DROP_TRIGGER = 16 ; // Trigger Name Table Name */
-SQLITE_DROP_VIEW = 17 ; // View Name NULL */
-SQLITE_INSERT = 18 ; // Table Name NULL */
-SQLITE_PRAGMA = 19 ; // Pragma Name 1st arg or NULL */
-SQLITE_READ = 20 ; // Table Name Column Name */
-SQLITE_SELECT = 21 ; // NULL NULL */
-SQLITE_TRANSACTION = 22 ; // NULL NULL */
-SQLITE_UPDATE = 23 ; // Table Name Column Name */
-SQLITE_ATTACH = 24 ; // Filename NULL */
-SQLITE_DETACH = 25 ; // Database Name NULL */
-
-SQLITE_DENY = 1 ; // Abort the SQL statement with an error */
-SQLITE_IGNORE = 2 ; // Don't allow access, but don't generate an error */
-
-
-; These are the allowed values for the eTextRep argument to
-; sqliteCreateCollation and sqliteCreateFunction.
-
-SQLITE_UTF8 = 1
-SQLITE_UTF16LE = 2
-SQLITE_UTF16BE = 3
-SQLITE_UTF16 = 4 ; Use native byte order
-SQLITE_ANY = 5
-
-; values returned by sqliteColumnType
-SQLITE_INTEGER = 1
-SQLITE_FLOAT = 2
-SQLITE_TEXT = 3
-SQLITE_BLOB = 4
-SQLITE_NULL = 5
-
-
-SQLITE_STATIC = 0
-SQLITE_TRANSIENT = -1
DELETED freshlib/equates/_zlib1.inc
Index: freshlib/equates/_zlib1.inc
==================================================================
--- freshlib/equates/_zlib1.inc
+++ /dev/null
@@ -1,131 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Constants and structures definitions for ZLIB library.
-;
-; Target OS: Any
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-; zlib.h -- interface of the 'zlib' general purpose compression library
-; version 1.2.3, July 18th, 2005
-;
-; Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler
-;
-; This software is provided 'as-is', without any express or implied
-; warranty. In no event will the authors be held liable for any damages
-; arising from the use of this software.
-;
-; Permission is granted to anyone to use this software for any purpose,
-; including commercial applications, and to alter it and redistribute it
-; freely, subject to the following restrictions:
-;
-; 1. The origin of this software must not be misrepresented; you must not
-; claim that you wrote the original software. If you use this software
-; in a product, an acknowledgment in the product documentation would be
-; appreciated but is not required.
-; 2. Altered source versions must be plainly marked as such, and must not be
-; misrepresented as being the original software.
-; 3. This notice may not be removed or altered from any source distribution.
-;
-; Jean-loup Gailly Mark Adler
-; jloup@gzip.org madler@alumni.caltech.edu
-;
-;
-; The data format used by the zlib library is described by RFCs (Request for
-; Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt
-; (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
-;
-
-
-; zconf.h -- configuration of the zlib compression library
-; Copyright (C) 1995-2005 Jean-loup Gailly.
-; For conditions of distribution and use, see copyright notice in zlib.h
-;
-
-MAX_MEM_LEVEL = 9
-MAX_WBITS = 15 ; 32K LZ77 window
-
-ZLIB_VERSION equ "1.2.3"
-ZLIB_VERNUM = $1230
-
-
-struct z_stream
-
- ptrNextIn dd ? ; next input byte
- AvailIn dd ? ; number of bytes available at next_in
- TotalIn dd ? ; total nb of input bytes read so far
-
- ptrNextOut dd ? ; next output byte should be put there
- AvailOut dd ? ; remaining free space at next_out
- TotalOut dd ? ; total nb of bytes output so far
-
- ptrMsg dd ? ; last error message, NULL if no error
-
- ptrState dd ? ; not visible by applications
-
- zalloc dd ? ; used to allocate the internal state
- zfree dd ? ; used to free the internal state
- opaque dd ? ; private data object passed to zalloc and zfree
-
- data_type dd ? ; best guess about the data type: binary or text
- adler dd ? ; adler32 value of the uncompressed data
- reserved dd ? ; reserved for future use
-ends
-
-
-; constants
-
-; Allowed flush values; see deflate() and inflate() below for details
-Z_NO_FLUSH = 0
-Z_PARTIAL_FLUSH = 1 ; will be removed, use Z_SYNC_FLUSH instead
-Z_SYNC_FLUSH = 2
-Z_FULL_FLUSH = 3
-Z_FINISH = 4
-Z_BLOCK = 5
-
-; Return codes for the compression/decompression functions. Negative
-; values are errors, positive values are used for special but normal events.
-
-Z_OK = 0
-Z_STREAM_END = 1
-Z_NEED_DICT = 2
-Z_ERRNO = -1
-Z_STREAM_ERROR = -2
-Z_DATA_ERROR = -3
-Z_MEM_ERROR = -4
-Z_BUF_ERROR = -5
-Z_VERSION_ERROR = -6
-
-; compression levels
-Z_NO_COMPRESSION = 0
-Z_BEST_SPEED = 1
-Z_BEST_COMPRESSION = 9
-Z_DEFAULT_COMPRESSION = -1
-
-; compression strategy; see deflateInit2() below for details */
-
-Z_FILTERED = 1
-Z_HUFFMAN_ONLY = 2
-Z_RLE = 3
-Z_FIXED = 4
-Z_DEFAULT_STRATEGY = 0
-
-
-; Possible values of the data_type field (though see inflate()) */
-
-Z_BINARY = 0
-Z_TEXT = 1
-Z_ASCII = Z_TEXT ; for compatibility with 1.2.2 and earlier
-Z_UNKNOWN = 2
-
-; The deflate compression method (the only one supported in this version)
-Z_DEFLATED = 8
-
-Z_NULL = 0 ; for initializing zalloc, zfree, opaque
-
DELETED freshlib/equates/allequates.inc
Index: freshlib/equates/allequates.inc
==================================================================
--- freshlib/equates/allequates.inc
+++ /dev/null
@@ -1,23 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Combined include of all equates.
-;
-; Target OS: Any
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-TRUE = 1
-FALSE = 0
-
-NULL = 0
-
-include '%TargetOS%/allequates.inc'
-
-include '_sqlite3.inc'
-include '_zlib1.inc'
DELETED freshlib/freshlib.asm
Index: freshlib/freshlib.asm
==================================================================
--- freshlib/freshlib.asm
+++ /dev/null
@@ -1,25 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: FreshLib amalgamation include file for the library code.
-;
-; Target OS: Any
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-include 'simpledebug/debug.asm'
-
-include 'system/all.asm'
-include 'data/all.asm'
-
-match =NEW, LIB_MODE {
- include 'graphics/all.asm'
- include 'gui/all.asm'
-
-; include 'FreshEdit/FreshEdit.asm'
-}
DELETED freshlib/freshlib.inc
Index: freshlib/freshlib.inc
==================================================================
--- freshlib/freshlib.inc
+++ /dev/null
@@ -1,19 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: FreshLib amalgamation include file for the non code definitions.
-;
-; Target OS: Any
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-LIB_MODE equ NEW
-
-include 'macros/allmacros.inc'
-include 'equates/allequates.inc'
-
DELETED freshlib/graphics/Linux/backbuffer.asm
Index: freshlib/graphics/Linux/backbuffer.asm
==================================================================
--- freshlib/graphics/Linux/backbuffer.asm
+++ /dev/null
@@ -1,78 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Provides raster bitmap, to be used for double buffer painting.
-;
-; Target OS: Linux
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-
-
-proc CreateBackBuffer, .hwin, .width, .height
-begin
- push ebx ecx edx
-
- stdcall GetMem, sizeof.TBackBuffer
- mov ebx, eax
-
- mov ecx, [.width]
- mov edx, [.height]
-
- xor eax, eax
- inc eax
-
- cmp ecx, eax
- jge @f
- mov ecx, eax
-@@:
- cmp edx, eax
- jge @f
- mov edx, eax
-@@:
- mov [ebx+TBackBuffer.width], ecx
- mov [ebx+TBackBuffer.height], edx
-
- cinvoke XCreatePixmap, [hApplicationDisplay], [.hwin], [ebx+TBackBuffer.width], [ebx+TBackBuffer.height], 24
- mov [ebx+TBackBuffer.raster], eax
- mov eax, ebx
- pop edx ecx ebx
- return
-endp
-
-
-
-
-proc DestroyBackBuffer, .pBackBuffer
-begin
- push eax ecx edx
- mov eax, [.pBackBuffer]
- push eax
- cinvoke XFreePixmap, [hApplicationDisplay], [eax+TBackBuffer.raster]
- stdcall FreeMem ; from the stack
- pop edx ecx eax
- return
-endp
-
-
-
-
-
-
-proc DrawBackBuffer, .context, .pBackBuffer, .x, .y
-begin
- push eax ecx edx
- mov eax, [.pBackBuffer]
- mov ecx, [.context]
-
- cinvoke XCopyArea, [hApplicationDisplay], [eax+TBackBuffer.raster], [ecx+TContext.raster], [ecx+TContext.handle], 0, 0, [eax+TBackBuffer.width], [eax+TBackBuffer.height], [.x], [.y]
-
- pop edx ecx eax
- return
-endp
-
DELETED freshlib/graphics/Linux/context.asm
Index: freshlib/graphics/Linux/context.asm
==================================================================
--- freshlib/graphics/Linux/context.asm
+++ /dev/null
@@ -1,190 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Context is a object that represents drawing surface in FreshLib
-;
-; Target OS: Linux
-;
-; Dependencies: memory.asm
-;
-; Notes:
-;_________________________________________________________________________________________
-
-uses libX11
-
-cmClear = GXclear
-cmAnd = GXand
-cmAndReverse = GXandReverse
-cmCopy = GXcopy
-cmAndInverted = GXandInverted
-cmNoOp = GXnoop
-cmXor = GXxor
-cmOr = GXor
-cmNor = GXnor
-cmEquiv = GXequiv
-cmInvert = GXinvert
-cmXorReverse = GXorReverse
-cmCopyInverted = GXcopyInverted
-cmOrInverted = GXorInverted
-cmNand = GXnand
-cmSet = GXset
-
-
-image_pointer_context = 2
-
-proc AllocateContext, .raster
-begin
- push ebx ecx edx
-
- stdcall GetMem, sizeof.TContext
- jc .error
- mov ebx, eax
-
- mov eax, [.raster]
- mov [ebx+TContext.raster], eax
-
- cinvoke XCreateGC, [hApplicationDisplay], [ebx+TContext.raster], 0, 0
- mov [ebx+TContext.handle], eax
- mov eax, ebx
-
-.exit:
- pop edx ecx ebx
- clc
- return
-
-.error:
- DebugMsg 'Error allocating context.'
- xor eax, eax
- pop edx ecx ebx
- stc
- return
-endp
-
-
-
-
-proc ReleaseContext, .context
-begin
- push eax ebx ecx edx
- mov ebx, [.context]
- cinvoke XFlush, [hApplicationDisplay]
- cinvoke XFreeGC, [hApplicationDisplay], [ebx+TContext.handle]
- cmp [ebx+TContext.clipregion], 0
- je @f
- cinvoke XDestroyRegion, [ebx+TContext.clipregion]
-@@:
- stdcall FreeMem, ebx
-
- clc
- pop edx ecx ebx eax
- return
-endp
-
-
-
-proc SetLineStyle, .context, .pLineStyle
-.color dd ?
-begin
- push eax ebx ecx edx esi
-
- mov ebx, [.context]
- mov esi, [.pLineStyle]
-
- mov eax, [esi+TLineStyle.flags]
- mov ecx, eax
- shr ecx, 8
- and eax, $ff ; cap_style
- and ecx, $ff ; join_style
-
- mov edx, LineSolid
- cmp [esi+TLineStyle.DashCount], 0
- je @f
- mov edx, LineDoubleDash
-@@:
- cinvoke XSetLineAttributes, [hApplicationDisplay], [ebx+TContext.handle], [esi+TLineStyle.width], edx, eax, ecx
- cinvoke XSetForeground, [hApplicationDisplay], [ebx+TContext.handle], [esi+TLineStyle.color]
-
- cmp [esi+TLineStyle.DashCount], 0
- je .exit
-
- lea ecx, [esi+TLineStyle.DashItems]
- cinvoke XSetDashes, [hApplicationDisplay], [ebx+TContext.handle], 0, ecx, [esi+TLineStyle.DashCount]
- cinvoke XSetBackground, [hApplicationDisplay], [ebx+TContext.handle], [esi+TLineStyle.clSpace]
-
-.exit:
- pop esi edx ecx ebx eax
- return
-endp
-
-
-proc SetDrawMode, .context, .mode
-begin
- push eax ecx edx
- mov eax, [.context]
- cinvoke XSetFunction, [hApplicationDisplay], [eax+TContext.handle], [.mode]
- pop edx ecx eax
- return
-endp
-
-
-
-
-
-proc SetClipRectangle, .context, .pBounds
-.rect XRectangle
-begin
- push eax ecx edx esi
-
- mov esi, [.context]
-
- cmp [esi+TContext.clipregion], 0
- je @f
- cinvoke XDestroyRegion, [esi+TContext.clipregion]
-@@:
- cinvoke XCreateRegion
- mov [esi+TContext.clipregion], eax
-
- mov edx, [.pBounds]
- test edx, edx
- jz .remove
-
- mov eax, [edx+TBounds.x]
- mov [.rect.x], ax
-
- mov eax, [edx+TBounds.y]
- mov [.rect.y], ax
-
- mov eax, [edx+TBounds.width]
- mov [.rect.width], ax
-
- mov eax, [edx+TBounds.height]
- mov [.rect.height], ax
-
- lea edx, [.rect]
- cinvoke XUnionRectWithRegion, edx, [esi+TContext.clipregion], [esi+TContext.clipregion]
- cinvoke XSetRegion, [hApplicationDisplay], [esi+TContext.handle], [esi+TContext.clipregion]
-
-.exit:
- pop esi edx ecx eax
- return
-
-.remove:
- cinvoke XSetClipMask, [hApplicationDisplay], [esi+TContext.handle], None
- jmp .exit
-endp
-
-
-
-
-proc IsDrawable, .raster
-begin
-
-; cinvoke XSetErrorHandler,
-
-
-
-
-
-endp
DELETED freshlib/graphics/Linux/draw.asm
Index: freshlib/graphics/Linux/draw.asm
==================================================================
--- freshlib/graphics/Linux/draw.asm
+++ /dev/null
@@ -1,72 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Draw library contains procedures for drawing oprtations.
-;
-; Target OS: Linux
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-lsEndCapRound = CapRound
-lsEndCapSquare = CapButt
-lsEndCapFlat = CapProjecting
-
-lsJoinRound = JoinRound shl 8
-lsJoinBevel = JoinBevel shl 8
-lsJoinMiter = JoinMiter shl 8
-
-
-
-proc DrawLine, .context, .x1, .y1, .x2, .y2
-begin
- push eax ebx ecx edx
-
- mov ebx, [.context]
- cinvoke XDrawLine, [hApplicationDisplay], [ebx+TContext.raster], [ebx+TContext.handle], [.x1], [.y1], [.x2], [.y2]
- pop edx ecx ebx eax
- return
-endp
-
-
-proc DrawFillRect, .context, .x, .y, .width, .height, .color
-begin
- push eax ebx ecx edx
- mov ebx, [.context]
- cinvoke XSetForeground, [hApplicationDisplay], [ebx+TContext.handle], [.color]
- cinvoke XFillRectangle, [hApplicationDisplay], [ebx+TContext.raster], [ebx+TContext.handle], [.x], [.y], [.width], [.height]
- pop edx ecx ebx eax
- return
-endp
-
-
-
-macro Outline [type, x, y] {
- common
-local ..types, ..points, ..count
- dd ..count
- dd ..types
- dd ..points
- common
- label ..types byte
- forward
- db type
- common
- label ..points dword
- forward
- dd x
- dd y
-}
-
-
-
-;proc Draw, .context, .pDrawPoints
-;begin
-;
-; return
-;endp
-
DELETED freshlib/graphics/Linux/fonts.asm
Index: freshlib/graphics/Linux/fonts.asm
==================================================================
--- freshlib/graphics/Linux/fonts.asm
+++ /dev/null
@@ -1,160 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Fonts managing library.
-;
-; Target OS: Linux
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-
-proc FontCreate, .fontname, .size, .weight, .flags
-begin
- push ebx ecx edx
- stdcall StrDup, [.fontname]
- mov ebx, eax
-
- test [.flags], ffMonospaced
- jz @f
- stdcall StrCat, ebx, FontAttr.mono
-@@:
- sub [.size], 2
- cmp [.size], 0
- jle @f
-
- stdcall StrCat, ebx, FontAttr.size
- stdcall NumToStr, [.size], ntsDec or ntsUnsigned
- push eax
- stdcall StrCat, ebx, eax
- stdcall StrDel ; from the stack
-@@:
- cmp [.weight], 0
- je @f
- shr [.weight], 2
- stdcall StrCat, ebx, FontAttr.weight
- stdcall NumToStr, [.weight], ntsDec or ntsUnsigned
- push eax
- stdcall StrCat, ebx, eax
- stdcall StrDel ; from the stack
-
-@@:
- test [.flags], ffItalic
- jz @f
- stdcall StrCat, ebx, FontAttr.italic
-@@:
-
- stdcall StrPtr, ebx
- cinvoke XftFontOpenName, [hApplicationDisplay], 0, eax
-
- stdcall StrDel, ebx
- pop edx ecx ebx
- return
-endp
-
-
-iglobal
- if used FontCreate
- label FontAttr byte
- .mono db ',Mono', 0
- .size db ':pixelsize=', 0
- .weight db ':weight=', 0
- .italic db ':slant=italic', 0
- end if
-endg
-
-
-
-
-
-
-
-
-
-
-macro XftPushArg field, type, value {
- push value
- push type
- push field
- add ebx, 12
-}
-
-macro XftStartArguments {
- push 0
- mov ebx, 4
-}
-
-XftFamily text 'family'
-XftStyle text 'style'
-XftSpacing text 'spacing'
-XftSlant text 'slant'
-XftWeight text 'weight'
-XftWidth text 'width'
-XftPixelSize text 'pixelsize'
-XftAntialias text 'antialias'
-XftAutohint text 'autohint'
-XftHintStyle text 'hintstyle'
-XftHinting text 'hinting'
-XftRGBA text 'rgba'
-
-
-proc FontCreate3, .fontname, .size, .weight, .flags
-begin
- push ebx ecx edx
-
-
- XftStartArguments
-
- cmp [.fontname], 0
- je @f
- stdcall StrPtr, [.fontname]
- XftPushArg XftFamily, XftTypeString, eax
-@@:
-
- cmp [.size], 2
- jle @f
- sub [.size], 2
- XftPushArg XftPixelSize, XftTypeInteger, [.size]
-@@:
-
- cmp [.weight], 0
- jle @f
- shr [.weight], 1
- XftPushArg XftWeight, XftTypeInteger, [.weight]
-@@:
-
- test [.flags], ffItalic
- jz @f
- XftPushArg XftSlant, XftTypeInteger, XFT_SLANT_ITALIC
-@@:
-
- test [.flags], ffMonospaced
- jz @f
- XftPushArg XftSpacing, XftTypeInteger, XFT_MONO
-@@:
- XftPushArg XftAntialias, XftTypeBool, 0
- XftPushArg XftHinting, XftTypeBool, 0
- XftPushArg XftHintStyle, XftTypeInteger, 0
- XftPushArg XftRGBA, XftTypeInteger, 5
- XftPushArg XftWidth, XftTypeInteger, 100
-
- invoke XftFontOpen, [hApplicationDisplay], 0
- add ebx, 8
- add esp, ebx
-
- pop edx ecx ebx
- return
-endp
-
-
-
-
-proc FontDestroy, .font
-begin
- stdcall XftFontClose, [hApplicationDisplay], [.font]
- return
-endp
DELETED freshlib/graphics/Linux/images.asm
Index: freshlib/graphics/Linux/images.asm
==================================================================
--- freshlib/graphics/Linux/images.asm
+++ /dev/null
@@ -1,112 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Memory based images manipulation library.
-;
-; Target OS: Linux
-;
-; Dependencies: memory.asm
-;
-; Notes:
-;_________________________________________________________________________________________
-
-; only 16, 24 and 32 bpp are supported.
-; It is stupid to support palleted modes and even 24bpp is not good...
-proc CreateImage, .width, .height, .bpp
-.scanline dd ?
-begin
- push ebx ecx edx esi
-
- stdcall GetMem, sizeof.TImage
- jc .finish
-
- mov esi, eax
-
- cmp [.width], 0
- jg @f
- mov [.width], 1
-@@:
- cmp [.height], 0
- jg @f
- mov [.height], 1
-@@:
-
- push [.width] [.height] [.bpp]
- pop [esi+TImage.bpp] [esi+TImage.height] [esi+TImage.width]
-
-; allocate image data
-
- mov ecx, [.bpp]
- mov eax, [.height]
- shr ecx, 3
- imul ecx, [.width]
- add ecx, 3
- and ecx, $fffffffc ; align scanline to dword.
- mov [.scanline], ecx
- imul eax, ecx
-
- stdcall GetMem, eax
- jc .error_free
- mov [esi+TImage.pData], eax
-
-; IMPORTANT!
-; The depth - 3rd argument MUST be $18 - I tested it on 16bpp and 32bpp screen setting and it works.
-; in all other settings XPutImage fails with segmentation fault or with BadMatch error.
-; This procedure is tested only with 32bit images - [.bpp]=32.
-; This issue needs some more research, but the documentation is pretty obscure and I am not so good in Linux programming.
- mov eax, [.bpp]
- add eax, $0f
- and eax, $f0
- cinvoke XCreateImage, [hApplicationDisplay], 0, $18, ZPixmap, 0, [esi+TImage.pData], [.width], [.height], eax, [.scanline]
- mov [esi+TImage.raster], eax
-
- clc
- mov eax, esi
-.finish:
- pop esi edx ecx ebx
- return
-
-.error_free:
- stdcall FreeMem, esi
- stc
- jmp .finish
-endp
-
-
-
-
-proc DestroyImage, .ptrImage
-begin
- push eax ecx edx esi
-
- mov esi, [.ptrImage]
- test esi, esi
- jz @f
-
- cinvoke XDestroyImage, [esi+TImage.raster]
- stdcall FreeMem, esi
-@@:
- pop esi edx ecx eax
- return
-endp
-
-
-
-
-proc DrawImage, .context, .pImage, .x, .y
-begin
- push eax ecx edx
-
- mov eax, [.pImage]
- test eax, eax
- jz .exit
-
- mov ecx, [.context]
- cinvoke XPutImage, [hApplicationDisplay], [ecx+TContext.raster], [ecx+TContext.handle], [eax+TImage.raster], 0, 0, [.x], [.y], [eax+TImage.width], [eax+TImage.height]
-.exit:
- pop edx ecx eax
- return
-endp
-
DELETED freshlib/graphics/Linux/text.asm
Index: freshlib/graphics/Linux/text.asm
==================================================================
--- freshlib/graphics/Linux/text.asm
+++ /dev/null
@@ -1,260 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Text drawing library.
-;
-; Target OS: Linux
-;
-; Dependencies:
-;
-; Notes: Uses XFT library to renter the text.
-;_________________________________________________________________________________________
-
-uses libXft
-
-proc __ColorToRender, .color, .rendercolor
-begin
- push eax ecx edx
-
- mov edx, [.rendercolor]
-
- xor eax, eax
- xor ecx, ecx
-
- mov ah, byte [.color]
- mov ch, byte [.color+1]
-
- mov [edx+_XftColor.color.blue], ax
- mov [edx+_XftColor.color.green], cx
-
- mov ah, byte [.color+2]
- mov ch, byte [.color+3]
- xor ch, $ff
- mov [edx+_XftColor.color.red], ax
- mov [edx+_XftColor.color.alpha], cx
-
- pop edx ecx eax
- return
-endp
-
-
-
-proc DrawString, .context, .ptrString, .len, .x, .y, .font, .color
- .cltxt _XftColor
-begin
- push eax ebx ecx edx esi edi
-
- cmp [.font], 0
- jne @f
-
- mov eax, [_SystemFont]
- mov [.font], eax
-
-@@:
- cinvoke XDefaultVisual, [hApplicationDisplay], 0
- mov ecx, [.context]
- cinvoke XftDrawCreate, [hApplicationDisplay], [ecx+TContext.raster], eax, 0
- mov ebx, eax
-
- mov ecx, [.context]
- cinvoke XftDrawSetClip, ebx, [ecx+TContext.clipregion]
-
- lea eax, [.cltxt]
- stdcall __ColorToRender, [.color], eax
-
- cinvoke XftDrawStringUtf8, ebx, eax, [.font], [.x], [.y], [.ptrString], [.len]
- cinvoke XftDrawDestroy, ebx
-
- pop edi esi edx ecx ebx eax
- return
-endp
-
-
-
-
-proc DrawStringOpaque, .context, .ptrString, .len, .x, .y, .font, .color, .background
- .cltxt _XftColor
-begin
- push eax ebx ecx edx esi edi
-
- cmp [.font], 0
- jne @f
-
- mov eax, [_SystemFont]
- mov [.font], eax
-
-@@:
- cinvoke XDefaultVisual, [hApplicationDisplay], 0
- mov ecx, [.context]
- cinvoke XftDrawCreate, [hApplicationDisplay], [ecx+TContext.raster], eax, 0
- mov ebx, eax
-
- mov ecx, [.context]
- cinvoke XftDrawSetClip, ebx, [ecx+TContext.clipregion]
-
- lea eax, [.cltxt]
- stdcall __ColorToRender, [.color], eax
-
- cinvoke XftDrawStringUtf8, ebx, eax, [.font], [.x], [.y], [.ptrString], [.len]
- cinvoke XftDrawDestroy, ebx
-
- pop edi esi edx ecx ebx eax
- return
-endp
-
-
-
-proc DrawColoredString, .context, .ptrString, .pCharAttr, .str_len_bytes, .x, .y, .char_offs, .fontwidth, .fontheight
-.xbeg dd ?
-.cltxt _XftColor
-.char dd ?
-.height dd ?
-.offs dd ?
-.skip dd ?
-begin
- push eax ebx ecx edx esi edi
-
- mov esi, [.pCharAttr]
-
- mov eax, [.x]
- mov [.xbeg], eax
-
- cinvoke XDefaultVisual, [hApplicationDisplay], 0
- mov ecx, [.context]
- cinvoke XftDrawCreate, [hApplicationDisplay], [ecx+TContext.raster], eax, 0
- mov ebx, eax
-
- mov ecx, [.context]
- cinvoke XftDrawSetClip, ebx, [ecx+TContext.clipregion]
-
- lea edi, [.cltxt]
-
- stdcall GetTextBounds, [.context], __HeightProbeString, __HeightProbeString.length, [esi+TCharAttr.font]
- mov [.height], edx
-
- stdcall GetTextOffset, [.context], __HeightProbeString, __HeightProbeString.length, [esi+TCharAttr.font]
- mov [.offs], edx
-
-.skip_offset:
- mov ecx, [.char_offs]
- mov [.skip], ecx
-
-.drawloop:
- cmp [.str_len_bytes], 0
- jle .enddraw
-
- mov ecx, [.ptrString]
- stdcall DecodeUtf8, [ecx]
- mov [.char], edx
-
- cmp eax, $01 ; word wrap character
- je .wrapline
-
- cmp [.skip], 0
- jg .drawok
-
-; mov ecx, [.y]
-; sub ecx, [.offs]
-; sub ecx, 2
-; stdcall DrawFillRect, [.context], [.x], ecx, [.fontwidth], [.height], [esi+TCharAttr.backbround]
-
- stdcall __ColorToRender, [esi+TCharAttr.color], edi
- cinvoke XftDrawStringUtf8, ebx, edi, [esi+TCharAttr.font], [.x], [.y], [.ptrString], [.char]
-
- mov eax, [.fontwidth]
- add [.x], eax
-; sub [.width], eax
-; js .enddraw
-
-.drawok:
- dec [.skip]
- mov eax, [.char]
- add [.ptrString], eax
- sub [.str_len_bytes], eax
-
- add esi, sizeof.TCharAttr
- jne .drawloop
-
-.enddraw:
- cinvoke XftDrawDestroy, ebx
- pop edi esi edx ecx ebx eax
- return
-
-.wrapline:
- mov eax, [.fontheight]
- add [.y], eax
- mov eax, [.xbeg]
- mov [.x], eax
-
- mov eax, [.char]
- add [.ptrString], eax
- sub [.str_len_bytes], eax
-
- add esi, sizeof.TCharAttr
- jmp .skip_offset
-
-endp
-
-
-
-
-
-
-
-; returns:
-; eax - width of the string in pixels.
-; edx - heigth of the string in pixels.
-
-
-proc GetTextBounds, .context, .ptrString, .len, .font
-.extents _XGlyphInfo
-begin
- push esi ecx
-
- cmp [.font], 0
- jne @f
-
- mov eax, [_SystemFont]
- mov [.font], eax
-
-@@:
- lea esi, [.extents]
- cinvoke XftTextExtentsUtf8, [hApplicationDisplay], [.font], [.ptrString], [.len], esi
-
- movzx eax, [esi+_XGlyphInfo.xOff]
- movzx edx, [esi+_XGlyphInfo.height]
- add edx, 2
-
- pop ecx esi
- return
-endp
-
-
-; returns:
-; eax - x offset of the baseline of the string.
-; edx - y offset of the baseline of the string.
-
-proc GetTextOffset, .context, .ptrString, .len, .font
-.extents _XGlyphInfo
-begin
- push esi ecx
-
- cmp [.font], 0
- jne @f
-
- mov eax, [_SystemFont]
- mov [.font], eax
-
-@@:
- lea esi, [.extents]
- cinvoke XftTextExtentsUtf8, [hApplicationDisplay], [.font], [.ptrString], [.len], esi
-
- movzx eax, [esi+_XGlyphInfo.x]
- movzx edx, [esi+_XGlyphInfo.y]
- add edx, 2
-
- pop ecx esi
- return
-endp
DELETED freshlib/graphics/Win32/backbuffer.asm
Index: freshlib/graphics/Win32/backbuffer.asm
==================================================================
--- freshlib/graphics/Win32/backbuffer.asm
+++ /dev/null
@@ -1,84 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Provides raster bitmap, to be used for double buffer painting.
-;
-; Target OS: Win32
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-
-
-proc CreateBackBuffer, .hwin, .width, .height
-begin
- push ebx ecx edx
-
- stdcall GetMem, sizeof.TBackBuffer
- mov ebx, eax
-
- mov ecx, [.width]
- mov edx, [.height]
-
- test ecx, ecx
- jns @f
- xor ecx, ecx
-@@:
- test edx, edx
- jns @f
- xor edx, edx
-@@:
- mov [ebx+TBackBuffer.width], ecx
- mov [ebx+TBackBuffer.height], edx
-
- invoke GetDC, [.hwin]
- push eax
- invoke CreateCompatibleBitmap, eax, [ebx+TBackBuffer.width], [ebx+TBackBuffer.height]
- mov [ebx+TBackBuffer.raster], eax
-
- invoke ReleaseDC, [.hwin] ; from the stack
-
- mov eax, ebx
- pop edx ecx ebx
- return
-endp
-
-
-
-proc DestroyBackBuffer, .pBackBuffer
-begin
- push eax ecx edx
- mov eax, [.pBackBuffer]
- push eax
- invoke DeleteObject, [eax+TBackBuffer.raster]
- stdcall FreeMem ; from the stack
- pop edx ecx eax
- return
-endp
-
-
-
-proc DrawBackBuffer, .context, .pBackBuffer, .x, .y
-begin
- push eax ecx edx esi edi
- mov esi, [.pBackBuffer]
-
- stdcall AllocateContext, [esi+TBackBuffer.raster]
- jc .exit
- mov edi, eax
-
- mov ecx, [.context]
- invoke BitBlt, [ecx+TContext.handle], [.x], [.y], [esi+TBackBuffer.width], [esi+TBackBuffer.height], [edi+TContext.handle], 0, 0, SRCCOPY
-
- stdcall ReleaseContext, edi
-
-.exit:
- pop edi esi edx ecx eax
- return
-
-
-endp
DELETED freshlib/graphics/Win32/context.asm
Index: freshlib/graphics/Win32/context.asm
==================================================================
--- freshlib/graphics/Win32/context.asm
+++ /dev/null
@@ -1,299 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Context is a object that represents drawing surface in FreshLib
-;
-; Target OS: Win32
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-uses user32, gdi32
-
-; Some of these constants are probably wrong!
-cmClear = R2_BLACK
-cmAnd = R2_MASKPEN
-cmAndReverse = R2_NOTMASKPEN
-cmCopy = R2_COPYPEN
-cmAndInverted = R2_MASKPENNOT
-cmNoOp = R2_NOP
-cmXor = R2_XORPEN
-cmOr = R2_MERGEPEN
-cmNor = R2_NOTMERGEPEN
-cmEquiv = R2_NOTXORPEN
-cmInvert = R2_NOT
-cmXorReverse = R2_NOTXORPEN
-cmCopyInverted = R2_NOTCOPYPEN
-cmOrInverted = R2_NOTMERGEPEN
-cmNand = R2_NOTMASKPEN
-cmSet = R2_WHITE
-
-
-proc AllocateContext, .raster
-begin
- push ebx ecx edx
-
- stdcall GetMem, sizeof.TContext
- mov ebx, eax
-
- push [.raster]
- pop [ebx+TContext.raster]
-
- invoke IsWindow, [.raster]
- test eax, eax
- jz .not_window
-
- invoke GetDC, [.raster]
- mov [ebx+TContext.handle], eax
- test eax, eax
- jz .error
-
- invoke SaveDC, [ebx+TContext.handle]
-
-.exit_ok:
- clc
- mov eax, ebx
- pop edx ecx ebx
- return
-
-.not_window: ; then it must be handle to image bitmap...
- invoke GetObjectType, [.raster]
- cmp eax, OBJ_BITMAP
- jne .error
-
- invoke CreateCompatibleDC, 0
- mov [ebx+TContext.handle], eax
- test eax, eax
- jz .error
-
- invoke SaveDC, ebx
- invoke SelectObject, [ebx+TContext.handle], [.raster]
- jmp .exit_ok
-
-.error:
- stc
- pop edx ecx ebx
- return
-endp
-
-
-
-
-proc ReleaseContext, .context
-begin
- push eax ebx ecx edx
-
- mov ebx, [.context]
-
-; delete all selected objects...
- invoke GetCurrentObject, [ebx+TContext.handle], OBJ_PEN
- push eax
- invoke GetCurrentObject, [ebx+TContext.handle], OBJ_BRUSH
- push eax
- invoke GetCurrentObject, [ebx+TContext.handle], OBJ_FONT
- push eax
-
- invoke RestoreDC, [ebx+TContext.handle], -1
-
- invoke DeleteObject ; from the stack
- invoke DeleteObject ; from the stack
- invoke DeleteObject ; from the stack
-
- invoke GetObjectType, [ebx+TContext.handle]
- cmp eax, OBJ_MEMDC
- je .delete
-
- cmp eax, OBJ_DC
- je .release
-
- stc
-.exit:
- pop edx ecx ebx eax
- return
-
-.delete:
- invoke DeleteDC, [ebx+TContext.handle]
- jmp .free
-
-.release:
- invoke ReleaseDC, [ebx+TContext.raster] , [ebx+TContext.handle]
-
-.free:
- stdcall FreeMem, ebx
- clc
- jmp .exit
-endp
-
-
-
-proc SetDrawMode, .context, .mode
-begin
- push eax ebx ecx edx
- mov ebx, [.context]
- test ebx, ebx
- jz .finish
-
- push [.mode]
- pop [ebx+TContext.drawmode]
- invoke SetROP2, [ebx+TContext.handle], [.mode]
-
-.finish:
- pop edx ecx ebx eax
- return
-endp
-
-
-
-
-proc SetLineStyle, .context, .pLineStyle
-begin
- push eax ebx ecx edx esi
-
- mov ebx, [.pLineStyle]
- mov esi, [.context]
-
- mov eax, [ebx+TLineStyle.color]
- bswap eax ; FreshLib uses Linux type color - red in the MSB
- ror eax, 8
-
- mov edx, PS_SOLID
- cmp [ebx+TLineStyle.DashCount], 0
- je @f
- mov edx, PS_DOT
- mov [ebx+TLineStyle.width], 0
-@@:
- invoke CreatePen, edx, [ebx+TLineStyle.width], eax ;[ebx+TLineStyle.color]
- invoke SelectObject, [esi+TContext.handle], eax
- invoke DeleteObject, eax
-
- cmp [ebx+TLineStyle.DashCount], 0
- je .exit
-
- mov eax, [ebx+TLineStyle.clSpace]
- bswap eax ; FreshLib uses Linux type color - red in the MSB
- ror eax, 8
-
- invoke SetBkColor, [esi+TContext.handle], eax
- invoke SetBkMode, [esi+TContext.handle], OPAQUE
-
-
-.exit:
- pop esi edx ecx ebx eax
- return
-endp
-
-
-
-
-
-
-proc SetClipRectangle, .context, .pBounds
-begin
- push eax ebx ecx edx
-
- xor ebx, ebx
- mov edx, [.pBounds]
- test edx, edx
- jz .setit
-
- mov eax, [edx+TBounds.width]
- mov ecx, [edx+TBounds.height]
- add eax, [edx+TBounds.x]
- add ecx, [edx+TBounds.y]
- invoke CreateRectRgn, [edx+TBounds.x], [edx+TBounds.y], eax, ecx
- mov ebx, eax
-
-.setit:
- mov edx, [.context]
- invoke SelectClipRgn, [edx+TContext.handle], ebx
-
- test ebx, ebx
- jz .exit
- invoke DeleteObject, ebx
-.exit:
- pop edx ecx ebx eax
- return
-endp
-
-
-
-
-;proc SetLineStyle, .context, .pLineStyle
-;.brush LOGBRUSH
-;.width dd ?
-;.dashcount dd ?
-;.dashes rd 16
-;begin
-; push eax ebx ecx edx esi
-;
-; mov ebx, [.pLineStyle]
-; mov esi, [.context]
-;
-; mov ecx, [ebx+TLineStyle.DashCount]
-; cmp ecx, 16
-; jbe @f
-; mov ecx, 16
-;@@:
-; mov [.dashcount], ecx
-;
-;.dashloop:
-; dec ecx
-; js .enddash
-; movzx eax, byte [ebx+TLineStyle.DashItems+ecx]
-; mov [.dashes+4*ecx], eax
-; jmp .dashloop
-;
-;.enddash:
-; push [ebx+TLineStyle.width]
-; pop [.width]
-;
-; mov [.brush.lbStyle], BS_SOLID
-; mov eax, [ebx+TLineStyle.color]
-; bswap eax ; FreshLib uses Linux type color - red in the MSB
-; ror eax, 8
-;
-; mov [.brush.lbColor], eax
-;
-; mov edx, PS_SOLID
-; xor ecx, ecx
-; cmp [.dashcount], 0
-; je @f
-; mov edx, PS_USERSTYLE
-; lea ecx, [.dashes]
-;@@:
-;
-; or edx, PS_GEOMETRIC
-; cmp [.width], 0
-; jne @f
-; and edx, not PS_GEOMETRIC
-; inc [.width]
-;@@:
-; or edx, [ebx+TLineStyle.flags]
-; lea eax, [.brush]
-;
-; invoke ExtCreatePen, edx, [.width], eax, [.dashcount], ecx
-; invoke SelectObject, [esi+TContext.handle], eax
-;
-;
-; invoke SetBkMode, [esi+TContext.handle], OPAQUE
-;
-; mov eax, [ebx+TLineStyle.color]
-; cmp [ebx+TLineStyle.DashCount], 0
-; je @f
-; mov eax, [ebx+TLineStyle.clSpace]
-;@@:
-; bswap eax ; FreshLib uses Linux type color - red in the MSB
-; ror eax, 8
-;
-; invoke SetBkColor, [esi+TContext.handle], eax
-;
-; pop esi edx ecx ebx eax
-; return
-;endp
-;
-
-
DELETED freshlib/graphics/Win32/draw.asm
Index: freshlib/graphics/Win32/draw.asm
==================================================================
--- freshlib/graphics/Win32/draw.asm
+++ /dev/null
@@ -1,123 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Draw library contains procedures for drawing oprtations.
-;
-; Target OS: Win32
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-lsEndCapRound = PS_ENDCAP_ROUND
-lsEndCapSquare = PS_ENDCAP_SQUARE
-lsEndCapFlat = PS_ENDCAP_FLAT
-
-lsJoinRound = PS_JOIN_ROUND
-lsJoinBevel = PS_JOIN_BEVEL
-lsJoinMiter = PS_JOIN_MITER
-
-
-
-proc DrawLine, .context, .x1, .y1, .x2, .y2
-begin
- push eax ebx ecx edx
- mov ebx, [.context]
-
- invoke MoveToEx, [ebx+TContext.handle], [.x1], [.y1], 0
- invoke LineTo, [ebx+TContext.handle], [.x2], [.y2]
-
- pop edx ecx ebx eax
- return
-endp
-
-
-
-
-proc DrawFillRect, .context, .x, .y, .width, .height, .color
-begin
- push eax ebx ecx edx esi
-
- mov ebx, [.context]
-
- mov eax, [.color]
- bswap eax
- ror eax, 8
- mov esi, eax
- invoke CreateSolidBrush, esi
- invoke SelectObject, [ebx+TContext.handle], eax
- push eax
-
- invoke CreatePen, PS_SOLID, 0, esi
- invoke SelectObject, [ebx+TContext.handle], eax
- push eax
-
- mov eax, [.x]
- mov ecx, [.y]
- add eax, [.width]
- add ecx, [.height]
-
- cmp [.width], 1
- je .line1
- cmp [.height], 1
- jne .rect
-
- dec ecx
- jmp .line
-
-.line1:
- dec eax
-.line:
- invoke MoveToEx, [ebx+TContext.handle], eax, ecx, 0
- invoke LineTo, [ebx+TContext.handle], [.x], [.y]
- inc [.x]
- invoke LineTo, [ebx+TContext.handle],[.x], [.y]
- jmp .free
-
-.rect:
- invoke Rectangle, [ebx+TContext.handle], [.x], [.y], eax, ecx
-
-; lea ecx, [.x]
-; invoke FillRect, [ebx+TContext.handle], ecx, eax
-.free:
- invoke SelectObject, [ebx+TContext.handle] ; from the stack.
- invoke DeleteObject, eax
- invoke SelectObject, [ebx+TContext.handle] ; from the stack.
- invoke DeleteObject, eax
- pop esi edx ecx ebx eax
- return
-endp
-
-
-
-
-
-macro Outline [type, x, y] {
- common
-local ..types, ..points, ..count
- dd ..count
- dd ..types
- dd ..points
- common
- label ..types byte
- forward
- db type
- common
- label ..points dword
- forward
- dd x
- dd y
-}
-
-
-
-
-proc Draw, .raster, .pDrawPoints
-begin
-
- return
-endp
-
DELETED freshlib/graphics/Win32/fonts.asm
Index: freshlib/graphics/Win32/fonts.asm
==================================================================
--- freshlib/graphics/Win32/fonts.asm
+++ /dev/null
@@ -1,63 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Fonts managing library.
-;
-; Target OS: Win32
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-
-proc FontCreate, .fontface, .size, .weight, .flags
-.pwc dd ?
-begin
- push ebx ecx edx esi edi
-
- neg [.size]
-
- stdcall StrLen, [.fontface]
- mov ebx, eax
-
- stdcall StrPtr, [.fontface]
- mov [.fontface], eax
-
- lea ecx, [8*ebx]
- stdcall GetMem, ecx
- mov edi, eax
-
- invoke MultiByteToWideChar, CP_UTF8, 0, [.fontface], ebx, edi, ecx
-
- mov eax, [.flags]
- mov ebx, eax
- mov ecx, eax
- mov edx, eax
- and ebx, ffItalic
- and ecx, ffUnderline
- and edx, ffStrikeOut
- and eax, ffMonospaced
- jz @f
- mov eax, FIXED_PITCH
-@@:
- invoke CreateFontW, [.size], 0, 0, 0, [.weight], ebx, ecx, edx, \
- DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, \
- CLIP_DEFAULT_PRECIS, PROOF_QUALITY, eax, \
- edi
-
- stdcall FreeMem, edi
- pop edi esi edx ecx ebx
- return
-endp
-
-
-proc FontDestroy, .font
-begin
- push eax ecx edx
- invoke DeleteObject, [.font]
- pop edx ecx eax
- return
-endp
DELETED freshlib/graphics/Win32/images.asm
Index: freshlib/graphics/Win32/images.asm
==================================================================
--- freshlib/graphics/Win32/images.asm
+++ /dev/null
@@ -1,118 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Memory based images manipulation library.
-;
-; Target OS: Win32
-;
-; Dependencies: memory.asm
-;
-; Notes:
-;_________________________________________________________________________________________
-
-
-; only 16, 24 and 32 bpp are supported.
-; It is stupid to support palleted modes and even 24bpp is not good...
-proc CreateImage, .width, .height, .bpp
-.bmi BITMAPINFOHEADER
-begin
- push ebx ecx edx esi
-
- stdcall GetMem, sizeof.TImage
- jc .finish
-
- mov esi, eax
-
- cmp [.width], 0
- jge @f
- mov [.width], 0
-@@:
- cmp [.height], 0
- jge @f
- mov [.height], 0
-@@:
- push [.width] [.height] [.bpp]
- pop [esi+TImage.bpp] [esi+TImage.height] [esi+TImage.width]
-
- lea eax, [.bmi]
- mov [eax+BITMAPINFOHEADER.biSize], sizeof.BITMAPINFOHEADER
- mov [eax+BITMAPINFOHEADER.biPlanes], 1
- mov [eax+BITMAPINFOHEADER.biCompression], BI_RGB
- mov [eax+BITMAPINFOHEADER.biSizeImage], 0
- mov [eax+BITMAPINFOHEADER.biXPelsPerMeter], 96 ; ???
- mov [eax+BITMAPINFOHEADER.biYPelsPerMeter], 96 ; ???
- mov [eax+BITMAPINFOHEADER.biClrUsed], 0
- mov [eax+BITMAPINFOHEADER.biClrImportant], 0
-
- mov ecx, [.bpp]
- mov [eax+BITMAPINFOHEADER.biBitCount], cx
- push [.width] [.height]
- neg dword [esp]
- pop [eax+BITMAPINFOHEADER.biHeight] [eax+BITMAPINFOHEADER.biWidth]
-
- lea ecx, [esi+TImage.pData]
- invoke CreateDIBSection, 0, eax, DIB_RGB_COLORS, ecx, 0, 0
- mov [esi+TImage.raster], eax
-
- clc
- mov eax, esi
-
-.finish:
- pop esi edx ecx ebx
- return
-endp
-
-
-proc DestroyImage, .ptrImage
-begin
- push eax ecx edx esi
-
- mov esi, [.ptrImage]
- cmp esi, 0
- je @f
- invoke DeleteObject, [esi+TImage.raster]
- stdcall FreeMem, esi
-@@:
- pop esi edx ecx eax
- return
-endp
-
-
-
-
-proc DrawImage, .context, .pImage, .x, .y
-begin
- push eax ecx edx esi edi
- mov esi, [.pImage]
- test esi, esi
- jz .exit
-
- stdcall AllocateContext, [esi+TImage.raster]
- jc .exit
- mov edi, eax
-
- mov ecx, [.context]
- mov eax, [ecx+TContext.drawmode]
- dec eax
- and eax, $0f
- invoke BitBlt, [ecx+TContext.handle], [.x], [.y], [esi+TImage.width], [esi+TImage.height], [edi+TContext.handle], 0, 0, [4*eax+__RopTable]
-
- stdcall ReleaseContext, edi
-
-.exit:
- pop edi esi edx ecx eax
- return
-endp
-
-; NEEDS some edit to fill the zeroes.
-
-if used __RopTable
-__RopTable dd BLACKNESS, PATPAINT, 0, NOTSRCCOPY, \
- 0, DSTINVERT, SRCINVERT, SRCERASE, \
- SRCAND, 0, 0, 0, \
- SRCCOPY, MERGEPAINT, SRCPAINT, WHITENESS
-end if
-
-
DELETED freshlib/graphics/Win32/text.asm
Index: freshlib/graphics/Win32/text.asm
==================================================================
--- freshlib/graphics/Win32/text.asm
+++ /dev/null
@@ -1,327 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Text drawing library.
-;
-; Target OS: Win32
-;
-; Dependencies: memory.asm
-;
-; Notes:
-;_________________________________________________________________________________________
-
-
-
-proc DrawString, .context, .ptrString, .len, .x, .y, .font, .color
-.pwc dd ?
-.pwl dd ?
-.buffer rb 256
-.charlen dd ?
-begin
- push eax ebx ecx edx
-
-; first convert the string:
- lea eax, [.buffer]
- mov ecx, [.len]
- shl ecx, 3
- cmp ecx, $100
- jbe @f
-
- stdcall GetMem, ecx
-
-@@:
- mov [.pwl], ecx
- mov [.pwc], eax
-
- invoke MultiByteToWideChar, CP_UTF8, 0, [.ptrString], [.len], [.pwc], ecx
- mov [.charlen], eax
-
- mov ebx, [.context]
-
- cmp [.font], 0
- jne @f
-
- invoke GetStockObject, DEFAULT_GUI_FONT
- mov [.font], eax
-
-@@:
- invoke SelectObject, [ebx+TContext.handle], [.font]
- push eax
-
- invoke SetBkMode, [ebx+TContext.handle], TRANSPARENT
- invoke SetTextAlign, [ebx+TContext.handle], TA_NOUPDATECP or TA_LEFT or TA_BASELINE
-
- mov eax, [.color]
- bswap eax
- ror eax, 8
- invoke SetTextColor, [ebx+TContext.handle], eax
- invoke TextOutW, [ebx+TContext.handle], [.x], [.y], [.pwc], [.charlen]
-
- invoke SelectObject, [ebx+TContext.handle] ; old font from the stack.
-
- cmp [.pwl], $100
- jbe @f
- stdcall FreeMem, [.pwc]
-@@:
- pop edx ecx ebx eax
- return
-endp
-
-
-
-proc DrawStringOpaque, .context, .ptrString, .len, .x, .y, .font, .color, .background
-.pwc dd ?
-.pwl dd ?
-.buffer rb 256
-.charlen dd ?
-begin
- push eax ebx ecx edx
-
-; first convert the string:
- lea eax, [.buffer]
- mov ecx, [.len]
- shl ecx, 2
- cmp ecx, $100
- jbe @f
-
- stdcall GetMem, ecx
-
-@@:
- mov [.pwl], ecx
- mov [.pwc], eax
-
- invoke MultiByteToWideChar, CP_UTF8, 0, [.ptrString], [.len], [.pwc], ecx
- mov [.charlen], eax
-
- mov ebx, [.context]
-
- cmp [.font], 0
- jne @f
-
- invoke GetStockObject, DEFAULT_GUI_FONT
- mov [.font], eax
-
-@@:
- invoke SelectObject, [ebx+TContext.handle], [.font]
- push eax
-
- invoke SetBkMode, [ebx+TContext.handle], OPAQUE
- mov eax, [.background]
- bswap eax
- ror eax, 8
- invoke SetBkColor, [ebx+TContext.handle], eax
- invoke SetTextAlign, [ebx+TContext.handle], TA_NOUPDATECP or TA_LEFT or TA_BASELINE
-
- mov eax, [.color]
- bswap eax
- ror eax, 8
- invoke SetTextColor, [ebx+TContext.handle], eax
- invoke TextOut, [ebx+TContext.handle], [.x], [.y], [.pwc], [.charlen]
-
- invoke SelectObject, [ebx+TContext.handle] ; old font from the stack.
-
- cmp [.pwl], $100
- jbe @f
- stdcall FreeMem, [.pwc]
-@@:
- pop edx ecx ebx eax
- return
-endp
-
-
-
-
-proc DrawColoredString, .context, .ptrString, .pCharAttr, .str_len_bytes, .x, .y, .char_offs, .fontwidth, .fontheight
-.xbeg dd ?
-;.wbeg dd ?
-.pwc dd ?
-.charlen dd ?
-.point POINT
-begin
- push eax ebx ecx edx esi edi
-
- mov eax, [.x]
-; mov ecx, [.width]
- mov [.xbeg], eax
-; mov [.wbeg], ecx
-
-; first convert the string:
- mov ecx, [.str_len_bytes]
- shl ecx, 2
- stdcall GetMem, ecx
- mov esi, eax
- mov [.pwc], eax
-
- invoke MultiByteToWideChar, CP_UTF8, 0, [.ptrString], [.str_len_bytes], esi, ecx
- mov [.charlen], eax
-
- mov ebx, [.context]
- mov edi, [.pCharAttr]
-
- invoke SaveDC, [ebx+TContext.handle]
-
- invoke SetBkMode, [ebx+TContext.handle], TRANSPARENT
- invoke SetTextAlign, [ebx+TContext.handle], TA_LEFT or TA_BASELINE
-
-.skip_offset:
- mov ecx, [.char_offs]
-
-.offsloop:
- jecxz .loop
-
- lodsw
- add edi, sizeof.TCharAttr
- dec [.charlen]
- jz .endline
-
- dec ecx
- cmp eax, $01
- jne .offsloop
-
- mov eax, [.fontheight]
- add [.y], eax
- jmp .skip_offset
-
-.loop:
- cmp word [esi], $01
- je .wrapline
-
- mov eax, [edi+TCharAttr.font]
- test eax, eax
- jnz @f
-
- invoke GetStockObject, DEFAULT_GUI_FONT
-@@:
- invoke SelectObject, [ebx+TContext.handle], eax
- mov eax, [edi+TCharAttr.background]
- bswap eax
- ror eax, 8
- invoke SetBkColor, [ebx+TContext.handle], $ff0000
-
- mov eax, [edi+TCharAttr.color]
- bswap eax
- ror eax, 8
- invoke SetTextColor, [ebx+TContext.handle], eax
-
- invoke TextOutW, [ebx+TContext.handle], [.x], [.y], esi, 1
-
- mov eax, [.fontwidth]
- add [.x], eax
-; sub [.width], eax
-; jl .endline
-
-.nextchar:
- add esi, 2
- add edi, sizeof.TCharAttr
- dec [.charlen]
- jnz .loop
-
-.endline:
- invoke RestoreDC, [ebx+TContext.handle], -1
- stdcall FreeMem, [.pwc]
- pop edi esi edx ecx ebx eax
- return
-
-.wrapline:
- mov eax, [.fontheight]
- add [.y], eax
- mov eax, [.xbeg]
-; mov ecx, [.wbeg]
- mov [.x], eax
-; mov [.width], ecx
-
- add esi, 2
- add edi, sizeof.TCharAttr
- dec [.charlen]
- jnz .skip_offset
- jmp .endline
-endp
-
-
-
-
-
-
-proc GetTextBounds, .context, .ptrString, .len, .font
-.size SIZE
-.pwc dd ?
-.charlen dd ?
-begin
- push ebx ecx
-
-; first convert the string:
- mov ecx, [.len]
- shl ecx, 3
- stdcall GetMem, ecx
- mov [.pwc], eax
- invoke MultiByteToWideChar, CP_UTF8, 0, [.ptrString], [.len], [.pwc], ecx
- mov [.charlen], eax
-
- mov ebx, [.context]
-
- cmp [.font], 0
- jne @f
- invoke GetStockObject, DEFAULT_GUI_FONT
- mov [.font], eax
-
-@@:
- invoke SelectObject, [ebx+TContext.handle], [.font]
- push eax
-
- lea eax, [.size]
- invoke GetTextExtentPoint32W, [ebx+TContext.handle], [.pwc], [.charlen], eax
- invoke SelectObject, [ebx+TContext.handle] ; from the stack.
-
- mov eax, [.size.cx]
- mov edx, [.size.cy]
-
- stdcall FreeMem, [.pwc]
- pop ecx ebx
- return
-endp
-
-
-; returns:
-; eax - x offset of the baseline of the string.
-; edx - y offset of the baseline of the string.
-
-proc GetTextOffset, .context, .ptrString, .len, .font
-.metrics TEXTMETRIC
-.pwc dd ?
-.charlen dd ?
-begin
- push ebx ecx
-
-; first convert the string:
- mov ecx, [.len]
- shl ecx, 3
- stdcall GetMem, ecx
- mov [.pwc], eax
- invoke MultiByteToWideChar, CP_UTF8, 0, [.ptrString], [.len], [.pwc], ecx
- mov [.charlen], eax
-
- mov ebx, [.context]
-
- cmp [.font], 0
- jne @f
- invoke GetStockObject, DEFAULT_GUI_FONT
- mov [.font], eax
-
-@@:
- invoke SelectObject, [ebx+TContext.handle], [.font]
- push eax
-
- lea eax, [.metrics]
- invoke GetTextMetricsW, [ebx+TContext.handle], eax
- invoke SelectObject, [ebx+TContext.handle] ; from the stack.
-
- xor eax, eax
- mov edx, [.metrics.tmAscent]
- sub edx, [.metrics.tmInternalLeading]
-
- stdcall FreeMem, [.pwc]
- pop ecx ebx
- return
-endp
DELETED freshlib/graphics/all.asm
Index: freshlib/graphics/all.asm
==================================================================
--- freshlib/graphics/all.asm
+++ /dev/null
@@ -1,19 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Graphics amalgamation include file.
-; Includes all graphic libraries of FreshLib
-;
-; Target OS: Any
-;_________________________________________________________________________________________
-
-
-include 'context.asm'
-include 'images.asm'
-include 'backbuffer.asm'
-include 'draw.asm'
-include 'giflib.asm'
-include 'fonts.asm'
-include 'text.asm'
DELETED freshlib/graphics/backbuffer.asm
Index: freshlib/graphics/backbuffer.asm
==================================================================
--- freshlib/graphics/backbuffer.asm
+++ /dev/null
@@ -1,27 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Provides raster bitmap, to be used for double buffer painting.
-;
-; Target OS: Any
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-module "BackBuffer library"
-
-; should be equal to the first 3 members of TImage in order to use the same draw procedure.
-
-struct TBackBuffer
- .width dd ?
- .height dd ?
- .raster dd ?
-ends
-
-
-include '%TargetOS%/backbuffer.asm'
-
-endmodule
DELETED freshlib/graphics/context.asm
Index: freshlib/graphics/context.asm
==================================================================
--- freshlib/graphics/context.asm
+++ /dev/null
@@ -1,110 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Context is a object that represents drawing surface in FreshLib
-;
-; Target OS: Any
-;
-; Dependencies:
-;
-; Notes: This file contains OS independent part and includes OS dependent files.
-;_________________________________________________________________________________________
-module "Graphic context library"
-
-struct TBounds
- .x dd ?
- .y dd ?
- .width dd ?
- .height dd ?
-ends
-
-
-
-struct TContext
- .raster dd ? ; handle to raster object (depends on TargetOS)
- .handle dd ? ; handle to context object (depends on TargetOS)
- .clipregion dd ? ; clipping region.
- .drawmode dd ?
-ends
-
-
-struct TDashListItem
- .dash dd ?
- .space dd ?
-ends
-
-
-struct TLineStyle
- .width dd ? ; width of the line in pixels. Width 0 is 1px width. It have special meaning in Linux for example.
- .color dd ? ; color of the line in format (from LSB to MSB) bb, gg, rr, aa ; Use of alpha value is something not very clear for all implementations...
- .flags dd ? ; set of lsEndCapXXX; lsJoinXXX
- .clSpace dd ? ; space color.
- .DashCount dd ? ; count of dash items in the dash list. For solid lines DashCount=0
- .DashItems: ; arbitrary count of TDashListItem
-ends
-
-
-; Creates static TLineStyle structure in design time.
-
-struc LineStyle width*, color*, flags, spacecolor, [dash, space] {
-common
-local ..count, ..dashcount
- ..count = 0
-
-common
- dd width
- dd color
- if flags eq
- dd lsEndCapRound or lsJoinRound
- else
- dd flags
- end if
-
- if spacecolor eq
- dd 0
- else
- dd spacecolor
- end if
-
- dd ..dashcount
-
-forward
- if ~dash eq
- db dash, space
- ..count = ..count + 2
- end if
-
-common
- ..dashcount = ..count
-}
-
-
-
-proc SetSimpleLine, .context, .color
-.style TLineStyle
- rd 16
-begin
- push eax
-
- lea eax, [.style]
- mov [eax+TLineStyle.width], 0
- mov [eax+TLineStyle.flags], 0
- mov [eax+TLineStyle.DashCount], 0
- mov [eax+TLineStyle.clSpace],0
-
- push [.color]
- pop [eax+TLineStyle.color]
-
-
- stdcall SetLineStyle, [.context], eax
- pop eax
- return
-endp
-
-
-
-include '%TargetOS%/context.asm'
-
-endmodule
DELETED freshlib/graphics/draw.asm
Index: freshlib/graphics/draw.asm
==================================================================
--- freshlib/graphics/draw.asm
+++ /dev/null
@@ -1,44 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Draw library contains procedures for drawing oprtations.
-;
-; Target OS: Any
-;
-; Dependencies:
-;
-; Notes: This file contains OS independent part and includes OS dependent files.
-;_________________________________________________________________________________________
-module "Draw library"
-
-
-include "%TargetOS%/draw.asm"
-
-
-proc DrawRectangle, .context, .pBounds, .color
-begin
- push eax ecx edx
-
- mov edx, [.pBounds]
-
- mov eax, [edx+TBounds.x]
- mov ecx, [edx+TBounds.y]
- add eax, [edx+TBounds.width]
- add ecx, [edx+TBounds.height]
- dec eax
- dec ecx
-
- stdcall SetSimpleLine, [.context], [.color]
- stdcall DrawLine, [.context], [edx+TBounds.x], [edx+TBounds.y], eax, [edx+TBounds.y]
- stdcall DrawLine, [.context], eax, [edx+TBounds.y], eax, ecx
- stdcall DrawLine, [.context], [edx+TBounds.x], ecx, eax, ecx
- stdcall DrawLine, [.context], [edx+TBounds.x], [edx+TBounds.y], [edx+TBounds.x], ecx
-
- pop edx ecx eax
- return
-endp
-
-
-endmodule
DELETED freshlib/graphics/fonts.asm
Index: freshlib/graphics/fonts.asm
==================================================================
--- freshlib/graphics/fonts.asm
+++ /dev/null
@@ -1,26 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Fonts managing library.
-;
-; Target OS: Any
-;
-; Dependencies:
-;
-; Notes: This file contains OS independent part of the library and includes respective
-; OS dependent files.
-;_________________________________________________________________________________________
-module "Fonts library"
-
-ffItalic = 1
-ffUnderline = 2
-ffStrikeOut = 4
-
-ffMonospaced = $80
-
-
-include '%TargetOS%/fonts.asm'
-
-endmodule
DELETED freshlib/graphics/giflib.asm
Index: freshlib/graphics/giflib.asm
==================================================================
--- freshlib/graphics/giflib.asm
+++ /dev/null
@@ -1,953 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: GIF images decoding library.
-;
-; Target OS: Any
-;
-; Dependencies: memory.asm; files.asm
-;
-; Notes:
-; Original source code by Exagone
-; http://exagone.cjb.net | http://www.exagone.org
-; _thomas_@mailroom.com
-;_________________________________________________________________________________________
-module "GIF library"
-
-struct TGifInfo
-;--- Header ---
- .GIFVersion rb 3 ; 3 byte string (not 0-terminated) that identifies
- ; the GIF Version (like 97a or 98a)
-; --- Logical screen descriptor ---
- .dwLSWidth dd ? ; Logical screen width
- .dwLSHeight dd ? ; Logical screen height
- ; NOTE: Use ImageWidth/Height to find the dimensions,
- ; This one can be different from the logical screen
- ; width and height.
-; --- Color info ---
- .lpColorTable dd ? ; Pointer to the color table
- .ColorCount dd ? ; Number of colors in image (and color table)
- .fTransparent dd ? ; if TRUE - the image have transparent color.
- .iTrasparentColor dd ? ; index of transparent color in the color table.
-
-; --- Image info ---
- .dwImageWidth dd ? ; Width of image
- .dwImageHeight dd ? ; Height of image
-
-; --- Image data ---
- .lpImageData dd ? ; Pointer to the actual image data
-
-; --- Input data ---
- .lpGIFData dd ? ; Pointer to the GIF File data
- .dwGIFDataSize dd ? ; Size of GIF Data
-
-; --- Internal data ---
-; Don't touch this data below, it is used internally by GIFLIB
- .lpLZWTable dd ? ; Pointer to LZW Table
- .dwLZWTableSize dd ? ; Current maximum size of table
- ; This size is dynamic and changes
- ; if the codesize exceeds 9 bits
-
- .dwLZWTableCount dd ? ; Current nr of entries in the LZW table
- .fGlobalCTable db ? ; If set, the GIF file has a global color table
- .dbGCTableSize db ? ; Size of the global color table, if available
- .fLocalCTable db ? ; If set, the first image has a local color table
- .dbLCTableSize db ? ; Size of the local color table, if available
- .lpGIFImage dd ? ; Pointer to the first real image data(Table based image data)
- .lpCurrentByte dd ? ; Pointer to the current byte (used with decompression)
- ; note: if this value is -1, end of the file is reached and
- ; the code-supplier returns 0 as padding
-
- .dbBitsAvailable db ? ; Nr of codebits currently available
- .dbCurBitSize db ? ; Current LZW code size
- .dbInitBitSize db ? ; Initial LZW code size
- .lpLastEOSB dd ? ; Pointer to end of current subblock (used with decompression)
- .dwLZWClear dd ? ; Value of LZW Clear code (CC)
- .CurrentBits dd ? ; Holds the current bits loaded
- .IsFirstCode db ? ; Indicates if the first code is being read now
- .PixelCounter dd ? ; Counts nr of PIXELS outputted
-ends
-
-
-EXTENSIONBLOCK = 021h
-IMAGEDESCRIPTOR = 02Ch
-GRAPHICCONTROLEXTENSTION = 0F9h
-COMMENTEXTENSION = 0FEh
-PLAINTEXTEXTENSION = 001h
-APPLICATIONEXTENSION = 0FFh
-
-
-; Creates TImage from the compressed GIF image.
-; Arguments:
-; pGifImage - pointer to memory, where compressed image resides.
-; DataSize - size of the image.
-; Returns:
-; CF=1 if error;
-; CF=0 and eax=TImage if success.
-proc CreateImageGIF, .pGifImage, .DataSize ;
-.gifinfo TGifInfo
-begin
- push ecx edx esi edi
-
- lea esi, [.gifinfo]
-
- push [.DataSize] [.pGifImage]
- pop [esi+TGifInfo.lpGIFData] [esi+TGifInfo.dwGIFDataSize]
-
- stdcall _GIFLoadHeader, esi
- jz .quit
-
- stdcall _GIFInitalizeDecoder, esi
- jz .quit
-
- stdcall CreateImage, [esi+TGifInfo.dwImageWidth], [esi+TGifInfo.dwImageHeight], 32
- jc .error
- mov edi, eax
-
- push [edi+TImage.pData]
- pop [esi+TGifInfo.lpImageData]
-
- stdcall _GIFDecompress, esi
- jz .quit
-
- stdcall _GIFCleanup, esi
-
- mov eax, edi
-
-.quit:
-.error:
- pop edi esi edx ecx
- return
-endp
-
-
-;===============================================================================
-; GIFLoadFile
-;===============================================================================
-; Loads gif data from a file
-; returns pointer to TImage
-proc ImageGifLoafFromFile, .lpFile
-begin
- push ecx
-
- stdcall LoadBinaryFile, [.lpFile]
- push eax
-
- stdcall CreateImageGIF, eax, ecx
- stdcall FreeMem ; from the stack
- pop ecx
- return
-endp
-
-
-
-;===============================================================================
-; GIFCleanup
-;===============================================================================
-; Cleanup
-;
-proc _GIFCleanup, .lpGifInfo
-begin
- push esi
- mov esi, [.lpGifInfo]
- stdcall FreeMem, [esi+TGifInfo.lpLZWTable]
- pop esi
- return
-endp
-
-
-;===============================================================================
-; GIFDecompress
-;===============================================================================
-; Decompresses the gif and outputs
-; returns:
-; 0 - color format not allowed
-; 1 - success
-; -1 - failed
-proc _GIFDecompress, .lpGifInfo
-begin
- push esi edi ebx
-
- mov esi, [.lpGifInfo]
- mov edi, [esi+TGifInfo.lpImageData]
-
- ; --- Initially, load 4 bytes ---
- mov [esi+TGifInfo.CurrentBits], 0
- mov [esi+TGifInfo.dbBitsAvailable], 0
-
- mov ebx, 4
-.while:
- stdcall _LoadNextByte, esi
- dec ebx
- jne .while
-
- stdcall _DECInitialize, esi
- stdcall _DECDecodeGIF, [.lpGifInfo]
-
- xor eax, eax
- inc eax
- pop ebx edi esi
- return
-
-.qfalse:
- xor eax, eax
- pop ebx edi esi
- return
-endp
-
-;===============================================================================
-; _DECDecodeGIF
-;===============================================================================
-; The actual decoder
-;
-proc _DECDecodeGIF, .lpGifInfo
- .OldCode dd ?
- .FirstCharOfOldCode db ?
- .FirstCharOfCode db ?
- .dummyalign dw ?
- .NrCodesToOutput dd ?
-begin
- push esi edi ebx
-
- mov esi, [.lpGifInfo]
-
- ; --- set counters ---
- mov [esi+TGifInfo.PixelCounter], 0 ;0 codes outputted
- mov eax, [esi+TGifInfo.dwImageWidth]
- mul [esi+TGifInfo.dwImageHeight]
- mov [.NrCodesToOutput], eax ;this is an OUTPUT CODE counter, not nr of compressed codes
-
-; LZW Decompression
-; [1] Initialize string table;
-; [2] get first code: ;
-; [3] output the string for to the charstream;
-; [4] = ;
-; [5] <- next code in codestream;
-; [6] does exist in the string table?
-; (yes: output the string for to the charstream; (A)
-; [...] <- translation for ; (B)
-; K <- first character of translation for ; (C)
-; add [...]K to the string table; (D)
-; <- ; ) (E)
-; (no: [...] <- translation for ; (F)
-; K <- first character of [...]; (G)
-; output [...]K to charstream and add it to string table; (H)
-; <- (I)
-; )
-; [7] go to [5];
-
-.mainloop:
- mov eax, [.NrCodesToOutput]
- cmp eax, [esi+TGifInfo.PixelCounter]
- je .endloop
-
- stdcall _GetNextCode, esi ; [1] and [5]
- mov ebx, eax
- cmp ebx, [esi+TGifInfo.dwLZWClear] ; Check for clearcode
- jne .noclear
-
- stdcall _DECResetLZW, esi ; Reset LZW
- jmp .mainloop
-
-.noclear:
- cmp [esi+TGifInfo.IsFirstCode], 1 ; Checks if steps [1]-[4] have to be done
- jne .notfirst
-
- dec [esi+TGifInfo.IsFirstCode] ;[2]
- stdcall _DECOutputString, esi, ebx ;[3]
- mov [.FirstCharOfOldCode], al ; saved for (G)
- mov [.OldCode], ebx ;[4]
- jmp .mainloop
-
-.notfirst:
- cmp [esi+TGifInfo.dwLZWTableCount], ebx ; [6] ; DECIsCodeInTable replacement
- jbe .notintable
-
- stdcall _DECOutputString, esi, ebx ;(B)
- mov [.FirstCharOfCode], al ;(C)
- mov [.FirstCharOfOldCode], al ; saved for (G)
- stdcall _DECAddToTable, esi, [.OldCode], eax ;(D)
- mov [.OldCode], ebx
- jmp .mainloop
-
-.notintable: ;(F)-(I)
- mov al, [.FirstCharOfOldCode] ; (G)
- stdcall _DECAddToTable, esi, [.OldCode], eax ;(H)
- stdcall _DECOutputString, esi, ebx ;(H)
- mov [.FirstCharOfOldCode], al ; saved for (G)
- mov [.OldCode], ebx
- jmp .mainloop
-
-.endloop:
- xor eax, eax
- inc eax
- pop ebx edi esi
- return
-endp
-
-
-;===============================================================================
-; DECAddToTable
-;===============================================================================
-; Adds an entry to the LZW Table
-; The enry consists of a prefix and a suffix (size is calculated automatically)
-; returns the code for the new entry
-proc _DECAddToTable, .lpGifInfo, .dwPrefix, .dbSuffix
-begin
- push esi edi ebx
-
- mov esi, [.lpGifInfo]
-
- ; --- Check if enough space in the table left
- mov ecx, [esi+TGifInfo.dwLZWTableSize]
- mov ebx, [esi+TGifInfo.dwLZWTableCount]
-
- push ebx
- shl ebx, 2
-
- ; --- If no space left, make the table bigger:
- cmp ebx, ecx
- jne .sizeok
-
- shl ecx, 1 ;Table size doubles
- mov [esi+TGifInfo.dwLZWTableSize], ecx
-
- ; --- Reallocate memory ---
- stdcall ResizeMem, [esi+TGifInfo.lpLZWTable], ecx
- mov [esi+TGifInfo.lpLZWTable], eax
-
-.sizeok:
- ; --- Create pointer to first free entry ---
- add ebx, [esi+TGifInfo.lpLZWTable]
-
- ; --- Find out the size of the string ---
- mov eax, [.dwPrefix]
- shl eax, 2
- add eax, [esi+TGifInfo.lpLZWTable]
- mov eax, [eax]
- shr eax, 8
- and eax, 0FFFh ;eax now holds the size of the prefix string
- inc eax
-
- ; --- Create the entry DWORD ---
- ; (see DECResetLZW for the format)
- mov ecx, [.dwPrefix]
- shl ecx, 20
- shl eax, 8
- or ecx, eax
- mov eax, [.dbSuffix]
- and eax, 0ffh
- or ecx, eax
-
- ; --- Store entry ---
- mov [ebx], ecx
-
- inc [esi+TGifInfo.dwLZWTableCount]
-
- pop ebx ;get saved code of new entry
-
- mov cl, [esi+TGifInfo.dbCurBitSize]
- xor eax, eax
- inc eax
- shl eax, cl
- dec eax
- cmp eax, ebx
- jne @f
-
- ;bitsize should be increased
- inc [esi+TGifInfo.dbCurBitSize] ;increase bitsize
-
-@@:
- mov eax, ebx
- pop ebx edi esi
- return
-endp
-
-
-;===============================================================================
-; DECOutputString
-;===============================================================================
-; Writes the string of dwCode to the output stream
-; returns the first character of the string in al
-;
-proc _DECOutputString, .lpGifInfo, .dwCode
-.LastChar db ?
-begin
- push esi edi ebx
-
- mov esi, [.lpGifInfo]
- mov edi, [esi+TGifInfo.lpLZWTable] ; --- Set basepointer ---
-
- mov eax, [.dwCode] ; --- Get entry ---
-
- mov ebx, [edi+4*eax] ; --- Get size of string ---
- shr ebx, 8 ; See the description of LZW table below.
- and ebx, $0fff
-
-; --- Output all codes backwards ---
- mov edx, [esi+TGifInfo.PixelCounter]
- shl edx, 2
- add edx, [esi+TGifInfo.lpImageData] ; edx is base pointer in the image data.
-
- add [esi+TGifInfo.PixelCounter], ebx ; update the pixel counter.
- dec ebx ; ebx is the counter and index in image data.
-
- mov esi, [esi+TGifInfo.lpColorTable] ; We don't need TGifInfo anymore.
-
-.outloop:
- mov eax, [edi+4*eax]
- mov [.LastChar], al
-
-; Get the color from the color table - esi points to 3 byte palette array.
- movzx ecx, al
- lea ecx, [ecx+2*ecx] ; = 3*ecx
- mov ecx, [esi+ecx]
- bswap ecx
- shr ecx, 8
-
-; Draw the pixel.
- mov [edx+4*ebx], ecx
-
- shr eax, 20 ; Get the prefix index in the LZW table.
- and eax, $0fff
-
- dec ebx
- jns .outloop
-
- mov al, [.LastChar]
- pop ebx edi esi
- return
-endp
-
-
-
-;===============================================================================
-; GetNextCode
-;===============================================================================
-; retrieves the next code from the compressed data stream and loads new bits
-; if needed.
-proc _GetNextCode, .lpGifInfo
-begin
- push esi edi ebx
-
- mov esi, [.lpGifInfo]
- mov ebx, [esi+TGifInfo.CurrentBits]
-
- ; --- Create bitmask for current nr of bits ---
- mov cl, [esi+TGifInfo.dbCurBitSize]
- xor eax, eax
- inc eax
- shl eax, cl
- dec eax
-
- ; --- AND ebx with bitmask ---
- and ebx, eax
-
- ; --- Shift used bits ---
- mov cl, [esi+TGifInfo.dbCurBitSize]
- shr [esi+TGifInfo.CurrentBits], cl
-
- ; --- Decrease # of bits available ---
- sub [esi+TGifInfo.dbBitsAvailable], cl
-
- ; --- Load as many bits as possible ---
-.while:
- cmp [esi+TGifInfo.dbBitsAvailable], 24
- ja .endwhile
- stdcall _LoadNextByte, esi
- jmp .while
-
-.endwhile:
- ; --- Return bits ---
- mov eax, ebx
- pop ebx edi esi
- return
-endp
-
-
-;===============================================================================
-; LoadNextByte
-;===============================================================================
-; Loads the currentbits entry with new bits
-;
-proc _LoadNextByte, .lpGifInfo
-begin
- push esi edi ebx
- mov esi, [.lpGifInfo]
-
- ; --- Get next byte from datastream ---
- mov edi, [esi+TGifInfo.lpCurrentByte]
- cmp edi, -1
- jne .notend
-
-;end of data already reached
- xor al, al ;return 0 as padding
- jmp .gotbyte
-
-;End of subblock reached?
-.notend:
- cmp edi, [esi+TGifInfo.lpLastEOSB]
- jne .noteosb
-
- xor eax, eax
- mov al, [edi] ; new subblock size
- test al,al
- jnz .sizeok
-
- ; if size=0, end of data
- mov [esi+TGifInfo.lpCurrentByte], -1 ;EOF indicator
- jmp .gotbyte
-
-.sizeok:
- inc edi ; new subblock with size al
- add eax, edi
- mov [esi+TGifInfo.lpLastEOSB], eax ;set new end of subblock
- add [esi+TGifInfo.lpCurrentByte], 2
- mov al, [edi]
- jmp .gotbyte
-
-.noteosb:
- mov al, [edi] ;get next byte
- inc [esi+TGifInfo.lpCurrentByte] ;increase for next read
-
- ; --- Got the new byte from the datasteam ---
-.gotbyte:
- mov cl, [esi+TGifInfo.dbBitsAvailable] ;Get nr of bits available
- mov edx, [esi+TGifInfo.CurrentBits] ;Get current bits
- and eax, 0ffh ;eax = al
- shl eax, cl ;Shift bits to right position
- or edx, eax ;OR new bits with current bits
- mov [esi+TGifInfo.CurrentBits], edx ;Save bits
- add [esi+TGifInfo.dbBitsAvailable], 8 ;Set new bits avaialble
-
- pop ebx edi esi
- return
-endp
-
-
-;===============================================================================
-; DECInitialize
-;===============================================================================
-; Initializes the decoder (table for LZW etc)
-;
-proc _DECInitialize, .lpGifInfo
-begin
- push esi edi
-
- mov esi, [.lpGifInfo]
- mov edi, [esi+TGifInfo.lpGIFImage]
-
- ; --- Get initial LZW code size ---
- mov cl, [edi]
- inc cl
- mov [esi+TGifInfo.dbInitBitSize], cl
-
- ; --- Set current bit size to initial bitsize ---
- mov [esi+TGifInfo.dbCurBitSize], cl
-
- ; --- Set size of LZW table ---
-
- cmp cl, 8
- jae @f ;if initial code size is less than 8-bits,
- mov cl, 8 ;set to 8-bits, if higher, don't change it
-@@:
- ; Calculate size of codetable:
- xor eax, eax
- inc eax
- add cl, 2 ; bitsize + 2
- shl eax, cl ; eax = 2 ^ (bitsize + 2) = 4 * (2^bitsize)
- mov [esi+TGifInfo.dwLZWTableSize], eax
-
- ; --- Allocate memory for LZW Table and store pointer ---
- stdcall GetMem, eax
- mov [esi+TGifInfo.lpLZWTable], eax
-
- ; --- Reset LZW ---
- stdcall _DECResetLZW, esi
-
- xor eax, eax
- inc eax
- pop edi esi
- return
-endp
-
-
-
-;===============================================================================
-; DECResetLZW
-;===============================================================================
-; Resets the LZW Table and variables (this is the proper action for a clear
-; code (CC) in data
-proc _DECResetLZW, .lpGifInfo
-begin
- push esi edi ebx
- mov esi, [.lpGifInfo]
-
-; The LZW table has the following format:
-; An array of DWORDS represents an array of string entries
-; One entry consists of a prefix code (which is an index to
-; another entry that should prefix the entry), a string length,
-; and the suffix byte (this byte should be added to the prefix
-; to get the full string).
-; DWORD:
-; | AAAA AAAA | AAAA BBBB | BBBB BBBB | CCCC CCCC |
-; ^ ^
-; MSB LSB
-; AAAAAAAAAAAA: 12-bit index in the LZW Table that indicates the prefix
-; BBBBBBBBBBBB: 12-bit length of the string
-; CCCCCCCC : 8-bit suffix byte
-
- ; --- reset LZW Table ---
- ; Reset bit size:
-
- mov cl, [esi+TGifInfo.dbInitBitSize]
- mov [esi+TGifInfo.dbCurBitSize], cl
-
- ; Get initial nr of entries
- ;mov eax, [esi].ColorCount
- ;NOTE: THE LINE ABOVE WAS PREVIOUSLY USED TO GET THE NR OF ROOT ENTRIES
- ; THIS DIDN'T WORK BECAUSE 1-BIT GIF'S ARE FOR AN UNKNOWN REASON CODED
- ; AS 2-BIT GIFS, SO THE NR OF ROOT ENTRIES HAS TO BE DETERMINED FROM THE
- ; INITIAL BITSIZE
- dec cl
- xor eax, eax
- inc eax
- shl eax, cl ; 2**codesize
- add eax, 2
- mov [esi+TGifInfo.dwLZWTableCount], eax
- mov edx, [esi+TGifInfo.lpLZWTable]
- ; Fill first {2**codcesize+2} entries
- shl eax, 2
- add eax, edx
- xor ecx, ecx
- inc ch ;size of sting is set to 1
-
-.fill:
- mov [edx], ecx
- inc cl
- add edx, 4
- cmp edx, eax
- jb .fill
-
- ; --- set clear code ---
- mov eax, [esi+TGifInfo.dwLZWTableCount]
- sub eax, 2
- mov [esi+TGifInfo.dwLZWClear], eax
- mov [esi+TGifInfo.IsFirstCode], 1
-
- ;lpLZWTable dd ? ; Pointer to LZW Table
- ;dwLZWTableSize dd ? ; Current maximum size of table
- ;dwLZWTableCount dd ? ; Current nr of entries in the LZW table
- ;dbCurBitSize db ? ; Current LZW code size
- ;dbInitBitSize db ? ; Initial LZW code size
- ;dwLZWClear dd ? ; Value of LZW Clear code (CC)
-
- xor eax, eax
- inc eax
- pop ebx edi esi
- return
-endp
-
-
-
-;===============================================================================
-; GIFLoadHeader
-;===============================================================================
-; Loads header and logical screen descriptor
-;
-proc _GIFLoadHeader, .lpGifInfo
-begin
- push esi edi ebx
- mov esi, [.lpGifInfo]
-
- ; --- EDI points to GIF Data, EBX is size of data ---
- mov edi, [esi+TGifInfo.lpGIFData]
- mov ebx, [esi+TGifInfo.dwGIFDataSize]
-
- cmp ebx, 11
- jb .failed ; ebx smaller than header & Logical screen descr. -> invalid GIF
-
- ; --- Check first 3 bytes ("GIF" signature) ---
- mov eax, [edi]
- and eax, $00ffffff
- cmp eax, 'GIF'
- jne .failed
-
- ; --- Copy version number ---
- lea ecx, [esi+TGifInfo.GIFVersion]
- mov ax, [edi+3]
- mov [ecx], ax
- mov al, [edi+5]
- mov [ecx+2], al
-
- ; --- Copy logical screen sizes ---
- xor eax, eax
- mov ax, [edi+6] ;Get Logical screen width
- mov [esi+TGifInfo.dwLSWidth], eax
- mov ax, [edi+8] ;Get Logical screen width
- mov [esi+TGifInfo.dwLSHeight], eax
-
- ; --- Set global color table flag and size ---
- mov cl, [edi+10]
- mov al, cl
- rol al, 1
- and al, 1
- mov [esi+TGifInfo.fGlobalCTable], al
- and cl, 111b
- mov [esi+TGifInfo.dbGCTableSize], cl
-
- xor eax, eax
- inc eax
- pop ebx edi esi
- return
-
-.failed:
- xor eax, eax
- pop ebx edi esi
- return
-endp
-
-
-
-;===============================================================================
-; GIFInitalizeDecoder
-;===============================================================================
-; Initializes decoder
-;
-proc _GIFInitalizeDecoder, .lpGifInfo
-begin
- push esi edi ebx
- mov esi, [.lpGifInfo]
-
- ; --- EDI points to GIF Data, EBX to end of data ---
- mov edi, [esi+TGifInfo.lpGIFData]
- mov ebx, [esi+TGifInfo.dwGIFDataSize]
- add ebx, edi
-
- add edi, 13 ; skip header and local screen descriptor
-
- ; --- Get global color tablesize in bytes ---
- mov cl, [esi+TGifInfo.dbGCTableSize]
- inc cl
- xor eax, eax
- inc eax
- shl eax, cl
- mov ecx, eax
- shl ecx, 1 ;--+--> ecx * 3
- add ecx, eax ;--+
-
- ; --- Skip global color table if available ---
- cmp [esi+TGifInfo.fGlobalCTable], 0
- je @f
- add edi, ecx
-@@:
- cmp edi, ebx
- jae .failed
-
- ; --- Search through the GIF blocks for the first graphic block ---
-.scanloop:
- cmp edi, ebx
- jae .failed
-
- mov al, [edi]
- cmp al, EXTENSIONBLOCK
- jne .maybe
-
- stdcall _SkipExtension, edi, ebx
- mov edi, eax
- jmp .scanloop
-
-.maybe:
- cmp al, IMAGEDESCRIPTOR
- jne .scanloop ; BUG: loop forever on some circumstances...
-
- stdcall _ProcessImageDescriptor, [.lpGifInfo], edi, ebx
- add edi, 11
- stdcall _SkipSubBlocks, edi
-
- xor eax, eax
- inc eax
-.quit:
- pop ebx edi esi
- return
-
-.failed:
- xor eax, eax
- jmp .quit
-endp
-
-
-
-;===============================================================================
-; ProcessImageDescriptor
-;===============================================================================
-; Processes an image desriptor block
-proc _ProcessImageDescriptor, .lpGifInfo, .lpStart, .lpEOF
-begin
- push esi edi
- mov esi, [.lpGifInfo]
-
- mov edx, [.lpStart]
- xor eax, eax
-
- ; --- copy image width & height ---
- mov ax, [edx+5]
- mov [esi+TGifInfo.dwImageWidth], eax
- mov ax, [edx+7]
- mov [esi+TGifInfo.dwImageHeight], eax
-
- ; --- look for local color table ---
- mov cl, [edx+9]
- mov al, cl
- rol cl, 1
- and cl, 1
- mov [esi+TGifInfo.fLocalCTable], cl
- and al, 111b
- mov [esi+TGifInfo.dbLCTableSize], al
-
- ; --- Find out which color table to use ---
- cmp cl, 1
- jne .setglobal
-
- ;local color table available
- ; --- Set color count ---
- mov cl, [esi+TGifInfo.dbLCTableSize]
- inc cl
- xor eax, eax
- inc eax
- shl eax, cl
- mov [esi+TGifInfo.ColorCount], eax
- ; --- Set color table pointer ---
- mov eax, edx
- add eax, 10 ;move to the local color table
- mov [esi+TGifInfo.lpColorTable], eax
- jmp .ctableok
-
-.setglobal:
- ;no local color table, use global color table
- ; --- Set color count ---
- mov cl, [esi+TGifInfo.dbGCTableSize]
- inc cl
- xor eax, eax
- inc eax
- shl eax, cl
- mov [esi+TGifInfo.ColorCount], eax
- ; --- Set color table pointer ---
- mov eax, [esi+TGifInfo.lpGIFData]
- add eax, 13 ;move to the global color table (at offset 13 in file)
- mov [esi+TGifInfo.lpColorTable], eax
-
-.ctableok:
- ; --- Set pointer to real image data (table based image data)
- mov eax, edx
- add eax, 10 ;Skip image descriptor
-
- cmp [esi+TGifInfo.fLocalCTable], 0
- je .setptr
-
- mov ecx, [esi+TGifInfo.ColorCount] ;-+
- add eax, ecx ; + add size of colortable
- shl ecx, 1 ; + (colorcount * 3)
- add eax, ecx ;-+
-
-.setptr:
- mov [esi+TGifInfo.lpGIFImage], eax
-
- ; --- Set some pointers to initialize the decompressor
- inc eax
- mov [esi+TGifInfo.lpLastEOSB], eax
- mov [esi+TGifInfo.lpCurrentByte], eax
-
- xor eax, eax
- inc eax
- pop edi esi
- return
-endp
-
-
-
-;=====================================================================
-; Skips an extension block that starts at lpStart. EOF is at lpEnd.
-; returns pointer to the end of block + 1
-; or 0 if failed
-; esi points at TGifInfo structure.
-proc _SkipExtension, .lpStart, .lpEnd
-begin
- ; --- Get type of extension ---
- mov edx, [.lpStart]
- mov al, [edx+1]
-
- ; --- Skip each type seperately ---
- cmp al, GRAPHICCONTROLEXTENSTION
- jne @f
-
- ; Get transparent color and flag.
- movzx eax, byte [edx+3]
- and eax, 1
- mov [esi+TGifInfo.fTransparent], eax
- mov al, [edx+6]
- mov [esi+TGifInfo.iTrasparentColor], eax
-
- ; Graphic control extension, has a fixed size of 8 bytes
- add edx, 8
- mov eax, edx
- jmp .endext
-
-@@:
- cmp al, COMMENTEXTENSION
- jne @f
-
- ; Comment extension, consists of subblocks of text
- add edx, 2 ;move to first subblock
- stdcall _SkipSubBlocks, edx
- jmp .endext
-
-@@:
- cmp al, PLAINTEXTEXTENSION
- jne @f
-
- ; Plain text extension, 15 header bytes and subblocks follow
- add edx, 15
- stdcall _SkipSubBlocks, edx
- jmp .endext
-
-@@:
- cmp al, APPLICATIONEXTENSION
- jne .endext
-
- ; Application extension, 14 header bytes and subblocks follow
- add edx, 14
- stdcall _SkipSubBlocks, edx
-.endext:
- return
-endp
-
-
-;===============================================================================
-; SkipSubBlocks
-;===============================================================================
-; Skips a sequence of subblocks until a block-terminator is found.
-; returns a pointer to the end of the block + 1.
-; lpStart points to the start of the subblocks
-;
-proc _SkipSubBlocks, .lpStart
-begin
- mov eax, [.lpStart]
- xor ecx, ecx
-.skiploop:
- mov cl, [eax] ; get size of subblock
- test cl, cl
- jz .endloop ; size=0 means terminator
- inc eax
- add eax, ecx ; add size to pointer
- jmp .skiploop
-
-.endloop:
- inc eax
- return
-endp
-
-
-endmodule
DELETED freshlib/graphics/images.asm
Index: freshlib/graphics/images.asm
==================================================================
--- freshlib/graphics/images.asm
+++ /dev/null
@@ -1,37 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Memory based images manipulation library.
-;
-; Target OS: Any
-;
-; Dependencies:
-;
-; Notes: Include respective OS dependent files.
-;_________________________________________________________________________________________
-module "Images library"
-
-struct TImage
- .width dd ? ; width in pixels.
- .height dd ? ; height in pixels.
- .bpp dd ? ; bits per pixel.
- .pData dd ? ; pointer to memory buffer with scanlines. all scanlines are aligned on dword.
- .raster dd ? ; OS handle to be used with procedures from other graphics libraries.
-ends
-
-
-proc DrawMaskedImage, .context, .mask, .image, .x, .y
-begin
- stdcall SetDrawMode, [.context], cmAnd
- stdcall DrawImage, [.context], [.mask], [.x], [.y]
- stdcall SetDrawMode, [.context], cmXor
- stdcall DrawImage, [.context], [.image], [.x], [.y]
- return
-endp
-
-
-include '%TargetOS%/images.asm'
-
-endmodule
DELETED freshlib/graphics/text.asm
Index: freshlib/graphics/text.asm
==================================================================
--- freshlib/graphics/text.asm
+++ /dev/null
@@ -1,476 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Text drawing library.
-;
-; Target OS: Any
-;
-; Dependencies: StrLib
-;
-; Notes: This file contains OS independent part of the library and includes respective
-; OS dependent files.
-;_________________________________________________________________________________________
-module "Text library"
-
-include "%TargetOS%/text.asm"
-
-
-macro min a, b, use {
- sub b, a
- sbb use, use
- and use, b
- add a, use
-}
-
-macro max a, b, use {
- sub b, a
- sbb use, use
- not use
- and use, b
- add a, use
-}
-
-
-struct TTextExtent
- .width dd ?
- .height dd ?
- .OffsX dd ?
- .OffsY dd ?
-ends
-
-
-struct TCharAttr
- .font dd ?
- .color dd ?
- .background dd ?
- .flags dd ? ; for free use of the client.
-ends
-
-
-; dtfXXX means "draw text flag"
-
-; horizontal align
-dtfAlignLeft = 0
-dtfAlignRight = 1
-dtfAlignCenter = 2
-dtfAlignJustify = 3
-
-; vertical align
-dtfAlignTop = 0 shl 2
-dtfAlignBottom = 1 shl 2
-dtfAlignMiddle = 2 shl 2
-
-; Text layout
-dtfCRLF = $0100
-dtfWordWrap = $0200
-dtfTableTabs = $0400
-
-
-struct _TTextChunk
- .y dd ?
- .width dd ?
- .height dd ?
- .len dd ?
- .ptr dd ?
-ends
-
-__HeightProbeString text '18ilj.Xygl[_|"`g'
-__NumberProbeString text '8888888888888888'
-
-; returns: eax - mean width
-; returns: edx - height
-; returns: ecx - descent
-proc FontGetCharSize, .raster, .font, .probe
-begin
- push ebx
-
- stdcall AllocateContext, [.raster]
- mov ebx, eax
-
- stdcall GetTextOffset, ebx, [.probe], 16, [.font]
- mov ecx, edx
-
-; DebugMsg "Text offset y:"
-; OutputRegister regECX, 10
-
- stdcall GetTextBounds, ebx, [.probe], 16, [.font]
- stdcall ReleaseContext, ebx
-
- sub ecx, edx
- shr eax, 4
- neg ecx
- pop ebx
- return
-endp
-
-
-
-
-proc AdjustCountUtf8
-begin
- push esi
- lea esi, [esi+ebx]
- stdcall ScanBackUtf8
- mov ebx, esi
- pop esi
- sub ebx, esi
- return
-endp
-
-
-proc DrawTextBox, .context, .text, .bounds, .flags, .font, .color
-.len dd ?
-.count dd ?
-.height dd ?
-.y dd ?
-
-.low dd ?
-.high dd ?
-
-.linew dd ?
-.lineh dd ?
-
-.DrawProc dd ?
-begin
- pushad
-
- mov ecx, DrawString
-
- mov eax, [.flags]
- and eax, $03
- cmp eax, dtfAlignJustify
- jne @f
- mov ecx, DrawStringJustified
-@@:
- mov [.DrawProc], ecx
-
- stdcall StrLen, [.text]
- mov [.len], eax
-
- stdcall StrPtr, [.text]
- mov esi, eax
-
- mov edi, [.bounds]
- mov eax, [edi+TBounds.height]
-; mov ecx, [edi+TBounds.y]
- mov [.height], eax
- mov [.y], 0 ;ecx
-
-; slice the string on chunks, depending on flags, rectangle width and the string content.
-; push _TTextChunk for every chunk in stack.
- mov [.count], 0
-.slice:
- mov ecx, [.len]
-
- test [.flags], dtfCRLF
- jz .cropit
-
- xor ecx, ecx
-
-.scanCRLF:
- cmp ecx, [.len]
- jae .cropit
-
- mov al, [esi+ecx]
-
- cmp al, $0d
- je .cropit
- cmp al, $0a
- je .cropit
- inc ecx
- jmp .scanCRLF
-
-.cropit:
- mov ebx, ecx ; high limit
-
- stdcall AdjustCountUtf8
- stdcall GetTextBounds, [.context], esi, ebx, [.font]
-
- cmp edx, [.height]
- jg .drawchunks
-
- mov [.lineh], edx
-
- cmp eax, [edi+TBounds.width]
- jle .itfits
-
- mov [.high], ebx
- mov [.low], 0
-
-.croploop:
- mov ebx, [.low]
- add ebx, [.high]
- shr ebx, 1
-
- stdcall AdjustCountUtf8
- stdcall GetTextBounds, [.context], esi, ebx, [.font]
- cmp eax, [edi+TBounds.width]
- je .itfits
-
- jg .above
-
- cmp ebx, [.low]
- je .itfits
-
- mov [.low], ebx
- jmp .croploop
-
-.above:
- mov [.high], ebx
- jmp .croploop
-
-.itfits: ; here ebx contains the len of string that fits in the rectangle.
- mov ecx, ebx
- mov [.linew], eax
-
- test [.flags], dtfWordWrap
- jz .pushit
-
-; search the last space or tab that separates words:
- mov edx, ecx
- cmp byte [esi+edx], $0d
- je .found
- cmp byte [esi+edx], $0a
- je .found
-
-.searchword:
- cmp byte [esi+edx], 0
- je .found
- cmp byte [esi+edx], ' '
- je .found
- cmp byte [esi+edx], $09
- je .found
- cmp byte [esi+edx], $0d
- je .found
- cmp byte [esi+edx], $0a
- je .found
-
- dec edx
- jnz .searchword
-
- mov edx, ecx
-
-.found:
- push ebx
- mov ebx, edx
- stdcall AdjustCountUtf8
- stdcall GetTextBounds, [.context], esi, ebx, [.font]
- mov [.linew], eax
- mov [.lineh], edx
- mov ecx, ebx
- pop ebx
-
-.pushit:
- push esi ; pointer to the string.
- push ecx ; length of the string.
- push [.lineh] ; height of the line.
- push [.linew] ; width of the line.
- push [.y] ;
-
- inc [.count]
-
- mov eax, [.lineh]
- add [.y], eax
- sub [.height], eax
-
- lea esi, [esi+ecx]
- sub [.len], ecx
- jz .drawchunks
-
- xor ecx, ecx
-
-; search for the whitespace that have to be skip
-.skiploop:
- mov al, [esi]
- cmp al, $0d
- je .skipcrlf
- cmp al, $0a
- je .skipcrlf
- cmp al, $20
- je .skipspace
- cmp al, $09
- je .skipspace
-
- jmp .slice
-
-.skipspace:
- inc esi
- dec [.len]
- jnz .skiploop
- jmp .drawchunks
-
-.skipcrlf:
- inc esi
- dec [.len]
- xor al, $0d xor $0a
- cmp [esi], al
- jne .slice
- inc esi
- dec [.len]
- jnz .slice
-
-; pop the _TTextChunk structures and draw, depending on flags.
-.drawchunks:
- mov ebx, esp
- stdcall GetTextOffset, [.context], [ebx+_TTextChunk.ptr], [ebx+_TTextChunk.len], [.font]
- mov eax, [ebx+_TTextChunk.height]
- sub eax, edx ; it should be the line y descent
- test [.flags], dtfAlignBottom
- jnz @f
- sub [.y], eax
-@@:
- mov edx, [.flags]
- and edx, dtfAlignBottom or dtfAlignMiddle
-
- mov ecx, [edi+TBounds.height]
- sub ecx, [.y]
-
- cmp edx, dtfAlignBottom
- je .yalignok
-
- sar ecx, 1
- cmp edx, dtfAlignMiddle
- je .yalignok
-
- xor ecx, ecx
-
-.yalignok:
-.drawloop:
- cmp [.count], 0
- je .finish
-
- mov ebx, esp
-
- mov eax, [edi+TBounds.width]
- sub eax, [ebx+_TTextChunk.width]
-
- mov edx, [.flags]
- and edx, $03
-
- cmp edx, dtfAlignRight
- je .hready
-
- shr eax, 1
- cmp edx, dtfAlignCenter
- je .hready
-
- xor eax, eax
-
-.hready:
- add eax, [edi+TBounds.x]
-
- push eax
- stdcall GetTextOffset, [.context], [ebx+_TTextChunk.ptr], [ebx+_TTextChunk.len], [.font]
- add edx, ecx
- add edx, [ebx+_TTextChunk.y]
- add edx, [edi+TBounds.y]
- pop eax
-
- stdcall [.DrawProc], [.context], [ebx+_TTextChunk.ptr], [ebx+_TTextChunk.len], eax, edx, [.font], [.color]
-
-; draws lines on every row of text. For debug purposes.
-iglobal
- if used __UnderlineStyle
- __UnderlineStyle LineStyle 0, $808080
- end if
-endg
-
-if defined options.DebugMode & options.DebugMode
- stdcall SetLineStyle, [.context], __UnderlineStyle
- stdcall DrawLine, [.context], [edi+TBounds.x], edx, [edi+TBounds.width], edx
-end if
-; end debug code
-
-
- add esp, sizeof._TTextChunk
- dec [.count]
- jmp .drawloop
-
-.finish:
- popad
- return
-endp
-
-
-
-
-proc DrawStringJustified, .raster, .ptrString, .len, .x, .y, .font, .color
-.XX dd ?
-.rem dd ?
-.crem dd ?
-.endptr dd ?
-begin
- pushad
-
- mov esi, [.ptrString]
- mov eax, [.len]
- add eax, esi
- mov [.endptr], eax
-
- stdcall StrLenUtf8, esi, [.len]
- mov ecx, eax
- dec ecx
- jg @f
- mov ecx, 1
-@@:
-
- stdcall GetTextBounds, [.raster], esi, [.len], [.font]
-
- sub eax, [edi+TBounds.width]
- neg eax
-
- cdq
- div ecx
-
- cmp eax, 4
- jge .cantjustify ; the needed space is too big for justify, so just draw it left aligned
-
- mov ecx, eax
- mov [.rem], edx
- mov [.crem], edx
-
- mov ebx, [.len]
- push [.x]
- pop [.XX]
-
-.drawloop:
- cmp esi, [.endptr]
- jae .finish
-
- stdcall DecodeUtf8, [esi]
- jc .finish
-
- push edx
- stdcall DrawString, [.raster], esi, edx, [.XX], [.y], [.font], [.color]
- stdcall GetTextBounds, [.raster], esi, edx, [.font]
- pop edx
- add esi, edx
- add [.XX], eax
- add [.XX], ecx
-
- cmp [.crem], 0
- je .drawloop
-
- sub ebx, [.rem]
- jge .drawloop
-
- inc [.XX]
- dec [.crem]
- mov ebx, [.len]
- sub ebx, [.rem]
- jmp .drawloop
-
-.finish:
- popad
- return
-
-.cantjustify:
- stdcall DrawString, [.raster], [.ptrString], [.len], [.x], [.y], [.font], [.color]
- jmp .finish
-endp
-
-
-
-endmodule
DELETED freshlib/gui/Linux/Main.asm
Index: freshlib/gui/Linux/Main.asm
==================================================================
--- freshlib/gui/Linux/Main.asm
+++ /dev/null
@@ -1,451 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Main procedure of GUI application library.
-;
-; Target OS: Linux
-;
-; Dependencies:
-;
-; Notes: Organize the main message/event loop needed by every GUI engine.
-;_________________________________________________________________________________________
-
-uglobal
- if used fGlobalTerminate
- fGlobalTerminate dd ?
- end if
-endg
-
-
-proc ProcessSystemEvents
- .event XEvent
-begin
- push ebx ecx edx
-
-.event_loop:
-; check for quit
- mov eax, [pApplication]
- mov eax, [eax+TApplication.MainWindow]
- test eax, eax
- jz .continue ; ???????????
-
- cmp dword [eax], 0
- jne .continue
-
- cinvoke XFlush, [hApplicationDisplay]
- xor eax, eax
- mov [fGlobalTerminate], 1
- stc
- pop edx ecx ebx
- return
-
-.continue:
- cinvoke XPending, [hApplicationDisplay]
- test eax, eax
- jz .noevents
-
- lea ebx, [.event]
- cinvoke XNextEvent, [hApplicationDisplay], ebx
- stdcall __ProcessOneSystemEvent, ebx
- jmp .event_loop
-
-.noevents:
- clc
- pop edx ecx ebx
- return
-
-endp
-
-
-
-
-proc WaitForSystemEvent
-.event XEvent
-begin
- push eax ecx edx
- lea eax, [.event]
- cinvoke XPeekEvent, [hApplicationDisplay], eax
- pop edx ecx eax
- return
-endp
-
-
-
-
-;proc EventsQueued, .pWin
-;begin
-; push eax ecx edx
-; cinvoke XQLength, [hApplicationDisplay]
-; test eax, eax
-; clc
-; jz @f
-; stc
-;@@:
-; pop edx ecx eax
-; return
-;endp
-
-
-
-
-proc __ProcessOneSystemEvent, .linux_event
-.event rd 64
-begin
- push eax ebx ecx edx esi edi
-
- mov ebx, [.linux_event]
-
- stdcall _GetWindowStruct, [ebx+XEvent.window]
- mov esi, eax
- lea edi, [.event]
- mov eax, [ebx+XEvent.type]
-
- cmp eax, DestroyNotify
- je .destroy
-
- test esi, esi
- jz .notprocessed
-
- cmp eax, MotionNotify
- je .mousemove
-
- cmp eax, EnterNotify
- je .mouseenter
-
- cmp eax, LeaveNotify
- je .mouseleave
-
- cmp eax, ButtonPress
- je .mouse_btn_press
-
- cmp eax, ButtonRelease
- je .mouse_btn_release
-
- cmp eax, Expose
- je .paint_window
-
- cmp eax, ClientMessage ; event from the window manager - button close for example.
- je .clientmessage
-
- cmp eax, KeyPress
- je .key_press
-
- cmp eax, KeyRelease
- je .key_release
-
- cmp eax, MappingNotify
- je .mapping_notify
-
- cmp eax, FocusIn
- je .focusin
-
- cmp eax, FocusOut
- je .focusout
-
- cmp eax, ConfigureNotify
- je .moveresize
-
-.notprocessed:
- pop edi esi edx ecx ebx eax
- stc
- return
-
-.exec_event:
- pushad
- stdcall ExecEvent, esi, edi
- popad
-
-.finish:
- pop edi esi edx ecx ebx eax
- clc
- return
-
-;.........................................................................
-; Resize events
-.moveresize:
-locals
- .xevent XConfigureEvent
-endl
- lea eax, [.xevent]
- cinvoke XCheckTypedWindowEvent, [hApplicationDisplay], [ebx+XConfigureEvent.window], ConfigureNotify, eax
- test eax, eax
- jz .process
-
- lea eax, [.xevent]
- cinvoke XPutBackEvent, [hApplicationDisplay], eax
-
- mov eax, [.xevent.x]
- cmp eax, [ebx+XConfigureEvent.x]
- jne .finish
-
- mov eax, [.xevent.y]
- cmp eax, [ebx+XConfigureEvent.y]
- jne .finish
-
- mov eax, [.xevent.width]
- cmp eax, [ebx+XConfigureEvent.width]
- jne .finish
-
- mov eax, [.xevent.height]
- cmp eax, [ebx+XConfigureEvent.height]
- jne .finish
-
-.process:
- mov [edi+TMoveResizeEvent.event], seMoveResize
-
- mov eax, [ebx+XConfigureEvent.x]
- mov ecx, [ebx+XConfigureEvent.y]
- mov [edi+TMoveResizeEvent.newX], eax
- mov [edi+TMoveResizeEvent.newY], ecx
-
- cmp [ebx+XConfigureEvent.height], 100
- jl @f
-; DebugMsg "NewX NewY"
-; OutputRegister regEAX, 10
-; OutputRegister regECX, 10
-@@:
- mov eax, [ebx+XConfigureEvent.width]
- mov ecx, [ebx+XConfigureEvent.height]
- mov [edi+TMoveResizeEvent.newWidth], eax
- mov [edi+TMoveResizeEvent.newHeight], ecx
-
- cmp [ebx+XConfigureEvent.height], 100
- jl @f
-; DebugMsg "NewW NewH"
-; OutputRegister regEAX, 10
-; OutputRegister regECX, 10
-@@:
- jmp .exec_event
-
-;.........................................................................
-; Focus events
-.focusout:
- mov [edi+TFocusOutEvent.event], seFocusOut
- jmp .setIC
-
-.focusin:
- mov [edi+TFocusInEvent.event], seFocusIn
-
-.setIC:
- cinvoke XSetICValues, [hInputContext], XNFocusWindow, [esi+TWindow.handle], 0
- jmp .exec_event
-
-;.........................................................................
-; DestroyNotify handler it invalidates the handle in TWindow structure and then destroys TWindow.
-.destroy:
- DebugMsg "Destroy notify"
- OutputNumber [ebx+XDestroyWindowEvent.window], 16, 8
- DebugMsg "h <<< Window handle"
-
- test esi, esi
- jz .finish
-
- DebugMsg "Destroy the object"
-
- mov [esi+TWindow.handle], 0
- stdcall Destroy, esi
- jmp .finish
-
-;.........................................................................
-; Mouse event handlers
-
-.mouseleave:
- mov [edi+TMouseEnterEvent.event], seMouseLeave
- jmp .exec_event
-
-.mouseenter:
- mov [edi+TMouseEnterEvent.event], seMouseEnter
- jmp .exec_event
-
-.mousemove:
- mov [edi+TMouseMoveEvent.event], seMouseMove
- mov eax, [ebx+XMotionEvent.x]
- mov ecx, [ebx+XMotionEvent.y]
- mov [edi+TMouseMoveEvent.x], eax
- mov [edi+TMouseMoveEvent.y], ecx
- jmp .exec_event
-
-.mouse_btn_press:
-.mouse_btn_release:
-
- mov eax, [ebx+XButtonEvent.type]
- mov [edi+TMouseButtonEvent.event], eax ; seMouseBtnPress=ButtonPress and seMouseBtnRelease = ButtonRelease
-
- mov eax, [ebx+XButtonEvent.button]
- dec eax
-
- cmp [edi+TScrollEvent.event], seMouseBtnRelease
- je @f
-
- cmp eax, 3
- jge .wheelscroll
-
-@@:
- mov [edi+TMouseButtonEvent.Button], eax
-
- mov eax, [ebx+XButtonEvent.state]
- mov [edi+TMouseButtonEvent.kbdStatus], eax
-
- mov eax, [ebx+XButtonEvent.x]
- mov ecx, [ebx+XButtonEvent.y]
- mov [edi+TMouseButtonEvent.x], eax
- mov [edi+TMouseButtonEvent.y], ecx
-
- jmp .exec_event
-
-.wheelscroll:
- mov ecx, scWheelUp
- je @f
- mov ecx, scWheelDn
-@@:
- mov [edi+TScrollEvent.event], seScroll
- mov [edi+TScrollEvent.ScrollBar], scrollY
- mov [edi+TScrollEvent.ScrollCmd], ecx
- mov [edi+TScrollEvent.Value], 1
- jmp .exec_event
-
-;.........................................................................
-; Window paint event
-
-.paint_window:
-; cmp [ebx+XExposeEvent.count], 0
-; jne .finish
-
- lea eax, [ebx+XExposeEvent.x]
- stdcall __PaintWindow, esi, eax
-
- jmp .finish
-
-;.........................................................................
-; Keyboard events.
-
-locals
- .utf8buff rb 16
-endl
-
-.key_press:
- mov ecx, seKbdKeyPress
- mov [edi+TKeyboardEvent.event], ecx
- mov ecx, [ebx+XKeyEvent.state]
- mov [edi+TKeyboardEvent.kbdStatus], ecx
-
- mov dword [.utf8buff], 0
- lea eax, [.utf8buff]
- cinvoke Xutf8LookupString, [hInputContext], ebx, eax, 16, 0, 0
-
-; here, .utg8buff contains the utf-8 string with the character typed on the keyboard.
- mov eax, dword [.utf8buff]
- mov [edi+TKeyboardEvent.key], eax
-
-.scancode:
- mov eax, [ebx+XKeyEvent.keycode]
- cinvoke XKeycodeToKeysym, [hApplicationDisplay], eax, 0
- mov [edi+TKeyboardEvent.scancode], eax
- jmp .exec_event
-
-
-.key_release:
- mov ecx, seKbdKeyRelease
- mov eax, [ebx+XKeyEvent.state]
-
- mov [edi+TKeyboardEvent.event], ecx
- mov [edi+TKeyboardEvent.kbdStatus], eax
- mov [edi+TKeyboardEvent.key], 0
- jmp .scancode
-
-
-
-; refreshes keyboard mapping information, stored locally in XLib.
-.mapping_notify:
- cinvoke XRefreshKeyboardMapping, ebx
- jmp .finish
-
-
-;.........................................................................
-; This event is sent from the window manager, when the user click on the close button of the
-; window or close it some other way. So, the window have to decide whether to close or not.
-
-.clientmessage:
- mov eax, dword [ebx+XClientMessageEvent.data]
- cmp eax, [atomWMDelete]
- jne .finish
-
-; The window is closed by click on close button or by pressing Alt+F4 or by other WM method
-;.close_from_wm:
- mov [edi+TCloseEvent.event], seCloseRequest
- mov [edi+TCloseEvent.reason], cerFromUser
- jmp .exec_event
-endp
-
-
-
-
-
-
-
-
-proc __PaintWindow, .pWindow, .ptrBounds
-.event TPaintEvent
-.caret dd ?
-begin
- push eax ebx ecx edx esi edi
-
- lea edi, [.event]
- mov esi, [.pWindow]
-
-if defined Caret
- mov [.caret], -1
- cmp esi, [Caret.pWindow]
- jne @f
- stdcall CaretShow, FALSE
- mov [.caret], eax
-@@:
-end if
- mov [edi+TPaintEvent.event], sePaint
-
- stdcall AllocateContext, [esi+TWindow.handle]
- mov ebx, eax
- mov [edi+TPaintEvent.context], eax
-
- xor eax, eax
- mov [edi+TPaintEvent.rect.left], eax
- mov [edi+TPaintEvent.rect.top], eax
- mov eax, $7fffffff
- mov [edi+TPaintEvent.rect.right], eax
- mov [edi+TPaintEvent.rect.bottom], eax
-
- mov edx, [.ptrBounds]
- test edx, edx
- jz .rectok
-
- mov eax, [edx+TBounds.x]
- mov ecx, [edx+TBounds.y]
-
- mov [edi+TPaintEvent.rect.left], eax
- mov [edi+TPaintEvent.rect.top], ecx
-
- mov eax, [edx+TBounds.width]
- mov ecx, [edx+TBounds.height]
- add eax, [edi+TPaintEvent.rect.left]
- add ecx, [edi+TPaintEvent.rect.top]
- mov [edi+TPaintEvent.rect.right], eax
- mov [edi+TPaintEvent.rect.bottom], ecx
-
-.rectok:
- pushad
- stdcall ExecEvent, esi, edi
- popad
-
- stdcall ReleaseContext, ebx
-
-if defined Caret
- cmp [.caret], -1
- je @f
- stdcall CaretShow, [.caret]
-@@:
-end if
- pop edi esi edx ecx ebx eax
- return
-endp
DELETED freshlib/gui/Linux/TApplication.asm
Index: freshlib/gui/Linux/TApplication.asm
==================================================================
--- freshlib/gui/Linux/TApplication.asm
+++ /dev/null
@@ -1,347 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: TApplication object class.
-;
-; Target OS: Linux
-;
-; Dependencies:
-;
-; Notes: TApplication by the idea is the base of GUI application, but the implementation
-; somehow need fixing...
-;_________________________________________________________________________________________
-
-
-uglobal
- if used CApplication
- hApplicationDisplay dd ?
- hRootWindow dd ?
-
- hInputMethod dd ?
- hInputContext dd ?
-
- _SystemFont dd ?
-
- atomWMDelete dd ?
- end if
-endg
-
-;cDefaultFont text 'Tahoma-8'
-cDefaultFont text 'Liberation Sans-9'
-cDefaultFontSize = 9
-;cDefaultFont text 'Ubuntu-9:rgba=rgb'
-;cDefaultFont text 'Unifont-12' ; this one have unicode support;
-
-
-; String constants needed for XLib
-; Why, they needed so many strings????????????????? For arguments!??????????
-_cWinDeleteName text 'WM_DELETE_WINDOW'
-
-XNVaNestedList text "XNVaNestedList"
-XNSeparatorofNestedList text "separatorofNestedList"
-XNQueryInputStyle text "queryInputStyle"
-XNClientWindow text "clientWindow"
-XNInputStyle text "inputStyle"
-XNFocusWindow text "focusWindow"
-XNResourceName text "resourceName"
-XNResourceClass text "resourceClass"
-XNGeometryCallback text "geometryCallback"
-XNDestroyCallback text "destroyCallback"
-XNFilterEvents text "filterEvents"
-XNPreeditStartCallback text "preeditStartCallback"
-XNPreeditDoneCallback text "preeditDoneCallback"
-XNPreeditDrawCallback text "preeditDrawCallback"
-XNPreeditCaretCallback text "preeditCaretCallback"
-XNPreeditStateNotifyCallback text "preeditStateNotifyCallback"
-XNPreeditAttributes text "preeditAttributes"
-XNStatusStartCallback text "statusStartCallback"
-XNStatusDoneCallback text "statusDoneCallback"
-XNStatusDrawCallback text "statusDrawCallback"
-XNStatusAttributes text "statusAttributes"
-XNArea text "area"
-XNAreaNeeded text "areaNeeded"
-XNSpotLocation text "spotLocation"
-XNColormap text "colorMap"
-XNStdColormap text "stdColorMap"
-XNForeground text "foreground"
-XNBackground text "background"
-XNBackgroundPixmap text "backgroundPixmap"
-XNFontSet text "fontSet"
-XNLineSpace text "lineSpace"
-XNCursor text "cursor"
-XNQueryIMValuesList text "queryIMValuesList"
-XNQueryICValuesList text "queryICValuesList"
-XNStringConversionCallback text "stringConversionCallback"
-XNStringConversion text "stringConversion"
-XNResetState text "resetState"
-XNHotKey text "hotkey"
-XNHotKeyState text "hotkeyState"
-XNPreeditState text "preeditState"
-XNVisiblePosition text "visiblePosition"
-XNR6PreeditCallbackBehavior text "r6PreeditCallback"
-XNRequiredCharSet text "requiredCharSet"
-XNQueryOrientation text "queryOrientation"
-XNDirectionalDependentDrawing text "directionalDependentDrawing"
-XNContextualDrawing text "contextualDrawing"
-XNBaseFontName text "baseFontName"
-XNMissingCharSet text "missingCharSet"
-XNDefaultString text "defaultString"
-XNOrientation text "orientation"
-XNFontInfo text "fontInfo"
-XNOMAutomatic text "omAutomatic"
-
-
-
-proc TApplication.Create, .obj
-.ptr dd ?
-begin
- push eax ecx edx
-
- cinvoke XInitThreads
- test eax, eax
- jz .exit_error
-
- cinvoke XSetErrorHandler, __FreshXErrorHandler
-
- cinvoke XOpenDisplay, 0
- test eax, eax
- jz .second_try
-
-.continue:
- DebugMsg 'Display opened.'
-
- mov [hApplicationDisplay], eax
-
- cinvoke XDefaultRootWindow, eax
- mov [hRootWindow], eax
-
- cinvoke XOpenIM, [hApplicationDisplay], 0, 0, 0
- mov [hInputMethod], eax
-
- lea eax, [.ptr]
- cinvoke XGetIMValues, [hInputMethod], XNQueryInputStyle, eax, 0
-
- mov eax, [.ptr]
- mov eax, [eax+4]
- cinvoke XCreateIC, [hInputMethod], XNInputStyle, [eax], 0
- mov [hInputContext], eax
-
- cinvoke XFree, [.ptr]
-
- stdcall InitMouseCursors
-
-; Creating internal atoms that to be used with Window manager of the application windows...
-; Maybe this code should reside somewhere else, not in application. In initialize TWindow???
-
- cinvoke XInternAtom, [hApplicationDisplay], _cWinDeleteName, 0
- mov [atomWMDelete], eax
-
- cinvoke XftFontOpenName, [hApplicationDisplay], 0, cDefaultFont
- mov [_SystemFont], eax
-
-
-; clipboard initialization.
-if __UseClipboard = 1
- stdcall __InitLinuxClipboard
-end if
-
- clc
- pop edx ecx eax
- return
-
-.second_try:
- stdcall Sleep, 200 ; wait a little.
-
- cinvoke XOpenDisplay, 0
- test eax, eax
- jnz .continue
-
-.exit_error:
- Message 'Error open display.'
- stc
- pop edx ecx eax
- return
-
-
-
-
-endp
-
-
-
-
-proc TApplication.Get, .obj, .paramID
-begin
- stc
- return
-endp
-
-
-
-proc TApplication.Set, .obj, .paramID, .value
-begin
- stc
- return
-endp
-
-
-
-proc TApplication.SysEventHandler
-begin
- clc
- return
-endp
-
-
-
-
-cXErrorMsg text 'X server error:'
-cXErrorMsg2 text 10, 0
-cXErrorMsg3 text 'Request: '
-cXErrorMsg4 text 'Minor code: '
-cXErrorMsg5 text 'ResourceID: $'
-
-proc __FreshXErrorHandler, .display, .error
-.buff rb 256
-begin
-if (defined options.DebugMode) & options.DebugMode
- cmp [fGlobalTerminate], 0
- jne .exit
-
- stdcall Output, cXErrorMsg
- mov ebx, [.error]
-
- movzx eax, [ebx+XErrorEvent.error_code]
- lea ecx, [.buff]
- cinvoke XGetErrorText, [.display], eax, ecx, 256
-
- lea ecx, [.buff]
- stdcall Output, ecx
- stdcall Output, cXErrorMsg2
-
- stdcall Output, cXErrorMsg3
- movzx eax, [ebx+XErrorEvent.request_code]
- stdcall OutputNumber, eax, 10, 3
- stdcall Output, cXErrorMsg2
-
- stdcall Output, cXErrorMsg4
- movzx eax, [ebx+XErrorEvent.minor_code]
- stdcall OutputNumber, eax, 10, 3
- stdcall Output, cXErrorMsg2
-
- stdcall Output, cXErrorMsg5
- stdcall OutputNumber, [ebx+XErrorEvent.resourceid], 16, 8
- stdcall Output, cXErrorMsg2
- stdcall Output, cXErrorMsg2
-end if
-.exit:
- cret
-endp
-
-
-
-
-; This code and data possibly will be used in FreshLib, but I hope, not very soon. :)
-
-; cinvoke XInternAtom, [hApplicationDisplay], _cWinSyncRequest, 0
-; mov [atomSyncRequest], eax
-;
-;
-; cinvoke XInternAtom, [hApplicationDisplay], _cAtomTypeAtom, 0
-; mov [atomTypeATOM], eax
-;
-;; _NET_WM_WINDOW_TYPE
-; cinvoke XInternAtom, [hApplicationDisplay], _cWinTypeAtomName, 0
-; mov [atomWMType], eax
-;
-; cinvoke XInternAtom, [hApplicationDisplay], _cWinTypeDlg, 0
-; mov [atomWinTypeDlg], eax
-;
-; cinvoke XInternAtom, [hApplicationDisplay], _cWinTypeTool, 0
-; mov [atomWinTypeTool], eax
-;
-; cinvoke XInternAtom, [hApplicationDisplay], _cWinTypeDock, 0
-; mov [atomWinTypeDock], eax
-;
-; cinvoke XInternAtom, [hApplicationDisplay], _cWinTypeNormal, 0
-; mov [atomWinTypeNormal], eax
-;
-; cinvoke XInternAtom, [hApplicationDisplay], atomAllowedActions.text, 0
-; mov [atomAllowedActions], eax
-;
-; cinvoke XInternAtom, [hApplicationDisplay], atomAllowedActions.minimize.text, 0
-; mov [atomAllowedActions.minimize], eax
-;
-; cinvoke XInternAtom, [hApplicationDisplay], atomAllowedActions.close.text, 0
-; mov [atomAllowedActions.close], eax
-;
-; cinvoke XInternAtom, [hApplicationDisplay], atomWMState.text, 0
-; mov [atomWMState], eax
-;
-; cinvoke XInternAtom, [hApplicationDisplay], atomWMState.modal.text, 0
-; mov [atomWMState.modal], eax
-;
-
-;_cWinTypeAtomName text '_NET_WM_WINDOW_TYPE'
-; _cWinTypeDlg text '_NET_WM_WINDOW_TYPE_DIALOG'
-; _cWinTypeTool text '_NET_WM_WINDOW_TYPE_TOOLBAR' ; it is with normal toolbar, but with only close button.
-; _cWinTypeDock text '_NET_WM_WINDOW_TYPE_DOCK' ; without title bar and above all other windows???
-; _cWinTypeNormal text '_NET_WM_WINDOW_TYPE_NORMAL'
-
-;_cWinSyncRequest text '_NET_WM_SYNC_REQUEST'
-;_cAtomTypeAtom text 'ATOM'
-
-; notes on different types, regarding XFWM window manager:
-; _NET_WM_WINDOW_TYPE_SPLASH - no title, goes up on activation.
-; _NET_WM_WINDOW_TYPE_DOCK - no title, always on top
-; _NET_WM_WINDOW_TYPE_DROPDOWN_MENU - ???
-; _NET_WM_WINDOW_TYPE_NOTIFICATION - ???
-; _
-;
-
-
-;macro atomset lbl, name, [valname, value] {
-;common
-; lbl dd ?
-;forward
-; valname dd ?
-;common
-; lbl#.text text `name
-;forward
-; lbl#valname#.text text `value
-;}
-;
-
-;uglobal
-; atomSyncRequest dd ?
-;
-; atomTypeATOM dd ?
-;
-; atomWMType dd ?
-; atomWinTypeDlg dd ?
-; atomWinTypeTool dd ?
-; atomWinTypeDock dd ?
-; atomWinTypeNormal dd ?
-;endg
-;
-;
-;iglobal
-; atomset atomAllowedActions, _NET_WM_ALLOWED_ACTIONS, \
-; .move, _NET_WM_ACTION_MOVE, \
-; .resize, _NET_WM_ACTION_RESIZE, \
-; .minimize, _NET_WM_ACTION_MINIMIZE, \
-; .shade, _NET_WM_ACTION_SHADE, \
-; .stick, _NET_WM_ACTION_STICK, \
-; .maximize_horz, _NET_WM_ACTION_MAXIMIZE_HORZ, \
-; .maximize_vert, _NET_WM_ACTION_MAXIMIZE_VERT, \
-; .fullscreen, _NET_WM_ACTION_FULLSCREEN, \
-; .change_desktop, _NET_WM_ACTION_CHANGE_DESKTOP, \
-; .close, _NET_WM_ACTION_CLOSE
-;
-; atomset atomWMState, _NET_WM_STATE, \
-; .modal, _NET_WM_STATE_MODAL
-;
-;endg
-;
DELETED freshlib/gui/Linux/keycodes.inc
Index: freshlib/gui/Linux/keycodes.inc
==================================================================
--- freshlib/gui/Linux/keycodes.inc
+++ /dev/null
@@ -1,74 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: This file contains scan code values for control keyboard keys.
-;
-; Target OS: Linux
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-keyHomeNumpad = $ff95
-keyUpNumpad = $ff97
-keyPgUpNumpad = $ff9a
-keyLeftNumpad = $ff96
-key5Numpad = $ff9d
-keyRightNumpad = $ff98
-keyEndNumpad = $ff9c
-keyDownNumpad = $ff99
-keyPgDnNumpad = $ff9b
-keyInsNumpad = $ff9e
-keyDelNumpad = $ff9f
-keyEnterNumpad = $ff8d
-keyPlusNumpad = $ffab
-keyMinusNumpad = $ffad
-keyAsteriskNumpad = $ffaa
-keySlashNumpad = $ffaf
-
-keyNumLock = $ff7f
-keyScrollLock = $ff14
-keyPause = $ff13
-
-
-keyLeft = $ff51
-keyRight = $ff53
-keyUp = $ff52
-keyDown = $ff54
-
-keyInsert = $ff63
-keyDelete = $ffff
-keyHome = $ff50
-keyEnd = $ff57
-keyPgUp = $ff55
-keyPgDown = $ff56
-
-keyF1 = $ffbe
-keyF2 = $ffbf
-keyF3 = $ffc0
-keyF4 = $ffc1
-
-keyF5 = $ffc2
-keyF6 = $ffc3
-keyF7 = $ffc4
-keyF8 = $ffc5
-
-keyF9 = $ffc6
-keyF10 = $ffc7
-keyF11 = $ffc8
-keyF12 = $ffc9
-
-keyCapsLock = $ffe5
-keyShiftLeft = $ffe1
-keyCtrlLeft = $ffe3
-;keyWndLeft =
-;keyWndRight =
-keyAltLeft = $ffe9
-keyAltRight = $ffea
-keyPopupMenu = $ff67
-keyShiftRight = $ffe2
-keyCtrlRight = $ffe4
-keyBackSpace = $ff08
DELETED freshlib/gui/Linux/mouse.asm
Index: freshlib/gui/Linux/mouse.asm
==================================================================
--- freshlib/gui/Linux/mouse.asm
+++ /dev/null
@@ -1,100 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Provides unified access to standard mouse cursors.
-;
-; Target OS: Linux
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-iglobal
- if used _Xcursors
- _Xcursors db 68, 152, 34, 108, 116, 40, 40, 150 ; X standard cursor font
- end if
-endg
-
-
-uglobal
- if used StockCursors
- StockCursors rd mcCount
- end if
-endg
-
-
-proc InitMouseCursors
-begin
- push eax ecx edx ebx
- mov ebx, mcCount-1
-
-.create_cursor_loop:
- movzx eax, [_Xcursors+ebx]
- cinvoke XCreateFontCursor, [hApplicationDisplay], eax
- mov [StockCursors+4*ebx], eax
-
- dec ebx
- jns .create_cursor_loop
- pop ebx edx ecx eax
- return
-endp
-
-
-
-if used InitMouseCursors
-finalize FinalizeMouseCursors
-begin
- mov ebx, mcCount-1
- cmp [hApplicationDisplay], 0
- je .exit
-
-.free_cursor_loop:
- cinvoke XFreeCursor, [hApplicationDisplay], [StockCursors+4*ebx]
- dec ebx
- jns .free_cursor_loop
-
-.exit:
- return
-endp
-end if
-
-
-proc SetMouseCursor, .hCursor
-begin
- push eax ecx edx
- cinvoke XDefineCursor, [hApplicationDisplay], [hRootWindow], [.hCursor]
- pop edx ecx eax
- return
-endp
-
-
-
-proc GetStockCursor, .index
-begin
- mov eax, [.index]
- and eax, 7
- mov eax, [StockCursors+4*eax]
- return
-endp
-
-
-proc MouseCapture, .hwnd
-begin
- push eax ecx edx
- cmp [.hwnd], 0
- je .release
-
- cinvoke XGrabPointer, [hApplicationDisplay], [.hwnd], FALSE, PointerMotionMask or ButtonPressMask or ButtonReleaseMask, \
- GrabModeAsync, GrabModeAsync, None, None, CurrentTime
-
-.finish:
- pop edx ecx eax
- return
-
-.release:
- cinvoke XUngrabPointer, [hApplicationDisplay], CurrentTime
- jmp .finish
-endp
DELETED freshlib/gui/Linux/windows.asm
Index: freshlib/gui/Linux/windows.asm
==================================================================
--- freshlib/gui/Linux/windows.asm
+++ /dev/null
@@ -1,421 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Window management OS interface functions.
-;
-; Target OS: Linux
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-
-proc _CreateNullWindow
-.attr XSetWindowAttributes
-begin
- push ecx edx esi
-
- lea eax, [.attr]
- mov [eax+XSetWindowAttributes.override_redirect], 1
- mov [eax+XSetWindowAttributes.backing_store], NotUseful
- mov [eax+XSetWindowAttributes.background_pixmap], None
- cinvoke XCreateWindow, [hApplicationDisplay], [hRootWindow], 0, 0, 1, 1, 0, CopyFromParent, InputOutput, CopyFromParent, CWBackingStore or CWOverrideRedirect or CWBackPixmap, eax
- mov esi, eax
- test eax, eax
- jz .exit
-
- cinvoke XSelectInput, [hApplicationDisplay], esi, ExposureMask or StructureNotifyMask or FocusChangeMask or \
- KeyPressMask or KeyReleaseMask or \
- ButtonPressMask or ButtonReleaseMask or \
- EnterWindowMask or LeaveWindowMask or \
- PointerMotionMask
-
- cinvoke XSetWMProtocols, [hApplicationDisplay], esi, atomWMDelete, 1
- mov eax, esi
-.exit:
- pop esi edx ecx
- return
-endp
-
-
-
-;_________________________________________________________________________________________
-
-
-
-proc _DestroyWindow, .hwnd
-begin
- push eax ecx edx
- stdcall _SetWindowStruct, [.hwnd], 0
- cinvoke XDestroyWindow, [hApplicationDisplay], [.hwnd]
- pop edx ecx eax
- return
-endp
-
-
-
-;_________________________________________________________________________________________
-
-
-
-proc _GetParent, .hwnd
-.root dd ?
-.parent dd ?
-.children dd ?
-.count dd ?
-begin
- push ecx edx esi
-
- lea esi, [.count]
- lea edx, [.children]
- lea ecx, [.parent]
- lea eax, [.root]
- cinvoke XQueryTree, [hApplicationDisplay], [.hwnd], eax, ecx, edx, esi
- test eax, eax
- jz .exit ; function failed
-
- cinvoke XFree, [.children]
-
- mov eax, [.parent]
-
-.exit:
- pop esi edx ecx
- return
-endp
-
-
-
-;_________________________________________________________________________________________
-
-
-proc _GetChildren, .hwnd
- .root dd ?
- .parent dd ?
- .children dd ?
- .count dd ?
-begin
- push ebx ecx edx esi
-
-
- lea ebx, [.count]
- lea edx, [.children]
- lea ecx, [.parent]
- lea eax, [.root]
- cinvoke XQueryTree, [hApplicationDisplay], [.hwnd], eax, ecx, edx, ebx
- test eax, eax
- jz .exit ; function failed
-
- xor ebx, ebx
- mov esi, [.children]
- test esi, esi
- jz .endchildren
-
- stdcall CreateArray, sizeof.TWinArrayItem
- mov ebx, eax
- mov ecx, [.count]
-
-.loophwnd:
- dec ecx
- js .endchildren_free
-
- stdcall AddArrayItems, ebx, 1
- mov ebx, edx
-
- mov edx, [esi+4*ecx]
- mov [eax+TWinArrayItem.handle], edx
-
- jmp .loophwnd
-
-.endchildren_free:
- cinvoke XFree, esi
-
-.endchildren:
- mov eax, ebx
-.exit:
- pop esi edx ecx ebx
- return
-endp
-
-
-;_________________________________________________________________________________________
-
-
-
-proc _GetVisible, .hwnd
-.attr XWindowAttributes
-begin
- push ebx ecx edx
-
- lea ebx, [.attr]
- cinvoke XGetWindowAttributes, [hApplicationDisplay], [.hwnd], ebx
- mov eax, [ebx+XWindowAttributes.map_state]
- test eax, eax
- jz @f
- mov eax, 1
-@@:
- pop edx ecx ebx
- return
-endp
-
-;_________________________________________________________________________________________
-
-
-proc _GetWindowBounds, .hwnd, .pBounds
-begin
- push eax ecx edx
-
- int3
- pop edx ecx eax
- return
-endp
-
-
-;_________________________________________________________________________________________
-
-
-proc _SetWindowBounds, .hwnd, .pBounds
- .wch XWindowChanges
-begin
- push eax ecx edx
-
- lea eax, [.wch]
- mov edx, [.pBounds]
-
- push [edx+TBounds.x] [edx+TBounds.y] [edx+TBounds.width] [edx+TBounds.height]
- pop [.wch.height] [.wch.width] [.wch.y] [.wch.x]
-
- cmp [.wch.width], 0
- jnz @f
- inc [.wch.width]
-@@:
- cmp [.wch.height], 0
- jnz @f
- inc [.wch.height]
-@@:
- cinvoke XConfigureWindow, [hApplicationDisplay], [.hwnd], CWX or CWY or CWWidth or CWHeight, eax
-
- pop edx ecx eax
- return
-endp
-
-
-;_________________________________________________________________________________________
-
-
-
-proc _SetWindowBorder, .hwnd, .brdType
- .attr XSetWindowAttributes
-begin
- push eax ecx edx
-
- mov [.attr.override_redirect], 1
- cmp [.brdType], borderNone
- je @f
- mov [.attr.override_redirect], 0
-@@:
- lea eax, [.attr]
- cinvoke XChangeWindowAttributes, [hApplicationDisplay], [.hwnd], CWOverrideRedirect, eax
-
- pop edx ecx eax
- return
-endp
-
-;_________________________________________________________________________________________
-
-
-proc _ShowWindow, .hwnd, .flag
-begin
- push eax ecx edx
-
- mov ecx, XUnmapWindow
- cmp [.flag], 0
- je @f
- mov ecx, XMapWindow
-@@:
- push [.hwnd] [hApplicationDisplay]
- call dword [ecx]
- add esp, 8
-
- pop edx ecx eax
- return
-endp
-
-
-;_________________________________________________________________________________________
-
-
-proc _RefreshWindow, .hwnd
-begin
- push eax ecx edx
- cinvoke XClearArea, [hApplicationDisplay], [.hwnd], 0, 0, 0, 0, TRUE
- cinvoke XFlush, [hApplicationDisplay]
- pop edx ecx eax
- return
-endp
-
-
-;_________________________________________________________________________________________
-
-
-proc _SetFocus, .hwnd
-begin
- push eax ecx edx
- cinvoke XSetInputFocus, [hApplicationDisplay], [.hwnd], RevertToParent, CurrentTime
- pop edx ecx eax
- return
-endp
-
-;_________________________________________________________________________________________
-
-proc _AddChild, .hwnd, .child
-begin
- push eax ecx edx
- cinvoke XReparentWindow, [hApplicationDisplay], [.child], [.hwnd], 10, 10
- pop edx ecx eax
- return
-endp
-
-;_________________________________________________________________________________________
-
-
-proc _SetWindowTextUtf8, .hwnd, .ptrUtf8
-begin
- push eax ecx edx
- cinvoke XStoreName, [hApplicationDisplay], [.hwnd], [.ptrUtf8]
- pop edx ecx eax
- return
-endp
-
-
-
-;_________________________________________________________________________________________
-
-
-
-proc _GetWindowTextUtf8, .hwnd, .ptrUtf8
-begin
- return
-endp
-
-
-
-
-;_________________________________________________________________________________________
-
-proc _EnableWindow, .hwnd, .flag
-begin
- push eax ecx edx
-
- stdcall _GetChildren, [.hwnd]
- test eax, eax
- jz .children_ok
-
- mov edx, [eax+TArray.count]
-.child_loop:
- dec edx
- js .end_children
-
- stdcall _EnableWindow, [eax+TArray.array+sizeof.TWinArrayItem*edx+TWinArrayItem.handle], [.flag]
- jmp .child_loop
-
-.end_children:
- stdcall FreeMem, eax
-
-.children_ok:
- mov ecx, ExposureMask or StructureNotifyMask or EnterWindowMask or LeaveWindowMask or PointerMotionMask
- cmp [.flag], 0
- je @f
- or ecx, FocusChangeMask or KeyPressMask or KeyReleaseMask or \
- ButtonPressMask or ButtonReleaseMask
-@@:
- cinvoke XSelectInput, [hApplicationDisplay], [.hwnd], ecx
-
- pop edx ecx eax
- return
-endp
-
-;_________________________________________________________________________________________
-
-proc _SetModalTowards, .hwnd, .hwndParent
-begin
- push eax ecx edx
- cinvoke XSetTransientForHint, [hApplicationDisplay], [.hwnd], [.hwndParent]
- pop edx ecx eax
- return
-endp
-
-;_________________________________________________________________________________________
-
-proc _FinalizeModal, .hwnd, .hwndParent
- .flushevent XEvent
-begin
- push eax ecx edx
-
- DebugMsg "Finalize modal"
-
-; dirty hack, but the button receives LeaveNotify after DestroyNotify
- cinvoke XSync, [hApplicationDisplay], FALSE
-.loop_flush:
- lea eax, [.flushevent]
- cinvoke XCheckMaskEvent, [hApplicationDisplay], LeaveWindowMask, eax
- test eax, eax
- jnz .loop_flush
-
- pop edx ecx eax
- return
-endp
-
-
-;_________________________________________________________________________________________
-
-
-win_structure_context = 1
-
-
-proc _GetWindowStruct, .hwin
- .user_data dd ?
-begin
- push ecx edx
- lea eax, [.user_data]
- cinvoke XFindContext, [hApplicationDisplay], [.hwin], win_structure_context, eax
- test eax, eax
- jnz .error
-
- mov eax, [.user_data]
- clc
- pop edx ecx
- return
-
-.error:
- DebugMsg 'FreshLib: Error find context.'
- mov edx, [ebp+4]
- OutputRegister regEDX, 16
-
- xor eax, eax
- pop edx ecx
- return
-endp
-
-
-
-
-;_________________________________________________________________________________________
-
-
-
-proc _SetWindowStruct, .hwin, .value
-begin
- push eax ecx edx
- cinvoke XSaveContext, [hApplicationDisplay], [.hwin], win_structure_context, [.value]
- pop edx ecx eax
- return
-endp
-
-
-
-
-
-
DELETED freshlib/gui/Main.asm
Index: freshlib/gui/Main.asm
==================================================================
--- freshlib/gui/Main.asm
+++ /dev/null
@@ -1,125 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Main procedure of GUI application library.
-;
-; Target OS: Any
-;
-; Dependencies:
-;
-; Notes: Organize the main message/event loop needed by every GUI engine.
-; This file contains only OS independent part and includes OS dependent files.
-;_________________________________________________________________________________________
-module "Main library"
-
-uglobal
- if used pApplication
- pApplication dd ?
- end if
-endg
-
-
-proc Run
-begin
-.mainloop:
- stdcall ProcessSystemEvents
- jc .terminate
-
- mov eax, [pApplication]
- test eax, eax
- jz .eventok
-
- cmp [eax+TApplication.OnIdle], 0
- je .eventok
-
- pushad
- stdcall [eax+TApplication.OnIdle], eax
- popad
-
-.eventok:
- stdcall WaitForSystemEvent
- jmp .mainloop
-
-.terminate:
- return
-endp
-
-
-
-
-proc ShowModal, .pForm, .pParent
-.prev dd ?
-begin
- push ecx edx
- mov ecx, [.pParent]
- mov edx, [.pForm]
-
- jecxz @f
- stdcall _SetModalTowards, [edx+TForm.handle], [ecx+TWindow.handle]
-@@:
- stdcall Set, edx, TForm.Visible, TRUE
-
- jecxz @f
- stdcall _EnableWindow, [ecx+TWindow.handle], FALSE
-@@:
-
- mov [edx+TForm.ModalResult], 0
-
- stdcall Get, edx, TForm.OnClose
- mov [.prev], eax
- stdcall Set, edx, TForm.OnClose, __ModalOnClose
-
-.modal_loop:
- stdcall ProcessSystemEvents
- jc .exit_modal
-
- cmp [edx+TForm.ModalResult], 0
- jne .exit_modal
-
- stdcall Get, edx, TWindow.Visible
- test eax, eax
- jz .exit_modal
-
-.vis_ok:
- stdcall WaitForSystemEvent
- jmp .modal_loop
-
-.exit_modal:
- jecxz @f
- stdcall _EnableWindow, [ecx+TWindow.handle], TRUE
-@@:
-
- stdcall Set, edx, TForm.OnClose, [.prev]
- stdcall Set, edx, TForm.Visible, FALSE
-
- jecxz @f
- mov ecx, [ecx+TWindow.handle]
-@@:
- stdcall _FinalizeModal, [edx+TForm.handle], ecx
-
- mov eax, [edx+TForm.ModalResult]
- pop edx ecx
- return
-endp
-
-
-; prevent destroy of the form from the close button or Alt+F4
-proc __ModalOnClose, .self, .reason
-begin
- push eax
- mov eax, [.self]
- mov [eax+TForm.ModalResult], mrCancel
- stc
- pop eax
- return
-endp
-
-
-
-
-
-include '%TargetOS%/Main.asm'
-
-endmodule
DELETED freshlib/gui/ObjTemplates.asm
Index: freshlib/gui/ObjTemplates.asm
==================================================================
--- freshlib/gui/ObjTemplates.asm
+++ /dev/null
@@ -1,131 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Objects template engine
-;
-; Target OS: Any
-;
-; Dependencies: objects.asm
-;
-; Notes:
-;_________________________________________________________________________________________
-module "Templates library"
-
-tfChild = 0
-tfParent = 1
-tfEnd = 2
-
-
-struct TObjTemplate
- .flags dd ? ; tfParent; tfEnd
- .class dd ?
- .ptrVar dd ? ; can be NULL
- .paramsize dd ?
- .params:
-ends
-
-
-macro ObjTemplate flags, class, name, [id, param] {
-common
-local ..paramsize, ..prms
- dd flags
- dd C#class
- dd name
- dd ..paramsize
-..prms:
-forward
-local ..value
- dd T#class#.#id
- dd ..value
-common
- dd -1
-forward
- if param eqtype 2
- ..value = param
- else
- ..value db param, 0
- end if
-common
- name dd ?
- ..paramsize = $ - ..prms
-}
-
-
-; returns the last created window in ebx.
-
-proc CreateFromTemplate, .ptrTemplate, .parent
-begin
- push esi
-
- mov esi, [.ptrTemplate]
- stdcall _DoCreateFromTemplate, [.parent]
-
- pop esi
- return
-endp
-
-
-proc _DoCreateFromTemplate, .parent
-begin
- push eax ecx edx
-
-.createloop:
- stdcall Create, [esi+TObjTemplate.class]
- execute [.parent], TObject.AddChild, ebx
-
- lea ecx, [esi+TObjTemplate.params]
-
-.paramloop:
- cmp dword [ecx], -1
- je .paramsok
-
- push ebx ecx edx esi edi
- stdcall Set, ebx, [ecx], [ecx+4]
- pop edi esi edx ecx ebx
- add ecx, 8
- jmp .paramloop
-
-.paramsok:
- mov eax, [esi+TObjTemplate.ptrVar]
- test eax, eax
- jz .oncreate
-
- mov [ebx+TObject.ptrVar], eax ; back link to the object instance variable.
- mov [eax], ebx ; returned pointer/handle to the object.
-
-.oncreate:
- cmp [ebx+TObject.OnCreate], 0
- je .gonext
-
-; execute user OnCreate event.
- pushad
- stdcall [ebx+TObject.OnCreate], ebx
- popad
-
-.gonext:
- mov edx, [esi+TObjTemplate.flags]
-
- mov eax, sizeof.TObjTemplate
- add eax, [esi+TObjTemplate.paramsize]
- add esi, eax
-
- test edx, tfParent
- jz .childrenok
-
- push ebx
- stdcall _DoCreateFromTemplate, ebx
- pop ebx
-
-.childrenok:
- test edx, tfEnd
- jz .createloop
-
-.exit:
- pop edx ecx eax
- return
-endp
-
-
-endmodule
DELETED freshlib/gui/TAction.asm
Index: freshlib/gui/TAction.asm
==================================================================
--- freshlib/gui/TAction.asm
+++ /dev/null
@@ -1,79 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Actions management library.
-;
-; Target OS: Any
-;
-; Dependencies:
-;
-; Notes: "Action" is set of executable code, combined with user interface attributes -
-; caption, accelerator keys, enable/disable status flag etc.
-; Different UI elements, such as buttons, menu items etc. can be attached to
-; the action object and to use its attributes. When the programmer changes
-; something in the action, all UI elements are updated automatically.
-;_________________________________________________________________________________________
-
-struc TAction caption, hint, icon, FastKey, enabled, OnExecute, OnIdle {
-common
- .Text dd caption ; handle or pointer to the caption string.
- .Hint dd hint ; handle or pointer to the Hint text.
- .icon dd icon ; pointer to TImage
- .FastKey dd FastKey ; pointer to keyboard accelerator combination.
- .Enabled dd enabled ; if FALSE, the action is not active.
- .OnExecute dd OnExecute ; pointer to procedure to be executed on activation of the action.
- .OnIdle dd OnIdle ; pointer to procedure that to be executed once, when there is no other events in the queue.
-}
-
-virtual at 0
- TAction TAction ?, ?, ?, ?, ?, ?, ?
-end virtual
-
-
-struc TFastKey flags, key, action {
- .flags dd flags
- .key dd key
- .action dd action
-}
-virtual at 0
- TFastKey TFastKey ?, ?, ?
-end virtual
-
-
-struct TActionList
- .count dd ?
- .accelerators dd ?
- .actions:
-ends
-
-
-
-macro ActionList name, [actname, caption, hint, icon, FastKey, OnExecute, OnIdle] {
-common
- local i, count, acclist
- i = 0
- label name dword
- .count dd count
- .accelerators dd acclist
-forward
- local .accitem, txtlbl, hintlbl
-
- txtlbl text caption
- hintlbl text hint
-
- actname TAction txtlbl, hintlbl, icon, accitem, 1, OnExecute, OnIdle
-
- i = i + 1
-common
- count = i
- label acclist dword
-
-forward
- if FastKey eq NONE
- accitem = 0
- else
- .accitem TFastKey FastKey, name#actname
- end if
-}
DELETED freshlib/gui/TApplication.asm
Index: freshlib/gui/TApplication.asm
==================================================================
--- freshlib/gui/TApplication.asm
+++ /dev/null
@@ -1,42 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: TApplication object class.
-;
-; Target OS: Any
-;
-; Dependencies:
-;
-; Notes: TApplication by the idea is the base of GUI application, but the implementation
-; somehow need fixing...
-;_________________________________________________________________________________________
-module "TApplication library"
-
-ObjectClass Application, \
- Object, \
- TApplication.Create, \
- 0, \
- TApplication.Get, \
- TApplication.Set, \
- 0, \
- TApplication.SysEventHandler
-
-
-
-; The root object in the application.
-; every other object will be child on the TApplication.MainWindow.
-; only one instance of TApplication should be created.
-;
-object TApplication, TObject
- .MainWindow dd ? ; pointer to a variable that contains pointer to the main window of the application. When this variable becomes 0 the application terminates.
- .Accelerators dd ? ; table of application wide hot keys.
- .OnIdle dd ? ; user event handler for idle state.
-endobj
-
-
-include '%TargetOS%/TApplication.asm'
-
-
-endmodule
DELETED freshlib/gui/TButton.asm
Index: freshlib/gui/TButton.asm
==================================================================
--- freshlib/gui/TButton.asm
+++ /dev/null
@@ -1,342 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: TButton object class
-;
-; Target OS: Any
-;
-; Dependencies:
-;
-; Notes: Represents GUI button.
-;_________________________________________________________________________________________
-module "TButton library"
-
-ObjectClass Button, \
- Window, \
- 0, \
- 0, \
- TButton.Get, \
- TButton.Set, \
- 0, \
- TButton.SysEventHandler
-
-
-; Button states for the field TButton.state
-btnNormal = 0
-btnPressed = 1
-btnPointed = 2
-btnChecked = 3
-
-
-
-
-object TButton, TWindow
- .state dd ?
- .Ficon dd ?
- .FiconAlign dd ?
- .Ftextalign dd ?
-
- .ModalResult dd ?
- .OnClick dd ?
-
- param .TextAlign
- param .Icon
- param .IconPosition
-endobj
-
-
-
-proc TButton.Get, .obj, .paramID
-begin
- mov eax, [.obj]
-
- stdcall IsObject, eax, CButton
- jc .exit
-
- cmp [.paramID], TButton.TextAlign
- je .gettextalign
-
- cmp [.paramID], TButton.IconPosition
- je .geticonposition
-
- cmp [.paramID], TButton.Icon
- je .geticon
-
- stc
-.exit:
- return
-
-.geticonposition:
- mov eax, [eax+TButton.FiconAlign]
- clc
- return
-
-.geticon:
- mov eax, [eax+TButton.Ficon]
- clc
- return
-
-.gettextalign:
- mov eax, [eax+TButton.Ftextalign]
- clc
- return
-endp
-
-
-
-
-
-dproc TButton.Set, .obj, .paramID, .value
-begin
- push eax ecx
- mov ecx, [.obj]
-
-dispatch [.paramID]
-
- stc
- pop ecx eax
- return
-
-.refresh:
- execute [.obj], TWindow.Refresh
- clc
- pop ecx eax
- return
-
-
-oncase TButton.TextAlign
- push [.value]
- pop [ecx+TButton.Ftextalign]
- jmp .refresh
-
-
-oncase TButton.Icon
- push [.value]
- pop [ecx+TButton.Ficon]
- jmp .refresh
-
-
-oncase TButton.IconPosition
- push [.value]
- pop [ecx+TButton.FiconAlign]
- jmp .refresh
-
-enddp
-
-
-
-
-dproc TButton.SysEventHandler, .pObj, .pEvent
-begin
- pushad
-
- mov esi, [.pObj]
- mov ebx, [.pEvent]
-
- dispatch [ebx+TSysEvent.event]
-
-.finish:
- stc
- popad
- return
-
-
-;. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-
-oncase sePaint
-; PAINT event is very important.
- mov edx, bxFlat
- mov edi, [clButtonBk] ; background
- mov ecx, [clButtonTxt] ; text
-
- cmp [esi+TButton.state], btnNormal
- je .drawit
-
- mov edx, bxRaised
- mov edi, [clButtonHotBk]
- mov ecx, [clButtonHotTxt]
-
- cmp [esi+TButton.state], btnPointed
- je .drawit
-
- mov edx, bxSunken
- mov edi, [clButtonBk]
- mov ecx, [clButtonHotTxt]
-
- cmp [esi+TButton.state], btnPressed
- je .drawit
-
- mov edx, bxFlat
-
-.drawit:
-locals
- .bounds TBounds
- .clTxt dd ?
-endl
- mov [.clTxt], ecx
-
- mov ecx, [esi+TButton._width]
- mov eax, [esi+TButton._height]
- mov [.bounds.x], 0
- mov [.bounds.y], 0
- mov [.bounds.width], ecx
- mov [.bounds.height], eax
- lea eax, [.bounds]
- stdcall [DrawBox], [ebx+TPaintEvent.context], eax, edi, edx
-
-; first draw the icon and then resize bounds for the text.
- mov edi, [esi+TButton.Ficon]
- test edi, edi
- jz .draw_text
-
- cmp [esi+TButton.FiconAlign], AlignLeft
- jne @f
-
-; align left
- mov eax, [.bounds.x]
- mov ecx, [.bounds.height]
- add eax, 2
- sub ecx, [edi+TImage.height]
- sar ecx, 1
- add ecx, [.bounds.y]
-
- mov edx, [edi+TImage.width]
- add edx, 4
- add [.bounds.x], edx
- sub [.bounds.width], edx
- jmp .draw_icon
-
-@@:
- cmp [esi+TButton.FiconAlign], AlignRight
- jne @f
-
-; align right
- mov edx, [edi+TImage.width]
-
- mov eax, [.bounds.x]
- add eax, [.bounds.width]
- sub eax, edx
- sub eax, 2
- sub [.bounds.width], edx
- sub [.bounds.width], 4
-
- mov ecx, [.bounds.height]
- sub ecx, [edi+TImage.height]
- sar ecx, 1
- add ecx, [.bounds.y]
- jmp .draw_icon
-
-@@:
- cmp [esi+TButton.FiconAlign], AlignTop
- jne @f
-
-; align top
- mov ecx, [.bounds.y]
- add ecx, 2
- mov eax, [.bounds.width]
- sub eax, [edi+TImage.width]
- sar eax, 1
- add eax, [.bounds.x]
-
- mov edx, [edi+TImage.height]
- add edx, 4
- add [.bounds.y], edx
- sub [.bounds.height], edx
- jmp .draw_icon
-
-@@:
- cmp [esi+TButton.FiconAlign], AlignBottom
- jne .draw_text
-
-; align bottom
- mov edx, [edi+TImage.height]
-
- mov ecx, [.bounds.y]
- add ecx, [.bounds.height]
- sub ecx, edx
- sub ecx, 2
- sub [.bounds.height], edx
- sub [.bounds.height], 4
-
- mov eax, [.bounds.width]
- sub eax, [edi+TImage.width]
- sar eax, 1
- add eax, [.bounds.x]
-
-.draw_icon:
- stdcall DrawImage, [ebx+TPaintEvent.context], [esi+TButton.Ficon], eax, ecx
-
-.draw_text:
- stdcall Get, esi, TWindow.Caption
- test eax, eax
- jz .finish
-
- push eax eax
- stdcall StrLen, eax
- mov ecx, eax
- pop eax
- lea edx, [.bounds]
- stdcall DrawTextBox, [ebx+TPaintEvent.context], eax, edx, [esi+TButton.Ftextalign], 0, [.clTxt]
- stdcall StrDel ; from the stack
- jmp .finish
-
-
-;. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-
-oncase seMouseEnter
- mov [esi+TButton.state], btnPointed
- execute esi, TButton.Refresh
- jmp .finish
-
-
-;. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-
-
-oncase seMouseLeave
- mov [esi+TButton.state], btnNormal
- execute esi, TButton.Refresh
- jmp .finish
-
-
-;. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-
-
-oncase seMouseBtnPress
- mov [esi+TButton.state], btnPressed
- execute esi, TWindow.Refresh
- jmp .finish
-
-
-;. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-
-
-oncase seMouseBtnRelease
-
- cmp [esi+TButton.state], btnPressed
- jne .finish
-
- mov [esi+TButton.state], btnPointed
- execute esi, TButton.Refresh
-
- cmp [esi+TButton.ModalResult], mrNone
- je @f
-
- stdcall Get, esi, TButton.Parent
- stdcall IsObject, eax, CForm
- jc @f
-
- push [esi+TButton.ModalResult]
- pop [eax+TForm.ModalResult]
-
-@@:
- cmp [esi+TButton.OnClick], 0
- je .finish
-
- stdcall [esi+TButton.OnClick], esi, [ebx+TMouseButtonEvent.Button]
- jmp .finish
-enddp
-
-
-endmodule
DELETED freshlib/gui/TEdit.asm
Index: freshlib/gui/TEdit.asm
==================================================================
--- freshlib/gui/TEdit.asm
+++ /dev/null
@@ -1,587 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: TEdit object class
-;
-; Target OS: Any
-;
-; Dependencies:
-;
-; Notes: Represents single line edit control.
-;_________________________________________________________________________________________
-module "TEdit library"
-
-ObjectClass Edit, \
- Window, \
- TEdit.Create, \
- TEdit.Destroy, \
- TEdit.Get, \
- TEdit.Set, \
- 0, \
- TEdit.SysEventHandler
-
-
-object TEdit, TWindow
- ._Text dd ?
- ._Len dd ? ; the length of the string in characters. (UTF-8)
- ._Start dd ? ; Where the string begins to be displayed in the edit window.
- ._Pos dd ? ; Position of the caret in the string.
- ._Sel dd ? ; Position of the selction in the string.
-
- ._MarginLeft dd ?
- ._MarginRight dd ?
-
- ._Focused dd ? ; flag
-
- param .Text
-endobj
-
-
-proc TEdit.Create, .obj
-begin
- push ecx eax
- stdcall StrNew
- mov ecx, [.obj]
- mov [ecx+TEdit._Text], eax
-
-; for test. Normal value is 0 for these fields.
-; mov [ecx+TEdit._MarginLeft], 8
-; mov [ecx+TEdit._MarginRight], 16
-
- mov [ecx+TEdit._cursor], mcText
-
- pop eax ecx
- clc
- return
-endp
-
-
-proc TEdit.Destroy, .obj
-begin
- mov eax, [.obj]
- stdcall StrDel, [eax+TEdit._Text]
- return
-endp
-
-
-proc TEdit.Get, .obj, .paramID
-begin
- stdcall IsObject, [.obj], CEdit
- jc .exit
-
- cmp [.paramID], TEdit.Text
- je .gettext
-
- stc
-.exit:
- return
-
-.gettext:
- mov eax, [.obj]
- stdcall StrDup, [eax+TEdit._Text]
- clc
- return
-endp
-
-
-
-
-proc TEdit.Set, .obj, .paramID, .value
-begin
- push esi
-
- mov esi, [.obj]
-
- cmp [.paramID], TEdit.Text
- je .settext
-
- stc
- pop esi
- return
-
-.settext:
- push eax
- mov [esi+TEdit._Start], 0
- mov [esi+TEdit._Pos], 0
- mov [esi+TEdit._Sel], 0
-
- lea eax, [esi+TEdit._Text]
- stdcall SetString, eax, [.value]
- stdcall StrLenUtf8, [esi+TEdit._Text], -1
- mov [esi+TEdit._Len], eax
-
- execute esi, TEdit.Refresh
- clc
- pop eax
- pop esi
- return
-endp
-
-
-
-
-
-
-proc TEdit.SysEventHandler, .pObj, .pEvent
-.changes dd ?
-.prevpos dd ?
-.PosChanged = 1
-.NeedRefresh = 2
-.ShowCaret = 4
-begin
- push eax ebx ecx edx esi edi
-
- mov [.changes], 0
- mov esi, [.pObj]
- mov ebx, [.pEvent]
- mov eax, [ebx+TSysEvent.event]
-
- cmp eax, sePaint
- je .onpaint
-
- cmp eax, seKbdKeyPress
- je .keypress
-
- cmp eax, seFocusIn
- je .focusin
-
- cmp eax, seFocusOut
- je .focusout
-
-.finish:
- stc
- pop edi esi edx ecx ebx eax
- return
-
-;............................................................................................
-
-.focusin:
- mov [esi+TEdit._Focused], TRUE
- stdcall CaretAttach, esi
- or [.changes], .PosChanged or .ShowCaret
- jmp .endmove
-
-.focusout:
- stdcall CaretShow, FALSE
- mov [esi+TEdit._Focused], FALSE
- or [.changes], .PosChanged
- jmp .endmove
-
-;............................................................................................
-
-.keypress:
-; mov eax, [ebx+TKeyboardEvent.kbdStatus]
-; OutputRegister regEAX, 16
-
- mov eax, [esi+TEdit._Pos]
- mov [.prevpos], eax
-
- mov eax, [ebx+TKeyboardEvent.key]
- test eax, eax
- jz .no_char
-
- cmp eax, $20
- jb .no_char
-
- cmp eax, $7f
- je .no_char
-
- push eax
-
- call .ClearSelection
-
- stdcall StrPtr, [esi+TEdit._Text]
- mov ecx, eax
- stdcall StrOffsUtf8, eax, [esi+TEdit._Pos]
- sub ecx, eax
- neg ecx
-
- pop eax
- stdcall StrCharInsert, [esi+TEdit._Text], eax, ecx
- inc [esi+TEdit._Len]
-
- mov [ebx+TKeyboardEvent.kbdStatus], 0
- or [.changes], .NeedRefresh
- jmp .right
-
-.no_char:
- mov eax, [ebx+TKeyboardEvent.scancode]
-
- cmp eax, keyLeftNumpad
- je .left
- cmp eax, keyLeft
- je .left
-
- cmp eax, keyRightNumpad
- je .right
- cmp eax, keyRight
- je .right
-
- cmp eax, keyHomeNumpad
- je .home
- cmp eax, keyHome
- je .home
-
- cmp eax, keyEndNumpad
- je .end
- cmp eax, keyEnd
- je .end
-
- cmp eax, keyDelNumpad
- je .del
- cmp eax, keyDelete
- je .del
-
- cmp eax, keyBackSpace
- je .backdel
-
- jmp .finish
-
-.left:
- cmp [esi+TEdit._Pos], 0
- jle .endmove
-
- or [.changes], .PosChanged
- dec [esi+TEdit._Pos]
- jmp .endmove
-
-.right:
- mov eax, [esi+TEdit._Pos]
- cmp eax, [esi+TEdit._Len]
- jae .finish
-
- or [.changes], .PosChanged
- inc [esi+TEdit._Pos]
- jmp .endmove
-
-.home:
- mov [esi+TEdit._Pos], 0
- mov [esi+TEdit._Start], 0
- mov [.changes], .PosChanged or .NeedRefresh
- jmp .endmove
-
-.end:
- mov eax, [esi+TEdit._Len]
- mov [esi+TEdit._Pos], eax
- or [.changes], .PosChanged
- jmp .endmove
-
-.backdel:
- call .ClearSelection
- jnc .endmove
-
- cmp [esi+TEdit._Pos], 0
- jle .endmove
-
- or [.changes], .PosChanged
- dec [esi+TEdit._Pos]
-
-.del:
- call .ClearSelection
- jnc .endmove
-
- mov eax, [esi+TEdit._Pos]
- cmp eax, [esi+TEdit._Len]
- jae .finish ; can't delete after the end of string.
-
- stdcall StrPtr, [esi+TEdit._Text]
-
- mov ecx, eax
- stdcall StrOffsUtf8, eax, [esi+TEdit._Pos]
- sub eax, ecx
-
- stdcall StrSplit, [esi+TEdit._Text], eax
- mov ebx, eax
-
- stdcall StrPtr, ebx
- stdcall DecodeUtf8, [eax]
-
- stdcall StrCopyPart, ebx, ebx, edx, -1
- stdcall StrCat, [esi+TEdit._Text], ebx
- stdcall StrDel, ebx
-
- dec [esi+TEdit._Len]
- or [.changes], .NeedRefresh
-
-.endmove:
- mov ebx, [.pEvent]
- mov eax, [esi+TEdit._Pos]
- cmp [ebx+TSysEvent.event], seKbdKeyPress
- jne .setselection
-
- test [ebx+TKeyboardEvent.kbdStatus], maskShift
- jnz .refresh
-
-.setselection:
- mov ecx, [.prevpos]
- cmp ecx, [esi+TEdit._Sel]
- je @f
- or [.changes], .NeedRefresh
-@@:
- mov [esi+TEdit._Sel], eax
-
- test [.changes], .NeedRefresh
- jz .caretmove
-
-.refresh:
- execute [.pObj], TEdit.Refresh
-
-.caretmove:
- cmp [esi+TEdit._Focused], 0
- je .finish
-
- test [.changes], .PosChanged
- jz .showcaret
-
- mov eax, [esi+TEdit._Pos]
- cmp eax, [esi+TEdit._Start]
- jl .scroll
-
- stdcall StrPtr, [esi+TEdit._Text]
- mov edi, eax
-
- stdcall StrOffsUtf8, edi, [esi+TEdit._Pos]
- mov ecx, eax
-
- stdcall StrOffsUtf8, edi, [esi+TEdit._Start]
- sub ecx, eax ; offset to char under cursor.
- jns .leftok
-
-.scroll:
- mov eax, [esi+TEdit._Start]
- sub eax, 8
- test eax, eax
- jns @f
- xor eax, eax
-@@:
- mov [esi+TEdit._Start], eax
- mov [.changes], .PosChanged or .NeedRefresh
- jmp .endmove
-
-.leftok:
- mov edi, eax ; pointer to start of the text.
-
- stdcall AllocateContext, [esi+TEdit.handle]
- push eax
-
- stdcall GetTextBounds, eax, edi, ecx, 0
- lea ecx, [eax+2] ; x coordinate of the cursor.
- add ecx, [esi+TEdit._MarginLeft]
-
- stdcall ReleaseContext ; from the stack.
-
- mov eax, [esi+TEdit._width]
- sub eax, [esi+TEdit._MarginRight]
- sub eax, ecx
- cmp eax, 2
- jge .caretok
-
- mov eax, [esi+TEdit._Start]
- add eax, 8
- cmp eax, [esi+TEdit._Len]
- jle @f
- mov eax, [esi+TEdit._Len]
-@@:
- mov [esi+TEdit._Start], eax
-
- mov [.changes], .PosChanged or .NeedRefresh
- jmp .endmove
-
-
-.caretok:
- mov edx, [esi+TEdit._height]
- sub edx, 4
-
- stdcall CaretChange, ecx, 2, 1, edx
-
-.showcaret:
- test [.changes], .ShowCaret
- jz .finish
-
- stdcall CaretShow, TRUE
- jmp .finish
-
-;............................................................................................
-
-.onpaint:
-locals
- .bounds TBounds
- .selbeg dd ?
- .selend dd ?
- .ypos dd ?
-endl
- mov eax, [esi+TEdit._Pos]
- mov ecx, [esi+TEdit._Sel]
- cmp eax,ecx
- jle @f
- xchg eax, ecx
-@@:
- mov [.selbeg], eax
- mov [.selend], ecx
-
- mov ecx, [esi+TEdit._width]
- mov eax, [esi+TEdit._height]
-
- mov [.bounds.x], 0
- mov [.bounds.y], 0
- mov [.bounds.width], ecx
- mov [.bounds.height], eax
-
- lea eax, [.bounds]
- stdcall [DrawBox], [ebx+TPaintEvent.context], eax, [clEditBk], bxSunken
-
- mov eax, [esi+TEdit._MarginLeft]
- mov ecx, [esi+TEdit._MarginRight]
- add [.bounds.x], eax
- sub [.bounds.width], eax
- sub [.bounds.width], ecx
- cmp [.bounds.width], 0
- jle .finish
-
- mov ecx, [esi+TEdit._Start]
-
- stdcall StrOffsUtf8, [esi+TEdit._Text], ecx
- mov edi, eax
-
- mov eax, [.bounds.y]
- add eax, [.bounds.height]
- sub eax, 4
- mov [.ypos], eax ; y position of the characters.
-
-.drawloop:
- stdcall DecodeUtf8, [edi]
- jc .finish
-
- test eax, eax
- jz .eraseremaining
-
- mov eax, [clEditTxt]
- cmp ecx, [.selbeg]
- jl .colorok
- cmp ecx, [.selend]
- jge .colorok
- mov eax, [clEditSelTxt]
-.colorok:
- push eax 0 [.ypos] [.bounds.x] edx edi
-
- push 0 edx edi
- add edi, edx
- stdcall GetTextBounds, [ebx+TPaintEvent.context] ; remaining from the stack
-
- sub [.bounds.width], eax
- js .nodraw
-
- cmp ecx, [.selbeg]
- jl .drawtxt
- cmp ecx, [.selend]
- jge .drawtxt
-
- mov esi, [.ypos]
- sub esi, edx
- add edx, 2
- stdcall DrawFillRect, [ebx+TPaintEvent.context], [.bounds.x], [.bounds.y], eax, [.bounds.height], [clEditSel]
-
-.drawtxt:
- add [.bounds.x], eax
- stdcall DrawString, [ebx+TPaintEvent.context] ; remaining from the stack
-
- inc ecx
- jmp .drawloop
-
-.nodraw:
- add esp, 24 ; 6*4
- jmp .finish
-
-.eraseremaining:
- stdcall DrawFillRect, [ebx+TPaintEvent.context], [.bounds.x], [.bounds.y], [.bounds.width], [.bounds.height], [clEditBk]
- jmp .finish
-
-.ClearSelection:
- mov eax, [esi+TEdit._Pos]
- mov ecx, [esi+TEdit._Sel]
- cmp eax, [esi+TEdit._Sel]
- je .noselection ; there is no selection.
- jg @f
- xchg eax, ecx ; eax=end_selection; ecx=beg_selection
-@@:
- add [esi+TEdit._Len], ecx
- sub [esi+TEdit._Len], eax
- mov [esi+TEdit._Pos], ecx
- mov [esi+TEdit._Sel], ecx
-
- push -1
- stdcall StrOffsUtf8, [esi+TEdit._Text], eax
- push eax
- stdcall StrOffsUtf8, [esi+TEdit._Text], ecx
- push eax
- stdcall StrPtr, [esi+TEdit._Text]
- sub [esp], eax ; begin of the selection
- sub [esp+4], eax
- mov eax, [esp]
- sub [esp+4], eax ; length of the selection
-
- stdcall StrSplit, [esi+TEdit._Text] ; position from the stack
- mov ecx, eax
- stdcall StrCopyPart, ecx, ecx ; pos and length from the stack.
- stdcall StrCat, [esi+TEdit._Text], ecx
- stdcall StrDel, ecx
-
- or [.changes], .PosChanged or .NeedRefresh
- clc
- retn
-
-.noselection:
- stc
- retn
-endp
-
-
-endmodule
-
-
-; stdcall DecodeUtf8, [edi]
-; jc .finish
-;
-; test eax, eax
-; jz .eraseremaining
-;
-; mov eax, [clEditTxt]
-; mov esi, [clEditBk]
-; cmp ecx, [.selbeg]
-; jl .colorok
-; cmp ecx, [.selend]
-; jge .colorok
-; mov eax, [clEditSelTxt]
-; mov esi, [clEditSel]
-;.colorok:
-; push eax 0 [.ypos] [.bounds.x] edx edi
-;
-; push 0 edx edi
-; add edi, edx
-; stdcall GetTextBounds, [ebx+TPaintEvent.context] ; remaining from the stack
-;
-; add eax, 2
-; stdcall DrawFillRect, [ebx+TPaintEvent.context], [.bounds.x], [.bounds.y], eax, [.bounds.height], esi
-; sub eax, 2
-;
-; add [.bounds.x], eax
-; sub [.bounds.width], eax
-; jc .nodraw
-;
-; stdcall DrawString, [ebx+TPaintEvent.context] ; remaining from the stack
-;
-; inc ecx
-; jmp .drawloop
-;
-;.nodraw:
-; add esp, 24 ; 6*4
-; jmp .finish
-;
-;.eraseremaining:
-; stdcall DrawFillRect, [ebx+TPaintEvent.context], [.bounds.x], [.bounds.y], [.bounds.width], [.bounds.height], [clEditBk]
-; jmp .finish
-;
-;endp
-;
DELETED freshlib/gui/TForm.asm
Index: freshlib/gui/TForm.asm
==================================================================
--- freshlib/gui/TForm.asm
+++ /dev/null
@@ -1,118 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: TForm object class
-;
-; Target OS: Any
-;
-; Dependencies:
-;
-; Notes: Represents form window that to serve as parent window for other controls.
-;_________________________________________________________________________________________
-module "TForm library"
-
-
-ObjectClass Form, \
- Window, \
- TForm.Create, \
- 0, \
- TForm.Get, \
- TForm.Set, \
- 0, \
- TForm.SysEventHandler
-
-
-mrNone = 0
-mrOK = 1
-mrCancel = 2
-mrAbort = 3
-mrRetry = 4
-mrIgnore = 5
-mrYes = 6
-mrNo = 7
-mrMaybe = 8
-
-
-object TForm, TWindow
-
- .ModalResult dd ?
-
- .OnClose dd ? ; On close window event handler.
-
- param .type
-endobj
-
-
-proc TForm.Create, .obj
-begin
- stdcall Set, [.obj], TWindow.borderKind, borderFull
- return
-endp
-
-
-; OS independent code.
-
-proc TForm.Get, .obj, .paramID
-begin
- stc
- return
-endp
-
-
-
-proc TForm.Set, .obj, .paramID, .value
-begin
- stc
- return
-endp
-
-
-
-proc TForm.SysEventHandler, .pObj, .pEvent
-begin
- push ebx esi
- mov ebx, [.pEvent]
- cmp [ebx+TSysEvent.event], sePaint
- je .onpaint
-
- cmp [ebx+TSysEvent.event], seCloseRequest
- je .close_request
-
-.finish:
- stc
- pop esi ebx
- return
-
-.onpaint:
- mov esi, [.pObj]
-
- mov eax, [esi+TWindow._width]
- mov ecx, [esi+TWindow._height]
-
- stdcall DrawFillRect, [ebx+TPaintEvent.context], 0, 0, eax, ecx, [clDialogBk]
- jmp .finish
-
-.close_request:
-; DebugMsg "Close request"
- cmp [esi+TForm.OnClose], 0
- je @f
-
- stdcall [esi+TForm.OnClose], esi, [ebx+TCloseEvent.reason] ; if OnClose return CF=0 the form is destroyed. Else, the form is not destroyed.
- jc .finish
-
-@@:
- stdcall Set, [.pObj], TForm.Visible, FALSE
- stdcall Destroy, [.pObj]
-
- DebugMsg "Form destroyed"
-
-.destroyed:
- clc
- pop esi ebx
- return
-endp
-
-
-endmodule
DELETED freshlib/gui/TImageLabel.asm
Index: freshlib/gui/TImageLabel.asm
==================================================================
--- freshlib/gui/TImageLabel.asm
+++ /dev/null
@@ -1,198 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: TImageLabel object class
-;
-; Target OS: Any
-;
-; Dependencies:
-;
-; Notes: Represents GUI picture or image.
-;_________________________________________________________________________________________
-module "TImageLabel library"
-
-ObjectClass ImageLabel, \
- Window, \
- 0, \
- 0, \
- TImageLabel.Get, \
- TImageLabel.Set, \
- 0, \
- TImageLabel.SysEventHandler
-
-iaLeft = 0
-iaRight = 1
-iaCenter = 2
-iaStretchH = 3
-
-iaTop = $0
-iaBottom = $100
-iaMiddle = $200
-iaStrechV = $300
-
-object TImageLabel, TWindow
- .FImageAlign dd ?
- .FImage dd ?
- .FMask dd ?
- .FBackground dd ?
-
- param .ImageAlign ; image align flags.
- param .Image ; TImage object
- param .Mask
-endobj
-
-
-
-proc TImageLabel.Get, .obj, .paramID
-begin
- mov eax, [.obj]
-
- stdcall IsObject, eax, CImageLabel
- jc .exit
-
- cmp [.paramID], TImageLabel.ImageAlign
- je .getimagealign
-
- cmp [.paramID], TImageLabel.Image
- je .getimage
-
- cmp [.paramID], TImageLabel.Mask
- je .getmask
-
- stc
-.exit:
- return
-
-.getimagealign:
- mov eax, [eax+TImageLabel.FImageAlign]
- clc
- return
-
-.getimage:
- mov eax, [eax+TImageLabel.FImage]
- clc
- return
-
-.getmask:
- mov eax, [eax+TImageLabel.FMask]
- clc
- return
-endp
-
-
-
-proc TImageLabel.Set, .obj, .paramID, .value
-begin
- push eax
-
- mov eax, [.obj]
- stdcall IsObject, eax, CImageLabel
- jc .exit
-
- cmp [.paramID], TImageLabel.ImageAlign
- je .setimagealign
-
- cmp [.paramID], TImageLabel.Image
- je .setimage
-
- cmp [.paramID], TImageLabel.Mask
- je .setmask
-
- stc
-.exit:
- pop eax
- return
-
-.setimage:
- push [.value]
- pop [eax+TImageLabel.FImage]
- jmp .refresh
-
-.setmask:
- push [.value]
- pop [eax+TImageLabel.FMask]
- jmp .refresh
-
-.setimagealign:
- push [.value]
- pop [eax+TImageLabel.FImageAlign]
-
-.refresh:
- execute [.obj], TWindow.Refresh
- clc
- pop eax
- return
-endp
-
-
-
-proc TImageLabel.SysEventHandler, .pObj, .pEvent
-begin
- push eax ebx ecx edx esi
-
- mov esi, [.pObj]
- mov ebx, [.pEvent]
- mov eax, [ebx+TSysEvent.event]
-
- cmp eax, sePaint
- je .onpaint
-
-.finish:
- stc
- pop esi edx ecx ebx eax
- return
-
-.onpaint:
- locals
- .bounds TBounds
- endl
- mov ecx, [esi+TImageLabel._width]
- mov eax, [esi+TImageLabel._height]
- mov [.bounds.x], 0
- mov [.bounds.y], 0
- mov [.bounds.width], ecx
- mov [.bounds.height], eax
-
- stdcall SetDrawMode, [ebx+TPaintEvent.context], cmCopy
- stdcall DrawFillRect, [ebx+TPaintEvent.context], [.bounds.x], [.bounds.y], [.bounds.width], [.bounds.height], [clDialogBk]
-
- mov eax, [esi+TImageLabel.FImage]
- mov ecx, [.bounds.width]
- mov edx, [.bounds.height]
- sub ecx, [eax+TImage.width]
- sub edx, [eax+TImage.height]
-
- mov eax, [esi+TImageLabel.FImageAlign]
-
- cmp al, iaRight
- je .x_ok
- cmp al, iaCenter
- je .x_center
- xor ecx, ecx
- jmp .x_ok
-.x_center:
- sar ecx, 1
-.x_ok:
- cmp ah, iaBottom /256
- je .y_ok
- cmp ah, iaMiddle / 256
- je .y_center
- xor edx, edx
- jmp .y_ok
-.y_center:
- sar edx, 1
-.y_ok:
- stdcall DrawMaskedImage, [ebx+TPaintEvent.context], [esi+TImageLabel.FMask], [esi+TImageLabel.FImage], ecx, edx
- jmp .finish
-endp
-
-
-
-
-
-
-
-
-endmodule
DELETED freshlib/gui/TLabel.asm
Index: freshlib/gui/TLabel.asm
==================================================================
--- freshlib/gui/TLabel.asm
+++ /dev/null
@@ -1,136 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: TLabel object class
-;
-; Target OS: Any
-;
-; Dependencies:
-;
-; Notes: Not finished.
-;_________________________________________________________________________________________
-module "TLabel library"
-
-ObjectClass Label, \
- Window, \
- 0, \
- 0, \
- TLabel.Get, \
- TLabel.Set, \
- 0, \
- TLabel.SysEventHandler
-
-
-object TLabel, TWindow
- .Ftextalign dd ?
-
- param .TextAlign ; text align flags.
- param .Control ; control that to be activated
-endobj
-
-
-
-proc TLabel.Get, .obj, .paramID
-begin
- mov eax, [.obj]
-
- stdcall IsObject, eax, CLabel
- jc .exit
-
- cmp [.paramID], TLabel.TextAlign
- je .gettextalign
-
- stc
-.exit:
- return
-
-.gettextalign:
- mov eax, [eax+TLabel.Ftextalign]
- clc
- return
-endp
-
-
-
-proc TLabel.Set, .obj, .paramID, .value
-begin
- push eax
-
- mov eax, [.obj]
- stdcall IsObject, eax, CLabel
- jc .exit
-
- cmp [.paramID], TLabel.TextAlign
- je .settextalign
-
- stc
-.exit:
- pop eax
- return
-
-.settextalign:
- push [.value]
- pop [eax+TLabel.Ftextalign]
-
-.refresh:
- execute [.obj], TWindow.Refresh
- clc
- pop eax
- return
-endp
-
-
-
-proc TLabel.SysEventHandler, .pObj, .pEvent
-begin
- push eax ebx ecx edx esi
-
- mov esi, [.pObj]
- mov ebx, [.pEvent]
- mov eax, [ebx+TSysEvent.event]
-
- cmp eax, sePaint
- je .onpaint
-
-.finish:
- stc
- pop esi edx ecx ebx eax
- return
-
-.onpaint:
- locals
- .bounds TBounds
- endl
-
- mov ecx, [esi+TLabel._width]
- mov eax, [esi+TLabel._height]
- mov [.bounds.x], 0
- mov [.bounds.y], 0
- mov [.bounds.width], ecx
- mov [.bounds.height], eax
- lea eax, [.bounds]
- stdcall [DrawBox], [ebx+TPaintEvent.context], eax, [clDialogBk], bxNone
-
- stdcall Get, esi, TWindow.Caption
- test eax, eax
- jz .finish
-
- push eax eax
- stdcall StrLen, eax
- mov ecx, eax
- pop eax
- lea edx, [.bounds]
- stdcall DrawTextBox, [ebx+TPaintEvent.context], eax, edx, [esi+TLabel.Ftextalign], 0, [clDialogTxt]
- stdcall StrDel ; from the stack
- jmp .finish
-endp
-
-
-
-
-
-
-
-endmodule
DELETED freshlib/gui/TMenu.asm
Index: freshlib/gui/TMenu.asm
==================================================================
--- freshlib/gui/TMenu.asm
+++ /dev/null
@@ -1,97 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: TMenu object class
-;
-; Target OS: Any
-;
-; Dependencies:
-;
-; Notes: Represents main menu or popup menu objects.
-;_________________________________________________________________________________________
-module "TMenu library"
-
-ObjectClass Menu, \
- Window, \
- TMenu.Create, \
- TMenu.Destroy,\
- TMenu.Get, \
- TMenu.Set, \
- TMenu.ExecCmd,\
- TMenu.SysEventHandler
-
-; The inherited TWindow.caption serves as a menu item caption in the parent menu.
-; The children TMenu objects are reparent to the root, and their pointers are stored in the
-; list of TMenuItem elements.
-object TMenu, TWindow
- .pForm dd ? ; pointer to TForm object. If NULL, the menu is popup menu.
- .pItems dd ? ;
-
- method .Show, .parent, .kind
-endobj
-
-
-
-proc TMenu.Create, .obj
-begin
- return
-endp
-
-
-proc TMenu.Destroy, .obj
-begin
- return
-endp
-
-
-proc TMenu.Get, .obj, .param
-begin
- return
-endp
-
-
-proc TMenu.Set, .obj, .param
-begin
-
- return
-endp
-
-
-proc TMenu.ExecCmd, .obj, .method
-begin
- cmp [.method], TMenu.Show
- je .show
-
- stc
- return
-
-; Method show
-.show:
-virtual at esi
- .parent dd ?
- .kind dd ?
-end virtual
-
- mov ebx, [.obj]
-; First check item count and set proper size of the menu window.
-
-
-
-
- return
-endp
-
-
-proc TMenu.SysEventHandler, .obj, .event
-begin
-
- return
-endp
-
-
-
-endmodule
-
-
DELETED freshlib/gui/TMenuItem.asm
Index: freshlib/gui/TMenuItem.asm
==================================================================
--- freshlib/gui/TMenuItem.asm
+++ /dev/null
@@ -1,40 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: TMenuItem object class
-;
-; Target OS: Any
-;
-; Dependencies:
-;
-; Notes: TMenuItems are the items of the GUI menu objects.
-;_________________________________________________________________________________________
-module "TMenuItem library"
-
-ObjectClass MenuItem, \
- Object, \
- TMenu.Create, \
- TMenu.Destroy,\
- TMenu.Get, \
- TMenu.Set, \
- TMenu.ExecCmd,\
- TMenu.SysEventHandler
-
-mikCommand = 0
-mikSubmenu = 1
-mikSeparator = 2
-
-
-object TMenuItem, TObject
- .parent dd ? ; pointer to TMenu object.
- .kind dd ? ; mikCommand, mikSubmenu or mikSeparator
- .pAction dd ? ; depending on the kind. Pointer to TAction or handle of string with the text.
- .child dd ? ; pointer to the child TMenu object
-
- method Paint, .context, .x, .y, .width, .height
-endobj
-
-
-endmodule
DELETED freshlib/gui/TObject.asm
Index: freshlib/gui/TObject.asm
==================================================================
--- freshlib/gui/TObject.asm
+++ /dev/null
@@ -1,59 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: TObject object class.
-;
-; Target OS: Any
-;
-; Dependencies:
-;
-; Notes: TObject is the root member of FreshLib objects tree.
-;_________________________________________________________________________________________
-module "TObject library"
-
-ObjectClass Object, \
- Root, \
- 0, \
- TObject.Destroy, \
- 0, \
- 0, \
- 0, \
- 0
-
-
-object TObject
- .ptrClass dd ? ; pointer to the object class structure.
-
- .mxAccess dd ? ; access mutex. Procedures from objects.asm will use it to ensure thread safety.
- .ptrVar dd ? ; pointer to the variable that keep the pointer to the object. This field can be 0. If not, Destroy procedure will set it to 0 on destroy.
-
- .OnCreate dd ? ; user event handlers.
- .OnDestroy dd ?
-
- method .AddChild, .objchild ; this method is not implemented in TObject, but every descendent can implement it's own parent/child system.
-endobj
-
-
-
-proc TObject.Destroy, .obj
-begin
- push eax
- mov eax, [.obj]
-
- cmp [eax+TObject.OnDestroy], 0
- je .exit
-
- pushad
- stdcall [eax+TObject.OnDestroy], eax
- popad
-
-.exit:
- pop eax
- return
-endp
-
-
-
-endmodule
DELETED freshlib/gui/TProgressbar.asm
Index: freshlib/gui/TProgressbar.asm
==================================================================
--- freshlib/gui/TProgressbar.asm
+++ /dev/null
@@ -1,190 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: TProgressBar object class; Simple progress bar control.
-;
-; Target OS: Any
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-module "TProgressbar library"
-
-ObjectClass Progress, \
- Window, \
- 0, \
- 0, \
- TProgress.Get, \
- TProgress.Set, \
- TProgress.ExecCmd, \
- TProgress.SysEventHandler
-
-object TProgress, TWindow
- ._Pos dd ?
- ._Max dd ?
- ._Color dd ?
-
- param .Pos
- param .Max
- param .Color
-
- method .Step
-endobj
-
-
-
-proc TProgress.Get, .pobj, .paramID
-begin
- push ecx
-
- stdcall IsObject, [.pobj], CProgress
- jc .exit
-
- mov eax, [.pobj]
- mov ecx, [.paramID]
-
- cmp ecx, TProgress.Pos
- jb .exit
- cmp ecx, TProgress.Color
- ja .exit
-
- sub ecx, TProgress.Pos
- pushd [eax+TProgress._Pos+4*ecx]
- pop eax
-
- clc
- pop ecx
- return
-
-.exit:
- stc
- pop ecx
- return
-endp
-
-
-
-proc TProgress.Set, .pobj, .paramID, .value
-begin
- push eax ecx
-
- stdcall IsObject, [.pobj], CProgress
- jc .exit
-
- mov eax, [.pobj]
- mov ecx, [.paramID]
-
- cmp ecx, TProgress.Pos
- jb .exit
- cmp ecx, TProgress.Color
- ja .exit
-
- sub ecx, TProgress.Pos
- pushd [.value]
- popd [eax+TProgress._Pos+4*ecx]
-
- execute [.pobj], TProgress.Refresh
-
- clc
- pop ecx eax
- return
-
-.exit:
- stc
- pop ecx eax
- return
-endp
-
-
-proc TProgress.SysEventHandler, .pobj, .pEvent
-begin
- push eax ebx ecx esi
-
- mov ebx, [.pEvent]
- cmp [ebx+TSysEvent.event], sePaint
- je .paint
-
-.finish:
- stc
- pop esi ecx ebx eax
- return
-
-.paint:
-locals
- .bounds TBounds
- .style TLineStyle
-endl
- mov [.bounds.x], 0
- mov [.bounds.y], 0
- mov eax, [esi+TProgress._width]
- mov ecx, [esi+TProgress._height]
- mov [.bounds.width], eax
- mov [.bounds.height], ecx
-
- lea eax, [.bounds]
- stdcall [DrawBox], [ebx+TPaintEvent.context], eax, 0, bxSunken or bxNoFill
-
- stdcall DrawRectangle, [ebx+TPaintEvent.context], eax, [clDialogBk]
-
- inc [.bounds.x]
- inc [.bounds.y]
- sub [.bounds.width], 2
- sub [.bounds.height], 2
-
- mov eax, [esi+TProgress._Pos]
- mov ecx, [esi+TProgress._Max]
- test ecx, ecx
- jnz @f
- inc ecx
-@@:
- cmp eax, ecx
- jle @f
- mov eax, ecx
-@@:
- imul eax, [.bounds.width]
- cdq
- idiv ecx
-
- stdcall DrawFillRect, [ebx+TPaintEvent.context], [.bounds.x], [.bounds.y], eax, [.bounds.height], [esi+TProgress._Color]
- sub [.bounds.width], eax
- inc eax
- inc [.bounds.width]
- stdcall DrawFillRect, [ebx+TPaintEvent.context], eax, [.bounds.y], [.bounds.width], [.bounds.height], [clDialogBk]
-
- jmp .finish
-endp
-
-
-
-
-proc TProgress.ExecCmd, .self, .method
-begin
- cmp [.method], TProgress.Step
- je .step
- stc
- return
-
-;-------------------------------------------------------------------------
-.step:
- push eax ecx
-
- mov eax, [.self]
- mov ecx, [eax+TProgress._Pos]
- cmp ecx, [eax+TProgress._Max]
- jge .exit
-
- inc [eax+TProgress._Pos]
- execute eax, TProgress.Refresh
-
-.exit:
- pop ecx eax
- clc
- return
-endp
-
-
-
-endmodule
DELETED freshlib/gui/TScrollWindow.asm
Index: freshlib/gui/TScrollWindow.asm
==================================================================
--- freshlib/gui/TScrollWindow.asm
+++ /dev/null
@@ -1,507 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: TScrollWindow object class
-;
-; Target OS: Any
-;
-; Dependencies:
-;
-; Notes: TScrollWindow is window that may have scrollers to scroll the client area.
-;_________________________________________________________________________________________
-module "TScrollWindow library"
-
-ObjectClass ScrollWindow, \
- Window, \
- TScrollWindow.Create, \
- 0, \
- TScrollWindow.Get, \
- TScrollWindow.Set, \
- TScrollWindow.ExecCmd, \
- TScrollWindow.SysEventHandler
-
-
-struct TScrollbar
- .Max dd ?
- .Page dd ?
- .Pos dd ?
-
- ._Drag dd ?
-ends
-
-
-
-object TScrollWindow, TWindow
- ._HScroller TScrollbar
- ._VScroller TScrollbar
-
- method HScrollSet, .Pos, .Max, .Page ; only params >=0 are set. If<0 ignored.
- method VScrollSet, .Pos, .Max, .Page
-endobj
-
-
-ScrollBarWidth = 16
-MinScrollBarWidth = 12
-
-;_________________________________________________________________________________________
-
-proc TScrollWindow.Create, .pobj
-begin
-; push eax
-; mov eax, [.pobj]
-
-; mov [eax+TScrollWindow._HScroller.Max], 255
-; mov [eax+TScrollWindow._HScroller.Page], 1
-; mov [eax+TScrollWindow._HScroller.Pos], 10
-
-; mov [eax+TScrollWindow._VScroller.Max], 1000
-; mov [eax+TScrollWindow._VScroller.Page], 1
-; mov [eax+TScrollWindow._VScroller.Pos], 450
-
-; pop eax
- return
-endp
-
-
-
-;_________________________________________________________________________________________
-
-
-proc TScrollWindow.Get, .pobj, .paramID
-begin
- stc
- return
-endp
-
-
-;_________________________________________________________________________________________
-
-
-proc TScrollWindow.Set, .pobj, .paramID, .value
-begin
-
- stc
- return
-endp
-
-
-;_________________________________________________________________________________________
-
-
-proc TScrollWindow.SysEventHandler, .pobj, .pEvent
- .event TScrollEvent
-begin
- push eax ebx edx esi edi
- mov esi, [.pobj]
- mov ecx, [.pEvent]
-
- cmp [ecx+TSysEvent.event], sePaint
- je .paint
-
- cmp [ecx+TSysEvent.event], seMouseBtnPress
- je .btnpress
-
- cmp [ecx+TSysEvent.event], seMouseBtnRelease
- je .btnrelease
-
- cmp [ecx+TSysEvent.event], seMouseMove
- je .mousemove
-
-.continue:
- stc
-.finish:
- pop edi esi edx ebx eax
- return
-
-
-;.........................................................................................
-
-.paint:
-locals
- .recth TBounds
- .rectv TBounds
- .rectx TBounds
-endl
- stdcall Get, esi, TScrollWindow.FreeArea
- mov ebx, eax
-
- mov eax, [ebx+TBounds.x]
- mov edx, [ebx+TBounds.y]
- mov [.recth.x], eax
- mov [.rectv.y], edx
-
- add eax, [ebx+TBounds.width]
- add edx, [ebx+TBounds.height]
- mov [.rectv.x], eax
- mov [.recth.y], edx
-
- inc edx
- inc eax
- mov [.rectx.y], edx
- mov [.rectx.x], eax
-
- mov [.recth.height], ScrollBarWidth
- mov [.rectv.width], ScrollBarWidth
- mov [.rectx.width], ScrollBarWidth-1
- mov [.rectx.height], ScrollBarWidth-1
-
- mov eax, [ebx+TBounds.width]
- mov edx, [ebx+TBounds.height]
- inc eax
- inc edx
- mov [.recth.width], eax
- mov [.rectv.height], edx
-
- lea eax, [.rectx]
- stdcall [DrawBox], [ecx+TPaintEvent.context], eax, [clDialogBk], bxNone
-
- lea eax, [.recth]
- stdcall [DrawBox], [ecx+TPaintEvent.context], eax, [clScrollBk], bxSunken or bxNoFill
-
- lea eax, [.rectv]
- stdcall [DrawBox], [ecx+TPaintEvent.context], eax, [clScrollBk], bxSunken or bxNoFill
-
- lea eax, [esi+TScrollWindow._HScroller]
- stdcall _SliderPixels, eax, [.recth.width]
-
- push esi
- stdcall DrawFillRect, [ecx+TPaintEvent.context], [.recth.x], [.recth.y], eax, [.recth.height], [clScrollBk]
- mov esi, [.recth.width]
- sub esi, eax
- sub esi, edx
-
- add eax, [.recth.x]
- lea edi, [eax+edx]
- stdcall DrawFillRect, [ecx+TPaintEvent.context], edi, [.recth.y], esi, [.recth.height], [clScrollBk]
- pop esi
-
- mov [.rectx.x], eax
-
- mov [.rectx.width], edx
- push [.recth.y] [.recth.height]
- pop [.rectx.height] [.rectx.y]
-
- lea eax, [.rectx]
- stdcall [DrawSlider], [ecx+TPaintEvent.context], eax, [clScrollSlider], sliderHorizontal
-
- lea eax, [esi+TScrollWindow._VScroller]
- stdcall _SliderPixels, eax, [.rectv.height]
-
- push esi
- stdcall DrawFillRect, [ecx+TPaintEvent.context], [.rectv.x], [.rectv.y], [.rectv.width], eax, [clScrollBk]
- mov esi, [.rectv.height]
- sub esi, eax
- sub esi, edx
-
- add eax, [.rectv.y]
- lea edi, [eax+edx]
- stdcall DrawFillRect, [ecx+TPaintEvent.context], [.rectv.x], edi, [.rectv.width], esi, [clScrollBk]
- pop esi
-
- mov [.rectx.y], eax
-
- mov [.rectx.height], edx
- push [.rectv.x] [.rectv.width]
- pop [.rectx.width] [.rectx.x]
-
- lea eax, [.rectx]
- stdcall [DrawSlider], [ecx+TPaintEvent.context], eax, [clScrollSlider], sliderVertical
-
- clc
- jmp .finish
-
-;.........................................................................................
-
-.btnpress:
- stdcall __ScrollSetCursor, esi, [ecx+TMouseButtonEvent.x], [ecx+TMouseButtonEvent.y]
-
- cmp [ecx+TMouseButtonEvent.Button], mbLeft
- jne .continue
-
- stdcall _WhatScrollbar, esi, [ecx+TMouseButtonEvent.x], [ecx+TMouseButtonEvent.y]
- jc .continue ; not found
-
-; here ecx=height of the scrollbar
-; edi= ptr to TScrollbar structure
-; ebx= coordinate of the mouse in the scrollbar
-
- stdcall _SliderPixels, edi, ecx
- sub ebx, eax
- jl .before
- cmp ebx, edx
- jg .after
-
-; inside the slider - capture the mouse.
- mov [edi+TScrollbar._Drag], ebx
- stdcall MouseCapture, [esi+TWindow.handle]
- jmp .continue
-
-.before:
-.after:
- jmp .continue
-
-;.........................................................................................
-
-.btnrelease:
- stdcall __ScrollSetCursor, esi, [ecx+TMouseButtonEvent.x], [ecx+TMouseButtonEvent.y]
-
- xor eax, eax
- mov [esi+TScrollWindow._HScroller._Drag], eax
- mov [esi+TScrollWindow._VScroller._Drag], eax
-
- stdcall MouseCapture, eax
- jmp .continue
-
-;.........................................................................................
-
-.mousemove:
- mov ecx, [.pEvent]
- stdcall __ScrollSetCursor, esi, [ecx+TMouseMoveEvent.x], [ecx+TMouseMoveEvent.y]
-
- mov ecx, [.pEvent]
- lea edi, [esi+TScrollWindow._HScroller]
- mov eax, [ecx+TMouseMoveEvent.x]
- mov ecx, [esi+TScrollWindow._width]
- mov [.event.ScrollBar], scrollX
- cmp [edi+TScrollbar._Drag], 0
- jne .found
-
- mov ecx, [.pEvent]
- lea edi, [esi+TScrollWindow._VScroller]
- mov eax, [ecx+TMouseMoveEvent.y]
- mov ecx, [esi+TScrollWindow._height]
- mov [.event.ScrollBar], scrollY
- cmp [edi+TScrollbar._Drag], 0
-
- je .continue
-
-
-.found:
- mov [.event.event], seScroll
- mov [.event.ScrollCmd], scTrack
-
- sub ecx, ScrollBarWidth
- sub eax, 2
- sub eax, [edi+TScrollbar._Drag]
- stdcall _SetSliderPos, edi, eax, ecx
- jc .endmove
-
- mov eax, [edi+TScrollbar.Pos]
- mov [.event.Value], eax
-
- lea eax, [.event]
- stdcall ExecEvent, esi, eax
- jnc .finish
-
-; ?????? Do we need this?
-; execute esi, TScrollWindow.Refresh
-
-.endmove:
- clc
- jmp .finish
-
-endp
-
-
-;_________________________________________________________________________________________
-
-
-proc TScrollWindow.ExecCmd, .self, .method
-begin
- cmp [.method], TScrollWindow._ComputeFreeArea
- je .computefreearea
-
- stc
- return
-
-
-.computefreearea:
- mov ecx, [.self]
- sub [ecx+TScrollWindow._FreeArea.width], ScrollBarWidth
- jns @f
- mov [ecx+TScrollWindow._FreeArea.width], 0
-@@:
- sub [ecx+TScrollWindow._FreeArea.height], ScrollBarWidth
- jns @f
- mov [ecx+TScrollWindow._FreeArea.height], 0
-@@:
- stc
- return
-endp
-
-
-;_________________________________________________________________________________________
-
-
-
-proc _SetSliderPos, .pScrollbar, .x, .lengthpx
-begin
- push eax ecx edx
-
- mov ecx, [.pScrollbar]
- stdcall _SliderPixels, [.pScrollbar], [.lengthpx]
-
- sub [.lengthpx], edx
- jz .zero
-
- mov eax, [ecx+TScrollbar.Max]
- imul [.x]
- idiv [.lengthpx]
-
- cmp eax, 0
- jge .ok
- mov eax, 0
-.ok:
- cmp eax, [ecx+TScrollbar.Max]
- jle .ok2
- mov eax, [ecx+TScrollbar.Max]
-.ok2:
- cmp [ecx+TScrollbar.Pos], eax
- stc
- je @f
- clc
-@@:
- mov [ecx+TScrollbar.Pos], eax
- pop edx ecx eax
- return
-
-.zero:
- xor eax, eax
- jmp .ok2
-endp
-
-
-
-; returns:
-; eax - position in pixels
-; edx - size in pixels
-
-proc _SliderPixels, .pScrollbar, .length
-begin
- push ecx esi
-
- mov ecx, [.pScrollbar]
-
-; page size in pixels.
- mov esi, [ecx+TScrollbar.Max]
- mov eax, [.length]
- add esi, [ecx+TScrollbar.Page]
- test esi, esi
- jz .lengthok
-
- imul [ecx+TScrollbar.Page]
- idiv esi
-
-.lengthok:
- cmp eax, MinScrollBarWidth
- jge @f
- mov eax, MinScrollBarWidth
-@@:
- cmp eax, [.length]
- jle @f
- mov eax, [.length]
-@@:
- push eax
-
-; position in pixels
-
- sub eax, [.length]
- mov esi, [ecx+TScrollbar.Max]
- test esi, esi
- jnz @f
- inc esi
-@@:
- neg eax
- mul [ecx+TScrollbar.Pos]
- div esi
-
- pop edx ; width
-
- pop esi ecx
- return
-endp
-
-
-proc __ScrollSetCursor, .window, .x, .y
-begin
- pushad
-
- mov esi, [.window]
- mov eax, [esi+TWindow._cursor]
- stdcall _WhatScrollbar, esi, [.x], [.y]
- jc @f
-
- mov eax, mcArrow
-@@:
- test eax, $ffffff00
- jnz @f
- stdcall GetStockCursor, eax
-@@:
- stdcall SetMouseCursor, eax
-
- popad
- return
-endp
-
-
-
-; returns:
-; ecx = height of the scrollbar
-; edi = ptr to TScrollbar structure
-; ebx = coordinate of the mouse in the scrollbar
-;
-; CF=1 if the cursor is not in scrollbar
-
-proc _WhatScrollbar, .window, .x, .y
-begin
- push eax edx esi
-
- mov esi, [.window]
-
-
- mov eax, [.x]
- mov edx, [.y]
-
- mov eax, [esi+TWindow._width]
- mov edx, [esi+TWindow._height]
-
- sub eax, ScrollBarWidth
- sub edx, ScrollBarWidth
-
- cmp [.x], eax
- jl .checkh
-
- cmp [.y], edx
- jg .notfound ; we are in the dead square.
-
-; mouse in vscrollbar
- mov ebx, [.y]
- mov ecx, edx
- lea edi, [esi+TScrollWindow._VScroller]
- jmp .found
-
-.checkh:
- cmp [.y], edx
- jl .notfound ; in the client area
-
-; mouse in hscrollbar
- mov ebx, [.x]
- mov ecx, eax
- lea edi, [esi+TScrollWindow._HScroller]
-
-.found:
- clc
- pop esi edx eax
- return
-
-.notfound:
- stc
- pop esi edx eax
- return
-endp
-
-
-
-endmodule
DELETED freshlib/gui/TTreeView.asm
Index: freshlib/gui/TTreeView.asm
==================================================================
--- freshlib/gui/TTreeView.asm
+++ /dev/null
@@ -1,144 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: TTreeView object class
-;
-; Target OS: Any
-;
-; Dependencies:
-; Notes:
-;_________________________________________________________________________________________
-module "TreeView library"
-
-ObjectClass TreeView, \
- ScrollWindow, \
- TTreeView.Create, \
- TTreeView.Destroy, \
- TTreeView.Get, \
- TTreeView.Set, \
- TTreeView.ExecCmd, \
- TTreeView.SysEventHandler
-
-; tree-view item state flags.
-tvisExpanded = 1
-tvisSelected = 2
-tvisFocused = 4
-
-
-struct TTreeViewItem
- .level dd ? ; the level of the element in the tree.
-
- .caption dd ? ; hString of the name.
- .state dd ? ; one or more state flags.
- .imgNormal dd ? ; index to the icon for normal state
- .iSelected dd ? ; index to the icon for selected state
-
- .pObject dd ? ; the object attached to the item
- align 32
- .shift = 5
-ends
-
-
-object TTreeView, TScrollWindow
- ._items dd ? ; TArray with
- ._first dd ? ; index of the fisrt visible item.
- ._pShadow dd ? ; pointer to TBackBuffer
-
- .OnItemDelete dd ? ; procedure to be call when the item is deleted. It should free the objects attached to the item.
-
- param .Focused
-
- method .AddItem, .iParent
- method .DelItem, .iItem ;deletes the item and all children.
- method .GetItem, .index
-endobj
-
-
-proc TTreeView.Create, .pobj
-begin
- mov ebx, [.pobj]
-
- stdcall CreateBackBuffer, [ebx+TTreeView.handle], 1, 1
- mov [ebx+TTreeView._pShadow], eax
-
- stdcall CreateArray, sizeof.TTreeViewItem
- mov [ebx+TTreeView._items], eax
-
- clc
- return
-endp
-
-
-proc TTreeView.Destroy, .pobj
-begin
- mov ebx, [.pobj]
-
- stdcall DestroyBackBuffer, [ebx+TTreeView._pShadow]
- execute ebx, TTreeView.DelItem, -1
- stdcall FreeMem, [ebx+TTreeView._items]
-
- clc
- return
-endp
-
-
-proc TTreeView.Get, .pobj, .paramID
-begin
- stc
- return
-endp
-
-
-proc TTreeView.Set, .pobj, .paramID, .value
-begin
- stc
- return
-endp
-
-
-proc TTreeView.ExecCmd, .self, .method
-begin
- stc
- return
-endp
-
-
-proc TTreeView.SysEventHandler, .pobj, .pEvent
-begin
- pushad
-
- mov ebx, [.pEvent]
- mov esi, [.pobj]
- mov eax, [ebx+TSysEvent.event]
-
- cmp eax, sePaint
- je .paint
-
- cmp eax, seMoveResize
- je .moveresize
-
-.continue:
- popad
- stc
- return
-
-.paint:
- stdcall SetClipRectangle, [ebx+TPaintEvent.context], 0
- stdcall TScrollWindow.SysEventHandler, [.pobj], [.pEvent]
- stdcall DrawBackBuffer, [ebx+TPaintEvent.context], [esi+TTreeView._pShadow], 0, 0
- jmp .continue
-
-.moveresize:
- stdcall Get, esi, TTreeView.FreeArea
-
- stdcall DestroyBackBuffer, [esi+TTreeView._pShadow]
- stdcall CreateBackBuffer, [esi+TTreeView.handle], [esi+TTreeView._FreeArea.width], [esi+TTreeView._FreeArea.height]
- mov [esi+TTreeView._pShadow], eax
- jmp .continue
-
-endp
-
-
-endmodule
DELETED freshlib/gui/TWindow.asm
Index: freshlib/gui/TWindow.asm
==================================================================
--- freshlib/gui/TWindow.asm
+++ /dev/null
@@ -1,805 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: TWindow object class
-;
-; Target OS: Any
-;
-; Dependencies:
-;
-; Notes: TWindow is the common ancestor of all visible on the screen controls.
-; This file contains only OS independent part of the library and includes
-; the OS dependent files.
-;_________________________________________________________________________________________
-module "TWindow library"
-
-ObjectClass Window, \
- Object, \
- TWindow.Create, \
- TWindow.Destroy, \
- TWindow.Get, \
- TWindow.Set, \
- TWindow.ExecCmd, \
- TWindow.SysEventHandler
-
-; The elements of the array returned by .GetSiblings param
-; if handle<>0 and pWindow=0 - it is a native window, not added by FreshLib
-struct TWinArrayItem
- .handle dd ? ; The native OS handle of the window.
- .pWindow dd ? ; pointer to TWindow descendent structure.
-ends
-
-; Border kind of window.
-borderNone = 0
-borderFull = 1
-borderModal = 2
-borderToolbox = 3
-
-struct __TInternalAlign
- .client TBounds
- .pClientWindow dd ?
-ends
-; assign X = 01
-; assign Y = 10
-
-; adjheight = 01
-; topleft = 00
-; bottomright = 10
-
-; 00 - adjwidht + bottomright
-
-; Window align values.
-waNone = 0
-waLeft = 1
-waTop = 2
-waRight = 3
-waBottom = 4
-waClient = 5
-
-
-object TWindow, TObject
-
- .handle dd ? ; it is handle to the system provided window.
-
- ._x dd ?
- ._y dd ?
- ._width dd ?
- ._height dd ?
-
- ._visible dd ?
-
- ._bounds_changed dd ?
-
- ._border dd ?
-
- ._align dd ? ; window horizontal alignment
-
- ._FreeArea TBounds ; the window area that remains free after all children aligned. [1]
-
- ._caption dd ? ; string handle with window caption.
- ._cursor dd ? ; it is a handle to the mouse cursor.
-
- .OnKeyPress dd ? ; key press user handler.
-
-; parameters
- param .x
- param .y
- param .width
- param .height
-
- param .Align
-
- param .FreeArea ; read only.
-
- param .borderKind
- param .Zorder
-
- param .Visible
- param .Caption
- param .Parent
- param .Cursor
- param .Children ; read only. returns array with all children; See the notes [2] below.
-
- method .Refresh
- method .Focus
- method .AlignChildren
- method .ToBack
- method .ToFront
-
- method ._ComputeFreeArea
-endobj
-
-; NOTES:
-; [1] FreeArea field
-;
-; [2] The param .children returns an array of TWinArrayItem filled with information about
-; all siblings of the given window.
-; This array is allocated with CreateArray and needs to be free with FreeMem after use.
-; TArray.lparam of the array contains a pointer to the element containing current window
-
-
-; OS dependend code
-include '%TargetOS%/windows.asm'
-
-
-; OS independent code.
-
-
-;_________________________________________________________________________________________
-
-
-proc TWindow.Create, .obj
-begin
- push eax ecx edx
- mov ebx, [.obj]
- stdcall _CreateNullWindow
- mov [ebx+TWindow.handle], eax
- stdcall _SetWindowStruct, eax, ebx
-
- pop edx ecx eax
- clc
- return
-endp
-
-
-;_________________________________________________________________________________________
-
-
-
-proc TWindow.Destroy, .obj
-begin
- push eax
- mov eax, [.obj]
- cmp [eax+TWindow.handle], 0
- je @f
- stdcall _DestroyWindow, [eax+TWindow.handle]
-@@:
- pop eax
- return
-endp
-
-
-
-;_________________________________________________________________________________________
-
-
-proc TWindow.Get, .obj, .paramID
-.rect RECT
-begin
- push edx esi
-
- stdcall IsObject, [.obj], CWindow
- jc .not_processed
-
- mov esi, [.obj]
- mov eax, [.paramID]
-
- test eax, maskParameter
- jz .field
-
- cmp eax, TWindow.x
- je .getrect
- cmp eax, TWindow.y
- je .getrect
- cmp eax, TWindow.width
- je .getrect
- cmp eax, TWindow.height
- je .getrect
-
- cmp eax, TWindow.FreeArea
- je .getfreearea
-
- cmp eax, TWindow.Visible
- je .getvisible
-
- cmp eax, TWindow.Caption
- je .getcaption
-
- cmp eax, TWindow.borderKind
- je .getborder
-
- cmp eax, TWindow.Children
- je .getchildren
-
- cmp eax, TWindow.Parent
- je .getparent
-
-
-.not_processed:
- stc
- pop esi edx
- return
-
-
-.field:
- mov eax, [esi+eax]
-
-
-.finish:
- clc
- pop esi edx
- return
-
-;.........................................................................................
-
-.getparent:
- stdcall _GetParent, [esi+TWindow.handle]
- test eax, eax
- jz .finish
- stdcall _GetWindowStruct, eax
- jmp .finish
-
-;.........................................................................................
-
-.getchildren:
- stdcall _GetChildren, [esi+TWindow.handle]
- test eax, eax
- jz .finish
-
- push ebx edi
-
- mov ebx, eax
- mov ecx, [ebx+TArray.count]
-
-.loop:
- jecxz .endloop
- dec ecx
-
- stdcall _GetWindowStruct, [ebx+TArray.array+8*ecx+TWinArrayItem.handle]
-
- mov [ebx+TArray.array+8*ecx+TWinArrayItem.pWindow], eax
- jmp .loop
-
-.endloop:
- mov eax, ebx
-
- pop edi ebx
- jmp .finish
-
-
-;.........................................................................................
-
-
-.getfreearea:
- mov [esi+TWindow._FreeArea.x], 0
- mov [esi+TWindow._FreeArea.y], 0
- mov eax, [esi+TWindow._width]
- mov ecx, [esi+TWindow._height]
- mov [esi+TWindow._FreeArea.width], eax
- mov [esi+TWindow._FreeArea.height], ecx
-
- execute esi, TWindow._ComputeFreeArea
-
- lea eax, [esi+TWindow._FreeArea]
- jmp .finish
-
-
-;.........................................................................................
-
-
-.getborder:
- mov eax, [esi+TWindow._border]
- jmp .finish
-
-
-;.........................................................................................
-
-
-.getcaption:
- stdcall StrDup, [esi+TWindow._caption]
- jmp .finish
-
-;.........................................................................................
-
-.getvisible:
- mov eax, [esi+TWindow._visible]
-; stdcall _GetVisible, [esi+TWindow.handle]
- jmp .finish
-
-;.........................................................................................
-
-
-.getrect:
- mov eax, [.paramID]
- sub eax, TWindow.x
- mov eax, [esi+TWindow._x+4*eax]
- jmp .finish
-endp
-
-
-;_________________________________________________________________________________________
-
-
-
-proc TWindow.Set, .obj, .paramID, .value
-begin
- stdcall IsObject, [.obj], CWindow
- jc .fault
-
- push eax esi
-
- mov esi, [.obj]
- mov eax, [.paramID]
-
- test eax, maskParameter
- jz .field
-
- cmp eax, TWindow.x
- je .setrect
- cmp eax, TWindow.y
- je .setrect
- cmp eax, TWindow.width
- je .setrect
- cmp eax, TWindow.height
- je .setrect
-
- cmp eax, TWindow.Visible
- je .setvisible
-
- cmp eax, TWindow.Caption
- je .setcaption
-
- cmp eax, TWindow.borderKind
- je .setborder
-
- cmp eax, TWindow.Align
- je .setalign
-
- pop esi eax
-.fault:
- stc
- return
-
-.field:
- pushd [.value]
- popd [esi+eax]
-
-.finish:
- clc
- pop esi eax
- return
-
-;.........................................................................................
-.setalign:
-locals
- .bounds TBounds
-endl
- mov eax, [.value]
- cmp eax, [esi+TWindow._align]
- je .finish
-
- mov [esi+TWindow._align], eax
-
- stdcall Get, esi, TWindow.Parent
- test eax, eax
- jz .finish
-
- execute eax, TWindow.AlignChildren
-
- jmp .finish
-
-;.........................................................................................
-
-
-.setborder:
- mov eax, [.value]
- xchg eax, [esi+TWindow._border]
- cmp eax, [esi+TWindow._border]
- je .finish
-
- stdcall _SetWindowBorder, [esi+TWindow.handle], [esi+TWindow._border]
- jmp .finish
-
-;.........................................................................................
-
-.setcaption:
- lea eax, [esi+TWindow._caption]
- stdcall SetString, eax, [.value]
- stdcall StrPtr, [eax]
-
- stdcall _SetWindowTextUtf8, [esi+TWindow.handle], eax
- jmp .finish
-
-;.........................................................................................
-
-.setvisible:
- mov eax, [.value]
- xchg [esi+TWindow._visible], eax
- cmp [esi+TWindow._visible], eax
- je .finish
-
- stdcall _ShowWindow, [esi+TWindow.handle], [.value]
-
- cmp [.value], 0
- je .finish
-
- cmp [esi+TWindow._align], waNone
- je .finish
-
- stdcall Get, esi, TWindow.Parent
- test eax, eax
- jz .finish
-
- execute eax, TWindow.AlignChildren
- jmp .finish
-
-;.........................................................................................
-
-.setrect:
- mov eax, [.paramID]
- sub eax, TWindow.x
-
- mov ecx, [.value]
- cmp ecx, [esi+TWindow._x+4*eax]
- je .finish
-
- mov [esi+TWindow._x+4*eax], ecx
-
- lea eax, [esi+TWindow._x]
- stdcall _SetWindowBounds, [esi+TWindow.handle], eax
- mov [esi+TWindow._bounds_changed], 0
-
- jmp .finish
-endp
-
-
-;_________________________________________________________________________________________
-
-
-
-
-proc TWindow.ExecCmd, .self, .method
-begin
- push eax edx
-
- cmp [.method], TWindow.Refresh
- je .refresh
-
- cmp [.method], TWindow._ComputeFreeArea
- je .computefreearea
-
- cmp [.method], TWindow.AlignChildren
- je .alignchildren
-
- cmp [.method], TWindow.Focus
- je .focus
-
- cmp [.method], TWindow.AddChild
- je .addchild
-
-.error:
- stc
- pop edx eax
- return
-
-;.........................................................................................
-
-.refresh:
- mov eax, [.self]
- cmp [eax+TWindow._visible], 0
- je .finish
- stdcall _RefreshWindow, [eax+TWindow.handle]
-.finish:
- clc
- pop edx eax
- return
-
-;.........................................................................................
-
-.computefreearea:
-
-
-
- jmp .finish
-
-;.........................................................................................
-
-.alignchildren:
-locals
- .winalign __TInternalAlign
-endl
-; THIS METHOD is not written very good. It should be revised some day in order to make
-; alignment fast and smooth for all OS supported!
- push esi edi
-
- stdcall Get, [.self], TWindow.Children
- test eax, eax
- jz .endalign
-
- mov edi, eax
- lea esi, [.winalign]
- mov ecx, [.self]
-
- push [ecx+TWindow._width] [ecx+TWindow._height]
- pop [esi+__TInternalAlign.client.height] [esi+__TInternalAlign.client.width]
-
- xor ecx,ecx
-
- mov [esi+__TInternalAlign.client.y], ecx
- mov [esi+__TInternalAlign.client.x], ecx
- mov [esi+__TInternalAlign.pClientWindow], ecx
-
-.loop:
- cmp ecx, [edi+TArray.count]
- je .endloop
-
- stdcall __DoAlignOne, [edi+TArray.array+8*ecx+TWinArrayItem.pWindow]
- inc ecx
- jmp .loop
-
-.endloop:
- mov ecx, [.winalign.pClientWindow]
- jecxz .updatewindows
-
- mov eax, [esi+__TInternalAlign.client.x]
- mov edx, [esi+__TInternalAlign.client.y]
- sub eax, [ecx+TWindow._x]
- sub edx, [ecx+TWindow._y]
- mov ebx, eax
- or ebx, edx
-
- mov eax, [esi+__TInternalAlign.client.width]
- mov edx, [esi+__TInternalAlign.client.height]
- sub eax, [ecx+TWindow._width]
- sub edx, [ecx+TWindow._height]
- or ebx, eax
- or ebx, edx
- mov [ecx+TWindow._bounds_changed], ebx
-
- push [esi+__TInternalAlign.client.height] [esi+__TInternalAlign.client.width] [esi+__TInternalAlign.client.y] [esi+__TInternalAlign.client.x]
- pop [ecx+TWindow._x] [ecx+TWindow._y] [ecx+TWindow._width] [ecx+TWindow._height]
-
-.updatewindows:
- mov ecx, [edi+TArray.count]
-
-.updateloop:
- dec ecx
- js .endupdate
-
- mov eax, [edi+8*ecx+TArray.array+TWinArrayItem.pWindow]
- cmp [eax+TWindow._bounds_changed], 0
- je .refresh_only
-
- lea edx, [eax+TWindow._x]
-; mov [eax+TWindow._bounds_changed], 0 - it will be zeroed in the seMoveResize event handler.
- stdcall _SetWindowBounds, [eax+TWindow.handle], edx
-
-.refresh_only:
- stdcall _RefreshWindow, [eax+TWindow.handle]
- jmp .updateloop
-
-.endupdate:
- stdcall FreeMem, edi
- mov eax, [.self]
- stdcall _RefreshWindow, [eax+TWindow.handle]
-
-.endalign:
- pop edi esi
- jmp .finish
-
-;.........................................................................................
-
-.focus:
- mov eax, [.self]
- stdcall _SetFocus, [eax+TWindow.handle]
- jmp .finish
-
-;.........................................................................................
-
-.addchild:
-; method parameter.
-virtual at ebx
- .child dd ?
-end virtual
- stdcall IsObject, [.child], CWindow
- jne .add_non_window
-
- mov ebx, [.child]
- mov eax, [.self]
-
- stdcall _AddChild, [eax+TWindow.handle], [ebx+TWindow.handle]
- jmp .finish
-
-.add_non_window: ; this is possible, but not implemented for now.
- jmp .error
-endp
-
-
-
-;_________________________________________________________________________________________
-
-
-proc TWindow.SysEventHandler, .pObj, .pEvent
-begin
- push eax ecx edx esi edi
-
- mov esi, [.pObj]
- mov ebx, [.pEvent]
- mov eax, [ebx+TSysEvent.event]
-
- cmp eax, seMouseEnter
- je .mouseenter
-
- cmp eax, seMouseLeave
- je .mouseleave
-
- cmp eax, seMouseBtnPress
- je .btnpress
-
- cmp eax, seMoveResize
- je .moveresize
-
- cmp eax, seKbdKeyPress
- je .keypress
-
- stc
-.finish:
- pop edi esi edx ecx eax
- return
-
-;.........................................................................................
-.moveresize:
- mov eax, [ebx+TMoveResizeEvent.newX]
- mov ecx, [ebx+TMoveResizeEvent.newY]
- mov [esi+TWindow._x], eax
- mov [esi+TWindow._y], ecx
-
- mov eax, [ebx+TMoveResizeEvent.newWidth]
- mov ecx, [ebx+TMoveResizeEvent.newHeight]
- xchg [esi+TWindow._width], eax
- xchg [esi+TWindow._height], ecx
- sub eax, [esi+TWindow._width]
- sub ecx, [esi+TWindow._height]
- or eax, ecx
- jnz .alignchildren ; when the resize is as a result of internal windows align, the _width and _height fields are already set.
- ; it must be this way, because the resize should be fast, but in Linux there is no DeferWindowPos function like in Win32
-
- cmp [esi+TWindow._bounds_changed], 0
- je .endresize
-
-.alignchildren:
- execute esi, TWindow.AlignChildren
- mov [esi+TWindow._bounds_changed], 0
-
-.endresize:
- clc
- jmp .finish
-
-;.........................................................................................
-
-.btnpress:
- execute esi, TWindow.Focus
- clc
- jmp .finish
-
-;.........................................................................................
-
-.mouseenter:
- mov eax, [esi+TWindow._cursor]
- test eax, $ffffff00
- jnz @f
- stdcall GetStockCursor, eax
-@@:
- stdcall SetMouseCursor, eax
- clc
- jmp .finish
-
-;.........................................................................................
-.mouseleave:
- stdcall GetStockCursor, mcArrow
- stdcall SetMouseCursor, eax
- clc
- jmp .finish
-
-;.........................................................................................
-
-.keypress:
- cmp [esi+TWindow.OnKeyPress], 0
- je @f
- stdcall [esi+TWindow.OnKeyPress], esi, ebx
-@@:
- clc
- jmp .finish
-endp
-
-
-
-proc __DoAlignOne, .pWindow
-.bounds TBounds
-.align dd ?
-begin
- pushad
-
- mov ebx, [.pWindow]
- cmp [ebx+TWindow._align], waNone
- je .exit
- cmp [ebx+TWindow._align], waClient
- ja .exit
-
- stdcall Get, ebx, TWindow.Visible
- test eax, eax
- jz .exit
-
- cmp [ebx+TWindow._align], waClient
- jne .doalign
-
-; only one window with waClient may exists.
- cmp [esi+__TInternalAlign.pClientWindow], 0
- jne .exit
-
- mov [esi+__TInternalAlign.pClientWindow], ebx
- jmp .exit
-
-.doalign:
- mov eax, [ebx+TWindow._align]
- dec eax
- mov [.align], eax
-
-; save the old bounds in order to detect change.
- mov eax, [ebx+TWindow._x]
- mov ecx, [ebx+TWindow._y]
- mov [.bounds.x], eax
- mov [.bounds.y], ecx
- mov eax, [ebx+TWindow._width]
- mov ecx, [ebx+TWindow._height]
- mov [.bounds.width], eax
- mov [.bounds.height], ecx
-
- mov ecx, TBounds.width
- mov edx, [ebx+TWindow._height]
- mov edi, TBounds.y
- bt [.align], 0 ; 0 - width; 1 - height
- jc @f
- mov ecx, TBounds.height
- mov edx, [ebx+TWindow._width]
- mov edi, TBounds.x
-@@:
- mov eax, [esi+__TInternalAlign.client+ecx]
- mov [ebx+TWindow._x+ecx], eax
-
- mov eax, [esi+__TInternalAlign.client.x]
- mov ecx, [esi+__TInternalAlign.client.y]
-
- bt [.align], 1 ; 0 - left/top; 1-right/bottom
- jnc @f
-
- add eax, [esi+__TInternalAlign.client.width]
- add ecx, [esi+__TInternalAlign.client.height]
- sub eax, [ebx+TWindow._width]
- sub ecx, [ebx+TWindow._height]
- neg edx
- add edi, 8
-
-@@:
- mov [ebx+TWindow._x], eax
- mov [ebx+TWindow._y], ecx
- add [esi+__TInternalAlign.client+edi], edx
- test edx, edx
- js @f
- sub [esi+__TInternalAlign.client+edi+8], edx
-@@:
- mov eax, [ebx+TWindow._x]
- mov ecx, [ebx+TWindow._y]
- mov edx, [ebx+TWindow._width]
- mov edi, [ebx+TWindow._height]
- sub eax, [.bounds.x]
- sub ecx, [.bounds.y]
- sub edx, [.bounds.width]
- sub edi, [.bounds.height]
- or ecx, eax
- or edx, edi
- or ecx, edx
- mov [ebx+TWindow._bounds_changed], ecx
-
-.exit:
- popad
- return
-endp
-
-
-
-
-endmodule
-
DELETED freshlib/gui/ThemeGUI.asm
Index: freshlib/gui/ThemeGUI.asm
==================================================================
--- freshlib/gui/ThemeGUI.asm
+++ /dev/null
@@ -1,172 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: This file contains procedures and data, that form the appearance of the
-; FreshLib GUI application. Colors, control borders, backgrownd drawing etc.
-;
-; Target OS: Any
-;
-; Dependencies:
-;
-; Notes: The user should be able to change these settings and if he uses external
-; procedures, then the code from this library should not be compiled.
-;_________________________________________________________________________________________
-module "GUI theme data and code library"
-
-; Box border type
-bxNone = 0
-bxRaised = 1
-bxSunken = 2
-bxFlat = 3
-bxNoFill = $80000000
-
-; Default colors
-iglobal
- var clBorderLight = $ffffff
- var clBorderDark = $606060 ; soft shadow
- var clBorderNeutral = $a0a0a8
-
- var clEditBk = $fffff0
- var clEditTxt = $000000
- var clEditSel = $0000a0
- var clEditSelTxt = $ffffff
-
- var clButtonBk = $d0d0d8
- var clButtonTxt = $000000
-
- var clButtonHotBk = $e0e0e8
- var clButtonHotTxt = $0000ff
-
- var clDialogBk = $d0d0d8
- var clDialogTxt = $000000
-
- var clScrollBk = $a0a0a0
- var clScrollSlider = $d0d0d8
-
- if ~defined DrawBox | defined ___DrawBox
- var DrawBox = DrawBoxDefault
- ___DrawBox = 1
- end if
-
- if ~defined DrawSlider | defined ___DrawSlider
- var DrawSlider = DrawSliderDefault
- ___DrawSlider = 1
- end if
-
-
-endg
-
-
-
-
-
-; Midnight colors
-;iglobal
-; var clBorderLight = $0000ff
-; var clBorderDark = $000000
-; var clBorderNeutral = $808080
-;
-; var clEditBk = $0000c0
-; var clEditTxt = $ffffff
-; var clEditSel = $0000ff
-; var clEditSelTxt = $000000
-;
-; var clButtonBk = $000080
-; var clButtonTxt = $ffffff
-;
-; var clButtonHotBk = $0000a0
-; var clButtonHotTxt = $ffffff
-;
-; var clDialogBk = $000080
-; var clDialogTxt = $ffffff
-;endg
-
-
-
-
-proc DrawBoxDefault, .context, .pBounds, .bkground, .border
- .brd RECT
-begin
- push eax ecx edx esi
-
-
- stdcall SetDrawMode, [.context], cmCopy
-
- mov esi, [.pBounds]
-
- mov edx, [.border]
- and edx, $ff
- jz .borderok
-
- mov eax, [esi+TBounds.x]
- mov ecx, [esi+TBounds.y]
- mov [.brd.left], eax
- mov [.brd.top], ecx
-
- add eax, [esi+TBounds.width]
- add ecx, [esi+TBounds.height]
- dec eax
- dec ecx
- mov [.brd.right], eax
- mov [.brd.bottom], ecx
-
- sub [esi+TBounds.width], 2
- sub [esi+TBounds.height], 2
- inc [esi+TBounds.x]
- inc [esi+TBounds.y]
-
- mov eax, [clBorderLight]
- mov ecx, [clBorderDark]
-
- cmp edx, bxRaised
- je .colorok
-
- xchg eax, ecx
-
- cmp edx, bxSunken
- je .colorok
-
- mov eax, [clBorderNeutral]
- mov ecx, eax
-
-.colorok:
- stdcall SetSimpleLine, [.context], eax
- stdcall DrawLine, [.context], [.brd.left], [.brd.top], [.brd.left], [.brd.bottom]
- stdcall DrawLine, [.context], [.brd.left], [.brd.top], [.brd.right], [.brd.top]
-
- stdcall SetSimpleLine, [.context], ecx
- stdcall DrawLine, [.context], [.brd.left], [.brd.bottom], [.brd.right], [.brd.bottom]
- inc [.brd.bottom]
- stdcall DrawLine, [.context], [.brd.right], [.brd.top], [.brd.right], [.brd.bottom]
-
-.borderok:
- bt [.border], 31
- jc .fillok
- stdcall DrawFillRect, [.context], [esi+TBounds.x], [esi+TBounds.y], [esi+TBounds.width], [esi+TBounds.height], [.bkground]
-
-; additional 1px margin
- sub [esi+TBounds.width], 2
- sub [esi+TBounds.height], 2
- inc [esi+TBounds.x]
- inc [esi+TBounds.y]
-
-.fillok:
- pop esi edx ecx eax
- return
-endp
-
-
-sliderHorizontal = 0
-sliderVertical = 1
-
-proc DrawSliderDefault, .context, .pBounds, .bkground, .type
-begin
- stdcall [DrawBox], [.context], [.pBounds], [.bkground], bxRaised
- return
-endp
-
-
-
-endmodule
DELETED freshlib/gui/Win32/Main.asm
Index: freshlib/gui/Win32/Main.asm
==================================================================
--- freshlib/gui/Win32/Main.asm
+++ /dev/null
@@ -1,495 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Main procedure of GUI application library.
-;
-; Target OS: Win32
-;
-; Dependencies:
-;
-; Notes: Organize the main message/event loop needed by every GUI engine.
-;_________________________________________________________________________________________
-
-proc ProcessSystemEvents
-.msg MSG
-begin
- push ecx edx esi
-
-.msgloop:
- lea esi, [.msg]
- xor eax, eax
-
- invoke PeekMessageW, esi, eax, eax, eax, PM_REMOVE
- test eax, eax
- jz .exitok
-
- cmp [.msg.message], WM_TIMER
- je .translate ; express dispatching of the timer messages.
-
- cmp [.msg.message], WM_QUIT
- je .terminate
-
- stdcall __ProcessOneSystemEvent, [esi+MSG.hwnd], [esi+MSG.message], [esi+MSG.wParam], [esi+MSG.lParam]
- jnc .msgloop ; the message is translated to system event and the event is executed by the object SysEvent handler.
-
-; the message is for window that is not an FreshLib object, so process with standard windows behaviour.
-; invoke TranslateMessage, esi
-.translate:
- invoke DispatchMessageW, esi
- jmp .msgloop
-
-
-.exitok:
- clc
- pop esi edx ecx
- return
-
-
-.terminate:
- mov eax, [.msg.wParam]
- stc
- pop esi edx ecx
- return
-endp
-
-
-
-proc WaitForSystemEvent
-begin
- push eax ecx edx
- invoke WaitMessage
- pop edx ecx eax
- return
-endp
-
-
-
-
-;proc EventsQueued, .pWin
-;.msg MSG
-;begin
-; push eax ecx edx
-; mov eax, [.pWin]
-; mov ecx, [eax+TWindow.handle]
-; lea eax, [.msg]
-; invoke PeekMessage, eax, ecx, 0, 0, PM_NOREMOVE
-; test eax, eax
-; clc
-; jz @f
-; stc
-;@@:
-; pop edx ecx eax
-; return
-;endp
-;
-
-;----------------------------------------------------------------------------------------------------------
-; This procedure makes following:
-; 1. Takes as arguments one windows message
-; 2. Converts this message to FreshLib system event (or not, depending on the message)
-; 3. Calls SysEventHandler procedures for the given object (if any) with the created event structure.
-; 4. returns CF=0 if the event was properly processed.
-; 5. returns CF=1 if the event was not processed.
-;
-; The event can be not processed in the following cases:
-; 1. The window that receives the message is not FreshLib object.
-; 2. TObjectClass.procSysEventHandler = 0 for the given class and all parents.
-; 3. All procSysEventHandler procedures refuse to process the event (CF=1)
-;----------------------------------------------------------------------------------------------------------
-uglobal
- if used __LatestPointedObj
- __LatestPointedObj dd ?
- end if
-endg
-
-
-dproc __ProcessOneSystemEvent, .hwnd, .wmsg, .wparam, .lparam
-.event rb 32
-begin
- push eax ebx ecx edx esi edi
-
- stdcall _GetWindowStruct, [.hwnd]
- test eax, eax
- jz .ondefault
-
- mov esi, eax
- lea edi, [.event]
-
- dispatch [.wmsg]
-
-.ondefault:
- pop edi esi edx ecx ebx eax
- stc
- return
-
-;.........................................................................................
-
-.exec_event:
- stdcall ExecEvent, esi, edi
-
-.finish:
- pop edi esi edx ecx ebx eax
- clc
- return
-
-;.........................................................................................
-
-oncase WM_MOUSEWHEEL
-
- mov eax, [.wparam]
- sar eax, 16
- mov ecx, scWheelUp
- test eax, eax
- jns @f
- mov ecx, scWheelDn
- neg eax
-@@:
- mov [edi+TScrollEvent.event], seScroll
- mov [edi+TScrollEvent.ScrollBar], scrollY
- mov [edi+TScrollEvent.ScrollCmd], ecx
-
- xor edx, edx
- mov ecx, 120
- idiv ecx
- mov [edi+TScrollEvent.Value], eax
-
- jmp .exec_event
-
-;.........................................................................................
-
-oncase WM_WINDOWPOSCHANGED
-
-locals
- .rect RECT
-endl
- mov ebx, [.lparam]
-
- lea eax, [edi+TMoveResizeEvent.newX]
- invoke GetClientRect, [.hwnd], eax
-
- mov eax, [ebx+WINDOWPOS.x]
- mov ecx, [ebx+WINDOWPOS.y]
- mov [edi+TMoveResizeEvent.newX], eax
- mov [edi+TMoveResizeEvent.newY], ecx
-
- mov [edi+TMoveResizeEvent.event], seMoveResize
- jmp .exec_event
-
-
-
-;.........................................................................................
-
-oncase WM_SYSKEYDOWN
-oncase WM_SYSKEYUP
-oncase WM_KEYDOWN
-oncase WM_KEYUP
-locals
- .keyboard rb 256
- .unicode rw 16
- .utf8 rb 16
-endl
- lea ebx, [.keyboard]
- invoke GetKeyboardState, ebx
- mov eax, [.lparam]
- mov ecx, eax
- shr eax, 16
- and ecx, $80000000
- and eax, $ff
- mov [edi+TKeyboardEvent.scancode], eax
- or eax, ecx
- lea edx, [.unicode]
- invoke ToUnicode, [.wparam], eax, ebx, edx, 16, 0
- xor ecx, ecx
- test eax, eax
- jz .key_translated ; the key can not be translated.
- js .key_translated ; it is a dead key. What we have to do???
-
- lea edx, [.utf8]
- xor ecx, ecx
- mov [edx], ecx
- mov [edx+4], ecx
- lea ecx, [.unicode]
- invoke WideCharToMultiByte, CP_UTF8, 0, ecx, eax, edx, 8, 0, 0
- xor ecx, ecx
- test eax, eax
- jz .key_translated
-
- mov ecx, dword [.utf8]
-
-.key_translated:
- mov [edi+TKeyboardEvent.key], ecx
-
- mov ecx, seKbdKeyPress
- cmp [.wmsg], WM_KEYDOWN
- je @f
- cmp [.wmsg], WM_SYSKEYDOWN
- je @f
- mov ecx, seKbdKeyRelease
-@@:
- mov [edi+TKeyboardEvent.event], ecx
-
- xor eax, eax
- test [.keyboard+VK_CONTROL], $80
- jz @f
- or eax, maskCtrl
-@@:
- test [.keyboard+VK_SHIFT], $80
- jz @f
- or eax, maskShift
-@@:
- test [.keyboard+VK_MENU], $80
- jz @f
- or eax, maskAlt
-@@:
- test [.keyboard+VK_SCROLL], $01
- jz @f
- or eax, maskScrLk
-@@:
- test [.keyboard+VK_CAPITAL], $01
- jz @f
- or eax, maskCapsLock
-@@:
-
-; or eax, [__MouseButtonMask]
-; OutputRegister regEAX, 16
-
- mov [edi+TKeyboardEvent.kbdStatus], eax
- jmp .exec_event
-
-
-;.........................................................................................
-
-
-oncase WM_SETFOCUS
- mov [edi+TFocusInEvent.event], seFocusIn
- jmp .exec_event
-
-
-;.........................................................................................
-
-
-oncase WM_KILLFOCUS
- mov [edi+TFocusOutEvent.event], seFocusOut
- jmp .exec_event
-
-
-;.........................................................................................
-
-
-oncase WM_SETCURSOR
-
- movzx eax, word [.lparam]
- cmp eax, HTCLIENT
- jne .ondefault
-
- mov eax, [esi+TWindow._cursor]
- test eax, $ffffff00
- jnz .customcursor
-
- stdcall GetStockCursor, eax
-
-.customcursor:
- stdcall SetMouseCursor, eax
- jmp .finish
-
-
-;.........................................................................................
-
-
-oncase WM_MOUSEMOVE
- cmp esi, [__LatestPointedObj]
- je .normal_mouse_move
-
- mov [edi+TMouseEnterEvent.event], seMouseLeave
- xchg esi, [__LatestPointedObj]
- test esi, esi
- jz .leaveok
- stdcall ExecEvent, esi, edi
-
-.leaveok:
- mov esi, [__LatestPointedObj]
- mov [edi+TMouseEnterEvent.event], seMouseEnter
- stdcall ExecEvent, esi, edi
-
-.normal_mouse_move:
- mov [edi+TMouseMoveEvent.event], seMouseMove
- movsx eax, word [.lparam]
- movsx ecx, word [.lparam+2]
- mov [edi+TMouseMoveEvent.x], eax
- mov [edi+TMouseMoveEvent.y], ecx
- jmp .exec_event
-
-
-
-;.........................................................................................
-
-oncase WM_PAINT
-locals
- .ps PAINTSTRUCT
- .context TContext
- .caret dd ?
- .rect2 RECT
-endl
- lea eax, [.rect2]
- invoke GetUpdateRect, [.hwnd], eax, FALSE
- test eax, eax
- jz .endpaint
-
- lea eax, [.ps]
- invoke BeginPaint, [.hwnd], eax
-
-if defined Caret
- mov [.caret], -1
- cmp esi, [Caret.pWindow]
- jne @f
-
- stdcall CaretShow, FALSE
- mov [.caret], eax
-@@:
-end if
-
- mov [edi+TPaintEvent.event], sePaint
- push [.ps.hdc]
- pop [.context.handle]
- push [.hwnd]
- pop [.context.raster]
-
- lea eax, [.context]
- mov [edi+TPaintEvent.context], eax
-
-; ?????????????????????????????
-; push [.ps.rcPaint.left] [.ps.rcPaint.top]
- push [.rect2.left] [.rect2.top]
- pop [edi+TPaintEvent.rect.top] [edi+TPaintEvent.rect.left]
-; push [.ps.rcPaint.right] [.ps.rcPaint.bottom]
- push [.rect2.right] [.rect2.bottom]
- pop [edi+TPaintEvent.rect.bottom] [edi+TPaintEvent.rect.right]
-
- stdcall ExecEvent, esi, edi
-
- lea eax, [.ps]
- invoke EndPaint, [.hwnd], eax
-
-if defined Caret
- cmp [.caret], -1
- je @f
- stdcall CaretShow, [.caret]
-@@:
-end if
-
-.endpaint:
- pop edi esi edx ecx ebx eax
- clc
- return
-
-
-;.........................................................................................
-
-
-oncase WM_CLOSE
- mov eax, [pApplication]
- mov eax, [eax+TApplication.MainWindow]
- cmp [eax], esi
- jne @f
-
-DebugMsg "Quit message posted."
- invoke PostQuitMessage, 0
-
-@@:
- mov [edi+TCloseEvent.event], seCloseRequest
- mov [edi+TCloseEvent.reason], cerFromUser
- jmp .exec_event
-
-oncase WM_DESTROY
- cmp esi, [__LatestPointedObj]
- jne .ondefault
-
- mov [__LatestPointedObj], 0
- jmp .ondefault
-
-;.........................................................................................
-
-
-oncase WM_LBUTTONUP
-oncase WM_RBUTTONUP
-oncase WM_MBUTTONUP
-oncase WM_LBUTTONDOWN
-oncase WM_RBUTTONDOWN
-oncase WM_MBUTTONDOWN
-oncase WM_LBUTTONDBLCLK
-oncase WM_RBUTTONDBLCLK
-oncase WM_MBUTTONDBLCLK
-
- stdcall __MouseButton, [.wmsg]
- mov [edi+TMouseButtonEvent.event], ecx
- mov [edi+TMouseButtonEvent.Button], eax
- stdcall __KeyStatus, [.wparam]
- mov [edi+TMouseButtonEvent.kbdStatus], eax
-
- movsx eax, word [.lparam]
- movsx ecx, word [.lparam+2]
- mov [edi+TMouseButtonEvent.x], eax
- mov [edi+TMouseButtonEvent.y], ecx
-
-
- jmp .exec_event
-enddp
-
-
-
-proc __MouseButton, .msg
-begin
- mov eax, [.msg]
- sub eax, WM_LBUTTONDOWN
- movzx ecx, byte [__mouse_event_table+eax]
- movzx eax, byte [__mouse_button_table+eax]
- return
-endp
-
-
-iglobal
- if used __mouse_button_table
- __mouse_button_table db mbLeft, mbLeft, mbLeft
- db mbRight, mbRight, mbRight
- db mbMiddle, mbMiddle, mbMiddle
- end if
-
- if used __mouse_event_table
- __mouse_event_table db seMouseBtnPress, seMouseBtnRelease, seMouseBtnDblClick
- db seMouseBtnPress, seMouseBtnRelease, seMouseBtnDblClick
- db seMouseBtnPress, seMouseBtnRelease, seMouseBtnDblClick
- end if
-endg
-
-
-;.........................................................................................
-
-
-
-proc __KeyStatus, .status
-begin
- xor eax, eax
- test [.status], MK_LBUTTON
- jz @f
- or eax, maskBtnLeft
-@@:
- test [.status], MK_RBUTTON
- jz @f
- or eax, maskBtnRight
-@@:
- test [.status], MK_MBUTTON
- jz @f
- or eax, maskBtnMiddle
-@@:
- test [.status], MK_SHIFT
- jz @f
- or eax, maskCtrl
-@@:
- test [.status], MK_CONTROL
- jz @f
- or eax, maskCtrl
-@@:
- return
-endp
DELETED freshlib/gui/Win32/TApplication.asm
Index: freshlib/gui/Win32/TApplication.asm
==================================================================
--- freshlib/gui/Win32/TApplication.asm
+++ /dev/null
@@ -1,57 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: TApplication object class.
-;
-; Target OS: Win32
-;
-; Dependencies:
-;
-; Notes: TApplication by the idea is the base of GUI application, but the implementation
-; somehow need fixing...
-;_________________________________________________________________________________________
-
-uglobal
- if used hInstance
- hInstance dd ?
- end if
-endg
-
-
-proc TApplication.Create, .obj
-begin
- push eax ecx edx
- invoke GetModuleHandleW, 0
- mov [hInstance], eax
-
- clc
- pop edx ecx eax
- return
-endp
-
-
-
-proc TApplication.Get, .obj, .paramID
-begin
- stc
- return
-endp
-
-
-
-
-proc TApplication.Set, .obj, .paramID, .value
-begin
- stc
- return
-endp
-
-
-
-proc TApplication.SysEventHandler, .obj, .event
-begin
- stc
- return
-endp
DELETED freshlib/gui/Win32/keycodes.inc
Index: freshlib/gui/Win32/keycodes.inc
==================================================================
--- freshlib/gui/Win32/keycodes.inc
+++ /dev/null
@@ -1,77 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: This file contains scan code values for control keyboard keys.
-;
-; Target OS: Win32
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-keyHomeNumpad = $47
-keyUpNumpad = $48
-keyPgUpNumpad = $49
-keyLeftNumpad = $4b
-key5Numpad = $4c
-keyRightNumpad = $4d
-keyEndNumpad = $4f
-keyDownNumpad = $50
-keyPgDnNumpad = $51
-keyInsNumpad = $52
-keyDelNumpad = $53
-keyEnterNumpad = $1c ; it is ASCII $0d
-keyPlusNumpad = $4e
-keyMinusNumpad = $4a
-keyAsteriskNumpad = $37
-keySlashNumpad = $35
-
-keyNumLock = $45
-keyScrollLock = $46
-keyPause = $45
-keyPrtScr = $37
-
-
-keyLeft = $4b
-keyRight = $4d
-keyUp = $48
-keyDown = $50
-
-keyInsert = $52
-keyDelete = $53
-keyHome = $47
-keyEnd = $4f
-keyPgUp = $49
-keyPgDown = $51
-
-keyF1 = $3b
-keyF2 = $3c
-keyF3 = $3d
-keyF4 = $3e
-
-keyF5 = $3f
-keyF6 = $40
-keyF7 = $41
-keyF8 = $42
-
-keyF9 = $43
-keyF10 = $44 ; used for menu and does not generate WM_KEYDOWN.
-keyF11 = $57
-keyF12 = $58
-
-keyCapsLock = $3a
-keyShiftLeft = $2a
-keyCtrlLeft = $1d
-keyWndLeft = $5b
-keyWndRight = $5c
-keyAltLeft = $38
-keyAltRight = $38
-keyPopupMenu = $5d
-keyShiftRight = $36
-keyCtrlRight = $1d
-
-keyBackSpace = $0e
-
DELETED freshlib/gui/Win32/mouse.asm
Index: freshlib/gui/Win32/mouse.asm
==================================================================
--- freshlib/gui/Win32/mouse.asm
+++ /dev/null
@@ -1,60 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Provides unified access to standard mouse cursors.
-;
-; Target OS: Win32
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-; ToDo: Arbitrary mouse cursors, B&W for the begining.
-
-
-proc SetMouseCursor, .hCursor
-begin
- push ecx edx
- invoke SetCursor, [.hCursor]
- pop edx ecx
- return
-endp
-
-
-
-proc GetStockCursor, .index
-begin
- push ecx edx
- mov eax, [.index]
- and eax, 7
- movzx eax, [_cursors+2*eax]
- invoke LoadCursorW, 0, eax
- pop edx ecx
- return
-endp
-
-if used _cursors
- _cursors dw IDC_ARROW, IDC_IBEAM, IDC_CROSS, IDC_SIZEWE, IDC_SIZENS, IDC_SIZENWSE, IDC_SIZENESW, IDC_WAIT
-end if
-
-
-
-proc MouseCapture, .hwnd
-begin
- push eax ecx edx
- cmp [.hwnd], 0
- je .release
-
- invoke SetCapture, [.hwnd]
-
-.finish:
- pop edx ecx eax
- return
-
-.release:
- invoke ReleaseCapture
- jmp .finish
-endp
DELETED freshlib/gui/Win32/windows.asm
Index: freshlib/gui/Win32/windows.asm
==================================================================
--- freshlib/gui/Win32/windows.asm
+++ /dev/null
@@ -1,447 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Window management OS interface functions.
-;
-; Target OS: Win32
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-
-iglobal
-if used cWindowClassName
- cWindowClassName du 'FreshWin', 0
-end if
-endg
-
-nWindowExtraBytes = 32
-ofsWindowStruct = nWindowExtraBytes - 4
-
-;_________________________________________________________________________________________
-;
-; Registers common window class
-; Call only once
-;_________________________________________________________________________________________
-
-if used _CreateNullWindow
-initialize __RegisterWindowClass
-
-.wc WNDCLASS
-
-begin
- xor eax, eax
- lea edi, [.wc]
- mov ecx, sizeof.WNDCLASS / 4
- rep stosd
-
- mov [.wc.style], CS_OWNDC or CS_DBLCLKS; or CS_VREDRAW or CS_HREDRAW
- mov [.wc.lpfnWndProc], __CommonWindowProc
- mov [.wc.cbWndExtra], nWindowExtraBytes
-
-; invoke CreateSolidBrush, $0000ff
-; mov [.wc.hbrBackground], eax
-
- mov eax,[hInstance]
- mov [.wc.hInstance],eax
- mov [.wc.lpszClassName], cWindowClassName
-
- lea eax, [.wc]
- invoke RegisterClassW, eax
-
- return
-endp
-end if
-
-
-
-;_________________________________________________________________________________________
-
-
-proc _CreateNullWindow
-begin
- push ecx edx
- invoke CreateWindowExW, 0, cWindowClassName, 0, WS_CLIPSIBLINGS or WS_CLIPCHILDREN, 0, 0, 0, 0, 0, 0, 0, 0
- pop edx ecx
- return
-endp
-
-;_________________________________________________________________________________________
-
-
-
-proc _DestroyWindow, .hwnd
-begin
- push eax ecx edx
- invoke DestroyWindow, [.hwnd]
- pop edx ecx eax
- return
-endp
-
-
-;_________________________________________________________________________________________
-
-
-proc _GetParent, .hwnd
-begin
- push ecx edx
- invoke GetParent, [.hwnd]
- pop edx ecx
- return
-endp
-
-;_________________________________________________________________________________________
-
-
-proc _GetChildren, .hwnd
-begin
- push ebx ecx edx
-
- xor ebx, ebx
-
- invoke GetWindow, [.hwnd], GW_CHILD
- mov ecx, eax
- jecxz .endchildren
-
- stdcall CreateArray, sizeof.TWinArrayItem
- mov ebx, eax
-
-.loophwnd:
- stdcall AddArrayItems, ebx, 1
- mov ebx, edx
-
- mov [eax+TWinArrayItem.handle], ecx
-
- invoke GetWindow, ecx, GW_HWNDNEXT
- mov ecx, eax
- jecxz .endchildren
- jmp .loophwnd
-
-.endchildren:
- mov eax, ebx
- pop edx ecx ebx
- return
-endp
-
-
-;_________________________________________________________________________________________
-
-
-
-proc _GetVisible, .hwnd
-begin
- push ecx edx
- invoke IsWindowVisible, [.hwnd]
- pop edx ecx
- return
-endp
-
-;_________________________________________________________________________________________
-
-
-proc _GetWindowBounds, .hwnd, .pBounds
-begin
- push eax ecx edx
-
- invoke GetClientRect, [.hwnd], [.pBounds]
- invoke GetParent, [.hwnd]
- invoke MapWindowPoints, [.hwnd], eax, [.pBounds], 2
-
- mov edx, [.pBounds]
- mov eax, [edx+TBounds.width]
- mov ecx, [edx+TBounds.height]
- sub eax, [edx+TBounds.x]
- sub ecx, [edx+TBounds.y]
- mov [edx+TBounds.width], eax
- mov [edx+TBounds.height], ecx
-
- pop edx ecx eax
- return
-endp
-
-
-
-;_________________________________________________________________________________________
-
-
-proc _SetWindowBounds, .hwnd, .pBounds
-.rect RECT
-begin
- push eax ecx edx
-
- mov eax, [.pBounds]
- push [eax+TBounds.width] [eax+TBounds.height]
- pop [.rect.bottom] [.rect.right]
- mov [.rect.left], 0
- mov [.rect.top], 0
-
- invoke GetWindowLongW, [.hwnd], GWL_EXSTYLE
- push eax
- push FALSE
- invoke GetWindowLongW, [.hwnd], GWL_STYLE
- push eax
-
- lea eax, [.rect]
- invoke AdjustWindowRectEx, eax ; and from the stack
-
- mov eax, [.rect.right]
- mov ecx, [.rect.bottom]
- sub eax, [.rect.left]
- sub ecx, [.rect.top]
-
- mov edx, [.pBounds]
- invoke SetWindowPos, [.hwnd], 0, [edx+TBounds.x], [edx+TBounds.y], eax, ecx, SWP_NOZORDER or SWP_NOREDRAW
-
- pop edx ecx eax
- return
-endp
-
-
-
-
-
-;_________________________________________________________________________________________
-wsNoneWindowBorder = WS_POPUP
-wsFullWindowBorder = WS_BORDER or WS_CAPTION or WS_SYSMENU or WS_SIZEBOX or WS_MINIMIZEBOX or WS_MAXIMIZEBOX
-wsModalWindowBorder = WS_CAPTION or WS_DLGFRAME or WS_SYSMENU
-wsToolboxWindowBorder = WS_BORDER or WS_CAPTION or WS_SYSMENU or WS_SIZEBOX
-
-wsAllWindowBorder = wsNoneWindowBorder or wsFullWindowBorder or wsModalWindowBorder or wsToolboxWindowBorder
-
-proc _SetWindowBorder, .hwnd, .brdType
-.bounds TBounds
-begin
- push eax ebx ecx edx esi
-
- invoke GetWindowLongW, [.hwnd], GWL_STYLE
- mov ebx, eax
-
- mov esi, [.brdType]
- and esi, 3
-
- invoke SetWindowLongW, [.hwnd], GWL_EXSTYLE, [.exstyles+4*esi]
-
- and ebx, not wsAllWindowBorder
- or ebx, [.styles+4*esi]
- invoke SetWindowLongW, [.hwnd], GWL_STYLE, ebx
-
- lea esi, [.bounds]
- stdcall _GetWindowBounds, [.hwnd], esi
- stdcall _SetWindowBounds, [.hwnd], esi
-
- pop esi edx ecx ebx eax
- return
-
-.styles dd wsNoneWindowBorder
- dd wsFullWindowBorder
- dd wsModalWindowBorder
- dd wsToolboxWindowBorder
-
-.exstyles dd 0
- dd WS_EX_APPWINDOW
- dd WS_EX_DLGMODALFRAME
- dd WS_EX_TOOLWINDOW
-
-endp
-
-;_________________________________________________________________________________________
-
-proc _ShowWindow, .hwnd, .flag
-begin
- push eax ecx edx
- invoke ShowWindow, [.hwnd], [.flag]
- pop edx ecx eax
- return
-endp
-
-
-;_________________________________________________________________________________________
-
-
-proc _RefreshWindow, .hwnd
-.rect RECT
-begin
- push eax ecx edx
-
-; lea eax, [.rect]
-; invoke GetClientRect, [.hwnd], eax
-; lea eax, [.rect]
- invoke InvalidateRect, [.hwnd], 0, FALSE
-
- pop edx ecx eax
- return
-endp
-
-
-;_________________________________________________________________________________________
-
-
-proc _SetFocus, .hwnd
-begin
- push eax ecx edx
-
- invoke SetFocus, [.hwnd]
-
- pop edx ecx eax
- return
-endp
-
-;_________________________________________________________________________________________
-
-proc _AddChild, .hwnd, .child
-begin
- push eax ecx edx
-
- invoke GetWindowLongW, [.child], GWL_STYLE
- or eax, WS_CHILD
- and eax, not (WS_DLGFRAME or WS_BORDER)
- invoke SetWindowLongW, [.child], GWL_STYLE, eax
- invoke SetParent, [.child], [.hwnd]
-
- pop edx ecx eax
- return
-endp
-
-;_________________________________________________________________________________________
-
-
-; Common utility procedures.
-
-
-;_________________________________________________________________________________________
-;
-; Returns the window TObject structure, from the window handle.
-;_________________________________________________________________________________________
-
-proc _GetWindowStruct, .hwin
-begin
- push ecx edx
- invoke GetWindowLongW, [.hwin], ofsWindowStruct
- pop edx ecx
- return
-endp
-
-
-
-;_________________________________________________________________________________________
-
-
-
-proc _SetWindowStruct, .hwin, .value
-begin
- push eax ecx edx
- invoke SetWindowLongW, [.hwin], ofsWindowStruct, [.value]
- pop edx ecx eax
- return
-endp
-
-
-;_________________________________________________________________________________________
-
-
-
-proc _SetWindowTextUtf8, .hwnd, .ptrUtf8
-.pwc dd ?
-.charlen dd ?
-begin
- stdcall StrLen, [.ptrUtf8]
- lea ecx, [eax*4]
-
- stdcall GetMem, ecx
- mov [.pwc], eax
-
- invoke MultiByteToWideChar, CP_UTF8, 0, [.ptrUtf8], -1, [.pwc], ecx
- mov [.charlen], eax
-
- invoke SendMessageW, [.hwnd], WM_SETTEXT, 0, [.pwc]
- stdcall FreeMem, [.pwc]
- return
-endp
-
-
-
-;_________________________________________________________________________________________
-
-
-
-proc _GetWindowTextUtf8, .hwnd, .ptrUtf8
-.pwc dd ?
-.charlen dd ?
-begin
- push ebx ecx edx edi
- stdcall StrNew
- mov ebx, eax
-
- invoke SendMessage, [.hwnd], WM_GETTEXTLENGTH, 0, 0
- mov [.charlen], eax
- lea ecx, [eax*4]
-
- stdcall StrSetCapacity, ebx, ecx
- mov edi, eax
-
- stdcall GetMem, ecx
- mov [.pwc], eax
-
- invoke SendMessage, [.hwnd], WM_GETTEXT, [.charlen], [.pwc]
- invoke WideCharToMultiByte, CP_UTF8, 0, [.pwc], -1, edi, [edi+string.capacity], 0, 0
- stdcall FreeMem, [.pwc]
- stdcall StrFixLen, ebx
- mov eax, ebx
- pop edi edx ecx ebx
- return
-endp
-
-
-
-;_________________________________________________________________________________________
-
-
-proc _EnableWindow, .hwnd, .flag
-begin
- push eax ecx edx
- invoke EnableWindow, [.hwnd], [.flag]
- pop edx ecx eax
- return
-endp
-
-
-;_________________________________________________________________________________________
-
-
-proc _SetModalTowards, .hwnd, .hwndParent
-begin
- push eax ecx edx
- stdcall _SetWindowBorder, [.hwnd], borderModal
- invoke SetWindowLongW, [.hwnd], GWL_HWNDPARENT, [.hwndParent]
-
- pop edx ecx eax
- return
-endp
-
-
-;_________________________________________________________________________________________
-
-
-proc _FinalizeModal, .hwnd, .hwndParent
-begin
- return
-endp
-
-
-;_________________________________________________________________________________________
-
-
-proc __CommonWindowProc, .hwnd, .wmsg, .wparam, .lparam
-begin
- stdcall __ProcessOneSystemEvent, [.hwnd], [.wmsg], [.wparam], [.lparam] ; sometimes windows calls winproc directly instead of using postmessage.
- jnc .finish
-
- invoke DefWindowProcW, [.hwnd], [.wmsg], [.wparam], [.lparam]
-
-.finish:
- return
-endp
-
DELETED freshlib/gui/all.asm
Index: freshlib/gui/all.asm
==================================================================
--- freshlib/gui/all.asm
+++ /dev/null
@@ -1,53 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: All GUI libraries combined include.
-;
-; Target OS: Any
-;
-; Dependencies:
-;
-; Notes: Includes all GUI libraries at once.
-;_________________________________________________________________________________________
-
-AlignLeft = 0
-AlignRight = 1
-AlignTop = 2
-AlignBottom = 3
-
-include 'sysevents.asm'
-
-include 'mouse.asm'
-include 'textcaret.asm'
-
-; OS independent support code
-include 'objects.asm'
-include 'TAction.asm'
-
-; OS independent template engine.
-include 'ObjTemplates.asm'
-
-; OS independent components
-include 'TObject.asm'
-include 'TWindow.asm'
-include 'TScrollWindow.asm'
-
-include 'TApplication.asm'
-include 'TForm.asm'
-include 'TButton.asm'
-include 'TEdit.asm'
-include 'TLabel.asm'
-include 'TImageLabel.asm'
-include 'TMenuItem.asm'
-include 'TMenu.asm'
-include 'TProgressbar.asm'
-include 'TTreeView.asm'
-
-include 'ThemeGUI.asm'
-
-include 'dialogs.asm'
-
-; OS independent main procedures.
-include 'Main.asm'
DELETED freshlib/gui/dialogs.asm
Index: freshlib/gui/dialogs.asm
==================================================================
--- freshlib/gui/dialogs.asm
+++ /dev/null
@@ -1,196 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Common dialogs procedures library.
-;
-; Target OS: Any
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-module "Common dialogs library"
-
-
-iglobal
- getfile _DlgIconError, '%lib%/gui/images/error.gif'
- getfile _DlgIconInformation, '%lib%/gui/images/information.gif'
- getfile _DlgIconQuestion, '%lib%/gui/images/question.gif'
- getfile _DlgIconWarning, '%lib%/gui/images/warning.gif'
- getfile _DlgMaskDialogIcons, '%lib%/gui/images/icon_mask.gif'
-
- if used _CommonDialogTemplate
- _CommonDialogTemplate:
- ObjTemplate tfParent or tfEnd, Form, frmCommonDialog, x, 200, y, 100, width, 480, height, 100
- ObjTemplate tfChild, ImageLabel, .imgIcon, x, 4, y, 4, width, 50, height, 50, Visible, TRUE, ImageAlign, iaCenter or iaMiddle
- ObjTemplate tfChild, Label, .LblText, x,58, y, 4, width, 10, height, 10, TextAlign, dtfAlignLeft or dtfAlignMiddle or dtfWordWrap or dtfCRLF, Visible, TRUE
-
- ObjTemplate tfChild, Button, .btnOK, x, 0, y, 0, width, 64, height, 24, TextAlign, dtfAlignCenter or dtfAlignMiddle, Caption, 'OK', ModalResult, mrOK
- ObjTemplate tfChild, Button, .btnCancel, x, 0, y, 0, width, 64, height, 24, TextAlign, dtfAlignCenter or dtfAlignMiddle, Caption, 'Cancel', ModalResult, mrCancel
- ObjTemplate tfChild, Button, .btnAbort, x, 0, y, 0, width, 64, height, 24, TextAlign, dtfAlignCenter or dtfAlignMiddle, Caption, 'Abort', ModalResult, mrAbort
- ObjTemplate tfChild, Button, .btnRetry, x, 0, y, 0, width, 64, height, 24, TextAlign, dtfAlignCenter or dtfAlignMiddle, Caption, 'Retry', ModalResult, mrRetry
- ObjTemplate tfChild, Button, .btnIgnore, x, 0, y, 0, width, 64, height, 24, TextAlign, dtfAlignCenter or dtfAlignMiddle, Caption, 'Ignore', ModalResult, mrIgnore
- ObjTemplate tfChild, Button, .btnYes, x, 0, y, 0, width, 64, height, 24, TextAlign, dtfAlignCenter or dtfAlignMiddle, Caption, 'Yes', ModalResult, mrYes
- ObjTemplate tfChild, Button, .btnNo, x, 0, y, 0, width, 64, height, 24, TextAlign, dtfAlignCenter or dtfAlignMiddle, Caption, 'No', ModalResult, mrNo
- ObjTemplate tfChild, Button, .btnMaybe, x, 0, y, 0, width, 64, height, 24, TextAlign, dtfAlignCenter or dtfAlignMiddle, Caption, 'Maybe', ModalResult, mrMaybe
- ObjTemplate tfEnd, Button, .btnHelp, x, 0, y, 0, width, 64, height, 24, TextAlign, dtfAlignCenter or dtfAlignMiddle, Caption, 'Help', ModalResult, mrNone
- end if
-endg
-
-
-; buttons flags used:
-smbOK = $01
-smbCancel = $02
-smbAbort = $04
-smbRetry = $08
-smbIgnore = $10
-smbYes = $20
-smbNo = $40
-smbMaybe = $80
-smbHelp = $100
-smbMaxButton = smbHelp
-
-smiError = 0
-smiInformation = 1
-smiQuestion = 2
-smiWarning = 3
-
-
-
-proc ShowMessage, .parent, .icon, .hTitle, .hMessage, .maskButtons
-.xrow dd ?
-.yrow dd ?
-.hicon dd ?
-.hmask dd ?
-begin
- push ebx ecx edx esi
- stdcall CreateFromTemplate, _CommonDialogTemplate, 0
-
-; First set the position and size of the dialog box, depending on the flags, and the size of the message.
-
-
-
-; Set the message text:
- stdcall Set, [frmCommonDialog.LblText], TLabel.Caption, [.hMessage]
-
-; Set the message title:
- stdcall Set, ebx, TForm.Caption, [.hTitle]
-
-; arrange the buttons
- mov eax, [.maskButtons]
- mov ecx, 32
- xor edx, edx
-.count:
- rol eax, 1
- adc edx, 0
- loop .count
-
- mov ecx, edx
- imul edx, 64 ; button width
- jecxz @f
- dec ecx
- imul ecx, 16
-@@:
- add edx, ecx ; edx contains the width of the button row in pixels.
-
- stdcall Get, ebx, TForm.width
- cmp eax, edx
- jge .widthok
-
- lea eax, [edx+32]
- stdcall Set, ebx, TForm.width, eax
-
-.widthok:
- sub eax, edx
- sar eax, 1 ; eax is the begin X coordinate of the row
- mov [.xrow], eax
-
- stdcall Get, ebx, TForm.height
- sub eax, 24+8
- mov [.yrow], eax
-
- mov edx, .btnTable
- mov ecx, $1
-
-.btnLoop:
- test [.maskButtons], ecx
- jz @f
-
- mov esi, [edx]
- stdcall Set, [esi], TButton.x, [.xrow]
- stdcall Set, [esi], TButton.y, [.yrow]
- stdcall Set, [esi], TButton.Visible, TRUE
- add [.xrow], 64+16
-
-@@:
- add edx, 4
- shl ecx, 1
- cmp ecx, smbMaxButton
- jbe .btnLoop
-
-; set the icon
- mov eax, [.icon]
- cmp eax, .iconCount
- jb @f
- xor eax, eax
-@@:
- stdcall CreateImageGIF, [.iconTable+4*eax], [.iconSizes+4*eax]
- OutputRegister regEAX, 16
- mov [.hicon], eax
- stdcall Set, [frmCommonDialog.imgIcon], TImageLabel.Image, eax
-
- stdcall CreateImageGIF, _DlgMaskDialogIcons, _DlgMaskDialogIcons.size
- OutputRegister regEAX, 16
- mov [.hmask], eax
- stdcall Set, [frmCommonDialog.imgIcon], TImageLabel.Mask, eax
-
-; set the text position and size.
- mov ecx, [.yrow]
- sub ecx, 8
- stdcall Set, [frmCommonDialog.LblText], TLabel.height, ecx
- stdcall Set, [frmCommonDialog.imgIcon], TImageLabel.height, ecx
-
- stdcall Get, [frmCommonDialog], TForm.width
- sub eax, 66
- stdcall Set, [frmCommonDialog.LblText], TLabel.width, eax
-
- stdcall ShowModal, ebx, [.parent]
- stdcall Destroy, ebx
- stdcall DestroyImage, [.hicon]
- stdcall DestroyImage, [.hmask]
-
- pop esi edx ecx ebx
- return
-
-.btnTable dd frmCommonDialog.btnOK, \
- frmCommonDialog.btnCancel, \
- frmCommonDialog.btnAbort, \
- frmCommonDialog.btnRetry, \
- frmCommonDialog.btnIgnore, \
- frmCommonDialog.btnYes, \
- frmCommonDialog.btnNo, \
- frmCommonDialog.btnMaybe, \
- frmCommonDialog.btnHelp
-
-.iconTable dd _DlgIconError, _DlgIconInformation, _DlgIconQuestion, _DlgIconWarning
-.iconCount = ($ - .iconTable)/4
-.iconSizes dd _DlgIconError.size, _DlgIconInformation.size, _DlgIconQuestion.size, _DlgIconWarning.size
-
-endp
-
-
-proc InputString, .parent
-begin
-
-
- return
-endp
-
-
-
-
-
-
-endmodule
DELETED freshlib/gui/images/error.gif
Index: freshlib/gui/images/error.gif
==================================================================
--- freshlib/gui/images/error.gif
+++ /dev/null
cannot compute difference between binary files
DELETED freshlib/gui/images/icon_mask.gif
Index: freshlib/gui/images/icon_mask.gif
==================================================================
--- freshlib/gui/images/icon_mask.gif
+++ /dev/null
cannot compute difference between binary files
DELETED freshlib/gui/images/information.gif
Index: freshlib/gui/images/information.gif
==================================================================
--- freshlib/gui/images/information.gif
+++ /dev/null
cannot compute difference between binary files
DELETED freshlib/gui/images/question.gif
Index: freshlib/gui/images/question.gif
==================================================================
--- freshlib/gui/images/question.gif
+++ /dev/null
cannot compute difference between binary files
DELETED freshlib/gui/images/theme_rhomb/Icons.odg
Index: freshlib/gui/images/theme_rhomb/Icons.odg
==================================================================
--- freshlib/gui/images/theme_rhomb/Icons.odg
+++ /dev/null
cannot compute difference between binary files
DELETED freshlib/gui/images/theme_rhomb/myown/error.gif
Index: freshlib/gui/images/theme_rhomb/myown/error.gif
==================================================================
--- freshlib/gui/images/theme_rhomb/myown/error.gif
+++ /dev/null
cannot compute difference between binary files
DELETED freshlib/gui/images/theme_rhomb/myown/information.gif
Index: freshlib/gui/images/theme_rhomb/myown/information.gif
==================================================================
--- freshlib/gui/images/theme_rhomb/myown/information.gif
+++ /dev/null
cannot compute difference between binary files
DELETED freshlib/gui/images/theme_rhomb/myown/mask.gif
Index: freshlib/gui/images/theme_rhomb/myown/mask.gif
==================================================================
--- freshlib/gui/images/theme_rhomb/myown/mask.gif
+++ /dev/null
cannot compute difference between binary files
DELETED freshlib/gui/images/theme_rhomb/myown/question.gif
Index: freshlib/gui/images/theme_rhomb/myown/question.gif
==================================================================
--- freshlib/gui/images/theme_rhomb/myown/question.gif
+++ /dev/null
cannot compute difference between binary files
DELETED freshlib/gui/images/theme_rhomb/myown/warning.gif
Index: freshlib/gui/images/theme_rhomb/myown/warning.gif
==================================================================
--- freshlib/gui/images/theme_rhomb/myown/warning.gif
+++ /dev/null
cannot compute difference between binary files
DELETED freshlib/gui/images/warning.gif
Index: freshlib/gui/images/warning.gif
==================================================================
--- freshlib/gui/images/warning.gif
+++ /dev/null
cannot compute difference between binary files
DELETED freshlib/gui/mouse.asm
Index: freshlib/gui/mouse.asm
==================================================================
--- freshlib/gui/mouse.asm
+++ /dev/null
@@ -1,29 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Provides unified access to standard mouse cursors.
-;
-; Target OS: Any
-;
-; Dependencies:
-;
-; Notes: This file contains OS independent part and includes OS dependent files.
-;_________________________________________________________________________________________
-module "Mouse library"
-
-mcArrow = 0
-mcText = 1
-mcCross = 2
-mcSizeH = 3
-mcSizeV = 4
-mcSizeUL_LR = 5
-mcSizeLL_UR = 6
-mcWait = 7
-
-mcCount = 8
-
-include '%TargetOS%/mouse.asm'
-
-endmodule
DELETED freshlib/gui/objects.asm
Index: freshlib/gui/objects.asm
==================================================================
--- freshlib/gui/objects.asm
+++ /dev/null
@@ -1,511 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Contains the base procedures for the FreshLib OOP framework
-;
-; Target OS: Any
-;
-; Dependencies: memory.asm
-;
-; Notes:
-;
-; TODO: Thread safety! The whole FreshLib should be thread safe. GUI part,as long as
-; uses memory objects should be thread safe. This can be achieved by locking
-; objects, during processing. objects.asm is the proper place for such lock mechanism.
-; The lock should be provided by some kind of mutex objects, associated with the objects.
-;
-;_________________________________________________________________________________________
-module "Objects library"
-
-struct TObjectClass
- .ptrParent dd 0 ; pointer to the parent TObjectClass
- .dataSize dd 0 ; size of TObject structure.
- .procCreate dd 0
- .procDestroy dd 0
- .procGetParam dd 0
- .procSetParam dd 0
- .procExecCmd dd 0 ; executes method in chain.
- .procSysEventHandler dd 0
-ends
-
-
-
-macro ObjectClass name*, parent*, procCreate*, procDestroy*, procGetParam*, procSetParam*, procExecCmd*, procSysEvents* {
- if used C#name
- C#name TObjectClass
- store dword C#parent at C#name#.ptrParent
- store dword sizeof.T#name at C#name#.dataSize
- store dword procCreate at C#name#.procCreate
- store dword procDestroy at C#name#.procDestroy
- store dword procGetParam at C#name#.procGetParam
- store dword procSetParam at C#name#.procSetParam
- store dword procExecCmd at C#name#.procExecCmd
- store dword procSysEvents at C#name#.procSysEventHandler
- end if
-}
-
-
-CRoot = 0
-
-
-maskParameter = $80000000
-Sequence param, maskParameter
-
-
-macro method name*, [arg] {
-common
- local ..argcount
- ..argcount = 0
- param name
- forward
- if ~arg eq
- ..argcount = ..argcount + 1
- end if
- common
- name#.argcount = ..argcount
-}
-
-
-macro execute obj*, meth*, [arg] {
-reverse
- if ~arg eq
- pushd arg
- end if
-common
- pushd meth#.argcount
- pushd meth
- pushd obj
- call __Exec
-}
-
-
-macro object name*, parent {
- macro name@object \{ name name \}
- macro size@object \{ sizeof.#name = $ \}
- struc name \{
- param.current = maskParameter
- if ~parent eq
- . parent
- end if
-}
-
-endobj fix } obj_helper
-
-macro obj_helper {
- virtual at 0
- name@object
- size@object
- end virtual
- purge name@object
- purge size@object
-}
-
-
-mxTimeout = 1000 ; 1s timeout for the access mutex objects.
-
-; common object procedures
-; These procedures work with every TObject descendent object type.
-
-
-;_________________________________________________________________________________________
-;
-; proc Create, .class - creates an instance from the given class.
-;
-; Arguments:
-; .class - pointer to TObjectClass structure for needed object.
-;
-; Returns:
-; ebx = pointer to the instance of the object.
-;
-; This procedure calls procCreate for the given object class and all
-; parent classes in reverce order.
-;_________________________________________________________________________________________
-
-proc Create, .class
-begin
- push eax ecx
-
- mov ecx, [.class]
- stdcall GetMem, [ecx+TObjectClass.dataSize]
- mov ebx, eax
- mov [eax+TObject.ptrClass], ecx
-
- lea eax, [eax+TObject.mxAccess]
- stdcall MutexCreate, 0, eax
-
- push 0
-
-.loop:
- cmp [ecx+TObjectClass.procCreate], 0
- je .parent
-
- push [ecx+TObjectClass.procCreate]
-
-.parent:
- mov ecx, [ecx+TObjectClass.ptrParent]
- test ecx, ecx
- jnz .loop
-
-.loop2:
- pop ecx
- jecxz .endcreate
-
- push ebx
- stdcall ecx, ebx
- pop ebx
- jmp .loop2
-
-.endcreate:
- lea eax, [ebx+TObject.mxAccess]
- stdcall MutexRelease, eax
- pop ecx eax
- return
-endp
-
-
-
-;_________________________________________________________________________________________
-;
-; proc Destroy, .obj - destroys the object instance.
-;
-; Arguments:
-; .obj - pointer to TObject descendent object.
-;
-; Returns:
-; nothing.
-;
-; This procedure calls procDestroy for the given object class and all
-; parent classes. Note that the memory is freed only by the last
-; destroy handled from CObject class.
-;_________________________________________________________________________________________
-
-proc Destroy, .obj
-begin
- push eax ebx
-
- mov ebx, [.obj]
- test ebx, ebx
- jz .error
-
- stdcall _LockObject, [.obj]
-
- mov ebx, [ebx+TObject.ptrClass]
-
-.loop:
- cmp [ebx+TObjectClass.procDestroy], 0
- je .parent
-
- mov eax, [ebx+TObjectClass.procDestroy]
-
- push ebx
- stdcall [ebx+TObjectClass.procDestroy], [.obj]
- pop ebx
-
-.parent:
- mov ebx, [ebx+TObjectClass.ptrParent]
- test ebx, ebx
- jnz .loop
-
- mov ebx, [.obj]
- lea eax, [ebx+TObject.mxAccess]
-
- mov ebx, [ebx+TObject.ptrVar]
- test ebx, ebx
- jz @f
- mov dword [ebx], 0
-@@:
- stdcall MutexDestroy, eax
- stdcall FreeMem, [.obj]
- clc
- pop ebx eax
- return
-
-.error:
- stdcall _UnlockObject, [.obj]
- stc
- pop ebx eax
- return
-endp
-
-
-
-
-;_________________________________________________________________________________________
-;
-; proc Get, .obj, .paramID - returns the value of given parameter
-;
-; Arguments:
-; .obj - pointer to TObject descendent object.
-; .paramID - ID number of the parameter being read.
-; Returns:
-; CF=0; eax = parameter value.
-; CF=1; the parameter is unknown and can not be retrived.
-;
-; This procedure calls procGet for the given object class and
-; if the procedure returns CF=1; tries to call the parents procedure
-; procGet, until the value is retrived, or the root level of inheritance
-; is reached.
-;_________________________________________________________________________________________
-
-proc Get, .obj, .paramID
-begin
- push ecx
-
-
- stdcall _LockObject, [.obj]
-
- mov ecx, [.obj]
-.loop0:
- stc
- jecxz .finish
-
-.loop:
- mov ecx, [ecx] ; TObject.ptrClass = TObjectClass.ptrParent = 0
- jecxz .finish
-
- cmp [ecx+TObjectClass.procGetParam], 0
- je .loop0
-
- push ecx
- stdcall [ecx+TObjectClass.procGetParam], [.obj], [.paramID]
- pop ecx
- jc .loop
-
-.finish:
- stdcall _UnlockObject, [.obj]
- pop ecx
- return
-endp
-
-
-
-;_________________________________________________________________________________________
-;
-; proc Set, .obj, .paramID - sets the value of given parameter
-;
-; Arguments:
-; .obj - pointer to TObject descendent object.
-; .paramID - ID number of the parameter being read.
-; .value - value of the parameter that should be set.
-; Returns:
-; CF=0 - the value is successfully set.
-; CF=1; the value is not set, because the parameter is unknown.
-;
-; This procedure calls procSet for the given object class and
-; if the procedure returns CF=1; tries to call the parents procedures
-; procSet, until the value is set, or the root level of inheritance
-; is reached.
-;_________________________________________________________________________________________
-
-proc Set, .obj, .paramID, .value
-begin
- push ecx
-
- stdcall _LockObject, [.obj]
- mov ecx, [.obj]
-.loop0:
- stc
- jecxz .finish
-
-.loop:
- mov ecx, [ecx] ; TObject.ptrClass = TObjectClass.ptrParent = 0
- jecxz .finish
-
- cmp [ecx+TObjectClass.procSetParam], 0
- je .loop0
-
- push ecx
- stdcall [ecx+TObjectClass.procSetParam], [.obj], [.paramID], [.value]
- pop ecx
- jc .loop
-
-.finish:
- stdcall _UnlockObject, [.obj]
- pop ecx
- return
-endp
-
-
-
-
-
-;_________________________________________________________________________________________
-;
-; proc ExecEvent, .obj, .event
-; Arguments:
-; .obj - pointer to the TObject descendent object.
-; .event - pointer to TSysEvent descendent structure.
-;_________________________________________________________________________________________
-
-proc ExecEvent, .obj, .event
-begin
- push ecx
-
- stdcall _LockObject, [.obj]
- mov ecx, [.obj]
-.loop0:
- stc
- jecxz .finish
-
-.loop:
- mov ecx, [ecx] ; TObject.ptrClass = TObjectClass.ptrParent = 0
- jecxz .finish
-
- cmp [ecx+TObjectClass.procSysEventHandler], 0
- je .loop0
-
- push ecx
- stdcall [ecx+TObjectClass.procSysEventHandler], [.obj], [.event]
- pop ecx
- jc .loop
-
-.finish:
- stdcall _UnlockObject, [.obj]
- pop ecx
- return
-endp
-
-
-
-
-;_________________________________________________________________________________________
-;
-; proc IsObject, .class - returns CF=0 if the given object belongs to
-; the given class. Else returns CF=1
-;_________________________________________________________________________________________
-proc IsObject ; , .obj, .class
-virtual at esp+8
- .obj dd ?
- .class dd ?
-end virtual
-begin
- push ecx
- lea ecx, [.obj]
-
-.loop:
- stc
- mov ecx, [ecx] ; TObject.ptrClass = TObjectClass.ptrParent = 0
- jecxz .finish
-
- cmp ecx, [.class] ; the first cmp will always fail because ecx contains pointer to obj that can't be equal to a class.
- jne .loop
-
-.finish:
- pop ecx
- retn 8
-endp
-
-
-
-;_________________________________________________________________________________________
-;
-; Executes a method of given class.
-; This procedure have arbitrary count of arguments
-; it calls in chain procExecCmd the classes and passes
-; a pointer to the arguments in esi.
-; It first calls the procExecCmd of the childs and then of the parents.
-; If some class have 0 in [procExecCmd] this class is skiped and
-; the execution continues on its parent.
-; If there is no proper handler back to the root, then the procedure
-; returns CF=1
-;_________________________________________________________________________________________
-
-proc __Exec ;, .obj, .method, .argcount, ..
-begin
-virtual at ebp+8
- .obj dd ?
- .method dd ?
- .argcount dd ?
- .arguments:
-end virtual
- push ebp
- mov ebp, esp ; now ebp+8 points to the arguments.
-
- push ecx ebx
-
- xor ebx, ebx
- cmp [.argcount], 0
- je @f
- lea ebx, [.arguments]
-@@:
- mov ecx, [.obj]
-
-.loop0:
- stc
- jecxz .exit
-
-.loop:
- mov ecx, [ecx] ; TObject.ptrClass = TObjectClass.ptrParent = 0
- jecxz .exit
-
- cmp [ecx+TObjectClass.procExecCmd], 0
- je .loop0
-
- push ecx ebx
- stdcall [ecx+TObjectClass.procExecCmd], [.obj], [.method]
- pop ebx ecx
- jc .loop
-
-.exit:
- pop ebx ecx
-
- ; experimental return from procedure with arbitrary count of arguments.
- ; with keeping all registers unchanged.
- mov esp, ebp
- push ecx
- mov ebp, [.argcount]
- lea ebp, [esp+8+4*ebp+12] ; the place where the return address should be placed. (Exec have 3 more arguments, including .argcount)
- mov ecx, [esp+8] ; return address
- mov [ebp], ecx ; move the return address to the proper place.
- pop ecx ; restore ecx
- pop esp ; old value of ebp
- xchg esp, ebp ; restore ebp and set esp to the proper value
- retn
-endp
-
-
-
-
-proc _LockObject, .obj
-begin
- push eax
-
- mov eax, [.obj]
- lea eax, [eax+TObject.mxAccess]
- stdcall WaitForMutex, eax, mxTimeout
- jc .stop
-
- pop eax
- return
-
-.stop:
- int3
- pop eax
- return
-
-endp
-
-
-
-
-proc _UnlockObject, .obj
-begin
- pushf
- push eax
-
- mov eax, [.obj]
- lea eax, [eax+TObject.mxAccess]
- stdcall MutexRelease, eax
-
- pop eax
- popf
- return
-endp
-
-
-
-
-
-endmodule
DELETED freshlib/gui/sysevents.asm
Index: freshlib/gui/sysevents.asm
==================================================================
--- freshlib/gui/sysevents.asm
+++ /dev/null
@@ -1,297 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Defines constants and structures for system events of FreshLib
-;
-; Target OS: Any
-;
-; Dependencies:
-;
-; Notes:
-;_________________________________________________________________________________________
-module "System events library"
-
-seMouseMove = $0001
-seMouseEnter = $0002
-seMouseLeave = $0003
-seMouseBtnPress = $0004
-seMouseBtnRelease = $0005
-seMouseBtnClick = $0006
-seMouseBtnDblClick = $0007
-seTimer = $0008
-seKbdKeyPress = $0009
-seKbdKeyRelease = $000a
-seKbdStatusChanged = $000b
-seKbdChar = $000c
-
-seScroll = $000d
-
-
-sePaint = $0100
-seCloseRequest = $0101
-
-seFocusIn = $0102
-seFocusOut = $0103
-
-seMoveResize = $0104
-
-
-struct TSysEvent
- .event dd ?
-ends
-
-
-struct TMouseMoveEvent
- . TSysEvent
- .x dd ?
- .y dd ?
-ends
-
-mbLeft = 0
-mbMiddle = 1
-mbRight = 2
-
-maskBtnLeft = $0100
-maskBtnMiddle = $0200
-maskBtnRight = $0400
-maskShift = $1
-maskCapsLock = $2
-maskCtrl = $4
-maskAlt = $8
-maskScrLk = $10
-
-
-struct TMouseButtonEvent
- . TSysEvent
- .Button dd ?
- .kbdStatus dd ?
- .x dd ? ; coordinates of the mouse pointer in the client
- .y dd ?
-ends
-
-
-struct TMouseEnterEvent
- . TSysEvent
-ends
-
-
-; These are scan codes for the non character keys. They are OS dependent and should be used by
-; their names.
-include '%TargetOS%/keycodes.inc'
-
-
-struct TKeyboardEvent
- . TSysEvent
- .key dd ? ; 1..4 bytes UTF-8 character typed by the keyboard, or 0 if non character key is pressed/released.
- .scancode dd ? ; scan code of the pressed key.
- .kbdStatus dd ? ; same as mouse button event - contains mouse buttons and Ctrl, Shift and Alt keys status.
-ends
-
-
-scTrack = 1
-scUp = 2
-scDown = 3
-scWheelUp = 4
-scWheelDn = 5
-
-scrollX = 0
-scrollY = 1
-
-
-struct TScrollEvent
- . TSysEvent
- .ScrollBar dd ? ; 0
- .ScrollCmd dd ? ;
- .Value dd ? ; Distance for scUp and scDown and position for scTrack
-ends
-
-
-struct TTimerEvent
- . TSysEvent
- .timer dd ?
-ends
-
-
-struct TPaintEvent
- . TSysEvent
-
- .context dd ? ; pointer to TContext structure, properly initialized.
- .rect RECT
-ends
-
-
-struct TCloseEvent
- . TSysEvent
- .reason dd ? ; how the close was requested?
-ends
-
-cerFromUser = 0 ; user pressed X button on the window header, pressed alt+F4 from the keyboard, or choose "Close" from the title menu.
-cerFromProgram = 1 ; Method Close was executed from the program.
-
-
-struct TFocusInEvent
- . TSysEvent
-ends
-
-struct TFocusOutEvent
- . TSysEvent
-ends
-
-
-struct TMoveResizeEvent
- . TSysEvent
- .newX dd ?
- .newY dd ?
- .newWidth dd ?
- .newHeight dd ?
-ends
-
-
-
-; creates and returns a string with the textual identifier of the pressed/released key.
-proc CreateKeyName, .pKeyEvent
-begin
- push ebx ecx esi edi
-
- stdcall StrDup, .strkey
- mov ebx, eax
-
- mov edi, [.pKeyEvent]
- test [edi+TKeyboardEvent.kbdStatus], maskCtrl
- jz @f
-
- stdcall StrCharCat, ebx, 'Ctrl'
- stdcall StrCharCat, ebx, '+'
-@@:
- test [edi+TKeyboardEvent.kbdStatus], maskAlt
- jz @f
- stdcall StrCharCat, ebx, 'Alt+'
-@@:
- test [edi+TKeyboardEvent.kbdStatus], maskShift
- jz @f
- stdcall StrCharCat, ebx, 'Shif'
- stdcall StrCharCat, ebx, 't+'
-@@:
- mov ecx, [edi+TKeyboardEvent.key]
- jecxz .searchlist
-
- cmp ecx, ' '
- jne @f
- mov ecx, 'Spc'
-@@:
- cmp ecx, ' '
- jae @f
- add ecx, '@'
-@@:
- cmp ecx, 'a'
- jb @f
- cmp ecx, 'z'
- ja @f
- xor ecx, $20
-@@:
- stdcall StrCharCat, ebx, ecx
-
-.exitok:
- mov eax, ebx
- clc
-
-.finish:
- pop edi esi ecx ebx
- return
-
-.searchlist:
- mov esi, __FunctionalKeyNames
-
-.loop:
- movzx ecx, word [esi]
- jecxz .notfound
- cmp ecx, [edi+TKeyboardEvent.scancode]
- je .found
- add esi, 4
- jmp .loop
-
-.found:
- movsx eax, word [esi+2]
- add esi, eax
- stdcall StrCat, ebx, esi
- jmp .exitok
-
-.notfound:
- stdcall StrDel, ebx
- xor eax, eax
- stc
- jmp .finish
-
-.strkey db 'key', 0
-endp
-
-
-macro keynames lbl, [scancode, name] {
-common
- label lbl word
-forward
- local pname
- dw scancode
- dw pname - $ + 2
-common
- dw 0
-forward
- pname db name, 0
-}
-
-
-iglobal
- if used __FunctionalKeyNames
- keynames __FunctionalKeyNames, \
- keyHomeNumpad, 'Home', \
- keyUpNumpad, 'Up', \
- keyPgUpNumpad, 'PgUp', \
- keyLeftNumpad, 'Left', \
- key5Numpad, 'Num5', \
- keyRightNumpad, 'Right', \
- keyEndNumpad, 'End', \
- keyDownNumpad, 'Down', \
- keyPgDnNumpad, 'PgDn', \
- keyInsNumpad, 'Ins', \
- keyDelNumpad, 'Del', \
- keyEnterNumpad, 'Enter', \
- keyNumLock, 'NumLock', \
- keyScrollLock, 'ScrLock', \
- keyPause, 'Pause', \
- keyLeft, 'Left', \
- keyRight, 'Right', \
- keyUp, 'Up', \
- keyDown, 'Down', \
- keyInsert, 'Ins', \
- keyDelete, 'Del', \
- keyHome, 'Home', \
- keyEnd, 'End', \
- keyPgUp, 'PgUp', \
- keyPgDown, 'PgDn', \
- keyF1, 'F1', \
- keyF2, 'F2', \
- keyF3, 'F3', \
- keyF4, 'F4', \
- keyF5, 'F5', \
- keyF6, 'F6', \
- keyF7, 'F7', \
- keyF8, 'F8', \
- keyF9, 'F9', \
- keyF10, 'F10', \
- keyF11, 'F11', \
- keyF12, 'F12', \
- keyCapsLock, 'CapsLock', \
- keyShiftLeft, 'ShiftL', \
- keyCtrlLeft, 'CtrlL', \
- keyAltLeft, 'AltL', \
- keyAltRight, 'AltR', \
- keyPopupMenu, 'PopupMenu', \
- keyShiftRight, 'ShiftR', \
- keyCtrlRight, 'CtrlR', \
- keyBackSpace, 'BackSp'
- end if
-endg
-
-endmodule
DELETED freshlib/gui/textcaret.asm
Index: freshlib/gui/textcaret.asm
==================================================================
--- freshlib/gui/textcaret.asm
+++ /dev/null
@@ -1,263 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: Text caret control library.
-;
-; Target OS: Any
-;
-; Dependencies: timers.asm; graphics libraries.
-;
-; Notes: Text caret have always only one instance.
-;_________________________________________________________________________________________
-module "Text caret library"
-
-; the caret is shared resource and can exists only in one instance
-struct TCaret
- .pWindow dd ?
- .visible dd ?
- .state dd ? ; 1 if the caret is displayed 0 if not.
- .Pos TBounds
- .OldPos TBounds
- .timer dd ?
- .sync dd ?
-ends
-
-
-
-uglobal
- if used CaretAttach
- Caret TCaret
- end if
-endg
-
-iglobal
- if used CaretTimes
- CaretTimes dd 200, 300
- end if
-endg
-
-
-if used CaretAttach
-
-initialize InitCaretTimer
-begin
- stdcall TimerCreate
- mov [eax+TTimer.interval], 200
- mov [eax+TTimer.Callback], __CaretTimerProc
- mov [eax+TTimer.flags], tmfCallProc
- mov [Caret.timer], eax
- return
-endp
-
-
-finalize DestroyCaretTimer
-begin
- stdcall CaretAttach, 0
- mov eax, [Caret.timer]
- and [eax+TTimer.flags], not tmfRunning
- stdcall TimerDestroy, eax
- return
-endp
-
-end if
-
-
-; Attaches the caret to the window, if the window needs caret.
-proc CaretAttach, .pWindow
-begin
- mov eax,[.pWindow]
- cmp eax, [Caret.pWindow]
- je .exit
-
- mov eax, -1
-@@:
- xchg [Caret.sync], eax
- test eax, eax
- jnz @b
-
- stdcall __DrawCaret, 0 ; hide the caret.
-
- mov eax, [.pWindow]
- xchg [Caret.pWindow], eax
- push eax
-
- xor eax, eax
- mov [Caret.visible], eax
- mov [Caret.Pos.x], eax
- mov [Caret.Pos.y], eax
- mov [Caret.Pos.height], eax
- mov [Caret.Pos.width], eax
-
-.finish:
- mov [Caret.sync], 0
- pop eax ; the old window.
-.exit:
- return
-endp
-
-
-
-
-proc CaretChange, .x, .y, .width, .height
-begin
- push eax
-
- mov eax, -1
-@@:
- xchg [Caret.sync], eax
- test eax, eax
- jnz @b
-
- stdcall __DrawCaret, 0
-
- push [.x] [.y]
- pop [Caret.Pos.y] [Caret.Pos.x]
-
- cmp [.width], 0
- je .endchange
-
- push [.width] [.height]
- pop [Caret.Pos.height] [Caret.Pos.width]
-
- stdcall __DrawCaret, 1
-
-.endchange:
- mov [Caret.sync], 0
-
- pop eax
- return
-endp
-
-
-; returns the old mode.
-proc __CaretShow, .visible
-begin
- mov eax, [.visible]
- cmp eax, [Caret.visible] ; old vs new mode.
- je .exit
-
- push [Caret.visible]
- mov [Caret.visible], eax
-
- push ecx edx
-
- mov ecx, [Caret.timer]
- mov edx, [ecx+TTimer.flags]
-
- or edx, tmfRunning
- test eax, eax
- jnz .timerok
- and edx, not tmfRunning
-.timerok:
- mov [ecx+TTimer.flags], edx
-
- stdcall __DrawCaret, [Caret.visible]
- pop edx ecx
-
- pop eax
-.exit:
- return
-endp
-
-
-proc CaretShow, .visible
-begin
- mov eax, -1
-@@:
- xchg [Caret.sync], eax
- test eax, eax
- jnz @b
-
- stdcall __CaretShow, [.visible]
- mov [Caret.sync], 0
-
- return
-endp
-
-
-
-proc __CaretTimerProc, .timer
-begin
- cmp [Caret.pWindow], 0
- je .exit
-
- mov eax, -1
- xchg [Caret.sync], eax
- test eax, eax
- jnz .exit ; don't wait for lock.
-
- cmp [Caret.visible], 0
- je @f
- mov eax, 2
-@@:
- stdcall __DrawCaret, eax
-
- mov [Caret.sync], 0
-
-.exit:
- return
-endp
-
-
-
-proc __DrawCaret, .operation ; 0 - erase; 1-draw; 2-change
-begin
- push ecx esi
-
- mov eax, [Caret.state]
- cmp eax, [.operation]
- je .exit
-
- cmp [Caret.pWindow], 0
- je .exit
-
- push $ffffff
-
- xor eax, 1
- mov [Caret.state], eax
-
- mov ecx, [Caret.timer]
- mov eax, [Caret.state]
- mov eax, [CaretTimes+4*eax]
- mov [ecx+TTimer.interval], eax
- mov [ecx+TTimer.value], 0
-
- test eax, eax
- jnz .draw
-; clear
- push [Caret.OldPos.height]
- push [Caret.OldPos.width]
- push [Caret.OldPos.y]
- push [Caret.OldPos.x]
- jmp .drawit
-
-.draw:
- push [Caret.Pos.height] [Caret.Pos.width] [Caret.Pos.y] [Caret.Pos.x]
- push [Caret.Pos.height] [Caret.Pos.width] [Caret.Pos.y] [Caret.Pos.x]
- pop [Caret.OldPos.x] [Caret.OldPos.y] [Caret.OldPos.width] [Caret.OldPos.height]
-
-.drawit:
- mov eax, [Caret.pWindow]
- stdcall AllocateContext, [eax+TWindow.handle]
- test eax, eax
- jz .exit
-
- mov esi, eax
-
- stdcall SetDrawMode, esi, cmXor
- stdcall DrawFillRect, esi ; arguments from the stack
- stdcall ReleaseContext, esi
-
-.exit:
- pop esi ecx
- return
-endp
-
-
-
-
-endmodule
-
-
DELETED freshlib/imports/Linux/libX11.inc
Index: freshlib/imports/Linux/libX11.inc
==================================================================
--- freshlib/imports/Linux/libX11.inc
+++ /dev/null
@@ -1,795 +0,0 @@
-; _______________________________________________________________________________________
-;| |
-;| ..::FreshLib::.. Free, open source. Licensed under "Fresh artistic license." |
-;|_______________________________________________________________________________________|
-;
-; Description: libX11 (XLib) import library.
-;
-; Target OS: Linux
-;
-; Dependencies:
-;
-; Notes: Needs editing of the function arguments
-;_________________________________________________________________________________________
-
-
-import_proto 'libX11.so.6', \
- XActivateScreenSaver ,, 'XActivateScreenSaver', \
- XAddConnectionWatch ,, 'XAddConnectionWatch', \
- XAddExtension ,, 'XAddExtension', \
- XAddHost ,, 'XAddHost', \
- XAddHosts ,, 'XAddHosts', \
- XAddPixel ,, 'XAddPixel', \
- XAddToExtensionList ,, 'XAddToExtensionList', \
- XAddToSaveSet ,, 'XAddToSaveSet', \
- XAllPlanes ,, 'XAllPlanes', \
- XAllocClassHint ,, 'XAllocClassHint', \
- XAllocColor ,, 'XAllocColor', \
- XAllocColorCells ,, 'XAllocColorCells', \
- XAllocColorPlanes ,, 'XAllocColorPlanes', \
- XAllocIconSize ,, 'XAllocIconSize', \
- XAllocNamedColor ,, 'XAllocNamedColor', \
- XAllocSizeHints ,, 'XAllocSizeHints', \
- XAllocStandardColormap ,, 'XAllocStandardColormap', \
- XAllocWMHints ,, 'XAllocWMHints', \
- XAllowEvents ,, 'XAllowEvents', \
- XAutoRepeatOff ,, 'XAutoRepeatOff', \
- XAutoRepeatOn ,, 'XAutoRepeatOn', \
- XBaseFontNameListOfFontSet ,, 'XBaseFontNameListOfFontSet', \
- XBell ,, 'XBell', \
- XBitmapBitOrder ,, 'XBitmapBitOrder', \
- XBitmapPad ,, 'XBitmapPad', \
- XBitmapUnit ,, 'XBitmapUnit', \
- XBlackPixel ,, 'XBlackPixel', \
- XBlackPixelOfScreen ,, 'XBlackPixelOfScreen', \
- XCellsOfScreen ,, 'XCellsOfScreen', \
- XChangeActivePointerGrab ,, 'XChangeActivePointerGrab', \
- XChangeGC ,, 'XChangeGC', \
- XChangeKeyboardControl ,, 'XChangeKeyboardControl', \
- XChangeKeyboardMapping ,, 'XChangeKeyboardMapping', \
- XChangePointerControl ,, 'XChangePointerControl', \
- XChangeProperty ,, 'XChangeProperty', \
- XChangeSaveSet ,, 'XChangeSaveSet', \
- XChangeWindowAttributes ,<.display, .hwnd, .valmask, .pSetWinAttr>, 'XChangeWindowAttributes', \
- XCheckIfEvent ,, 'XCheckIfEvent', \
- XCheckMaskEvent ,, 'XCheckMaskEvent', \
- XCheckTypedEvent ,<.display, .event_type, .pEvent>, 'XCheckTypedEvent', \
- XCheckTypedWindowEvent ,, 'XCheckTypedWindowEvent', \
- XCheckWindowEvent ,, 'XCheckWindowEvent', \
- XCirculateSubwindows ,, 'XCirculateSubwindows', \
- XCirculateSubwindowsDown ,, 'XCirculateSubwindowsDown', \
- XCirculateSubwindowsUp ,, 'XCirculateSubwindowsUp', \
- XClearArea ,, 'XClearArea', \
- XClearWindow ,, 'XClearWindow', \
- XClipBox ,, 'XClipBox', \
- XCloseDisplay ,, 'XCloseDisplay', \
- XCloseIM ,, 'XCloseIM', \
- XCloseOM ,, 'XCloseOM', \
- XConfigureWindow ,, 'XConfigureWindow', \
- XConnectionNumber ,, 'XConnectionNumber', \
- XContextDependentDrawing ,, 'XContextDependentDrawing', \
- XContextualDrawing ,, 'XContextualDrawing', \
- XConvertCase ,, 'XConvertCase', \
- XConvertSelection ,<.display, .selection, .target, .property, .requestor, .time>, 'XConvertSelection', \
- XCopyArea ,, 'XCopyArea', \
- XCopyColormapAndFree ,, 'XCopyColormapAndFree', \
- XCopyGC ,, 'XCopyGC', \
- XCopyPlane ,, 'XCopyPlane', \
- XCreateBitmapFromData ,, 'XCreateBitmapFromData', \
- XCreateColormap ,, 'XCreateColormap', \
- XCreateFontCursor ,, 'XCreateFontCursor', \
- XCreateFontSet ,, 'XCreateFontSet', \
- XCreateGC ,, 'XCreateGC', \
- XCreateGlyphCursor ,, 'XCreateGlyphCursor', \
- XCreateIC ,, 'XCreateIC', \
- XCreateImage ,, 'XCreateImage', \
- XCreateOC ,, 'XCreateOC', \
- XCreatePixmap ,, 'XCreatePixmap', \
- XCreatePixmapCursor ,, 'XCreatePixmapCursor', \
- XCreatePixmapFromBitmapData ,, 'XCreatePixmapFromBitmapData', \
- XCreateRegion ,, 'XCreateRegion', \
- XCreateSimpleWindow ,<.display, .parent, .x, .y, .width, .height, .widthBorder, .clBorder, .clBackground>, 'XCreateSimpleWindow', \
- XCreateWindow ,<.display, .parent, .x, .y, .width, .height, .widthBorder, .depth, .class, .visual, .valuemask, .pAttributes>, 'XCreateWindow', \
- XDefaultColormap ,, 'XDefaultColormap', \
- XDefaultColormapOfScreen ,, 'XDefaultColormapOfScreen', \
- XDefaultDepth ,, 'XDefaultDepth', \
- XDefaultDepthOfScreen ,, 'XDefaultDepthOfScreen', \
- XDefaultGC ,, 'XDefaultGC', \
- XDefaultGCOfScreen ,, 'XDefaultGCOfScreen', \
- XDefaultRootWindow ,, 'XDefaultRootWindow', \
- XDefaultScreen ,, 'XDefaultScreen', \
- XDefaultScreenOfDisplay ,, 'XDefaultScreenOfDisplay', \
- XDefaultString ,, 'XDefaultString', \
- XDefaultVisual ,, 'XDefaultVisual', \
- XDefaultVisualOfScreen ,, 'XDefaultVisualOfScreen', \
- XDefineCursor ,, 'XDefineCursor', \
- XDeleteContext ,, 'XDeleteContext', \
- XDeleteModifiermapEntry ,, 'XDeleteModifiermapEntry', \
- XDeleteProperty ,, 'XDeleteProperty', \
- XDestroyIC ,, 'XDestroyIC', \
- XDestroyImage ,, 'XDestroyImage', \
- XDestroyOC ,, 'XDestroyOC', \
- XDestroyRegion ,, 'XDestroyRegion', \
- XDestroySubwindows ,, 'XDestroySubwindows', \
- XDestroyWindow ,, 'XDestroyWindow', \
- XDirectionalDependentDrawing ,, 'XDirectionalDependentDrawing', \
- XDisableAccessControl ,, 'XDisableAccessControl', \
- XDisplayCells ,, 'XDisplayCells', \
- XDisplayHeight ,, 'XDisplayHeight', \
- XDisplayHeightMM ,, 'XDisplayHeightMM', \
- XDisplayKeycodes ,, 'XDisplayKeycodes', \
- XDisplayMotionBufferSize ,, 'XDisplayMotionBufferSize', \
- XDisplayName ,, 'XDisplayName', \
- XDisplayOfIM ,, 'XDisplayOfIM', \
- XDisplayOfOM ,, 'XDisplayOfOM', \
- XDisplayOfScreen ,, 'XDisplayOfScreen', \
- XDisplayPlanes ,, 'XDisplayPlanes', \
- XDisplayString ,, 'XDisplayString', \
- XDisplayWidth ,, 'XDisplayWidth', \
- XDisplayWidthMM ,, 'XDisplayWidthMM', \
- XDoesBackingStore ,, 'XDoesBackingStore', \
- XDoesSaveUnders ,, 'XDoesSaveUnders', \
- XDrawArc ,, 'XDrawArc', \
- XDrawArcs ,, 'XDrawArcs', \
- XDrawImageString ,, 'XDrawImageString', \
- XDrawImageString16 ,, 'XDrawImageString16', \
- XDrawLine ,, 'XDrawLine', \
- XDrawLines ,, 'XDrawLines', \
- XDrawPoint ,, 'XDrawPoint', \
- XDrawPoints ,, 'XDrawPoints', \
- XDrawRectangle ,, 'XDrawRectangle', \
- XDrawRectangles ,, 'XDrawRectangles', \
- XDrawSegments ,, 'XDrawSegments', \
- XDrawString ,, 'XDrawString', \
- XDrawString16 ,, 'XDrawString16', \
- XDrawText ,, 'XDrawText', \
- XDrawText16 ,, 'XDrawText16', \
- XEHeadOfExtensionList ,, 'XEHeadOfExtensionList', \
- XESetBeforeFlush ,, 'XESetBeforeFlush', \
- XESetCloseDisplay ,, 'XESetCloseDisplay', \
- XESetCopyGC ,, 'XESetCopyGC', \
- XESetCreateFont ,, 'XESetCreateFont', \
- XESetCreateGC ,, 'XESetCreateGC', \
- XESetError ,, 'XESetError', \
- XESetErrorString ,, 'XESetErrorString', \
- XESetEventToWire ,, 'XESetEventToWire', \
- XESetFlushGC ,, 'XESetFlushGC', \
- XESetFreeFont ,, 'XESetFreeFont', \
- XESetFreeGC ,, 'XESetFreeGC', \
- XESetPrintErrorValues ,, 'XESetPrintErrorValues', \
- XESetWireToError ,, 'XESetWireToError', \
- XESetWireToEvent ,, 'XESetWireToEvent', \
- XEmptyRegion ,, 'XEmptyRegion', \
- XEnableAccessControl ,, 'XEnableAccessControl', \
- XEqualRegion ,, 'XEqualRegion', \
- XEventMaskOfScreen ,, 'XEventMaskOfScreen', \
- XEventsQueued ,, 'XEventsQueued', \
- XExtendedMaxRequestSize ,, 'XExtendedMaxRequestSize', \
- XExtentsOfFontSet ,, 'XExtentsOfFontSet', \
- XFetchBuffer ,<.display, .nbytes_return, .buffer>, 'XFetchBuffer', \
- XFetchBytes ,<.display, .nbytes_return>, 'XFetchBytes', \
- XFetchName ,<.display, .window, .window_name_return>, 'XFetchName', \
- XFillArc ,, 'XFillArc', \
- XFillArcs ,, 'XFillArcs', \
- XFillPolygon ,, 'XFillPolygon', \
- XFillRectangle ,, 'XFillRectangle', \
- XFillRectangles ,, 'XFillRectangles', \
- XFilterEvent ,, 'XFilterEvent', \
- XFindContext ,, 'XFindContext', \
- XFindOnExtensionList ,, 'XFindOnExtensionList', \
- XFlush ,, 'XFlush', \
- XFlushGC ,, 'XFlushGC', \
- XFontsOfFontSet ,, 'XFontsOfFontSet', \
- XForceScreenSaver ,, 'XForceScreenSaver', \
- XFree ,<.ptr>, 'XFree', \
- XFreeColormap ,, 'XFreeColormap', \
- XFreeColors ,, 'XFreeColors', \
- XFreeCursor ,, 'XFreeCursor', \
- XFreeExtensionList ,, 'XFreeExtensionList', \
- XFreeFont ,, 'XFreeFont', \
- XFreeFontInfo ,, 'XFreeFontInfo', \
- XFreeFontNames ,, 'XFreeFontNames', \
- XFreeFontPath ,, 'XFreeFontPath', \
- XFreeFontSet ,, 'XFreeFontSet', \
- XFreeGC ,, 'XFreeGC', \
- XFreeModifiermap ,, 'XFreeModifiermap', \
- XFreePixmap ,, 'XFreePixmap', \
- XFreeStringList ,, 'XFreeStringList', \
- XGContextFromGC ,, 'XGContextFromGC', \
- XGeometry ,, 'XGeometry', \
- XGetAtomName ,, 'XGetAtomName', \
- XGetAtomNames ,, 'XGetAtomNames', \
- XGetClassHint ,, 'XGetClassHint', \
- XGetCommand ,, 'XGetCommand', \
- XGetDefault ,, 'XGetDefault', \
- XGetErrorDatabaseText ,, 'XGetErrorDatabaseText', \
- XGetErrorText ,, 'XGetErrorText', \
- XGetFontPath ,, 'XGetFontPath', \
- XGetFontProperty ,, 'XGetFontProperty', \
- XGetGCValues ,, 'XGetGCValues', \
- XGetGeometry ,, 'XGetGeometry', \
- XGetICValues ,, 'XGetICValues', \
- XGetIMValues ,, 'XGetIMValues', \
- XGetIconName ,, 'XGetIconName', \
- XGetIconSizes ,, 'XGetIconSizes', \
- XGetImage ,, 'XGetImage', \
- XGetInputFocus ,, 'XGetInputFocus', \
- XGetKeyboardControl ,, 'XGetKeyboardControl', \
- XGetKeyboardMapping ,, 'XGetKeyboardMapping', \
- XGetModifierMapping ,, 'XGetModifierMapping', \
- XGetMotionEvents ,, 'XGetMotionEvents', \
- XGetNormalHints ,, 'XGetNormalHints', \
- XGetOCValues ,, 'XGetOCValues', \
- XGetOMValues ,, 'XGetOMValues', \
- XGetPixel ,, 'XGetPixel', \
- XGetPointerControl ,, 'XGetPointerControl', \
- XGetPointerMapping ,, 'XGetPointerMapping', \
- XGetRGBColormaps ,, 'XGetRGBColormaps', \
- XGetScreenSaver ,, 'XGetScreenSaver', \
- XGetSelectionOwner ,<.display, .selection>, 'XGetSelectionOwner', \
- XGetSizeHints ,, 'XGetSizeHints', \
- XGetStandardColormap ,, 'XGetStandardColormap', \
- XGetSubImage ,, 'XGetSubImage', \
- XGetTextProperty ,, 'XGetTextProperty', \
- XGetTransientForHint ,, 'XGetTransientForHint', \
- XGetVisualInfo ,, 'XGetVisualInfo', \
- XGetWMClientMachine ,, 'XGetWMClientMachine', \
- XGetWMColormapWindows ,, 'XGetWMColormapWindows', \
- XGetWMHints ,, 'XGetWMHints', \
- XGetWMIconName ,, 'XGetWMIconName', \
- XGetWMName ,, 'XGetWMName', \
- XGetWMNormalHints ,, 'XGetWMNormalHints', \
- XGetWMProtocols ,, 'XGetWMProtocols', \
- XGetWMSizeHints ,, 'XGetWMSizeHints', \
- XGetWindowAttributes ,<.display, .hwin, .pWinAttr>, 'XGetWindowAttributes', \
- XGetWindowProperty ,<.display, .hwin, .property, .offset, .length, .delete, .req_type, .pTypeRet, .pFormatRet, .pNItemsRet, .pRemainsRet, .pDataRet>, 'XGetWindowProperty', \
- XGetZoomHints ,, 'XGetZoomHints', \
- XGrabButton ,, 'XGrabButton', \
- XGrabKey ,, 'XGrabKey', \
- XGrabKeyboard ,, 'XGrabKeyboard', \
- XGrabPointer ,, 'XGrabPointer', \
- XGrabServer ,, 'XGrabServer', \
- XHeightMMOfScreen ,, 'XHeightMMOfScreen', \
- XHeightOfScreen ,, 'XHeightOfScreen', \
- XIMOfIC ,, 'XIMOfIC', \
- XIconifyWindow ,, 'XIconifyWindow', \
- XIfEvent ,, 'XIfEvent', \
- XImageByteOrder ,, 'XImageByteOrder', \
- XInitExtension ,, 'XInitExtension', \
- XInitImage ,, 'XInitImage', \
- XInitThreads ,, 'XInitThreads', \
- XInsertModifiermapEntry ,, 'XInsertModifiermapEntry', \
- XInstallColormap ,