cmdline.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
  2. <html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
  3. <head>
  4. <title>GTC Command-line options - GTC documentation</title>
  5. <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
  6. <link rel='stylesheet' type='text/css' href='layout/default.css' />
  7. </head>
  8. <body>
  9. <p><a href='index.html'>◄ Back to index</a></p>
  10. <div class='c0'>
  11. <h1>GTC Command-line options</h1>
  12. <p>The computer version of GTC has a number of options available on the command-line. They are all listed here.</p>
  13. <p>Please note that currently, these options are not available for the FlashApp version.</p>
  14. <div class='toc'><div class='toctop'><div class='tocbot'><div class='toc-content'>
  15. <b>Contents:</b><ul>
  16. <li><a href='#Basic.usage'>Basic usage</a>
  17. <ul>
  18. <li><a href='#Invocation'>Invocation</a></li>
  19. <li><a href='#Adding.options'>Adding options</a></li>
  20. </ul></li>
  21. <li><a href='#List.of.all.options'>List of all options</a>
  22. <ul>
  23. <li><a href='#Options.affecting.output'>Options affecting output</a>
  24. <ul>
  25. <li><a href='#-o.switch'>-o switch</a></li>
  26. <li><a href='#--folder.switch'>--folder switch</a></li>
  27. <li><a href='#--output.switch'>--output switch</a></li>
  28. </ul></li>
  29. <li><a href='#Preprocessor.options'>Preprocessor options</a>
  30. <ul>
  31. <li><a href='#-I.switch'>-I switch</a></li>
  32. <li><a href='#-D.switch'>-D switch</a></li>
  33. </ul></li>
  34. <li><a href='#Optimization.options'>Optimization options</a>
  35. <ul>
  36. <li><a href='#-exe.switch'>-exe switch</a></li>
  37. <li><a href='#-mno-bss.switch'>-mno-bss switch</a></li>
  38. </ul></li>
  39. <li><a href='#Other.options'>Other options</a>
  40. <ul>
  41. <li><a href='#--.separator'>-- separator</a></li>
  42. </ul></li>
  43. </ul></li>
  44. </ul>
  45. </div></div></div></div>
  46. <div class='c1'>
  47. <hr class='hr1' /><h1 class='heading'><a name='Basic.usage'></a>Basic usage</h1><div class='c1in'><hr class='hr1in' /><div class='c2'>
  48. <hr class='hr2' /><h2 class='heading'><a name='Invocation'></a>Invocation</h2><div class='c2in'><hr class='hr2in' />
  49. <p>To compile a file named<span class='widespace'>&#32;</span><code>hello.c</code>, open a command-line prompt in the folder where<span class='widespace'>&#32;</span><code>hello.c</code><span class='widespace'>&#32;</span>is stored, and type:</p>
  50. <pre>
  51. gtc hello.c
  52. </pre>
  53. <p>This will create files named<span class='widespace'>&#32;</span><code>hello.89z</code>,<span class='widespace'>&#32;</span><code>hello.9xz</code><span class='widespace'>&#32;</span>and<span class='widespace'>&#32;</span><code>hello.v2z</code><span class='widespace'>&#32;</span>(or only some of those, if your program is specific to a calculator model). You can now run them after sending them to your calculator or to an emulator.</p>
  54. </div></div>
  55. <div class='c2'>
  56. <hr class='hr2' /><h2 class='heading'><a name='Adding.options'></a>Adding options</h2><div class='c2in'><hr class='hr2in' />
  57. <p>You can modify the behaviour of GTC with command-line options (or command-line <em>switches</em>). Their position on the command-line does not matter. For example, if you want to use the<span class='widespace'>&#32;</span><a href='cmdline.html#-o.switch'><code>-o</code><span class='widespace'>&#32;</span>switch</a> to create files named<span class='widespace'>&#32;</span><code>somename.89z</code>,<span class='widespace'>&#32;</span><code>somename.9xz</code><span class='widespace'>&#32;</span>and<span class='widespace'>&#32;</span><code>somename.v2z</code>, you can type:</p>
  58. <pre>
  59. gtc hello.c -o somename
  60. </pre>
  61. <p>Or, equivalently:</p>
  62. <pre>
  63. gtc -o somename hello.c
  64. </pre>
  65. <p>See below for a complete list of options.</p>
  66. </div></div>
  67. </div></div>
  68. <div class='c1'>
  69. <hr class='hr1' /><h1 class='heading'><a name='List.of.all.options'></a>List of all options</h1><div class='c1in'><hr class='hr1in' /><div class='c2'>
  70. <hr class='hr2' /><h2 class='heading'><a name='Options.affecting.output'></a>Options affecting output</h2><div class='c2in'><hr class='hr2in' /><div class='c3'>
  71. <hr class='hr3' /><h3 class='heading'><a name='-o.switch'></a><code>-o</code><span class='widespace'>&#32;</span>switch</h3><div class='c3in'><hr class='hr3in' />
  72. <p>By default,<span class='widespace'>&#32;</span><code>gtc hello.c foo.c bar.c</code><span class='widespace'>&#32;</span>results in an executable named<span class='widespace'>&#32;</span><code>hello.89z</code><span class='widespace'>&#32;</span>or<span class='widespace'>&#32;</span><code>hello.v2z</code>. You can specify other names with this switch, for example<span class='widespace'>&#32;</span><code>gtc hello.c foo.c bar.c -o somename</code><span class='widespace'>&#32;</span>will instead create an executable named<span class='widespace'>&#32;</span><code>somename.89z</code><span class='widespace'>&#32;</span>or<span class='widespace'>&#32;</span><code>somename.v2z</code>.</p>
  73. </div></div>
  74. <div class='c3'>
  75. <hr class='hr3' /><h3 class='heading'><a name='--folder.switch'></a><code>--folder</code><span class='widespace'>&#32;</span>switch</h3><div class='c3in'><hr class='hr3in' />
  76. <p>By default, calculator executables are stored in the<span class='widespace'>&#32;</span><code>main</code><span class='widespace'>&#32;</span>folder. You can store them in the folder<span class='widespace'>&#32;</span><code>somefold</code><span class='widespace'>&#32;</span>with the switch<span class='widespace'>&#32;</span><code>--folder=somefold</code>.</p>
  77. </div></div>
  78. <div class='c3'>
  79. <hr class='hr3' /><h3 class='heading'><a name='--output.switch'></a><code>--output</code><span class='widespace'>&#32;</span>switch</h3><div class='c3in'><hr class='hr3in' />
  80. <p>By default,<span class='widespace'>&#32;</span><code>gtc hello.c -o somename</code><span class='widespace'>&#32;</span>results in an executable named<span class='widespace'>&#32;</span><code>somename.89z</code>; the name of the program on the calculator will thus be<span class='widespace'>&#32;</span><code>somename()</code>. You can change this with the switch<span class='widespace'>&#32;</span><code>--output=myprog</code>:<span class='widespace'>&#32;</span><code>gtc hello.c -o somename --output=myprog</code><span class='widespace'>&#32;</span>creates an executable named<span class='widespace'>&#32;</span><code>somename.89z</code><span class='widespace'>&#32;</span>containing a program whose name on the calculator will be<span class='widespace'>&#32;</span><code>myprog()</code>.</p>
  81. </div></div>
  82. </div></div>
  83. <div class='c2'>
  84. <hr class='hr2' /><h2 class='heading'><a name='Preprocessor.options'></a>Preprocessor options</h2><div class='c2in'><hr class='hr2in' /><div class='c3'>
  85. <hr class='hr3' /><h3 class='heading'><a name='-I.switch'></a><code>-I</code><span class='widespace'>&#32;</span>switch</h3><div class='c3in'><hr class='hr3in' />
  86. <p>The<span class='widespace'>&#32;</span><code>-I folder</code><span class='widespace'>&#32;</span>(or<span class='widespace'>&#32;</span><code>-Ifolder</code>) switch tells GTC to look for include files not only in the current directory, but also in the folder<span class='widespace'>&#32;</span><code>folder</code>.
  87. You can use this switch several times to include several folders.</p>
  88. </div></div>
  89. <div class='c3'>
  90. <hr class='hr3' /><h3 class='heading'><a name='-D.switch'></a><code>-D</code><span class='widespace'>&#32;</span>switch</h3><div class='c3in'><hr class='hr3in' />
  91. <p>The<span class='widespace'>&#32;</span><code>-D SYMBOL</code><span class='widespace'>&#32;</span>(or<span class='widespace'>&#32;</span><code>-DSYMBOL</code>) switch tells GTC to<span class='widespace'>&#32;</span><a href='preprocessor.html#.23define'><code>#define</code></a><span class='widespace'>&#32;</span>the symbol<span class='widespace'>&#32;</span><code>SYMBOL</code>, with no specific value.
  92. The<span class='widespace'>&#32;</span><code>-D SYMBOL=value</code><span class='widespace'>&#32;</span>(or<span class='widespace'>&#32;</span><code>-DSYMBOL=value</code>) switch tells GTC to<span class='widespace'>&#32;</span><a href='preprocessor.html#.23define'><code>#define</code></a><span class='widespace'>&#32;</span>the symbol<span class='widespace'>&#32;</span><code>SYMBOL</code>, with the value<span class='widespace'>&#32;</span><code>value</code>.
  93. You can use this switch several times to define several symbols.</p>
  94. </div></div>
  95. </div></div>
  96. <div class='c2'>
  97. <hr class='hr2' /><h2 class='heading'><a name='Optimization.options'></a>Optimization options</h2><div class='c2in'><hr class='hr2in' />
  98. <p>It is in the philosophy of GTC to have default options as sensible as possible, so optimization options are kept to a bare minimum. Furthermore, optimizations are <em>always</em> enabled.</p>
  99. <div class='c3'>
  100. <hr class='hr3' /><h3 class='heading'><a name='-exe.switch'></a><code>-exe</code><span class='widespace'>&#32;</span>switch</h3><div class='c3in'><hr class='hr3in' />
  101. <p>This switch will make your program much smaller and very slightly faster, at the expense of a short loading time (usually less than half a second). However note that because it adds an unpacker to your program, it will make very small programs (less than 3-4 kilobytes) larger, so it should not be used in this case. It has the same effect as defining the<span class='widespace'>&#32;</span><a href='missing.html' class='invalidlink'><code>EXE_OUT</code></a><span class='widespace'>&#32;</span>preprocessor symbol.</p>
  102. <p>It can be an interesting way to work around <a href='glossary.html#AMS'>AMS</a>'s <a href='missing.html' class='invalidlink'>program size limit</a> for <a href='glossary.html#AMS'>AMS</a> version 2.0x, because a program that exceeds the size limit when uncompressed can be compressed to a size below the limit.</p>
  103. </div></div>
  104. <div class='c3'>
  105. <hr class='hr3' /><h3 class='heading'><a name='-mno-bss.switch'></a><code>-mno-bss</code><span class='widespace'>&#32;</span>switch</h3><div class='c3in'><hr class='hr3in' />
  106. <p>This switch disables the creation of BSS sections. In some cases it has absolutely no effect, in other cases it will either make the program faster and smaller, or make it much larger (if you are using large global arrays).</p>
  107. </div></div>
  108. </div></div>
  109. <div class='c2'>
  110. <hr class='hr2' /><h2 class='heading'><a name='Other.options'></a>Other options</h2><div class='c2in'><hr class='hr2in' /><div class='c3'>
  111. <hr class='hr3' /><h3 class='heading'><a name='--.separator'></a><code>--</code><span class='widespace'>&#32;</span>separator</h3><div class='c3in'><hr class='hr3in' />
  112. <p>Not an option <em>per se</em>, but a way to indicate that all arguments after<span class='widespace'>&#32;</span><code>--</code><span class='widespace'>&#32;</span>are really filenames and not command-line switches.
  113. For example<span class='widespace'>&#32;</span><code>gtc -DHELLO hello.c -- foo.c -file-with-dashes-.c</code><span class='widespace'>&#32;</span>will compile the 3 files<span class='widespace'>&#32;</span><code>hello.c</code>,<span class='widespace'>&#32;</span><code>foo.c</code><span class='widespace'>&#32;</span>and<span class='widespace'>&#32;</span><code>-file-with-dashes-.c</code>, with the single option<span class='widespace'>&#32;</span><code>-DHELLO</code>. Without<span class='widespace'>&#32;</span><code>--</code><span class='widespace'>&#32;</span>the file<span class='widespace'>&#32;</span><code>-file-with-dashes-.c</code><span class='widespace'>&#32;</span>would have been understood as an (invalid) command-line option.
  114. </div></div>
  115. </div></div>
  116. </div></div></p></div>
  117. </body>
  118. </html>