Add back stuff required for 'make format' Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com>
diff --git a/.github/update-contributing.py b/.github/update-contributing.py new file mode 100755 index 0000000..41bf352 --- /dev/null +++ b/.github/update-contributing.py
@@ -0,0 +1,35 @@ +#!/usr/bin/env python3 + +# Header +contrib = ["""\ +# Contributing to Project U-Ray +"""] + +# Extract the "Contributing" section from README.md +found = False +for line in open('README.md'): + if found: + if line.startswith('# '): + # Found the next top level header + break + contrib.append(line) + else: + if line.startswith('# Contributing'): + found = True + +# Footer +contrib.append("""\ + + + + + + +---- + +This file is generated from [README.md](README.md), please edit that file then +run the `./.github/update-contributing.py`. + +""") + +open("CONTRIBUTING.md", "w").write("".join(contrib))
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..b1bc529 --- /dev/null +++ b/CONTRIBUTING.md
@@ -0,0 +1,97 @@ +# Contributing to Project U-Ray + +There are a couple of guidelines when contributing to Project U-Ray which are +listed here. + +### Sending + +All contributions should be sent as +[GitHub Pull requests](https://help.github.com/articles/creating-a-pull-request-from-a-fork/). + +### License + +All software (code, associated documentation, support files, etc) in the +Project U-Ray repository are licensed under the very permissive +[ISC Licence](COPYING). A copy can be found in the [`COPYING`](COPYING) file. + +All new contributions must also be released under this license. + +### Code of Conduct + +By contributing you agree to the [code of conduct](CODE_OF_CONDUCT.md). We +follow the open source best practice of using the [Contributor +Covenant](https://www.contributor-covenant.org/) for our Code of Conduct. + +### Sign your work + +To improve tracking of who did what, we follow the Linux Kernel's +["sign your work" system](https://github.com/wking/signed-off-by). +This is also called a +["DCO" or "Developer's Certificate of Origin"](https://developercertificate.org/). + +**All** commits are required to include this sign off and we use the +[Probot DCO App](https://github.com/probot/dco) to check pull requests for +this. + +The sign-off is a simple line at the end of the explanation for the +patch, which certifies that you wrote it or otherwise have the right to +pass it on as a open-source patch. The rules are pretty simple: if you +can certify the below: + + Developer's Certificate of Origin 1.1 + + By making a contribution to this project, I certify that: + + (a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + + (b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or + + (c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + + (d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. + +then you just add a line saying + + Signed-off-by: Random J Developer <random@developer.example.org> + +using your real name (sorry, no pseudonyms or anonymous contributions.) + +You can add the signoff as part of your commit statement. For example: + + git commit --signoff -a -m "Fixed some errors." + +*Hint:* If you've forgotten to add a signoff to one or more commits, you can use the +following command to add signoffs to all commits between you and the upstream +master: + + git rebase --signoff upstream/master + +### Contributing to the docs + +In addition to the above contribution guidelines, see the guide to +[updating the Project U-Ray docs](UPDATING-THE-DOCS.md). + + + + + + +---- + +This file is generated from [README.md](README.md), please edit that file then +run the `./.github/update-contributing.py`. +
diff --git a/README.md b/README.md index 0924187..b8e2c57 100644 --- a/README.md +++ b/README.md
@@ -87,4 +87,89 @@ * XCZU2EG, XCZU2CG, XCZU3EG, XCZU3CG, XCZU4EG, XCZU4CG, XCZU4EV, XCZU5EG, XCZU5CG, XCZU5EV, XCZU7EV, XCZU7EG, and XCZU7CG +# Contributing +There are a couple of guidelines when contributing to Project U-Ray which are +listed here. + +### Sending + +All contributions should be sent as +[GitHub Pull requests](https://help.github.com/articles/creating-a-pull-request-from-a-fork/). + +### License + +All software (code, associated documentation, support files, etc) in the +Project U-Ray repository are licensed under the very permissive +[ISC Licence](COPYING). A copy can be found in the [`COPYING`](COPYING) file. + +All new contributions must also be released under this license. + +### Code of Conduct + +By contributing you agree to the [code of conduct](CODE_OF_CONDUCT.md). We +follow the open source best practice of using the [Contributor +Covenant](https://www.contributor-covenant.org/) for our Code of Conduct. + +### Sign your work + +To improve tracking of who did what, we follow the Linux Kernel's +["sign your work" system](https://github.com/wking/signed-off-by). +This is also called a +["DCO" or "Developer's Certificate of Origin"](https://developercertificate.org/). + +**All** commits are required to include this sign off and we use the +[Probot DCO App](https://github.com/probot/dco) to check pull requests for +this. + +The sign-off is a simple line at the end of the explanation for the +patch, which certifies that you wrote it or otherwise have the right to +pass it on as a open-source patch. The rules are pretty simple: if you +can certify the below: + + Developer's Certificate of Origin 1.1 + + By making a contribution to this project, I certify that: + + (a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + + (b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or + + (c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + + (d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. + +then you just add a line saying + + Signed-off-by: Random J Developer <random@developer.example.org> + +using your real name (sorry, no pseudonyms or anonymous contributions.) + +You can add the signoff as part of your commit statement. For example: + + git commit --signoff -a -m "Fixed some errors." + +*Hint:* If you've forgotten to add a signoff to one or more commits, you can use the +following command to add signoffs to all commits between you and the upstream +master: + + git rebase --signoff upstream/master + +### Contributing to the docs + +In addition to the above contribution guidelines, see the guide to +[updating the Project U-Ray docs](UPDATING-THE-DOCS.md).
diff --git a/third_party/reformat.tcl b/third_party/reformat.tcl new file mode 100755 index 0000000..c4efb5d --- /dev/null +++ b/third_party/reformat.tcl
@@ -0,0 +1,108 @@ +#!/usr/bin/env tclsh +# From: https://gist.github.com/yyamasak/af250f7ca74e18526734#file-reformat-tcl-L10 +# Which is based on https://wiki.tcl-lang.org/page/Reformatting+Tcl+code+indentation +# See for licensing + +proc reformat {tclcode {pad 4}} { + set lines [split $tclcode \n] + set out "" + set continued no + set oddquotes 0 + set line [lindex $lines 0] + set indent [expr {([string length $line]-[string length [string trimleft $line \ \t]])/$pad}] + set pad [string repeat " " $pad] + + foreach orig $lines { + set newline [string trim $orig \ \t] + set line [string repeat $pad $indent]$newline + if {[string index $line end] eq "\\"} { + if {!$continued} { + incr indent 2 + set continued yes + } + } elseif {$continued} { + incr indent -2 + set continued no + } + + if { ! [regexp {^[ \t]*\#} $line] } { + + # oddquotes contains : 0 when quotes are balanced + # and 1 when they are not + set oddquotes [expr {([count $line \"] + $oddquotes) % 2}] + if {! $oddquotes} { + set nbbraces [count $line \{] + incr nbbraces -[count $line \}] + set brace [string equal [string index $newline end] \{] + set unbrace [string equal [string index $newline 0] \}] + if {$nbbraces!=0 || $brace || $unbrace} { + incr indent $nbbraces ;# [GWM] 010409 multiple close braces + if {$indent<0} { + error "unbalanced braces" + } + puts $unbrace + puts $pad + puts $nbbraces + set np [expr {$unbrace? [string length $pad]:-$nbbraces*[string length $pad]}] + set line [string range $line $np end] + } + } else { + # unbalanced quotes, preserve original indentation + set line $orig + } + } + append out $line\n + } + return $out +} + +proc eol {} { + switch -- $::tcl_platform(platform) { + windows {return \r\n} + unix {return \n} + macintosh {return \r} + default {error "no such platform: $::tc_platform(platform)"} + } +} + +proc count {string char} { + set count 0 + while {[set idx [string first $char $string]]>=0} { + set backslashes 0 + set nidx $idx + while {[string equal [string index $string [incr nidx -1]] \\]} { + incr backslashes + } + if {$backslashes % 2 == 0} { + incr count + } + set string [string range $string [incr idx] end] + } + return $count +} + +set usage "reformat.tcl ?-indent number? filename" + +if {[llength $argv]!=0} { + if {[lindex $argv 0] eq "-indent"} { + set indent [lindex $argv 1] + set argv [lrange $argv 2 end] + } else { + set indent 4 + } + if {[llength $argv]>1} { + error $usage + } + set f [open $argv r] + set data [read $f] + close $f + + set filename "$argv.tmp" + set f [open $filename w] + + puts -nonewline $f [reformat [string map [list [eol] \n] $data] $indent] + close $f + file copy -force $filename $argv + file delete -force $filename + +}