summaryrefslogtreecommitdiff
path: root/web/funnelAC/fwACsrc/ccline.fwi
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /web/funnelAC/fwACsrc/ccline.fwi
Initial commit
Diffstat (limited to 'web/funnelAC/fwACsrc/ccline.fwi')
-rw-r--r--web/funnelAC/fwACsrc/ccline.fwi74
1 files changed, 74 insertions, 0 deletions
diff --git a/web/funnelAC/fwACsrc/ccline.fwi b/web/funnelAC/fwACsrc/ccline.fwi
new file mode 100644
index 0000000000..8b17c718ed
--- /dev/null
+++ b/web/funnelAC/fwACsrc/ccline.fwi
@@ -0,0 +1,74 @@
+@! FUNNNELWEB COPYRIGHT
+@! ====================
+@! FunnelWeb is a literate-programming macro preprocessor.
+@!
+@! Copyright (C) 1992 Ross N. Williams.
+@!
+@! Ross N. Williams
+@! ross@spam.adelaide.edu.au
+@! 16 Lerwick Avenue, Hazelwood Park 5066, Australia.
+@!
+@! This program is free software; you can redistribute it and/or modify
+@! it under the terms of Version 2 of the GNU General Public License as
+@! published by the Free Software Foundation.
+@!
+@! This program is distributed WITHOUT ANY WARRANTY; without even the implied
+@! warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+@! See Version 2 of the GNU General Public License for more details.
+@!
+@! You should have received a copy of Version 2 of the GNU General Public
+@! License along with this program. If not, you can FTP the license from
+@! prep.ai.mit.edu/pub/gnu/COPYING-2 or write to the Free Software
+@! Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+@!
+@! Section 2a of the license requires that all changes to this file be
+@! recorded prominently in this file. Please record all changes here.
+@!
+@! Programmers:
+@! ABC Anthony B. Coates coates@physics.uq.edu.au
+
+@! Defines a macro "@<line@>" for inserting #line pragmas into C and
+@! C++ code.
+
+@! Here is an example of a (trivial) FunnelWeb file for a C program
+@! with the @<line@> macros added.
+
+@!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+@! @i ccline.fwi @! include the @<line@> definition
+@!
+@! @$@<dummy@>==@{@- @! OK, here is a definition with some C code
+@! @<line@> @! At the start of it, add a @<line@> definition
+@! void dummy(void) {};
+@! @}
+
+@! @O@<tester.cc@>==@{@- @! The main code
+@! @<line@> @! Start with @<line@>
+@! @<dummy@> @! Code for dummy routine
+@! @<line@> @! Call @<line@> again to reset file/line
+@! int main(void) {
+@! } // end main
+@! @}
+@!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+@! i.e. the rules are
+@! (i) call @<line@> at the start of any definition containing
+@! code.
+@! (ii) call @<line@> after any macro call which may itself
+@! contain a @<line@> call.
+
+@! **** These pragmas need to be set at the top of the .fw file.
+@! **** Include this file at the top or set the pragmas there
+@! **** manually.
+
+@! The #line_offset pragma needs to be set to 1 for C/C++.
+@p #line_offset = 1
+
+@! The #line_depth pragma needs to be set to 1 to
+@! work in the manner described above.
+@p #line_depth = 1
+
+@! After all that, here is the definition itself.
+
+@$@<line@>@M==@{#line @<#line@> "@<#file@>"@}
+
+@! End of ccline.fwi