Skip to content

Commit

Permalink
Merge pull request #4 from devinsmith/dev/update_1_7_79
Browse files Browse the repository at this point in the history
Update to 1.7.79
  • Loading branch information
devinsmith authored Nov 2, 2022
2 parents 4d2332f + d2d5d12 commit 17b7da8
Show file tree
Hide file tree
Showing 48 changed files with 2,514 additions and 9,497 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
build_type: "Release",
cc: "cl",
cxx: "cl",
generators: "Visual Studio 16 2019",
generators: "Visual Studio 17 2022",
archiver: "7z a",
artifact: "windows_msvc.7z"
}
Expand All @@ -41,8 +41,8 @@ jobs:
cc: "gcc",
cxx: "g++",
generators: "Ninja",
archiver: "7z a",
artifact: "ubuntu_gcc.7z"
archiver: "tar czf",
artifact: "ubuntu_gcc.tar.gz"
}
#
# MacOS disabled because I have no idea where GL/gl.h is.
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ cmake-build-*/

# Jetbrains IDEs
.idea/

Makefile.in
Makefile.am
4 changes: 2 additions & 2 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ Charles W. Warren charles@moontown.org:
David Tyree:
JPEG Image and JPEG Icon support.

Jeroen van der Zijp <jeroen@fox-toolkit.com>:
Jeroen van der Zijp <jeroen@fox-toolkit.net>:
Main FOX Library author.



The true list should probably be much larger; if you feel I have inadvertantly omitted
you, please email me jeroen@fox-toolkit.com and I'll add you immediately.
you, please email me jeroen@fox-toolkit.net and I'll add you immediately.
107 changes: 107 additions & 0 deletions TRACING
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@



About Tracing using FXTRACE
===========================



The basic idea is similar to FXASSERT:- you will add lots FXTRACE commands, but
you probably never want to remove them. Just like FXASSERT, FXTRACE commands can
be left in the code, as they're automatically compiled out when the library
is build for release mode, i.e. with -DNDEBUG on the command line of your compiler.

If this isn't reason enough to forego old printf() statements for FXTRACE, I remind
you that under MSWindows, no stdout/stderr is opened up for non-console applications,
and one has to use the Debug API calls instead of printf() calls.

Using FXTRACE is therefore pretty convenient, as the MSWindows implementation of FOX
will automatically use those Debug API's if your program is not compiled as a console
application, and will revert to stderr under console mode [and of course under UNIX].


You use FXTRACE with DOUBLE PARENTHESES, as in:


FXTRACE((200,"%s::onFocusIn %08x\n",getClassName(),this));


This is done so the C preprocessor can expand:


FXTRACE((200,"%s::onFocusIn %08x\n",getClassName(),this))


into:


fxtrace (200,"%s::onFocusIn %08x\n",getClassName(),this)


or, in case of -DNDEBUG or release builds:


((void)0)


Which any self-respecting compiler completely ignores and generates no
object code for. BTW, this is what everybody does for asserts also.


The number `200' in the above example is the tracelevel at which the statement
will produce actual outputs on your screen.

Starting your FOX program with:


<programname> -tracelevel 300


will cause all FXTRACE statements with levels 300 and up to be BLOCKED from
producing any outputs.

Since you don't want to see reams of outputs, the most frequently occuring types
of events should be given the highest trace level.

For now, tracelevels 0 through 99 are reserved for application use, with FOX itself
using levels 100 and upwards.

Note that as tracing is controlled by a simple global variable fxTraceLevel, your
program can simply set a higher tracelevel at a point in its execution where things
are starting to get a little bit hairy.....

Another way to set the tracelevel is to set the environment variable FOX_TRACE_LEVEL.
The tracelevel takes effect when the FXApp is initialized. Setting the tracelevel
from the command-line takes precedence over the FOX_TRACE_LEVEL tracelevel value.


Tentative assignments of tracelevels in FOX:


100: Important, high-level info, such as ctors and dtors for Icons, Images,
Bitmaps, Fonts, and Cursors.
Since you may easily leak those resources if your program does not track
these properly, setting tracelevel to 101 (or higher) will allow you to
see easily what's being created and destroyed.

200: Infrequent events such as mapping/unmapping of windows, selection requests,
and such stuff.

250: More frequent stuff such as DND events.

300: Button clicks.

350: Mouse movements.

400: GUI Updates, when GUI Updates are allowed.


I have not been overzealous sticking to these conventions, but now that it's written
down for me to re-read, there's a higher chance that I'll stick to it in the future.

Further assignments will probably follow some day....



- Jeroen

26 changes: 14 additions & 12 deletions adie/Adie.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ FXIMPLEMENT(Adie,FXApp,AdieMap,ARRAYNUMBER(AdieMap))

// Make some windows
Adie::Adie(const FXString& name):FXApp(name){
FXTRACE((10,"Adie::Adie(%s)\n",name.text()));

// Make some icons; these are shared between all text windows
bigicon=new FXGIFIcon(this,big_gif);
Expand Down Expand Up @@ -216,22 +217,22 @@ FXint Adie::start(int argc,char** argv){
// Exec path is default for syntax path
execpath=FXSystem::getExecPath();

FXTRACE((10,"execpath=%s\n",execpath.text()));
FXTRACE((11,"execpath=%s\n",execpath.text()));

// See if override paths are provided in the registry
syntaxpaths=reg().readStringEntry("SETTINGS","syntaxpaths",execpath.text());

FXTRACE((10,"syntaxpaths=%s\n",syntaxpaths.text()));
FXTRACE((11,"syntaxpaths=%s\n",syntaxpaths.text()));

// Look for syntax file in the syntax paths
syntaxfile=FXPath::search(syntaxpaths,"Adie.stx");

FXTRACE((10,"syntaxfile=%s\n",syntaxfile.text()));
FXTRACE((11,"syntaxfile=%s\n",syntaxfile.text()));

// Get icon search path
iconpath=reg().readStringEntry("SETTINGS","iconpath",FXIconCache::defaultIconPath);

FXTRACE((10,"iconpath=%s\n",iconpath.text()));
FXTRACE((11,"iconpath=%s\n",iconpath.text()));

// Change icon search path
associations->setIconPath(iconpath);
Expand Down Expand Up @@ -391,7 +392,7 @@ TextWindow* Adie::findWindow(const FXString& file) const {
TextWindow* Adie::openFileWindow(const FXString& file,FXint lineno,FXint column){
TextWindow *window=nullptr;

FXTRACE((1,"Adie::openFileWindow(%s,%d,%d)\n",file.text(),lineno,column));
FXTRACE((11,"Adie::openFileWindow(%s,%d,%d)\n",file.text(),lineno,column));

// See if we already have this file
window=findWindow(file);
Expand Down Expand Up @@ -427,11 +428,11 @@ TextWindow* Adie::openFileWindow(const FXString& file,FXint lineno,FXint column)

// Get syntax for language name
Syntax* Adie::getSyntaxByName(const FXString& lang){
FXTRACE((10,"Adie::getSyntaxByName(%s)\n",lang.text()));
FXTRACE((11,"Adie::getSyntaxByName(%s)\n",lang.text()));
if(!lang.empty()){
for(FXint syn=0; syn<syntaxes.no(); syn++){
if(syntaxes[syn]->getName()==lang){
FXTRACE((10,"syntaxes[%d]: language: %s matched name: %s!\n",syn,syntaxes[syn]->getName().text(),lang.text()));
FXTRACE((11,"syntaxes[%d]: language: %s matched name: %s!\n",syn,syntaxes[syn]->getName().text(),lang.text()));
return syntaxes[syn];
}
}
Expand All @@ -442,7 +443,7 @@ Syntax* Adie::getSyntaxByName(const FXString& lang){

// Get syntax by consulting registry
Syntax* Adie::getSyntaxByRegistry(const FXString& file){
FXTRACE((10,"Adie::getSyntaxByRegistry(%s)\n",file.text()));
FXTRACE((11,"Adie::getSyntaxByRegistry(%s)\n",file.text()));
if(!file.empty()){
FXString name=FXPath::name(file);
FXString lang=reg().readStringEntry("SYNTAX",name);
Expand All @@ -454,11 +455,11 @@ Syntax* Adie::getSyntaxByRegistry(const FXString& file){

// Get syntax by matching file patterns
Syntax* Adie::getSyntaxByPattern(const FXString& file){
FXTRACE((10,"Adie::getSyntaxByPattern(%s)\n",file.text()));
FXTRACE((11,"Adie::getSyntaxByPattern(%s)\n",file.text()));
if(!file.empty()){
for(FXint syn=0; syn<syntaxes.no(); syn++){
if(syntaxes[syn]->matchFilename(file)){
FXTRACE((10,"syntaxes[%d]: language: %s matched file: %s!\n",syn,syntaxes[syn]->getName().text(),file.text()));
FXTRACE((11,"syntaxes[%d]: language: %s matched file: %s!\n",syn,syntaxes[syn]->getName().text(),file.text()));
return syntaxes[syn];
}
}
Expand All @@ -469,11 +470,11 @@ Syntax* Adie::getSyntaxByPattern(const FXString& file){

// Get syntax by matching file contents
Syntax* Adie::getSyntaxByContents(const FXString& contents){
FXTRACE((10,"Adie::getSyntaxByContents(%s)\n",contents.text()));
FXTRACE((11,"Adie::getSyntaxByContents(%s)\n",contents.text()));
if(!contents.empty()){
for(FXint syn=0; syn<syntaxes.no(); syn++){
if(syntaxes[syn]->matchContents(contents)){
FXTRACE((10,"syntaxes[%d]: language: %s matched contents: %s!\n",syn,syntaxes[syn]->getName().text(),contents.text()));
FXTRACE((11,"syntaxes[%d]: language: %s matched contents: %s!\n",syn,syntaxes[syn]->getName().text(),contents.text()));
return syntaxes[syn];
}
}
Expand All @@ -486,6 +487,7 @@ Syntax* Adie::getSyntaxByContents(const FXString& contents){

// Clean up the mess
Adie::~Adie(){
FXTRACE((10,"Adie::~Adie()\n"));
for(int i=0; i<syntaxes.no(); i++) delete syntaxes[i];
FXASSERT(windowlist.no()==0);
delete associations;
Expand Down
Loading

0 comments on commit 17b7da8

Please sign in to comment.