-
-
Notifications
You must be signed in to change notification settings - Fork 74
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
Adding new functions this_line, this_file, this_counter #115
Open
bstarynk
wants to merge
9
commits into
Trepan-Debuggers:remake-4-3
Choose a base branch
from
bstarynk:remake-4-3
base: remake-4-3
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
5fd18a2
start adding this_file,n this_line, this_counter functions
bstarynk 0cab240
more code, untested, in func_this_file, func_this_line, func_this_cou…
bstarynk 4f3c4d2
coded more in func_this_file, func_this_line , func_this_counter
bstarynk 38438dd
coded func_this_counter for $(this_counter) inspired by GCC __COUNTER__
bstarynk 1284d31
implemented $(this_line) and $(this_file) textual functions
bstarynk 9d6be5e
bad documentation for new functions this_line, this_file, this_counter
bstarynk e7e147c
the GNUremakefile is used if existing
bstarynk 6932b33
doc/make.pdf seems good and document properly this_line, this_file, t…
bstarynk 4bcaf92
mention GNUremakefile
bstarynk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1370,6 +1370,65 @@ func_value (char *o, char **argv, const char *funcname UNUSED) | |
return o; | ||
} | ||
|
||
///// added by <[email protected]> | ||
|
||
|
||
/** | ||
$(this_file) | ||
|
||
Always expands to the current Makefile path. Inspired by the __FILE__ macro of C. | ||
**/ | ||
|
||
static char * | ||
func_this_file (char *o UNUSED, char **argv UNUSED, const char *funcname UNUSED) | ||
{ | ||
if (reading_file) { | ||
return xstrdup(reading_file->filenm); | ||
} | ||
else | ||
return xstrdup("?"); | ||
} | ||
|
||
|
||
/** | ||
$(this_line) | ||
|
||
Always expands to the current line number. Inspired by the __LINE__ macro of C. | ||
**/ | ||
|
||
static char * | ||
func_this_line (char *o UNUSED, char **argv UNUSED, const char *funcname UNUSED) | ||
{ | ||
if (reading_file) { | ||
char linumbuf[32]; | ||
memset (linumbuf, 0, sizeof(linumbuf)); | ||
snprintf(linumbuf, sizeof(linumbuf), "%lu", reading_file->lineno); | ||
return xstrdup(linumbuf); | ||
} | ||
else | ||
return xstrdup("0"); | ||
} | ||
|
||
|
||
/** | ||
$(this_counter) | ||
|
||
Always expands to a unique, incremented, counter. Inspired by the __COUNTER__ macro of GCC. | ||
**/ | ||
|
||
static char * | ||
func_this_counter (char *o UNUSED, char **argv UNUSED, const char *funcname UNUSED) | ||
{ | ||
static long counter; | ||
char cntbuf[32]; | ||
memset (cntbuf, 0, sizeof(cntbuf)); | ||
counter++; | ||
snprintf (cntbuf, sizeof(cntbuf), "%ld", counter); | ||
return xstrdup(cntbuf); | ||
} | ||
///// end of functions added by <[email protected]> | ||
|
||
|
||
/* | ||
\r is replaced on UNIX as well. Is this desirable? | ||
*/ | ||
|
@@ -2210,6 +2269,10 @@ static struct function_table_entry function_table_init[] = | |
FT_ENTRY ("eval", 0, 1, 1, func_eval), | ||
FT_ENTRY ("file", 1, 2, 1, func_file), | ||
FT_ENTRY ("debugger", 0, 1, 1, func_debugger), | ||
/// three functions added by <[email protected]> | ||
FT_ENTRY ("this_file", 0, 0, 0, func_this_file), | ||
FT_ENTRY ("this_line", 0, 0, 0, func_this_line), | ||
FT_ENTRY ("this_counter", 0, 0, 0, func_this_counter), | ||
#ifdef EXPERIMENTAL | ||
FT_ENTRY ("eq", 2, 2, 1, func_eq), | ||
FT_ENTRY ("not", 0, 1, 1, func_not), | ||
|
@@ -2236,7 +2299,10 @@ expand_builtin_function (char *o, int argc, char **argv, | |
but so far no internal ones do, so just test it for all functions here | ||
rather than in each one. We can change it later if necessary. */ | ||
|
||
if (!argc && !entry_p->alloc_fn) | ||
if (!argc | ||
/// the functions named this_* by <[email protected]> take no arguments... | ||
&& strncmp(entry_p->name, "this", sizeof("this")-1) | ||
&& !entry_p->alloc_fn) | ||
return o; | ||
|
||
if (!entry_p->fptr.func_ptr) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm getting an in build because this
@node
line is missing:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you help (perhaps by patching the pull request). I am not familiar witrh
texinfo
. But you could use the C code and improve/correct the documentation. Thanks. Basile StarynkevitchThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok - #116 started. (I thought when you open a PR there's a button that allows maintainers to add more commits. I didn't see that here so a new PR was started).
I don't see though that the
this_
functions do anything. See that PR for details.