<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'> <html xmlns='http://www.w3.org/1999/xhtml'> <head> <title>src/casl2.c</title> <meta name='robots' content='noindex,nofollow' /> <meta name='generator' content='GLOBAL-6.6.5' /> <meta http-equiv='Content-Style-Type' content='text/css' /> <link rel='stylesheet' type='text/css' href='../style.css' /> </head> <body> <a id='TOP' name='TOP'></a><h2 class='header'><a href='../mains.html'>root</a>/<a href='../files/2932.html'>src</a>/casl2.c</h2> <em class='comment'>/* [<][>]<a href='#L52'>[^]</a><a href='#L74'>[v]</a>[top]<a href='#BOTTOM'>[bottom]</a><a href='../mains.html'>[index]</a><a href='../help.html'>[help]</a> */</em> <hr /> <h2 class='header'>DEFINITIONS</h2> This source file includes following definitions. <ol> <li><a href='#L52' title='Defined at 52.'>addcerrlist_casl2</a></li> <li><a href='#L57' title='Defined at 57.'>objfile_name</a></li> <li><a href='#L74' title='Defined at 74.'>main</a></li> </ol> <hr /> <pre> <a id='L1' name='L1'></a> 1 <em class='sharp'>#include</em> "<a href='2418.html'>package.h</a>" <a id='L2' name='L2'></a> 2 <em class='sharp'>#include</em> "<a href='2413.html'>assemble.h</a>" <a id='L3' name='L3'></a> 3 <em class='sharp'>#include</em> "<a href='2420.html'>exec.h</a>" <a id='L4' name='L4'></a> 4 <a id='L5' name='L5'></a> 5 <em class='comment'>/**</em> <a id='L6' name='L6'></a> 6 <em class='comment'> * @brief CASL IIのエラーをエラーリストに追加</em> <a id='L7' name='L7'></a> 7 <em class='comment'> *</em> <a id='L8' name='L8'></a> 8 <em class='comment'> * @return なし</em> <a id='L9' name='L9'></a> 9 <em class='comment'> */</em> <a id='L10' name='L10'></a> 10 <strong class='reserved'>void</strong> <a href='../S/2841.html#L52' title='Defined at 52 in src/casl2.c.'>addcerrlist_casl2</a>(); <a id='L11' name='L11'></a> 11 <a id='L12' name='L12'></a> 12 <em class='comment'>/**</em> <a id='L13' name='L13'></a> 13 <em class='comment'> * @brief アセンブル結果を書き込むファイルの名前</em> <a id='L14' name='L14'></a> 14 <em class='comment'> *</em> <a id='L15' name='L15'></a> 15 <em class='comment'> * @return ファイル名</em> <a id='L16' name='L16'></a> 16 <em class='comment'> *</em> <a id='L17' name='L17'></a> 17 <em class='comment'> * @param *str ファイル名</em> <a id='L18' name='L18'></a> 18 <em class='comment'> */</em> <a id='L19' name='L19'></a> 19 <strong class='reserved'>char</strong> *<a href='../S/2841.html#L57' title='Defined at 57 in src/casl2.c.'>objfile_name</a>(<strong class='reserved'>const</strong> <strong class='reserved'>char</strong> *<a href='../Y/203.html' title='Multiple used in 103 places.'>str</a>); <a id='L20' name='L20'></a> 20 <a id='L21' name='L21'></a> 21 <em class='comment'>/**</em> <a id='L22' name='L22'></a> 22 <em class='comment'> * @brief casl2コマンドのオプション</em> <a id='L23' name='L23'></a> 23 <em class='comment'> */</em> <a id='L24' name='L24'></a> 24 <strong class='reserved'>static</strong> <strong class='reserved'>struct</strong> <a href='../Y/169.html' title='Multiple used in 5 places.'>option</a> <a href='../Y/138.html' title='Multiple used in 10 places.'>longopts</a>[] = <em class='brace'>{</em> <a id='L25' name='L25'></a> 25 <em class='brace'>{</em> "source", <a href='../Y/156.html' title='Multiple used in 27 places.'>no_argument</a>, <a href='../Y/3.html' title='Multiple used in 191 places.'>NULL</a>, 's' <em class='brace'>}</em>, <a id='L26' name='L26'></a> 26 <em class='brace'>{</em> "label", <a href='../Y/156.html' title='Multiple used in 27 places.'>no_argument</a>, <a href='../Y/3.html' title='Multiple used in 191 places.'>NULL</a>, 'l' <em class='brace'>}</em>, <a id='L27' name='L27'></a> 27 <em class='brace'>{</em> "labelonly", <a href='../Y/156.html' title='Multiple used in 27 places.'>no_argument</a>, <a href='../Y/3.html' title='Multiple used in 191 places.'>NULL</a>, 'L' <em class='brace'>}</em>, <a id='L28' name='L28'></a> 28 <em class='brace'>{</em> "assembledetail", <a href='../Y/156.html' title='Multiple used in 27 places.'>no_argument</a>, <a href='../Y/3.html' title='Multiple used in 191 places.'>NULL</a>, 'a' <em class='brace'>}</em>, <a id='L29' name='L29'></a> 29 <em class='brace'>{</em> "assembledetailonly", <a href='../Y/156.html' title='Multiple used in 27 places.'>no_argument</a>, <a href='../Y/3.html' title='Multiple used in 191 places.'>NULL</a>, 'A' <em class='brace'>}</em>, <a id='L30' name='L30'></a> 30 <em class='brace'>{</em> "assembleout", <a href='../Y/170.html' title='Multiple used in 2 places.'>optional_argument</a>, <a href='../Y/3.html' title='Multiple used in 191 places.'>NULL</a>, 'o' <em class='brace'>}</em>, <a id='L31' name='L31'></a> 31 <em class='brace'>{</em> "assembleoutonly", <a href='../Y/170.html' title='Multiple used in 2 places.'>optional_argument</a>, <a href='../Y/3.html' title='Multiple used in 191 places.'>NULL</a>, 'O' <em class='brace'>}</em>, <a id='L32' name='L32'></a> 32 <em class='brace'>{</em> "trace", <a href='../Y/156.html' title='Multiple used in 27 places.'>no_argument</a>, <a href='../Y/3.html' title='Multiple used in 191 places.'>NULL</a>, 't' <em class='brace'>}</em>, <a id='L33' name='L33'></a> 33 <em class='brace'>{</em> "tracearithmetic", <a href='../Y/156.html' title='Multiple used in 27 places.'>no_argument</a>, <a href='../Y/3.html' title='Multiple used in 191 places.'>NULL</a>, 't' <em class='brace'>}</em>, <a id='L34' name='L34'></a> 34 <em class='brace'>{</em> "tracelogical", <a href='../Y/156.html' title='Multiple used in 27 places.'>no_argument</a>, <a href='../Y/3.html' title='Multiple used in 191 places.'>NULL</a>, 'T' <em class='brace'>}</em>, <a id='L35' name='L35'></a> 35 <em class='brace'>{</em> "dump", <a href='../Y/156.html' title='Multiple used in 27 places.'>no_argument</a>, <a href='../Y/3.html' title='Multiple used in 191 places.'>NULL</a>, 'd' <em class='brace'>}</em>, <a id='L36' name='L36'></a> 36 <em class='brace'>{</em> "monitor", <a href='../Y/156.html' title='Multiple used in 27 places.'>no_argument</a>, <a href='../Y/3.html' title='Multiple used in 191 places.'>NULL</a>, 'm' <em class='brace'>}</em>, <a id='L37' name='L37'></a> 37 <em class='brace'>{</em> "memorysize", <a href='../Y/186.html' title='Multiple used in 6 places.'>required_argument</a>, <a href='../Y/3.html' title='Multiple used in 191 places.'>NULL</a>, 'M' <em class='brace'>}</em>, <a id='L38' name='L38'></a> 38 <em class='brace'>{</em> "clocks", <a href='../Y/186.html' title='Multiple used in 6 places.'>required_argument</a>, <a href='../Y/3.html' title='Multiple used in 191 places.'>NULL</a>, 'C' <em class='brace'>}</em>, <a id='L39' name='L39'></a> 39 <em class='brace'>{</em> "version", <a href='../Y/156.html' title='Multiple used in 27 places.'>no_argument</a>, <a href='../Y/3.html' title='Multiple used in 191 places.'>NULL</a>, 'v' <em class='brace'>}</em>, <a id='L40' name='L40'></a> 40 <em class='brace'>{</em> "help", <a href='../Y/156.html' title='Multiple used in 27 places.'>no_argument</a>, <a href='../Y/3.html' title='Multiple used in 191 places.'>NULL</a>, 'h' <em class='brace'>}</em>, <a id='L41' name='L41'></a> 41 <em class='brace'>{</em> 0, 0, 0, 0 <em class='brace'>}</em>, <a id='L42' name='L42'></a> 42 <em class='brace'>}</em>; <a id='L43' name='L43'></a> 43 <a id='L44' name='L44'></a> 44 <em class='comment'>/**</em> <a id='L45' name='L45'></a> 45 <em class='comment'> * @brief casl2のエラー定義</em> <a id='L46' name='L46'></a> 46 <em class='comment'> */</em> <a id='L47' name='L47'></a> 47 <a href='../S/2415.html#L18' title='Defined at 18 in include/cerr.h.'>CERR</a> <a href='../Y/40.html' title='Multiple used in 2 places.'>cerr_casl2</a>[] = <em class='brace'>{</em> <a id='L48' name='L48'></a> 48 <em class='brace'>{</em> 126, "no source file" <em class='brace'>}</em>, <a id='L49' name='L49'></a> 49 <em class='brace'>{</em> 127, "invalid option" <em class='brace'>}</em>, <a id='L50' name='L50'></a> 50 <em class='brace'>}</em>; <a id='L51' name='L51'></a> 51 <a id='L52' name='L52'></a> 52 <strong class='reserved'>void</strong> <a href='../R/87.html' title='Multiple referred from 2 places.'>addcerrlist_casl2</a>() <a id='L53' name='L53'></a> 53 <em class='brace'>{</em> <a id='L54' name='L54'></a> 54 <a href='../S/2845.html#L13' title='Defined at 13 in src/cerr.c.'>addcerrlist</a>(<a href='../S/2424.html#L14' title='Defined at 14 in include/cmem.h.'>ARRAYSIZE</a>(<a href='../Y/40.html' title='Multiple used in 2 places.'>cerr_casl2</a>), <a href='../Y/40.html' title='Multiple used in 2 places.'>cerr_casl2</a>); <a id='L55' name='L55'></a> 55 <em class='brace'>}</em> <a id='L56' name='L56'></a> 56 <a id='L57' name='L57'></a> 57 <strong class='reserved'>char</strong> *<a href='../R/192.html' title='Multiple referred from 3 places.'>objfile_name</a>(<strong class='reserved'>const</strong> <strong class='reserved'>char</strong> *<a href='../Y/153.html' title='Multiple used in 9 places.'>name</a>) <a id='L58' name='L58'></a> 58 <em class='brace'>{</em> <a id='L59' name='L59'></a> 59 <strong class='reserved'>const</strong> <strong class='reserved'>char</strong> *<a href='../Y/79.html' title='Multiple used in 2 places.'>default_name</a> = "a.o"; <a id='L60' name='L60'></a> 60 <strong class='reserved'>return</strong> <a href='../S/2831.html#L25' title='Defined at 25 in src/cmem.c.'>strdup_chk</a>( <a id='L61' name='L61'></a> 61 (<a href='../Y/153.html' title='Multiple used in 9 places.'>name</a> == <a href='../Y/3.html' title='Multiple used in 191 places.'>NULL</a> || !<a href='../Y/153.html' title='Multiple used in 9 places.'>name</a>[0]) ? <a href='../Y/79.html' title='Multiple used in 2 places.'>default_name</a> : <a href='../Y/153.html' title='Multiple used in 9 places.'>name</a>, <a id='L62' name='L62'></a> 62 "objfile_name" <a id='L63' name='L63'></a> 63 ); <a id='L64' name='L64'></a> 64 <em class='brace'>}</em> <a id='L65' name='L65'></a> 65 <a id='L66' name='L66'></a> 66 <em class='comment'>/**</em> <a id='L67' name='L67'></a> 67 <em class='comment'> * @brief casl2コマンドのメイン</em> <a id='L68' name='L68'></a> 68 <em class='comment'> *</em> <a id='L69' name='L69'></a> 69 <em class='comment'> * @return 正常終了時は0、エラー発生時は1</em> <a id='L70' name='L70'></a> 70 <em class='comment'> *</em> <a id='L71' name='L71'></a> 71 <em class='comment'> * @param argc コマンドライン引数の数</em> <a id='L72' name='L72'></a> 72 <em class='comment'> * @param *argv[] コマンドライン引数の配列</em> <a id='L73' name='L73'></a> 73 <em class='comment'> */</em> <a id='L74' name='L74'></a> 74 <strong class='reserved'>int</strong> main(<strong class='reserved'>int</strong> <a href='../Y/8.html' title='Multiple used in 38 places.'>argc</a>, <strong class='reserved'>char</strong> *<a href='../Y/10.html' title='Multiple used in 63 places.'>argv</a>[]) <a id='L75' name='L75'></a> 75 <em class='brace'>{</em> <a id='L76' name='L76'></a> 76 <strong class='reserved'>int</strong> <a href='../Y/146.html' title='Multiple used in 30 places.'>memsize</a> = <a href='../S/2417.html#L19' title='Defined at 19 in include/struct.h.'>DEFAULT_MEMSIZE</a>; <a id='L77' name='L77'></a> 77 <strong class='reserved'>int</strong> <a href='../Y/58.html' title='Multiple used in 15 places.'>clocks</a> = <a href='../S/2417.html#L20' title='Defined at 20 in include/struct.h.'>DEFAULT_CLOCKS</a>; <a id='L78' name='L78'></a> 78 <strong class='reserved'>int</strong> <a href='../Y/166.html' title='Multiple used in 15 places.'>opt</a> = 0; <a id='L79' name='L79'></a> 79 <strong class='reserved'>int</strong> <a href='../Y/197.html' title='Multiple used in 34 places.'>stat</a> = 0; <a id='L80' name='L80'></a> 80 <strong class='reserved'>int</strong> <a href='../Y/16.html' title='Multiple used in 5 places.'>asfilecnt</a> = 0; <a id='L81' name='L81'></a> 81 <strong class='reserved'>char</strong> **<a href='../Y/15.html' title='Multiple used in 5 places.'>asfile</a> = <a href='../Y/3.html' title='Multiple used in 191 places.'>NULL</a>; <a id='L82' name='L82'></a> 82 <strong class='reserved'>char</strong> *<a href='../Y/159.html' title='Multiple used in 6 places.'>objfile</a> = <a href='../Y/3.html' title='Multiple used in 191 places.'>NULL</a>; <a id='L83' name='L83'></a> 83 <strong class='reserved'>const</strong> <strong class='reserved'>char</strong> *<a href='../Y/234.html' title='Multiple used in 10 places.'>version</a> = <a href='../D/55.html' title='Multiple defined in 2 places.'>PACKAGE_VERSION</a>; <a id='L84' name='L84'></a> 84 <strong class='reserved'>const</strong> <strong class='reserved'>char</strong> *<a href='../Y/67.html' title='Multiple used in 10 places.'>cmdversion</a> = "casl2 of YACASL2 version %s\n"; <a id='L85' name='L85'></a> 85 <strong class='reserved'>const</strong> <strong class='reserved'>char</strong> *<a href='../Y/231.html' title='Multiple used in 16 places.'>usage</a> = <a id='L86' name='L86'></a> 86 "Usage: %s [-slLaAtTdmvh] [-oO[<OBJECTFILE>]] [-M <MEMORYSIZE>] [-C <CLOCKS>] FILE1[ FILE2 ...]\n"; <a id='L87' name='L87'></a> 87 <a id='L88' name='L88'></a> 88 <em class='comment'>/* エラーの定義 */</em> <a id='L89' name='L89'></a> 89 <a href='../S/2845.html#L3' title='Defined at 3 in src/cerr.c.'>cerr_init</a>(); <a id='L90' name='L90'></a> 90 <a href='../S/2841.html#L52' title='Defined at 52 in src/casl2.c.'>addcerrlist_casl2</a>(); <a id='L91' name='L91'></a> 91 <a href='../S/2837.html#L797' title='Defined at 797 in src/assemble.c.'>addcerrlist_assemble</a>(); <a id='L92' name='L92'></a> 92 <a href='../S/2812.html#L213' title='Defined at 213 in src/exec.c.'>addcerrlist_exec</a>(); <a id='L93' name='L93'></a> 93 <a id='L94' name='L94'></a> 94 <em class='comment'>/* オプションの処理 */</em> <a id='L95' name='L95'></a> 95 <strong class='reserved'>while</strong>((<a href='../Y/166.html' title='Multiple used in 15 places.'>opt</a> = <a href='../Y/112.html' title='Multiple used in 5 places.'>getopt_long</a>(<a href='../Y/8.html' title='Multiple used in 38 places.'>argc</a>, <a href='../Y/10.html' title='Multiple used in 63 places.'>argv</a>, "tTdslLmao::O::AM:C:vh", <a href='../Y/138.html' title='Multiple used in 10 places.'>longopts</a>, <a href='../Y/3.html' title='Multiple used in 191 places.'>NULL</a>)) != -1) <em class='brace'>{</em> <a id='L96' name='L96'></a> 96 <strong class='reserved'>switch</strong>(<a href='../Y/166.html' title='Multiple used in 15 places.'>opt</a>) <em class='brace'>{</em> <a id='L97' name='L97'></a> 97 <strong class='reserved'>case</strong> 's': <a id='L98' name='L98'></a> 98 <a href='../Y/18.html' title='Multiple used in 17 places.'>asmode</a>.<a href='../Y/195.html' title='Multiple used in 11 places.'>src</a> = <a href='../Y/228.html' title='Multiple used in 79 places.'>true</a>; <a id='L99' name='L99'></a> 99 <strong class='reserved'>break</strong>; <a id='L100' name='L100'></a> 100 <strong class='reserved'>case</strong> 'l': <a id='L101' name='L101'></a> 101 <a href='../Y/18.html' title='Multiple used in 17 places.'>asmode</a>.<a href='../Y/127.html' title='Multiple used in 44 places.'>label</a> = <a href='../Y/228.html' title='Multiple used in 79 places.'>true</a>; <a id='L102' name='L102'></a> 102 <strong class='reserved'>break</strong>; <a id='L103' name='L103'></a> 103 <strong class='reserved'>case</strong> 'L': <a id='L104' name='L104'></a> 104 <a href='../Y/18.html' title='Multiple used in 17 places.'>asmode</a>.<a href='../Y/127.html' title='Multiple used in 44 places.'>label</a> = <a href='../Y/228.html' title='Multiple used in 79 places.'>true</a>; <a id='L105' name='L105'></a> 105 <a href='../Y/18.html' title='Multiple used in 17 places.'>asmode</a>.<a href='../Y/161.html' title='Multiple used in 4 places.'>onlylabel</a> = <a href='../Y/228.html' title='Multiple used in 79 places.'>true</a>; <a id='L106' name='L106'></a> 106 <strong class='reserved'>break</strong>; <a id='L107' name='L107'></a> 107 <strong class='reserved'>case</strong> 'a': <a id='L108' name='L108'></a> 108 <a href='../Y/18.html' title='Multiple used in 17 places.'>asmode</a>.<a href='../Y/14.html' title='Multiple used in 6 places.'>asdetail</a> = <a href='../Y/228.html' title='Multiple used in 79 places.'>true</a>; <a id='L109' name='L109'></a> 109 <strong class='reserved'>break</strong>; <a id='L110' name='L110'></a> 110 <strong class='reserved'>case</strong> 'A': <a id='L111' name='L111'></a> 111 <a href='../Y/18.html' title='Multiple used in 17 places.'>asmode</a>.<a href='../Y/14.html' title='Multiple used in 6 places.'>asdetail</a> = <a href='../Y/228.html' title='Multiple used in 79 places.'>true</a>; <a id='L112' name='L112'></a> 112 <a href='../Y/18.html' title='Multiple used in 17 places.'>asmode</a>.<a href='../Y/160.html' title='Multiple used in 4 places.'>onlyassemble</a> = <a href='../Y/228.html' title='Multiple used in 79 places.'>true</a>; <a id='L113' name='L113'></a> 113 <strong class='reserved'>break</strong>; <a id='L114' name='L114'></a> 114 <strong class='reserved'>case</strong> 'o': <a id='L115' name='L115'></a> 115 <a href='../Y/159.html' title='Multiple used in 6 places.'>objfile</a> = <a href='../S/2841.html#L57' title='Defined at 57 in src/casl2.c.'>objfile_name</a>(<a href='../Y/167.html' title='Multiple used in 8 places.'>optarg</a>); <a id='L116' name='L116'></a> 116 <strong class='reserved'>break</strong>; <a id='L117' name='L117'></a> 117 <strong class='reserved'>case</strong> 'O': <a id='L118' name='L118'></a> 118 <a href='../Y/18.html' title='Multiple used in 17 places.'>asmode</a>.<a href='../Y/160.html' title='Multiple used in 4 places.'>onlyassemble</a> = <a href='../Y/228.html' title='Multiple used in 79 places.'>true</a>; <a id='L119' name='L119'></a> 119 <a href='../Y/159.html' title='Multiple used in 6 places.'>objfile</a> = <a href='../S/2841.html#L57' title='Defined at 57 in src/casl2.c.'>objfile_name</a>(<a href='../Y/167.html' title='Multiple used in 8 places.'>optarg</a>); <a id='L120' name='L120'></a> 120 <strong class='reserved'>break</strong>; <a id='L121' name='L121'></a> 121 <strong class='reserved'>case</strong> 't': <a id='L122' name='L122'></a> 122 <a href='../Y/88.html' title='Multiple used in 35 places.'>execmode</a>.<a href='../Y/227.html' title='Multiple used in 13 places.'>trace</a> = <a href='../Y/228.html' title='Multiple used in 79 places.'>true</a>; <a id='L123' name='L123'></a> 123 <strong class='reserved'>break</strong>; <a id='L124' name='L124'></a> 124 <strong class='reserved'>case</strong> 'T': <a id='L125' name='L125'></a> 125 <a href='../Y/88.html' title='Multiple used in 35 places.'>execmode</a>.<a href='../Y/227.html' title='Multiple used in 13 places.'>trace</a> = <a href='../Y/228.html' title='Multiple used in 79 places.'>true</a>; <a id='L126' name='L126'></a> 126 <a href='../Y/88.html' title='Multiple used in 35 places.'>execmode</a>.<a href='../Y/136.html' title='Multiple used in 6 places.'>logical</a> = <a href='../Y/228.html' title='Multiple used in 79 places.'>true</a>; <a id='L127' name='L127'></a> 127 <strong class='reserved'>break</strong>; <a id='L128' name='L128'></a> 128 <strong class='reserved'>case</strong> 'd': <a id='L129' name='L129'></a> 129 <a href='../Y/88.html' title='Multiple used in 35 places.'>execmode</a>.<a href='../Y/81.html' title='Multiple used in 8 places.'>dump</a> = <a href='../Y/228.html' title='Multiple used in 79 places.'>true</a>; <a id='L130' name='L130'></a> 130 <strong class='reserved'>break</strong>; <a id='L131' name='L131'></a> 131 <strong class='reserved'>case</strong> 'm': <a id='L132' name='L132'></a> 132 <a href='../Y/88.html' title='Multiple used in 35 places.'>execmode</a>.<a href='../Y/201.html' title='Multiple used in 5 places.'>step</a> = <a href='../Y/228.html' title='Multiple used in 79 places.'>true</a>; <a id='L133' name='L133'></a> 133 <strong class='reserved'>break</strong>; <a id='L134' name='L134'></a> 134 <strong class='reserved'>case</strong> 'M': <a id='L135' name='L135'></a> 135 <a href='../Y/146.html' title='Multiple used in 30 places.'>memsize</a> = <a href='../Y/21.html' title='Multiple used in 7 places.'>atoi</a>(<a href='../Y/167.html' title='Multiple used in 8 places.'>optarg</a>); <a id='L136' name='L136'></a> 136 <strong class='reserved'>break</strong>; <a id='L137' name='L137'></a> 137 <strong class='reserved'>case</strong> 'C': <a id='L138' name='L138'></a> 138 <a href='../Y/58.html' title='Multiple used in 15 places.'>clocks</a> = <a href='../Y/21.html' title='Multiple used in 7 places.'>atoi</a>(<a href='../Y/167.html' title='Multiple used in 8 places.'>optarg</a>); <a id='L139' name='L139'></a> 139 <strong class='reserved'>break</strong>; <a id='L140' name='L140'></a> 140 <strong class='reserved'>case</strong> 'v': <a id='L141' name='L141'></a> 141 <a href='../Y/102.html' title='Multiple used in 115 places.'>fprintf</a>(<a href='../Y/200.html' title='Multiple used in 93 places.'>stdout</a>, <a href='../Y/67.html' title='Multiple used in 10 places.'>cmdversion</a>, <a href='../Y/234.html' title='Multiple used in 10 places.'>version</a>); <a id='L142' name='L142'></a> 142 <strong class='reserved'>goto</strong> <a href='../Y/30.html' title='Multiple used in 5 places.'>casl2fin</a>; <a id='L143' name='L143'></a> 143 <strong class='reserved'>case</strong> 'h': <a id='L144' name='L144'></a> 144 <a href='../Y/102.html' title='Multiple used in 115 places.'>fprintf</a>(<a href='../Y/200.html' title='Multiple used in 93 places.'>stdout</a>, <a href='../Y/231.html' title='Multiple used in 16 places.'>usage</a>, <a href='../Y/10.html' title='Multiple used in 63 places.'>argv</a>[0]); <a id='L145' name='L145'></a> 145 <strong class='reserved'>goto</strong> <a href='../Y/30.html' title='Multiple used in 5 places.'>casl2fin</a>; <a id='L146' name='L146'></a> 146 <strong class='reserved'>case</strong> '?': <a id='L147' name='L147'></a> 147 <a href='../Y/102.html' title='Multiple used in 115 places.'>fprintf</a>(<a href='../Y/198.html' title='Multiple used in 23 places.'>stderr</a>, <a href='../Y/231.html' title='Multiple used in 16 places.'>usage</a>, <a href='../Y/10.html' title='Multiple used in 63 places.'>argv</a>[0]); <a id='L148' name='L148'></a> 148 <a href='../S/2845.html#L45' title='Defined at 45 in src/cerr.c.'>setcerr</a>(212, ""); <em class='comment'>/* invalid option */</em> <a id='L149' name='L149'></a> 149 <strong class='reserved'>goto</strong> <a href='../Y/30.html' title='Multiple used in 5 places.'>casl2fin</a>; <a id='L150' name='L150'></a> 150 <em class='brace'>}</em> <a id='L151' name='L151'></a> 151 <em class='brace'>}</em> <a id='L152' name='L152'></a> 152 <a id='L153' name='L153'></a> 153 <em class='comment'>/* ソースファイルが指定されていない場合は終了 */</em> <a id='L154' name='L154'></a> 154 <strong class='reserved'>if</strong>(<a href='../Y/10.html' title='Multiple used in 63 places.'>argv</a>[<a href='../Y/168.html' title='Multiple used in 10 places.'>optind</a>] == <a href='../Y/3.html' title='Multiple used in 191 places.'>NULL</a>) <em class='brace'>{</em> <a id='L155' name='L155'></a> 155 <a href='../S/2845.html#L45' title='Defined at 45 in src/cerr.c.'>setcerr</a>(126, ""); <em class='comment'>/* no source file */</em> <a id='L156' name='L156'></a> 156 <a href='../Y/102.html' title='Multiple used in 115 places.'>fprintf</a>(<a href='../Y/198.html' title='Multiple used in 23 places.'>stderr</a>, "casl2 error - %d: %s\n", <a href='../Y/32.html' title='Multiple used in 59 places.'>cerr</a>-><a href='../Y/157.html' title='Multiple used in 57 places.'>num</a>, <a href='../Y/32.html' title='Multiple used in 59 places.'>cerr</a>-><a href='../Y/151.html' title='Multiple used in 23 places.'>msg</a>); <a id='L157' name='L157'></a> 157 <strong class='reserved'>goto</strong> <a href='../Y/30.html' title='Multiple used in 5 places.'>casl2fin</a>; <a id='L158' name='L158'></a> 158 <em class='brace'>}</em> <a id='L159' name='L159'></a> 159 <a href='../S/2856.html#L113' title='Defined at 113 in src/struct.c.'>create_cmdtable</a>(<a href='../S/2417.html#L61' title='Defined at 61 in include/struct.h.'>HASH_CMDTYPE</a>); <em class='comment'>/* 命令の名前とタイプがキーのハッシュ表を作成 */</em> <a id='L160' name='L160'></a> 160 <a href='../S/2856.html#L253' title='Defined at 253 in src/struct.c.'>reset</a>(<a href='../Y/146.html' title='Multiple used in 30 places.'>memsize</a>, <a href='../Y/58.html' title='Multiple used in 15 places.'>clocks</a>); <em class='comment'>/* 仮想マシンCOMET IIのリセット */</em> <a id='L161' name='L161'></a> 161 <a href='../Y/16.html' title='Multiple used in 5 places.'>asfilecnt</a> = <a href='../Y/8.html' title='Multiple used in 38 places.'>argc</a> - <a href='../Y/168.html' title='Multiple used in 10 places.'>optind</a>; <a id='L162' name='L162'></a> 162 <a href='../Y/15.html' title='Multiple used in 5 places.'>asfile</a> = <a href='../S/2831.html#L14' title='Defined at 14 in src/cmem.c.'>calloc_chk</a>(<a href='../Y/16.html' title='Multiple used in 5 places.'>asfilecnt</a>, <strong class='reserved'>sizeof</strong>(<strong class='reserved'>char</strong> *), "asfile"); <a id='L163' name='L163'></a> 163 <strong class='reserved'>for</strong>(<strong class='reserved'>int</strong> <a href='../Y/117.html' title='Multiple used in 233 places.'>i</a> = 0; <a href='../Y/117.html' title='Multiple used in 233 places.'>i</a> < <a href='../Y/16.html' title='Multiple used in 5 places.'>asfilecnt</a>; <a href='../Y/117.html' title='Multiple used in 233 places.'>i</a>++) <em class='brace'>{</em> <em class='comment'>/* 引数からファイル名配列を取得 */</em> <a id='L164' name='L164'></a> 164 <a href='../Y/15.html' title='Multiple used in 5 places.'>asfile</a>[<a href='../Y/117.html' title='Multiple used in 233 places.'>i</a>] = <a href='../Y/10.html' title='Multiple used in 63 places.'>argv</a>[<a href='../Y/168.html' title='Multiple used in 10 places.'>optind</a> + <a href='../Y/117.html' title='Multiple used in 233 places.'>i</a>]; <a id='L165' name='L165'></a> 165 <em class='brace'>}</em> <a id='L166' name='L166'></a> 166 <em class='comment'>/* アセンブル */</em> <a id='L167' name='L167'></a> 167 <strong class='reserved'>if</strong>(<a href='../S/2837.html#L751' title='Defined at 751 in src/assemble.c.'>assemble</a>(<a href='../Y/16.html' title='Multiple used in 5 places.'>asfilecnt</a>, <a href='../Y/15.html' title='Multiple used in 5 places.'>asfile</a>, 0) == <a href='../Y/92.html' title='Multiple used in 52 places.'>false</a> || <a href='../Y/18.html' title='Multiple used in 17 places.'>asmode</a>.<a href='../Y/161.html' title='Multiple used in 4 places.'>onlylabel</a> == <a href='../Y/228.html' title='Multiple used in 79 places.'>true</a>) <em class='brace'>{</em> <a id='L168' name='L168'></a> 168 <strong class='reserved'>goto</strong> <a href='../S/2856.html#L278' title='Defined at 278 in src/struct.c.'>shutdown</a>; <a id='L169' name='L169'></a> 169 <em class='brace'>}</em> <a id='L170' name='L170'></a> 170 <em class='comment'>/* オブジェクトファイル名が指定されている場合は、アセンブル結果をオブジェクトファイルに出力 */</em> <a id='L171' name='L171'></a> 171 <strong class='reserved'>if</strong>(<a href='../Y/159.html' title='Multiple used in 6 places.'>objfile</a> != <a href='../Y/3.html' title='Multiple used in 191 places.'>NULL</a>) <em class='brace'>{</em> <a id='L172' name='L172'></a> 172 <a href='../S/2837.html#L805' title='Defined at 805 in src/assemble.c.'>outassemble</a>(<a href='../Y/159.html' title='Multiple used in 6 places.'>objfile</a>); <a id='L173' name='L173'></a> 173 <em class='brace'>}</em> <a id='L174' name='L174'></a> 174 <em class='comment'>/* onlyassembleモード以外の場合、仮想マシンCOMET IIを実行 */</em> <a id='L175' name='L175'></a> 175 <strong class='reserved'>if</strong>(<a href='../Y/18.html' title='Multiple used in 17 places.'>asmode</a>.<a href='../Y/160.html' title='Multiple used in 4 places.'>onlyassemble</a> == <a href='../Y/92.html' title='Multiple used in 52 places.'>false</a>) <em class='brace'>{</em> <a id='L176' name='L176'></a> 176 <a href='../S/2812.html#L676' title='Defined at 676 in src/exec.c.'>exec</a>(); <em class='comment'>/* 仮想マシンCOMET IIの実行 */</em> <a id='L177' name='L177'></a> 177 <em class='brace'>}</em> <a id='L178' name='L178'></a> 178 <a href='../S/2856.html#L278' title='Defined at 278 in src/struct.c.'>shutdown</a>: <a id='L179' name='L179'></a> 179 <a href='../S/2856.html#L278' title='Defined at 278 in src/struct.c.'>shutdown</a>(); <em class='comment'>/* 仮想マシンCOMET IIのシャットダウン */</em> <a id='L180' name='L180'></a> 180 <a href='../Y/30.html' title='Multiple used in 5 places.'>casl2fin</a>: <a id='L181' name='L181'></a> 181 <a href='../S/2424.html#L21' title='Defined at 21 in include/cmem.h.'>FREE</a>(<a href='../Y/159.html' title='Multiple used in 6 places.'>objfile</a>); <a id='L182' name='L182'></a> 182 <a href='../S/2424.html#L21' title='Defined at 21 in include/cmem.h.'>FREE</a>(<a href='../Y/15.html' title='Multiple used in 5 places.'>asfile</a>); <a id='L183' name='L183'></a> 183 <a href='../S/2856.html#L135' title='Defined at 135 in src/struct.c.'>free_cmdtable</a>(<a href='../S/2417.html#L61' title='Defined at 61 in include/struct.h.'>HASH_CMDTYPE</a>); <a id='L184' name='L184'></a> 184 <strong class='reserved'>if</strong>(<a href='../Y/32.html' title='Multiple used in 59 places.'>cerr</a>-><a href='../Y/157.html' title='Multiple used in 57 places.'>num</a> > 0) <em class='brace'>{</em> <a id='L185' name='L185'></a> 185 <a href='../Y/197.html' title='Multiple used in 34 places.'>stat</a> = 1; <a id='L186' name='L186'></a> 186 <em class='brace'>}</em> <a id='L187' name='L187'></a> 187 <a href='../S/2845.html#L72' title='Defined at 72 in src/cerr.c.'>freecerr</a>(); <em class='comment'>/* エラーの解放 */</em> <a id='L188' name='L188'></a> 188 <strong class='reserved'>return</strong> <a href='../Y/197.html' title='Multiple used in 34 places.'>stat</a>; <a id='L189' name='L189'></a> 189 <em class='brace'>}</em> </pre> <hr /> <a id='BOTTOM' name='BOTTOM'></a> <em class='comment'>/* [<][>]<a href='#L52'>[^]</a><a href='#L74'>[v]</a><a href='#TOP'>[top]</a>[bottom]<a href='../mains.html'>[index]</a><a href='../help.html'>[help]</a> */</em> </body> </html>