Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trace #1332

Merged
merged 14 commits into from
Apr 1, 2017
Merged

Trace #1332

merged 14 commits into from
Apr 1, 2017

Conversation

rpspringuel
Copy link
Contributor

I started this while working on 1285 and found it so useful that I went whole hog and formalized it and applied it to all the internal functions. It could be applied to Gregorio or user name space functions as well, but I'm less sure that there's a gain from that.

Nominally at least, tests aren't supposed to change as a result of this PR, but #1331 was found as a result of applying this, so that needs to be resolved before this is merged.

This adds functionality for tracing internal functions by manually adding two function calls to each function.  The first call takes an argument which is intended to identify the function being called and (possibly) the arguments with which it has been called (in testing some arguments don’t take well to outputting to the log file, and so are omitted).  The second call takes no argument and serves to indicate the end of the function.  While the output of these functions is interwoven into the normal log file, it has a unique prefix (GreTrace) allowing filter tools to quickly isolate these lines.  We also make use of indentation in order to indicate the nesting of function calls.

Output is formatted as follows:
```
GreTrace: gre@generatelines
GreTrace: -----
GreTrace: gre@removespaceabove
GreTrace: | gre@generatelines
GreTrace: | -----
GreTrace: -----
GreTrace: gre@generatelines
GreTrace: -----
GreTrace: gre@updateleftbox
GreTrace: | gre@updatelinewidth
GreTrace: | | gre@generatelines
GreTrace: | | -----
GreTrace: | -----
GreTrace: -----
GreTrace: gre@widthof
GreTrace: -----
```
I noticed that there was code in gregoriotex-main.tex which had to be duplicated in gregoriosyms.sty in order for that functionality to work properly in the symbols only style.  However, some recent changes in gregoriotex-main.tex weren’t reflected in the code in greogiosyms.sty resulting in an inconsistency.  Rather than simply fix that inconsistency, I’ve put the code that is supposed to be common to both in a separate file and included that file in both locations.  This way there’s only one place where the changes have to be made and they’ll be reflected in both uses.
Some arguments do not take well to expansion attempts before being written to the log and by not expanding the arguments what appears in the trace log is the function as it was called in the code, making it easier to find the right code location for an error (which is the whole point of this functionality).  Therefore, we prevent `\gre@trace` from expanding its arguments.
I’m not creating a CHANGELOG entry for this as this is entirely internal.
@henryso
Copy link
Contributor

henryso commented Mar 14, 2017

Why aren't all macros (i.e., user and gregorio macros) traced as well?

@rpspringuel
Copy link
Contributor Author

I only traced the internal macros because the calling of them tends to be more hidden than the calling of user or Gregorio namespace ones, which actually appear in source files (or gtex ones). I could add tracing to all macros if that would be more useful.

@henryso
Copy link
Contributor

henryso commented Mar 14, 2017

I guess some finesse is needed. It's probably important to trace user and Gregorio macros that are called from internal macros.

@rpspringuel
Copy link
Contributor Author

That is probably a good point, but I don't know how to design a mechanism to selectively track such macros based on who is calling them.

@henryso
Copy link
Contributor

henryso commented Mar 14, 2017

Well, I just meant being selective in which user and gregorio macros are traced.

@rpspringuel
Copy link
Contributor Author

That would be substantially easier to pull off. Do you have a list of macros which you think should be traced?

@henryso
Copy link
Contributor

henryso commented Mar 14, 2017

Based on recent experience, \GreSetLinesClef. Maybe we should just add trace to user and gregorio macros as we encounter the need to do so. Alternately, I guess we can look for gregorio macros called from other GregorioTeX macros?

* develop:
  Documentation
  Set up the left box using next line heights in \GreDiscretionary. Fixes gregorio-project#1285.
  Documentation correction
  Fixed infinite recursion.
  Implemented function to set adjust line height for next line. Part of the implementation for gregorio-project#1285.
  Oops.  Forgot to stage a change.
  Swap some \hskip to \gre@hskip
  More redundant function calls
  More redundant function calls
  Move file version declaration
  Remove useless debug messages
  Removing redundant function calls
@rpspringuel
Copy link
Contributor Author

Okay, I've added tracing to all of the possible functions in gregoriotex-signs.tex. Take a look at what that does, and let me know if I should do the same for the other files.

@henryso
Copy link
Contributor

henryso commented Mar 27, 2017

I think this is good enough. More can be added as we encounter the need to add it.

@rpspringuel rpspringuel merged commit dafc48f into gregorio-project:develop Apr 1, 2017
@rpspringuel rpspringuel deleted the trace branch April 1, 2017 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants