ng-1.5beta1/ 40755 1750 1750 0 7642273645 11373 5ustar amurausersng-1.5beta1/bin/ 40755 1750 1750 0 7642273644 12142 5ustar amurausersng-1.5beta1/bin/SKG-JISYO100644 1750 1750 415010 7126003715 13525 0ustar amurausers! /!/ " /″/ $ /$/ % /%/ & /&/ ' /′/ ( /(/ ) /)/ * /*/※/ , /,/、/ - /―/ー/ . /./。/・/ : /:/ < /〈//</《/ = /〓/ > /〉/>/》/ ? /?/ ~ /〜/ ̄/ @ /@/ [ /「/『/[/【/ ] /」/』/]/】/ { /{/『/ } /}/』/ | /|/ Greek /Α/Β/Γ/Δ/Ε/Ζ/Η/Θ/Ι/Κ/Λ/Μ/Ν/Ξ/Ο/Π/Ρ/Σ/Τ/Υ/Φ/Χ/Ψ/Ω/ Lambda /Λ/ Russia /А/Б/В/Г/Д/Е/Ё/Ж/З/И/Й/К/Л/М/Н/О/П/Р/С/Т/У/Ф/Х/Ц/Ч/Ш/Щ/Ъ/Ы/Ь/Э/Ю/Я/ Sigma /Σ/ abstract /アブストラクト/ access /アクセス/ account /アカウント/ address /アドレス/ advice /アドバイス/ algol /アルゴル/ algorithm /アルゴリズム/ allocate /アロケート/ alogol /アルゴル/ alpha /α/ alphabet /アルファベット/ america /アメリカ/ and /∧/ announce /アナウンス/ apart /アパート/ application /アプリケーション/ approach /アプローチ/ architecture /アーキテクチャ/ ascii /アスキー/ assembler /アセンブラ/ assign /アサイン/ automaton /オートマトン/ average /アベレージ/ backup /バックアップ/ base /ベース/ batch /バッチ/ baud /ボー/ beer /ビール/ benchmark /ベンチマーク/ berkley /バークレイ/ best /ベスト/ beta /β/ bit /ビット/ bitmap /ビットマップ/ board /ボード/ branch /ブランチ/ bridge /ブリッジ/ broadcast /ブロードキャスト/ buffer /バッファ/ bug /バグ/ bus /バス/ button /ボタン/ byte /バイト/ cable /ケーブル/ cache /キャッシュ/ cake /ケーキ/ california /カルフォルニア/ call /コール/ camp /キャンプ/ campus /キャンパス/ cancel /キャンセル/ capability /ケーパビリティ/ card /カード/ cartridge /カートリッジ/ case /ケース/ cassette /カセット/ catalogue /カタログ/ category /カテゴリー/ center /センター/ channel /チャネル/ character /キャラクタ/ check /チェック/ circle /サークル/ class /クラス/ clear /クリア/ click /クリック/ client /クライアント/ code /コード/ coding /コーディング/ coffee /コーヒー/ color /カラー/ comeback /カムバック/ command /コマンド/ comment /コメント/ communication /コミュニケーション/ compa /コンパ/ compile /コンパイル/ compiler /コンパイラ/ computer /コンピューター/コンピュータ/ connector /コネクタ/ console /コンソール/ contact /コンタクト/ copy /コピー/ cost /コスト/ count /カウント/ course /コース/ cover /カバー/ cpu /中央処理装置/CPU/ crash /クラッシュ/ cross /クロス/ cursor /カーソル/ custom /カスタム/ data /データ/ database /データベース/ debug /ディバッグ/ default /ディフォルト/ delta /δ/ demo /デモ/ design /デザイン/ desk /デスク/ device /デバイス/ directory /ディレクトリィ/ディレクトリ/ disk /ディスク/ display /ディスプレイ/ document /ドキュメント/ domain /ドメイン/ dot /ドット/ down /ダウン/ drive /ドライブ/ driver /ドライバー/ドライバ/ dynamic /ダイナミック/ edinburgh /エディンバラ/ edit /エディット/ editor /エディタ/ electronics /エレクトロニクス/ emulator /エミュレーター/ end /エンド/ energy /エネルギー/ entry /エントリー/エントリ/ epsilon /ε/ error /エラー/ essay /エッセィ/ eta /η/ ethernet /イーサネット/ etl /電総研/ fiber /ファイバー/ file /ファイル/ filter /フィルター/ floppy /フロッピィ/ flow /フロー/ flowchart /フローチャート/ follow /フォロウ/ font /フォント/ forall /∀/ format /フォーマット/ forward /フォワード/ frame /フレーム/ france /フランス/ free /フリー/ gamma /γ/ gap /ギャップ/ gateway /ゲートウェイ/ giga /ギガ/ graph /グラフ/ greek /α/β/γ/δ/ε/ζ/η/θ/ι/κ/λ/μ/ν/ξ/ο/π/ρ/σ/τ/υ/φ/χ/ψ/ω/ group /グループ/ guard /ガード/ hamming /ハミング/ hard /ハード/ hardware /ハードウェア/ head /ヘッド/ header /ヘッダー/ヘッダ/ hiking /ハイキング/ hint /ヒント/ host /ホスト/ hotel /ホテル/ house /ハウス/ ibm /IBM/ icon /アイコン/ icot /新世代コンピュータ開発機構/ idea /アイディア/ ideal /イデアル/ image /イメージ/ implement /インプリメント/ inch /インチ/ informal /インフォーマル/ inheritance /インヘリタンス/ inhouse /インハウス/ install /インストール/ interface /インターフェース/インタフェース/ internet /インターネット/ interpreter /インタープリタ/ invoice /インボイス/ iota /ι/ italic /イタリック/ job /ジョブ/ juice /ジュース/ kernel /カーネル/ key /キー/ keyboard /キーボード/ keyword /キーワード/ kilo /キロ/ kit /キット/ kk /株式会社/ label /ラベル/ lambda /λ/ laser /レーザー/ laserprinter /レーザープリンタ/ laserwriter /レーザーライタ/ level /レベル/ library /ライブラリ/ license /ライセンス/ line /ライン/ link /リンク/ list /リスト/ load /ロード/ local /ローカル/ lock /ロック/ login /ログイン/ logout /ログアウト/ london /ロンドン/ loop /ループ/ lucky /ラッキー/ mach /Mach/ machine /マシン/マシーン/ macro /マクロ/ mail /メイル/メール/ mailer /メイラー/ mailing /メイリング/ main /メイン/ maker /メーカー/ manager /マネージャ/マネージャー/ manner /マナー/ manual /マニュアル/ map /マップ/ mapping /マッピング/ mask /マスク/ master /マスター/ mccarthy /マッカーシー/ mechanism /メカニズム/ medal /メダル/ mega /メガ/ member /メンバー/ memo /メモ/ memory /メモリ/ menu /メニュー/ merge /マージ/ merit /メリット/ message /メッセージ/ meta /メタ/ meter /メートル/ micro /マイクロ/ minibuffer /ミニバッファ/ minor /マイナー/ mode /モード/ model /モデル/ modem /モデム/ module /モジュール/ monitor /モニター/ mount /マウント/ mouse /マウス/ mu /μ/ multi /マルチ/ multiprocessor /マルチプロセッサ/ name /ネーム/ nami /〜/ neck /ネック/ net /ネット/ network /ネットワーク/ news /ニュース/ nickname /ニックネーム/ node /ノード/ note /ノート/ nu /ν/ number /ナンバー/ object /オブジェクト/ observer /オブザーバ/オブザーバー/ office /オフィス/ olympic /オリンピック/ omega /ω/ omicron /ο/ online /オンライン/ operating /オペレーティング/ operation /オペレーション/ option /オプション/ order /オーダ/ oriented /オリエンテッド/ original /オリジナル/ os /OS/ out /アウト/ overflow /オーバーフロー/ overhead /オーバヘッド/ package /パッケージ/ packet /パケット/ page /ページ/ pager /ページャ/ paging /ページング/ pair /ペア/ paradigm /パラダイム/ paradox /パラドックス/ parameter /パラメーター/パラメータ/ paris /パリ/ partition /パーティション/ party /パーティー/ pass /パス/ passing /パッシング/ passport /パスポート/ password /パスワード/ patch /パッチ/ path /パス/ pattern /パターン/ percent /%/ performance /パーフォーマンス/ period /ピリオド/ permission /パーミッション/ phi /φ/ pi /π/ piano /ピアノ/ pitcher /ピッチャー/ pocket /ポケット/ pointer /ポインタ/ polling /ポーリング/ port /ポート/ post /〒/ポスト/ postmaster /ポストマスター/ primitive /プリミティブ/ print /プリント/ printer /プリンター/ procedure /プロシージャ/ process /プロセス/ processor /プロセッサ/ professional /プロフェッショナル/ program /プログラム/ programmer /プログラマ/プログラマー/ programming /プログラミング/ project /プロジェクト/ prompt /プロンプト/ protect /プロテクト/ protection /プロテクション/ protocol /プロトコル/ psi /ψ/ public /パブリック/ question /?/ queue /キュー/ radio /ラジオ/ random /ランダム/ reader /リーダー/ record /レコード/ region /リージョン/ register /レジスタ/ release /リリース/ remote /リモート/ repeat /々/ report /レポート/ request /リクエスト/ reset /リセット/ ring /リング/ roma /ローマ/ room /ルーム/ root /ルート/ route /ルート/ routing /ルーティング/ rule /ルール/ russia /а/б/в/г/д/е/ё/ж/з/и/й/к/л/м/н/о/п/р/с/т/у/ф/х/ц/ч/ш/щ/ъ/ы/ь/э/ю/я/ sample /サンプル/ save /セーブ/ schedule /スケジュール/ scheduling /スケジューリング/ search /サーチ/ second /セカンド/ security /セキュリティー/ segment /セグメント/ semaphore /セマフォ/ semicolon /セミコロン/ seminar /セミナー/ sense /センス/ serial /シリアル/ series /シリーズ/ server /サーバー/サーバ/ service /サービス/ session /セッション/ set /セット/ shell /シェル/ shock /ショック/ short /ショート/ sigma /σ/ simple /シンプル/ single /シングル/ site /サイト/ size /サイズ/ soft /ソフト/ software /ソフトウェア/ sort /ソート/ source /ソース/ space /スペース/ speech /スピーチ/ sports /スポーツ/ ss /§/ stack /スタック/ stanford /スタンフォード/ step /ステップ/ stockholm /ストックホルム/ stream /ストリーム/ string /ストリング/ style /スタイル/ sub /サブ/ subdomain /サブドメイン/ subject /サブジェクト/ subnet /サブネット/ subnetting /サブネッティング/ sun /サン/ support /サポート/ sweden /スウェーデン/ switch /スィッチ/ system /システム/ table /テーブル/ tap /タップ/ tape /テープ/ task /タスク/ tau /τ/ tautology /トートロジー/ taxi /タクシー/ tennis /テニス/ test /テスト/ text /テキスト/ theta /θ/ thread /スレッド/ tool /ツール/ toplevel /トップレベル/ touch /タッチ/ traffic /トラフィック/ trans /トランス/ transceiver /トランシーバー/ tree /ツリー/ trouble /トラブル/ tutorial /チュートリアル/ tv /テレビ/ type /タイプ/ unix /UNIX/ up /アップ/ user /ユーザ/ユーザー/ vector /ベクトル/ version /バージョン/ virus /ウィルス/ visa /ビザ/ volt /ボルト/ volunteer /ボランティア/ white /ホワイト/ window /ウィンドウ/ workinggroup /ワーキンググループ/ workshop /ワークショップ/ workstation /ワークステーション/ writer /ライター/ zeta /ζ/ あ /阿/娃/唖/亜/ あb /浴/ あe /合/会/逢/ あg /挙/揚/上/ あi /合/会/空/開/ あk /飽/開/明/空/ あo /合/ あr /有/在/ あs /悪/ あt /当/有/挙/合/会/蓬/ あu /合/逢/会/ あw /合/会/ あい /愛/哀/相/姶/挨/合/ あいs /愛/ あいかわ /相川/ あいかわr /相変/ あいさつ /挨拶/ あいしゃ /愛車/ あいしょう /愛称/相性/ あいじょう /愛情/ あいだ /間/ あいち /愛知/ あいちゃく /愛着/ あいて /相手/ あいはら /相原/ あいぼう /相棒/ あいまい /曖昧/ あいよう /愛用/ あお /青/ あおi /青/ あおk /青/ あおい /葵/青井/ あおき /青木/ あおぞら /青空/ あおた /青田/ あおば /青葉/ あおばやま /青葉山/ あおやま /青山/ あか /赤/垢/ あかi /赤/ あかn /赤/ あかr /明/ あかご /赤子/ あかさか /赤坂/ あかじ /赤字/ あかつき /暁/ あかね /茜/ あかほん /赤本/ あかま /赤間/ あかもん /赤門/ あき /秋/穐/空/章/昭/明/晰/ あきr /明/ あきこ /晶子/ あきた /秋田/ あきのり /明憲/彰則/ あきはばら /秋葉原/ あきひこ /昭彦/ あきひろ /昭博/晃広/ あきら /晃/明/彰/朗/璋/ あきらm /諦/ あく /悪/渥/握/ あくい /悪意/ あくしつ /悪質/ あくしゅ /握手/ あくしゅけん /握手券/ あくせい /悪性/ あくま /悪魔/ あけぼの /曙/ あげ /上/ あさ /朝/麻/浅/ あさi /浅/ あさk /浅/ あさか /浅香/ あさがた /朝方/ あさくさ /浅草/ あさって /明後日/ あさひ /朝日/旭/ あざ /字/ あざぶ /麻布/ あし /足/芦/葦/ あしがら /足柄/ あした /明日/ あしなみ /足並/ あしべ /芦部/ あじ /味/鯵/ あじとみ /安次富/ あす /明日/ あずk /預/ あずさ /梓/ あずま /東/吾妻/ あせ /汗/ あせt /焦/ あそ /阿曽/ あそb /遊/ あそn /遊/ あたe /与/ あたr /辺/ あたい /値/ あたかも /宛/ あたたk /暖/ あたたm /暖/ あたま /頭/ あたらs /新/ あたり /辺/ あだち /足立/ あっか /悪化/ あっしゅく /圧縮/ あっとう /圧倒/ あっとうてき /圧倒的/ あつ /篤/斡/圧/厚/敦/ あつi /熱/暑/厚/ あつk /厚/熱/暑/ あつm /集/厚/ あつs /暑/ あつかe /扱/ あつかi /扱/ あつかo /扱/ あつかt /扱/ あつかu /扱/ あつかw /扱/ あつぎ /厚木/ あつぎし /厚木市/ あつし /篤志/敦/厚志/ あつゆき /篤幸/ あて /宛/ あてさき /宛先/ あと /後/跡/ あな /穴/ あなた /貴方/ あに /兄/ あね /姉/姐/ あねがさき /姉ヶ崎/ あねさき /姉崎/ あばr /暴/ あぶ /虻/ あぶn /危/ あぶなi /危/ あぶら /油/脂/ あべ /安部/安倍/阿部/ あほ /阿呆/ あま /天/甘/雨/尼/ あまe /甘/ あまi /甘/ あまr /余/ あまがい /天海/ あまの /天野/ あみ /網/ あめ /雨/飴/ あや /文/綾/絢/ あやs /怪/ あやこ /亜矢子/彩子/ あやまr /誤/謝/ あやまt /誤/謝/ あゆ /鮎/ あゆm /歩/ あゆみ /彩友美/ あら /荒/ あらe /洗/ あらi /洗/荒/ あらt /新/洗/ あらu /洗/ あらz /非/ あらい /荒井/ あらいだs /洗い出/ あらかじm /予/ あらかじめ /予/ あらかわ /荒川/ あらがね /荒金/ あらき /荒木/ あらし /嵐/ あらそu /争/ あらたm /改/ あらまき /荒巻/ あらわr /現/ あらわs /現/表/ あらわざ /荒技/ あり /有/蟻/ ありかわ /有川/ ありがたi /有難/ ありがとu /有難/ ありま /有馬/ ある /或/ あるi /歩/ あるk /歩/ あるじ /主/ あわ /泡/粟/阿波/ あわr /憐/哀/ あわさ /粟佐/ あわせ /袷/ あわばこ /泡箱/ あん /安/案/暗/杏/鞍/闇/按/庵/ あんい /安易/ あんか /安価/ あんぎゃ /行脚/ あんけん /案件/ あんこく /暗黒/ あんごう /暗号/ あんごうか /暗号化/ あんざい /安西/ あんしょう /暗蕉/ あんしん /安心/ あんしんs /安心/ あんじ /暗示/ あんず /杏/ あんぜん /安全/ あんぜんせい /安全性/ あんてい /安定/ あんどう /安藤/ あんない /案内/ あんもく /暗黙/ あんらく /安楽/ い /位/為/意/井/唯/如/偉/異/亥/医/遺/違/謂/衣/萎/胃/緯/維/移/畏/椅/易/慰/惟/尉/威/委/夷/囲/依/伊/以/彙/猪/居/ いe /言/ いi /言/良/ いk /行/生/ いm /居/ いn /居/ いo /言/ いr /入/居/煎/ いt /言/行/居/ いu /言/云/ いw /言/ いい /飯/猪/ いいざわ /飯沢/ いいだ /飯田/ いいだばし /飯田橋/ いいづか /飯塚/ いいわけ /言い訳/ いいん /医院/委員/ いいんかい /委員会/ いいんちょう /委員長/ いえ /家/ いえだ /家田/ いえもと /家元/ いか /以下/医科/ いかr /怒/ いかt /怒/ いかが /如何/ いかがく /医科学/ いかわ /井川/ いかん /如何/ いがい /以外/意外/ いがくぶ /医学部/ いがらし /五十嵐/ いき /息/域/囲気/閾/粋/意気/ いきおi /勢/ いきき /行き来/ いきぎr /息切/ いぎ /意義/ いく /郁/育/ いくr /幾/ いくt /幾/ いくお /郁雄/育男/ いくさ /戦/ いくせい /育成/ いくとおr /幾通/ いけ /池/ いけお /池尾/ いけだ /池田/ いけぶくろ /池袋/ いけん /意見/ いこう /以降/移行/意向/ いこく /異国/ いこま /生駒/ いご /以後/ いざかや /居酒屋/ いし /医師/石/意思/意志/ いしかわ /石河/石川/ いしき /意識/ いしきてき /意識的/ いしざか /石坂/ いしじま /石島/ いしずか /石塚/ いしそつう /意志疎通/ いしだ /石田/ いしつ /異質/ いしはた /石畑/ いしばし /石橋/ いしゃ /医者/ いしやま /石山/ いしゅ /異種/ いしゅせい /異種性/ いしょう /衣裳/衣装/ いしょく /移植/委嘱/ いしょくせい /移植性/ いじ /維持/意地/ いじょう /以上/異常/≧/ いじょうしゅうりょう /異常終了/ いじん /異人/ いす /椅子/ いすう /位数/ いず /伊豆/ いずみ /和泉/泉/ いせん /緯線/ いぜん /以前/依然/ いそ /磯/ いそg /急/ いそi /急/ いそう /位相/ いそがs /忙/ いぞん /依存/異存/ いぞんせい /依存性/ いぞんぶ /依存部/ いた /板/ いたi /痛/ いたm /痛/ いたn /痛/ いたr /至/ いたs /致/ いたt /至/ いたい /遺体/ いたくけんきゅう /委託研究/ いただi /頂/戴/ いただk /頂/戴/ いだ /井田/ いだi /抱/ いだk /抱/ いち /一/位置/壱/市/ いちい /一位/一意/ いちいせい /一意性/ いちいち /一々/ いちいてき /一意的/ いちいん /一因/一員/ いちおう /一応/ いちかわ /市川/ いちがい /一概/ いちぎょう /一行/ いちげん /一言/一見/ いちごうかん /一号館/ いちじ /一時/一事/ いちじかん /一時間/ いちじてき /一時的/ いちじるs /著/ いちずk /位置付/ いちたろう /一太郎/ いちだい /一台/ いちだん /一段/ いちど /一度/ いちどう /一同/ いちにち /一日/ いちにんまえ /一人前/ いちねん /一年/ いちはら /市原/ いちばん /一番/ いちばんちょう /一番町/ いちぶ /一部/ いちぶぶん /一部分/ いちまい /一枚/ いちまんえん /一万円/ いちまんえんしへい /一万円紙幣/ いちもつ /一物/ いちよう /一様/ いちよし /市吉/ いちらん /一覧/ いちれい /一例/ いちれん /一連/ いちろう /一郎/ いっt /言/行/ いっかい /一回/一階/一介/ いっかげつ /一箇月/ いっかしょ /一箇所/ いっかつ /一括/ いっかん /一環/一貫/ いっき /一気/ いっきょ /一挙/ いっけん /一見/一軒/ いっこ /一個/ いっこう /一行/一向/ いっこく /一刻/ いっさい /一切/ いっさくねん /一昨年/ いっしき /一式/ いっしゅ /一種/ いっしゅうかん /一週間/ いっしゅどくとく /一種独特/ いっしゅるい /一種類/ いっしゅん /一瞬/ いっしょ /一緒/ いっしょn /一緒/ いっしょう /一生/ いっしょうけんめい /一生懸命/ いっすん /一寸/ いっせい /一斉/ いっそう /一層/ いったい /一体/ いったん /一端/一旦/ いっち /一致/ いっちょうめ /一丁目/ いっつう /一通/ いってい /一定/ いっとき /一時/ いっぱい /一杯/ いっぱく /一泊/一拍/ いっぱつ /一発/ いっぱん /一般/ いっぱんか /一般化/ いっぱんせい /一般性/ いっぱんてき /一般的/ いっぷう /一風/ いっぺん /一遍/ いっぽ /一歩/ いっぽう /一方/一報/ いっぽん /一本/ いつ /逸/溢/何時/ いつつばし /五橋/ いてん /移転/ いでん /遺伝/ いでんし /遺伝子/ いと /意図/糸/ いとs /愛/ いとう /伊藤/伊東/ いとうちゅう /伊藤忠/ いとてき /意図的/ いど /井戸/ いどう /移動/ いな /否/稲/ いなm /否/ いない /以内/ いなか /田舎/ いながき /稲垣/ いなげ /稲毛/ いなもり /稲盛/ いなもりざいだん /稲盛財団/ いにん /委任/ いぬ /犬/ いぬがみ /犬神/ いね /稲/ いの /猪野/伊野/猪/ いのr /祈/ いのt /祈/ いのうえ /井上/ いのおか /猪岡/ いのしし /猪/ いのち /命/生命/ いのまた /猪股/ いはん /違反/ いばら /茨/ いばらぎ /茨城/ いほう /違法/ いま /今/ いまい /今井/ いまだ /未/ いみ /意味/ いみろん /意味論/ いも /芋/ いもうと /妹/ いや /嫌/ いよう /医用/異様/ いよく /意欲/ いらい /以来/依頼/ いりえ /入江/ いりぐち /入口/ いりや /入谷/ いりょう /医療/ いりょく /威力/ いるま /入間/ いれかe /入れ替/ いろ /色/ いろいろ /色々/ いわ /岩/ いわi /祝/ いわu /祝/ いわお /巌/ いわき /岩城/ いわし /鰯/ いわた /岩田/ いわて /岩手/ いわてだいがく /岩手大学/ いわなみ /岩波/ いわま /岩間/ いわもと /岩本/ いん /音/引/印/隠/陰/因/韻/院/蔭/胤/淫/飲/姻/員/咽/允/隕/ いんさつ /印刷/ いんし /院試/ いんしょう /印象/ いんじ /印字/ いんすう /因数/ いんせい /院生/ いんせき /隕石/ いんたい /引退/ いんち /吋/ いんど /印度/ いんぺい /隠蔽/ いんぼう /陰謀/ いんよう /引用/ いんようかいし /引用開始/ いんりょく /引力/ いんりょくけん /引力圏/ う /雨/右/有/鵜/卯/迂/羽/烏/宇/ うe /飢/植/ うi /浮/ うk /受/浮/ うm /埋/生/産/ うr /売/得/ うt /売/打/ うい /初/ うえ /上/↑/植/ うええだ /上枝/ うえだ /上田/ うえなか /植中/ うえの /上野/ うお /魚/ うかがe /伺/ うかがi /伺/ うかがt /伺/ うかがu /窺/伺/ うかがw /伺/ うけつけ /受付/ うけとr /受け取/受取/ うけとt /受け取/受取/ うけとりにん /受取人/ うけわたs /受渡/ うごi /動/ うごk /動/ うし /丑/牛/ うしなt /失/ うしなu /失/ うしなw /失/ うしろ /後/ うじ /氏/ うす /臼/碓/ うすi /薄/ うすk /薄/ うすr /薄/ うすい /臼井/ うすき /薄/ うず /渦/ うそ /嘘/ うた /歌/唄/ うたi /歌/ うたがi /疑/ うたがw /疑/ うたひめ /歌姫/ うち /内/家/ うちがわ /内側/ うちだ /内田/ うちゅう /宇宙/ うちゅうきち /宇宙基地/ うちゅうれき /宇宙暦/ うちわけ /内訳/ うったe /訴/ うつ /蔚/欝/鬱/ うつr /移/ うつs /移/映/写/ うつt /移/ うつくs /美/ うつわ /器/ うで /腕/ うでまえ /腕前/ うながs /促/ うなぎ /鰻/ うば /姥/ うばt /奪/ うばu /奪/ うへん /右辺/ うべ /宇部/ うま /馬/ うまi /旨/ うまや /厩/ うみ /海/ うみだs /生み出/ うみべ /海辺/ うめ /梅/ うめだ /梅田/ うめむら /梅村/ うら /裏/浦/ うらm /恨/ うらn /恨/ うらぎr /裏切/ うらなi /占/ うらやす /浦安/ うらわ /浦和/ うり /瓜/ うりば /売場/ うるう /閏/ うるうどし /閏年/ うれs /嬉/ うわさ /噂/ うわべ /上辺/ うん /云/運/雲/ うんえい /運営/ うんえいのうりょく /運営能力/ うんせい /運勢/ うんちん /運賃/ うんてん /運転/ うんてんしゅ /運転手/ うんどう /運動/ うんぬん /云々/ うんめい /運命/ うんよう /運用/ え /回/会/絵/重/恵/餌/荏/江/得/枝/柄/笑/ えm /得/ えn /得/ えr /得/ えt /得/ えい /英/映/影/鋭/詠/衛/頴/穎/盈/瑛/洩/泳/永/栄/曳/嬰/営/叡/ えいいち /英一/ えいえん /永遠/ えいかいわ /英会話/ えいが /映画/ えいきゅう /永久/ えいきょう /影響/ えいぎょう /営業/ えいぎょうしょ /営業所/ えいぎょうぶ /営業部/ えいぎょうほんぶ /営業本部/ えいこく /英国/ えいこもじ /英小文字/ えいご /英語/ えいじ /英字/ えいすうじ /英数字/ えいたろう /永太朗/ えいてん /栄転/ えいぶん /英文/ えいゆう /英雄/ えいり /営利/ えいりもくてき /営利目的/ えがi /描/ えがk /描/ えがお /笑顔/ えがわ /江川/ えき /駅/役/益/疫/液/易/繹/ えきしょう /液晶/ えきちょう /駅長/ えきでん /駅伝/ えきめい /駅名/ えたい /得体/ えだ /枝/ えちご /越後/ えつ /閲/越/謁/悦/ えつこ /悦子/ えのき /榎/ えのもと /榎本/ えひめ /愛媛/ えびす /恵比寿/ えみ /恵美/ えらb /選/ えらi /偉/ えらn /選/ えらs /偉/ えり /襟/ えん /円/宛/延/煙/淵/演/塩/鴛/鉛/遠/薗/苑/艶/縁/猿/燕/焔/炎/沿/援/掩/怨/宴/奄/堰/園/厭/ えんえき /演繹/ えんえきほう /演繹法/ えんかい /宴会/ えんかく /遠隔/ えんかくち /遠隔地/ えんかつ /円滑/ えんかん /鉛管/ えんき /延期/ えんぎ /演技/縁起/ えんざん /演算/ えんざんし /演算子/ えんしゅう /演習/円周/ えんしんりょく /遠心力/ えんじょ /援助/ えんじょう /遠城/ えんそう /演奏/ えんだい /演題/ えんちょう /園長/延長/ えんどう /遠藤/ えんりょ /遠慮/ お /汚/於/尾/夫/御/雄/男/生/小/ おc /落/ おe /終/追/負/ おi /置/追/負/ おk /起/置/ おo /追/ おp /追/ おr /降/折/居/ おs /押/惜/推/ おt /落/折/負/追/ おu /負/追/ おw /終/追/ おい /甥/追/ おいわけ /追分/ おう /横/桜/応/黄/鴎/鴬/襖/翁/王/殴/欧/旺/押/往/奥/央/凹/ おうj /応/ おうz /応/ おうえん /応援/ おうかん /王冠/ おうぎ /扇/ おうしゅう /応酬/ おうしょう /王将/ おうじ /王子/ おうじさま /王子様/ おうじょう /往生/ おうせい /旺盛/ おうだ /殴打/ おうとう /応答/ おうとつ /凹凸/ おうふく /往復/ おうぶん /欧文/ おうへん /応変/ おうぼ /応募/ おうよう /応用/ おうようかがく /応用科学/ おお /大/多/ おおi /多/大/ おおk /大/多/ おおm /多/ おおs /多/ おおt /覆/ おおu /覆/ おおあかじ /大赤字/ おおあざ /大字/ おおい /大井/ おおいそ /大磯/ おおいた /大分/ おおいまちせん /大井町線/ おおえん /応援/ おおおかやま /大岡山/ おおおき /大木/ おおかみ /狼/ おおかわ /大川/ おおがた /大型/ おおがら /大柄/ おおき /大木/ おおくr /御送/ おおくぼ /大久保/大窪/ おおくら /大倉/ おおぐろ /大黒/ おおけが /大怪我/ おおごえ /大声/ おおごと /大事/ おおさか /大阪/ おおさかだいがく /大阪大学/ おおさき /大崎/ おおさわ /大沢/ おおしば /大芝/ おおしま /大嶋/ おおすじ /大筋/ おおぜい /大勢/多勢/ おおそうじ /大掃除/ おおた /太田/大田/ おおたに /大谷/ おおだい /大台/ おおつ /大津/ おおつか /大塚/ おおつき /大槻/ おおて /大手/ おおとも /大友/ おおはし /大橋/ おおはば /大幅/ おおふな /大船/ おおまえ /大前/ おおまち /大町/ おおみや /大宮/ おおむかし /大昔/ おおむね /概/ おおめ /大目/ おおもじ /大文字/ おおもり /大森/ おおや /大矢/ おおやけ /公/ おか /丘/岡/ おかs /犯/可笑/ おかげ /御陰/ おかし /お菓子/ おかだ /岡田/ おかむら /岡村/ おかやま /岡山/ おがさわら /小笠原/ おがた /小方/ おがわ /小川/ おき /沖/ おきかe /置き換/ おきなわ /沖縄/ おぎ /荻/ おぎくぼ /荻窪/ おぎなt /補/ おぎなu /補/ おぎの /荻野/ おぎわら /荻原/ おく /屋/奥/臆/憶/億/ おくr /送/遅/贈/ おくt /送/ おくかわ /奥川/ おくじょう /屋上/ おくの /奥野/奥乃/ おくりじょう /送り状/ おぐら /小倉/ おけ /桶/ おげんき /御元気/ おこr /起/怒/ おこs /起/ おこたr /怠/ おこたt /怠/ おこなe /行/ おこなi /行/ おこなo /行/ おこなt /行/ おこなu /行/ おこなw /行/ おこり /瘧/ おさ /長/ おさm /収/治/納/ おさむ /修/ おざわ /小沢/ おしe /教/ おじゃま /御邪魔/ おす /牡/♂/ おそi /遅/ おそk /遅/ おそr /恐/ おそs /遅/ おだ /織田/小田/ おだか /小高/ おち /落/ おちあい /落合/ おちつk /落着/ おちば /落葉/ おっと /夫/ おっぱま /追浜/ おつ /乙/ おと /音/ おとr /劣/ おとs /落/ おとうと /弟/ おとこ /男/ おとさた /音沙汰/ おととい /一昨日/ おとどk /御届/ おとな /大人/ おとなし /音無/ おどr /踊/ おどろi /驚/ おどろk /驚/ おなj /同/ おなz /同/ おなじ /々/ おに /鬼/ おにづか /鬼塚/ おねがi /お願/ おねがい /お願い/ おの /小野/ おのおの /各々/ おのれ /己/ おば /伯母/ おひま /御暇/ おび /帯/ おびひろ /帯広/ おぼe /覚/憶/ おみ /臣/ おも /主/面/ おもe /思/ おもi /思/重/ おもk /重/ おもm /重/ おもn /主/ おもs /重/ おもt /思/重/ おもu /思/ おもw /思/ おもい /思/ おもしろ /面白/ おもしろi /面白/ おもしろk /面白/ おもしろs /面白/ おもて /表/面/ おや /親/ おやこ /親子/ おやだま /親玉/ およb /及/ およg /泳/ おり /折/ おれ /俺/ おれい /御礼/ おれせん /折線/ おろk /愚/ おろし /卸/ おわr /終/ おわt /終/ おわり /終/ おん /音/御/穏/温/恩/ おんかい /音階/ おんがく /音楽/ おんがくか /音楽家/ おんきょう /音響/ おんせい /音声/ おんせん /温泉/ おんちゅう /御中/ おんてい /音程/ おんど /音頭/温度/ おんどく /音読/ おんな /女/ おんぱ /音波/ おんぷ /音符/ おんよm /音読/ か /下/日/歌/化/家/個/仮/花/夏/火/暇/香/靴/果/蚊/霞/過/迦/貨/嘩/課/蝦/菓/華/荷/茄/苛/箇/稼/禾/禍/珂/河/架/科/寡/嫁/嘉/可/加/佳/価/伽/何/賀/ かe /変/替/買/換/ かi /書/買/ かk /書/掛/欠/ かm /噛/ かn /噛/兼/ かo /買/ かr /借/苅/刈/枯/ かs /貸/加/化/課/ かt /買/勝/掛/ かu /買/ かw /買/替/変/代/換/ かい /回/皆/会/絵/改/海/階/懐/壊/魁/解/介/怪/開/甲斐/貝/蟹/芥/界/灰/械/晦/拐/戒/恢/悔/快/廻/塊/下位/獪/ かいs /介/ かいいん /会員/ かいえん /開演/ かいかん /快感/会館/ かいが /絵画/ かいがい /海外/ かいがいりょこう /海外旅行/ かいがもり /貝が森/ かいがら /貝殻/ かいがん /海岸/ かいがんせん /海岸線/ かいきょう /回教/ かいぎ /会議/ かいぎしつ /会議室/ かいぎょう /改行/開業/ かいけい /会計/ かいけつ /解決/ かいこ /蚕/ かいこうめん /開口面/ かいごう /会合/ かいさい /開催/ かいさつ /改札/ かいし /開始/ かいしつ /開室/ かいしつび /開室日/ かいしゃ /会社/ かいしゃく /解釈/ かいしゃめい /会社名/ かいしゅう /回収/ かいしょう /解消/ かいしょく /会食/ かいじょ /解除/ かいじょう /会場/階乗/海上/ かいすう /回数/ かいせい /快晴/改正/ かいせき /解析/ かいせきほう /解析法/ かいせつ /解説/ かいせん /回線/ かいせんぞくせい /回線属性/ かいぜん /改善/ かいそう /階層/ かいそく /快速/ かいぞう /改造/解像/ かいぞうど /解像度/ かいたい /解体/ かいだん /階段/ かいちょう /快調/会長/ かいてい /改訂/ かいていばん /改訂版/ かいてき /快適/ かいてん /回転/ かいとう /回答/ かいとうしゃ /回答者/ かいどく /解読/ かいにゅう /介入/ かいにん /解任/ かいはつ /開発/ かいはつぶ /開発部/ かいひ /回避/会費/ かいひん /海浜/ かいふう /開封/ かいふく /回復/ かいぶん /回文/ かいへい /開閉/ かいへん /改変/ かいほう /開放/解法/解放/会報/ かいむ /皆無/ かいめい /改名/解明/ かいもの /買物/ かいよう /潰瘍/ かいらん /回覧/ かいり /浬/ かいりょう /改良/ かいろ /回路/ かいわ /会話/ かいわい /界隈/ かいわれ /貝割/ かえ /替/ かえr /帰/換/ かえs /返/帰/ かえt /帰/返/ かえりm /省/ かえりびと /帰人/ かえる /蛙/ かお /顔/ かおr /香/ かおう /花王/ かおだt /顔立/ かおまk /顔負/ かおり /香織/香/ かおる /馨/薫/ かかe /抱/ かかg /掲/ かかr /係/ かかw /関/ かかい /可解/ かかく /価格/ かかり /係/掛/ かかりかん /係官/ かかりちょう /係長/掛長/ かかん /日間/ かがく /科学/化学/ かがくか /科学科/ かがくかい /科学会/ かがくぎじゅつ /科学技術/ かがみ /鏡/ かがやi /輝/ かがやk /輝/ かき /下記/蛎/柿/垣/書/ かきおき /書き置き/ かきかe /書換/ かきこm /書込/書き込/ かきだs /書出/ かきなおs /書き直/ かきならb /書き並/ かきん /課金/ かぎ /鍵/鈎/ かぎr /限/ かぎt /限/ かぎり /限/ かく /確/各/客/覚/革/隔/閣/郭/較/赫/角/穫/獲/殻/核/格/撹/拡/廓/嚇/劃/画/ かくr /隠/ かくs /隠/ かくい /各位/ かくえい /角栄/ かくぎょう /各行/ かくご /覚悟/ かくしゃ /各社/ かくしゅ /各種/ かくしん /確信/ かくじ /各自/ かくじつ /確実/ かくじん /各人/ かくすう /画数/ かくだい /拡大/ かくちょう /拡張/格調/ かくちょうし /拡張子/ かくちょうせい /拡張性/ かくてい /確定/ かくていs /確定/ かくていてき /確定的/ かくとく /獲得/ かくど /角度/ かくにん /確認/ かくのう /格納/ かくほ /確保/ かくらん /各欄/ かくりつ /確率/確立/ かぐら /神楽/ かけ /掛/ かけひ /筧/ かけんひ /科研費/ かげ /陰/影/ かげき /歌劇/ かげつ /ヶ月/箇月/ かげん /加減/ かこ /過去/ かこm /囲/ かこn /囲/ かこu /囲/ かこう /加工/ かごしま /鹿児島/ かさ /笠/傘/ かさn /重/ かさい /火災/家裁/ かさま /笠間/ かさん /加算/ かざr /飾/ かざん /火山/ かし /菓子/歌詞/橿/樫/可視/ かしこi /賢/ かしこk /賢/ かしつ /過失/ かしゅ /歌手/ かしょ /個所/箇所/ かしら /頭/ かしわ /栢/柏/ かしわぎ /柏木/ かじ /梶/ かじうら /梶浦/ かじか /鰍/ かじょう /箇条/ かすが /春日/ かすみ /霞/ かず /数/和/一/下図/ かずひろ /一博/ かずまさ /和正/ かずよし /和義/一義/ かせg /稼/ かせい /火星/化成/ かせつ /仮説/ かせん /下線/ かぜ /風/風邪/ かそう /仮想/ かそうきおく /仮想記憶/ かそうきおくきこう /仮想記憶機構/ かそうてき /仮想的/ かぞe /数/ かぞく /家族/ かた /方/形/型/肩/潟/片/ かたi /難/固/堅/ かたk /固/ かたm /固/傾/ かたr /語/ かたt /語/ かたい /難/ かたかな /片仮名/ かたがた /方々/ かたき /敵/ かたすいろん /型推論/ かたたいけい /型体系/ かたち /形/ かたつk /型付/ かたて /片手/ かたな /刀/ かたはば /肩幅/ かたひら /片平/ かたほう /片方/ かたむi /傾/ かたむk /傾/ かためん /片面/ かたやま /片山/ かたりろん /型理論/ かだい /課題/ かち /価値/ かちどき /勝鬨/ かちょう /課長/ かっか /閣下/ かっきてき /画期的/ かっこ /括弧/【/】/(/)/』/『/[/]/ かっこう /格好/ かって /勝手/ かっぱつ /活発/ かつ /割/滑/且/轄/褐/葛/渇/活/括/恰/喝/勝/克/ かつお /鰹/ かつし /克志/ かつじ /活字/ かつどう /活動/ かつやく /活躍/ かつやま /勝山/ かつよう /活用/ かてい /仮定/過程/課程/家庭/ かていかんきょう /家庭環境/ かていちょうさ /家庭調査/ かとう /加藤/ かとき /過渡期/ かど /角/過度/┘/┐/┌/└/ かどう /稼働/華道/ かどくせい /可読性/ かどた /角田/ かどまつ /角松/ かな /仮名/ かなs /悲/ かなu /叶/ かなかんじ /仮名漢字/ かなかんじへんかん /仮名漢字変換/ かながわ /神奈川/ かなざわ /金沢/ かなめ /要/ かなもり /金森/ かならz /必/ かにゅう /加入/ かね /金/ かねこ /金子/ かねつ /加熱/ かの /彼/ かのう /可能/ かのうせい /可能性/ かのじょ /彼女/ かのじょじしん /彼女自身/ かば /樺/椛/ かばん /鞄/ かひつ /加筆/ かびん /花瓶/ かふんしょう /花粉症/ かぶ /株/下部/ かぶしき /株式/ かぶしきかいしゃ /株式会社/ かぶしきがいしゃ /株式会社/ かぶそしき /下部組織/ かぶと /兜/甲/ かべ /壁/ かま /鎌/釜/蒲/ かまe /構/ かまi /構/ かまu /構/ かまw /構/ かまいし /釜石/ かまくら /鎌倉/ かまた /鎌田/蒲田/ かまど /竃/ かみ /上/紙/髪/神/ かみすぎ /上杉/ かみなり /雷/ かみむら /上村/ かみや /神谷/ かめ /亀/ かめい /仮名/亀井/ かめやま /亀山/ かめん /仮面/ かも /鴨/ かもく /科目/ かや /萱/茅/ かゆ /粥/ かよe /通/ かよi /通/ かよo /通/ かよt /通/ かよu /通/ かよw /通/ かよう /火曜/ かようび /火曜日/ から /空/〜/柄/殻/唐/ からm /絡/ からn /絡/ からだ /体/身体/ かり /仮/刈/ かりうど /狩人/ かりゅう /下流/ かりょく /火力/ かるi /軽/ かるk /軽/ かるs /軽/ かれ /彼/ かれr /彼/ かれら /彼等/ かわ /側/川/皮/河/ かわr /変/代/換/ かわt /変/ かわい /川合/ かわいg /可愛/ かわいi /可愛/ かわいk /可愛/ かわいr /可愛/ かわうち /川内/ かわかみ /川上/ かわごえ /川越/ かわさき /川崎/ かわしま /川島/ かわぞえ /川添/ かわたび /川渡/ かわだ /川田/ かわちや /河内谷/ かわはら /川原/ かわまた /川又/ かわら /瓦/河原/ かん /間/換/巻/感/甘/観/完/函/関/舘/館/韓/陥/閑/鑑/還/貫/諌/莞/艦/肝/翰/缶/緩/簡/管/竿/看/監/環/潅/澗/漢/汗/歓/款/棺/桓/柑/敢/憾/慣/患/幹/干/寛/官/姦/堪/喚/勧/勘/刊/寒/冠/侃/乾/甲/菅/煥/ かんj /感/ かんs /関/ かんz /感/ かんい /簡易/ かんかく /感覚/間隔/ かんかつ /管轄/ かんがe /考/ かんがえ /考え/ かんきょう /環境/ かんきょうせってい /環境設定/ かんきょうへんすう /環境変数/ かんけい /関係/ かんけいしゃ /関係者/ かんけいせつ /関係節/ かんけつ /簡潔/完結/間欠/ かんけつか /簡潔化/ かんげい /歓迎/ かんげき /感激/ かんげん /管弦/ かんこう /観光/官公/刊行/ かんこく /韓国/ かんさい /関西/ かんさいちく /関西地区/ かんさいちほう /関西地方/ かんさつ /観察/ かんし /監視/ かんしゃ /感謝/ かんしゃs /感謝/ かんしゅう /慣習/監修/ かんしょく /感蝕/ かんしん /感心/関心/ かんじ /漢字/幹事/ かんじへんかん /漢字変換/ かんじょう /感情/勘定/ かんじん /肝心/ かんすう /関数/ かんすうがた /関数型/ かんすうくうかん /関数空間/ かんすうてきよう /関数適用/ かんすうめい /関数名/ かんせい /完成/ かんせつ /間接/関節/ かんせつてき /間接的/ かんぜん /完全/ かんそう /感想/乾燥/完走/ かんそく /観測/ かんそくじょ /観測所/ かんたん /簡単/ かんたんか /簡単化/ かんだ /神田/ かんだかi /甲高/ かんち /関知/感知/ かんちがi /勘違/ かんちょう /艦長/ かんづめ /缶詰/ かんてん /観点/ かんとう /関東/ かんとく /監督/ かんどう /感動/ かんない /関内/ かんねん /観念/ かんねんs /観念/ かんばt /頑張/ かんばん /看板/ かんべん /勘弁/簡便/ かんぺき /完璧/ かんやく /簡約/監訳/ かんやくりつ /簡約律/ かんよ /関与/ かんり /管理/ かんりしゃ /管理者/ かんりにん /管理人/ かんりゃく /簡略/ かんりょう /完了/ かんれき /還暦/ かんれん /関連/ かんわきゅうだい /閑話休題/ かんんけつへん /完結編/ が /我/茅/駕/餓/雅/賀/蛾/芽/臥/画/牙/峨/俄/河/ がい /外/街/害/概/骸/鎧/該/蓋/碍/涯/慨/崖/咳/劾/凱/既/ がいかい /外界/ がいかん /概観/ がいこく /外国/ がいこくご /外国語/ がいこくじん /外国人/ がいしゃ /会社/外車/ がいしゅつ /外出/ がいしょう /外傷/ がいじ /外字/ がいじん /外人/ がいせつ /概説/ がいせつほう /外接法/ がいせん /外線/ がいてき /外的/ がいとう /該当/街頭/ がいねん /概念/ がいねんてき /概念的/ がいぶ /外部/ がいよう /概要/ がいりゃく /概略/ がいろ /街路/ がいろじゅ /街路樹/ がか /画家/ がき /垣/ がく /楽/額/学/顎/岳/學/ がくい /学位/ がくいん /学院/ がくえん /学園/ がくがい /学外/ がくぎょう /学業/ がくぎょうせいせき /学業成績/ がくし /学士/ がくしゃ /学者/ がくしゅう /学習/ がくしゅういん /学習院/ がくしょう /楽章/ がくしん /学振/ がくじゅつ /学術/ がくじょうもう /学情網/ がくせい /学生/ がくせいふく /学生服/ がくせき /学籍番号/ がくだん /楽団/ がくちょう /学長/ がくない /学内/ がくないびん /学内便/ がくねん /学年/ がくふ /楽譜/ がくぶ /学部/ がくほう /学報/ がくれき /学歴/ がくわり /学割/ がし /樫/ がそ /画素/ がそかん /画素間/ がそごと /画素毎/ がぞう /画像/ がぞうしょり /画像処理/ がぞうじょうほう /画像情報/ がた /型/潟/方/ がっか /学科/ がっかい /学会/ がっかいし /学会誌/ がっき /学期/楽器/ がっこう /学校/ がっこうきょうし /学校教師/ がっこうたんい /学校単位/ がっしゅく /合宿/ がっしょう /合唱/ がっそう /合奏/ がっち /合致/ がっぴ /月日/ がつ /月/ がばん /画板/ がまん /我慢/ がみ /上/ がめん /画面/ がら /柄/ がらす /硝子/ がりゅう /我流/ がわ /側/ がん /元/顔/丸/含/願/頑/雁/贋/翫/岩/眼/癌/玩/巌/岸/ がんこもの /巌固者/ がんたん /元旦/ がんばr /頑張/ がんばt /頑張/ き /気/既/木/机/基/記/機/危/起/祈/寄/亀/鬼/騎/飢/輝/軌/貴/規/徽/紀/稀/季/畿/汽/毅/帰/棄/棋/期/旗/揮/忌/幾/希/岐/嬉/奇/器/喜/伎/企/樹/黄/饋/綺/氣/己/僖/ きe /消/ きg /気/ きi /聞/聴/効/ きk /聞/聴/効/利/ きm /決/来/ きr /切/着/ きs /記/ きt /来/切/着/ きあつ /気圧/ きい /紀伊/奇異/ きいろ /黄色/ きうち /木内/ きおく /記憶/ きおくせんめい /記憶鮮明/ きおくそうち /記憶装置/ きおん /気温/ きかe /着換/ きかい /機械/機会/ きかく /企画/規格/ きかくぶ /企画部/ きかん /期間/機関/饋還/貴艦/ きがく /貴学/ きがる /気軽/ きき /機器/危機/ きぎょう /企業/ きく /鞠/菊/掬/ きくち /菊地/菊池/ きぐ /危惧/器具/ きぐち /木口/ きけいしき /木形式/ きけつ /帰結/ きけん /危険/棄権/ きけんど /危険度/ きげん /起源/期限/ きこう /機構/寄港/気候/ きこうぞう /木構造/ きこく /帰国/ きごう /記号/〓/↓/↑/←/→/〒/※/▼/▽/▲/△/■/□/◆/◇/◎/●/○/★/☆/§/@/*/&/#/%/£/¢/$/¥/℃/″/′/°/♀/♂/∴/∞/≧/≦/>/</≠/=/÷/×/±/−/+/】/【/』/『/」/「/》/《/〉/〈/}/{/]/[/〕/〔/)/(/”/“/’/‘/‥/…/|/‖/〜/\///‐/―/ー/〇/〆/々/仝/〃/ゞ/ゝ/ヾ/ヽ/_/ ̄/^/¨/`/´/゜/゛/!/?/;/:/・/./,/。/、/♪/ きごうしょり /記号処理/ きごうれつ /記号列/ きごうろんりがく /記号論理学/ きさい /記載/ きさいs /記載/ きさま /貴様/ きざい /機材/ きし /岸/ きしゃ /気車/ きしゅ /機種/ きしょうてんけつ /起承転/ きしょく /気色/ きじ /記事/ きじすう /記事数/ きじせんたく /記事選択/ きじつ /期日/ きじゅつ /記述/ きじゅん /基準/ きすう /奇数/ きず /傷/ きずt /傷/ きせい /帰省/既成/ きせき /奇跡/ きせつ /季節/ きそ /基礎/起訴/ きそu /競/ きそく /規則/ きそけんきゅう /基礎研究/ きそけんきゅうしょ /基礎研究所/ きそけんきゅうぶ /基礎研究部/ きそりろん /基礎理論/ きそろん /基礎論/ きそん /既存/ きぞく /帰属/ きぞん /既存/ きた /北/ きたn /汚/ きたい /期待/ きたかぜ /北風/ きたく /帰宅/ きたはら /北原/ きたむら /北村/ きち /吉/基地/ きちゃく /帰着/ きちょう /貴重/ きっさ /喫茶/ きって /切手/ きっぷ /切符/ きつ /詰/橘/桔/喫/吃/吉/ きづi /気付/ きづk /気付/ きてい /規定/ きど /城戸/ きどr /気取/ きどう /起動/ きなが /気長/ きにゅう /記入/ きぬた /砧/ きね /杵/ きねん /記念/ きねんかい /記念会/ きねんび /記念日/ きのう /機能/昨日/帰納/ きのうかん /機能間/ きのうてき /帰納的/ きのうてきていぎ /帰納的定義/ きのうほう /帰納法/ きのした /木下/ きば /牙/木場/ きばん /基盤/ きび /黍/ きびs /厳/ きびき /忌引/ きふ /寄付/ きふきん /寄付金/ きぶん /気分/ きほう /記法/ きほん /基本/ きほんがた /基本型/ きほんきごうれつ /基本記号列/ きほんきのう /基本機能/ きほんしき /基本式/ きほんてき /基本的/ きぼ /規模/ きぼう /希望/ きぼうしゃ /希望者/ きまつ /期末/ きみ /君/気味/ きみとし /公稔/ きみょう /奇妙/ きむら /木村/ きもt /気持/ きもち /気持/ きゃく /客/脚/却/ きゃくいん /客員/ きゃくほん /脚本/ きゃしゃ /華奢/ きゃっかん /客観/ きやく /規約/ きゅう /久/吸/急/泣/救/休/及/求/旧/給/糾/級/笈/窮/究/球/灸/汲/朽/弓/宮/仇/丘/九/ きゅうs /窮/ きゅういん /吸引/ きゅうがた /旧型/ きゅうきゅう /救急/ きゅうきゅうしゃ /救急車/ きゅうきょく /究極/ きゅうぎょう /休業/ きゅうけい /休憩/ きゅうけいじょ /休憩所/ きゅうげき /急激/ きゅうこう /急行/休講/ きゅうし /給紙/ きゅうしゅう /九州/吸収/ きゅうしゅうだい /九州大/ きゅうしゅうだいがく /九州大学/ きゅうじつ /休日/ きゅうじょう /球場/ きゅうじん /求人/ きゅうじんこうこく /求人広告/ きゅうせい /旧姓/ きゅうそく /急速/ きゅうだい /九大/ きゅうびん /急便/ きゅうむ /急務/ きゅうめい /及明/ きゅうめん /球面/ きゅうよう /休養/ きゅうりょう /給料/ きょ /居/去/距/許/虚/渠/挙/拠/拒/巨/ きょう /今日/京/強/狭/橋/鏡/胸/共/香/狂/経/叫/教/驚/饗/響/郷/蕎/興/脅/矯/況/挟/恭/恐/怯/彊/峡/境/喬/卿/匡/協/凶/競/兇/僑/侠/供/享/亨/ きょうh /今日/ きょうあく /凶悪/ きょういく /教育/ きょういくしゃ /教育者/ きょういくてき /教育的/ きょうか /強化/ きょうかい /境界/協会/教会/ きょうかいめん /境界面/ きょうかしょ /教科書/ きょうかつ /恐喝/ きょうかん /教官/共感/ きょうき /凶器/ きょうきゅう /供給/ きょうぎ /協議/ きょうくん /教訓/ きょうこ /響子/ きょうこう /恐慌/ きょうごう /競合/ きょうさい /共済/ きょうざい /教材/ きょうし /教師/ きょうしつ /教室/ きょうしゅく /恐縮/ きょうじ /恭司/教示/ きょうじゃく /強弱/ きょうじゅ /教授/ きょうじゅしつ /教授室/ きょうじん /強靭/ きょうせい /強制/ きょうせいてき /強制的/ きょうそう /競争/ きょうそうきょく /協奏曲/ きょうぞん /共存/ きょうだい /京大/兄弟/兄妹/ きょうちょう /強調/協調/ きょうちょうせい /協調性/ きょうつう /共通/ きょうつういちじ /共通一次/ きょうてん /経典/ きょうと /京都/ きょうとう /教頭/ きょうとしょう /京都賞/ きょうとだいがく /京都大学/ きょうど /強度/ きょうどう /協同/共同/ きょうふ /恐怖/ きょうへん /共編/ きょうぼう /凶暴/ きょうみ /興味/ きょうむ /教務/ きょうゆう /共有/ きょうよう /教養/共用/ きょうようがくぶ /教養学部/ きょうようぶ /教養部/ きょうりつ /共立/ きょうりょく /協力/強力/ きょうれつ /強烈/ きょうわ /協和/ きょか /許可/ きょく /曲/局/極/ きょくいん /局員/ きょくしょうち /極小値/ きょくせつ /曲折/ きょくせん /曲線/ きょくたん /極端/ きょくち /極値/ きょくちょう /局長/ きょくばん /局番/ きょくめい /曲名/ きょくめん /曲面/局面/ きょくもく /曲目/ きょくりつ /曲率/ きょくりょく /極力/ きょしつ /居室/ きょしょ /拠所/ きょじゅかい /教授会/ きょじん /巨人/ きょせい /虚勢/ きょぞう /巨象/ きょだい /巨大/ きょねん /去年/ きょひ /拒否/ きょよう /許容/ きょり /距離/ きよ /清/ きよi /清/ きよう /器用/ きよし /清/ きよみず /清水/ きらi /嫌/ きらt /嫌/ きらu /嫌/ きらw /嫌/ きらく /気楽/ きり /桐/切/ きりすときょう /基督教/ きりとr /切取/ きりとりせん /切取り線/ きりはなs /切離/ きりゅう /桐生/ きれい /綺麗/ きろく /記録/ きろめーとる /粁/ きわ /際/ きわm /極/ きん /今/近/金/筋/謹/襟/衿/菌/芹/緊/禽/禁/琴/欽/欣/斤/錦/巾/均/勤/僅/ きんがく /金額/ きんきゅう /緊急/ きんきょう /近況/ きんけん /金券/ きんこ /金庫/ きんざん /金山/ きんし /禁止/ きんしつ /均質/ きんしょう /金賞/ きんじ /近似/ きんじょ /近所/ きんせん /金銭/ きんぞく /金属/ きんだい /近代/ きんちょう /緊張/ きんちょうs /緊張/ きんてつ /近鉄/ きんにく /筋肉/ きんねん /近年/ きんぱく /金箔/ きんぼう /近傍/ きんむ /勤務/ きんよう /金曜/ きんようび /金曜日/ きんりん /近隣/ ぎ /技/疑/議/誼/蟻/義/祇/犠/欺/擬/戯/宜/妓/儀/偽/城/木/ ぎし /技師/ ぎじ /議事/擬似/ ぎじへんすう /擬似変数/ ぎじゅく /義塾/ ぎじゅつ /技術/ ぎじゅつしゃ /技術者/ ぎじゅつてき /技術的/ ぎじゅつぶ /技術/ ぎじゅつほんぶ /技術本部/ ぎじろく /議事録/ ぎせい /儀牲/ ぎせいしゃ /儀牲者/ ぎだい /議題/ ぎちょう /議長/ ぎふ /岐阜/ ぎほう /技法/ ぎみ /気味/ ぎむ /義務/ ぎもん /疑問/ ぎもんし /疑問視/ ぎもんてん /疑問点/ ぎゃく /逆/虐/ ぎゃくかんすう /逆関数/ ぎゃくしゅう /逆襲/ ぎゃくじょう /逆上/ ぎゃくじょうs /逆上/ ぎゃくもどr /逆戻/ ぎゃっこう /逆行/ ぎゃっこうs /逆行/ ぎゅう /牛/ ぎゅうにゅう /牛乳/ ぎょ /魚/御/禦/漁/ ぎょう /行/仰/業/暁/尭/凝/ ぎょうかい /業界/ ぎょうしゃ /業者/ ぎょうすう /行数/ ぎょうせき /業績/ ぎょうむ /業務/ ぎょうめ /行目/ ぎょうれつ /行列/ ぎょく /玉/ ぎょらい /魚雷/ ぎれい /儀礼/ ぎろん /議論/ ぎん /銀/吟/ ぎんが /銀河/ ぎんがけい /銀河系/ ぎんがちず /銀河地図/ ぎんこう /銀行/ ぎんざ /銀座/ く /口/苦/工/駒/駈/駆/躯/矩/玖/狗/区/句/倶/九/久/ くe /喰/食/ くi /食/喰/悔/ くm /組/ くn /組/ くr /来/繰/暮/ くt /食/喰/ くu /食/喰/ くw /食/喰/ くう /空/ くうかん /空間/ くうかんちゅう /空間中/ くうき /空気/ くうきょ /空虚/ くうこう /空港/ くうしゅうごう /空集合/ くうせき /空席/ くうちょう /空調/ くうはく /空白/ くうれつ /空列/ くかく /区画/ くかん /区間/ くぎr /区切/ くぎt /区切/ くぎり /区切/ くけい /矩形/ くさ /草/ くさか /久坂/ くし /釧/櫛/串/駆使/ くしん /苦心/ くじょう /苦情/ くじら /鯨/ くす /楠/ くすのき /楠/ くすり /薬/ くず /屑/ くずr /崩/ くそ /糞/ くだ /菅/ くだk /砕/ くだr /下/ くだs /下/ くだん /九段/ くち /口/ くちぐち /口々/ くちびる /唇/ くちぶえ /口笛/ くちゃ /苦茶/ くちょう /口調/ くっせつ /屈折/ くつ /靴/掘/沓/窟/屈/ くつう /苦痛/ くつがえs /覆/ くつわ /轡/ くとうてん /句読点/ くどう /工藤/ くどうりん /駆動輪/ くに /国/邦/國/ くにあき /国昭/ くによし /国吉/ くばr /配/ くばt /配/ くび /首/ くふう /工夫/ くぶん /区分/ くべつ /区別/ くぼ /窪/久保/ くぼた /久保田/ くま /熊/隈/ くまがい /熊谷/ くまがや /熊谷/ くまもと /熊本/ くみ /組/ くみあw /組合/ くみあい /組合/ くみこ /久美子/ くみこm /組込/ くみとr /汲み取/ くめ /粂/ くも /雲/ くもr /曇/ くもり /曇/ くやm /悔/ くら /蔵/倉/ くらb /比/較/ くらi /暗/ くらk /暗/ くらt /食/ くらい /位/ くらしき /倉敷/ くらぶ /倶楽部/ くり /繰/栗/ くりあw /繰り合/ くるi /狂/ くるs /苦/ くるt /狂/ くるu /狂/ くるま /車/ くれない /紅/ くろ /黒/ くろう /苦労/ くろかみ /黒髪/ くろかわ /黒川/ くろご /黒子/ くろさか /黒坂/ くろぼし /黒星/ くろまつ /黒松/ くろまる /黒丸/●/ くわ /鍬/桑/ くわe /加/ くわs /詳/ くわw /加/ くわはら /桑原/ くん /君/董/訓/薫/勲/ くんれいしき /訓令式/ くんれん /訓練/ ぐ /虞/愚/具/倶/ ぐあい /具合/ ぐう /隅/遇/寓/偶/宮/ ぐうき /偶奇/ ぐうきせい /偶奇性/ ぐうぜん /偶然/ ぐしょう /具象化/ ぐしょうか /具象化/ ぐたい /具体/ ぐたいてき /具体的/ ぐたいれい /具体例/ ぐち /愚痴/ ぐのう /愚能/ ぐび /具備/ ぐみ /組/ ぐらい /位/ ぐん /群/郡/軍/ ぐんじ /郡司/ ぐんたい /軍隊/ ぐんま /群馬/ け /化/家/怪/祁/袈/卦/毛/ けr /蹴/ けs /消/決/ けt /蹴/ けい /形/型/系/兄/計/継/恵/軽/経/傾/鶏/頚/警/詣/蛍/荊/茎/罫/繋/稽/畦/渓/桂/景/敬/携/掲/憩/慧/慶/径/契/珪/圭/啓/刑/係/掛/痙/ けいい /敬意/経緯/ けいえい /経営/ けいえいs /経営/ けいおう /慶應/慶応/ けいおうだい /慶応大/ けいか /経過/ けいかい /警戒/ けいかく /計画/ けいかん /警官/ けいぐ /敬具/ けいけん /経験/ けいげん /軽減/ けいこう /傾向/ けいこく /警告/ けいこくs /警告/ けいさい /掲載/ けいさつ /警察/ けいさん /計算/ けいさんき /計算機/ けいさんきかがく /計算機科学/ けいさんきしつ /計算機室/ けいさんきそく /計算規則/ けいさんけっか /計算結果/ けいさんほう /計算法/ けいさんほうほう /計算方法/ けいさんりょう /計算量/ けいざい /経済/ けいしき /形式/ けいしきか /形式化/ けいしきてき /形式的/ けいしゃ /傾斜/ けいしょう /継承/敬称/ けいじ /刑事/掲示/計時/ けいじどうしゃ /軽自動車/ けいじばん /掲示板/ けいじゅ /圭樹/ けいじょう /形状/ けいすう /係数/ けいせい /形成/ けいせき /形跡/ けいせん /罫線/┴/┤/┼/┘/┬/├/└/┐/┌/│/─/━/┃/┏/┓/┛/┗/┣/┳/┫/┻/╋/┠/┯/┨/┷/┿/┝/┰/┥/┸/╂/ けいそう /軽装/ けいそく /計測/ けいぞう /敬三/ けいぞく /継続/ けいぞくてき /継続的/ けいたい /形態/ けいだい /慶大/ けいとう /系統/ けいとうてき /系統的/ けいひ /経費/ けいひん /京浜/ けいもう /啓蒙/ けいやく /契約/ けいやくしょ /契約書/ けいゆ /経由/ けいよう /京葉/ けいり /経理/ けいりょう /計量/ けいりょうてき /計量的/ けいれき /経歴/ けいれつ /系列/ けいれん /痙攣/ けいろ /経路/ けが /怪我/ けさ /今朝/ けしき /景色/ けしょう /化粧/ けしょうばこ /化粧箱/ けしん /化身/仮身/ けずr /削/ けずt /削/ けた /桁/ けっs /決/ けっか /結果/ けっかん /血管/ けっきょく /結局/ けっこう /結構/ けっこん /結婚/ けっこんしき /結婚式/ けっさく /傑作/ けっしん /決心/ けっせき /欠席/ けっせきにっすう /欠席日数/ けっそん /欠損/ けっちゃく /結着/ けってい /決定/ けってん /欠点/ けっぱく /潔白/ けつ /穴/決/結/訣/血/潔/欠/傑/ けつあつ /血圧/ けつご /結語/ けつごう /結合/ けつごうほうそく /結合法則/ けつじょ /欠如/ けつろん /結論/ けはい /気配/ けみがわ /検見川/ けむ /煙/ けむり /煙/ けもの /獣/ けん /見/間/件/研/肩/犬/嫌/鍵/権/鹸/験/顕/険/遣/軒/賢/謙/県/絹/硯/献/牽/検/捲/拳/懸/憲/建/堅/圏/喧/剣/券/兼/健/倦/倹/樫/筧/ けんあん /懸案/ けんい /権威/ けんいち /健一/ けんか /喧嘩/ けんかい /見解/ けんかじょうず /喧嘩上手/ けんがく /見学/ けんきゅう /研究/ けんきゅういん /研究員/ けんきゅうか /研究科/ けんきゅうかい /研究会/ けんきゅうしつ /研究室/ けんきゅうしゃ /研究者/ けんきゅうしゅうかい /研究集会/ けんきゅうしょ /研究所/ けんきゅうじょ /研究所/ けんきゅうひ /研究費/ けんきゅじょ /研究所/ けんげん /権限/ けんこう /健康/ けんこうしんだん /健康診断/ けんさ /検査/ けんさく /検索/ けんし /犬歯/ けんしゅう /研修/ けんしゅうせい /研修生/ けんしゅつ /検出/ けんしょう /検証/ けんしょうけい /検証系/ けんじ /健二/ けんじょうご /謙譲語/ けんせつ /建設/ けんせつてき /建設的/ けんそう /喧噪/ けんぞうぶつ /建造物/ けんたろう /健太郎/ けんち /検知/見地/ けんちく /建築/ けんちょ /顕著/ けんとう /検討/見当/ けんとうs /検討/ けんとうちゅう /検討中/ けんない /県内/ けんにん /兼任/ けんびきょう /顕微鏡/ けんぶつ /見物/ けんみん /県民/ けんむ /兼務/ けんめい /懸命/賢明/ けんり /権利/ けんろん /圏論/ げ /下/外/ げい /鯨/迎/芸/猊/ げいいん /原因/ げいか /猊下/ げいじゅつ /芸術/ げき /激/隙/撃/戟/劇/ げきじょう /劇場/ げきてき /劇的/ げきとつ /激突/ げきは /撃破/ げしゃ /下車/ げしゅく /下宿/ げじゅん /下旬/ げっかん /月刊/ げっこう /月光/ げっぽ /月歩/ げつ /月/ げつよう /月曜/ げつようび /月曜日/ げん /言/元/現/原/限/諺/舷/絃/玄/源/減/弦/幻/厳/ げんz /減/ げんあん /原案/ げんいん /原因/ げんいんふめい /原因不明/ げんかい /限界/ げんき /元気/ げんきゅう /言及/ げんきょう /元凶/ げんきん /現金/ げんこう /原稿/現行/ げんご /言語/ げんさく /原作/ げんざい /現在/ げんざいいち /現在位置/ げんし /原子/ げんしかく /原子核/ げんしゅ /厳守/ げんしょ /原書/ げんしょう /現象/減少/ げんしりょく /原子力/ げんじつ /現実/ げんじつてき /現実的/ げんじてん /現時点/ げんじゅう /厳重/ げんじょう /現状/現場/ げんそく /原則/ げんぞん /現存/ げんだい /現代/ げんち /現地/ げんちょ /原著/ げんてい /限定/ げんてん /原点/ げんど /限度/ げんば /現場/ げんぱつ /原発/ げんぶん /原文/ げんぺい /源平/ げんぽん /原本/ げんまい /玄米/ げんみつ /厳密/ げんり /原理/ げんりてき /原理的/ げんりょう /限量/ こ /子/個/雇/鼓/顧/鈷/跨/誇/虎/菰/胡/股/袴/糊/狐/湖/枯/故/戸/弧/庫/己/孤/姑/固/呼/古/乎/小/琥/児/来/ こe /越/ こg /焦/ こi /濃/来/ こk /濃/ こm /込/混/ こn /込/来/ こr /来/懲/凝/ こs /越/漉/ こt /凝/ こu /乞/請/ こy /来/ こあみ /小網/ こい /恋/鯉/故意/ こいし /小石/ こいびと /恋人/ こう /行/後/広/口/好/項/横/光/向/考/香/高/更/慌/垢/溝/稿/工/公/降/構/厚/鴻/閤/鋼/砿/鉱/酵/郊/購/貢/講/衡/荒/航/膏/腔/肱/肯/耕/綱/絞/紘/紅/糠/硬/皇/甲/港/浩/洪/江/梗/校/杭/晃/昂/攻/控/拘/抗/恒/弘/康/庚/幸/巷/巧/宏/孝/孔/坑/喉/后/勾/効/功/倖/候/侯/佼/交/黄/廣/敲/剛/興/河/ こうz /高/ こうあん /考案/ こうい /行為/好意/ こういき /広域/ こういしょう /後遺症/ こういち /浩一/康一/孝一/ こううん /幸運/ こうえん /講演/公園/公演/ こうえんかい /講演会/ こうえんじ /高円寺/ こうか /効果/高架/工科/ こうかい /公開/後悔/高階/ こうかいろんり /高階論理/ こうかきかえ /項書換え/ こうかせんろ /高架線路/ こうかん /交換/ こうかんけい /項関係/ こうがい /梗概/ こうがく /工学/ こうがくか /工学科/ こうがくはかせ /工学博士/ こうがくぶ /工学部/ こうがっか /工学科/ こうき /後期/後記/ こうきしん /好奇心/ こうきち /厚吉/ こうきゅう /高級/ こうきょう /交響/公共/ こうきょうきょく /交響曲/ こうぎ /抗議/講義/ こうぎょう /興業/工業/ こうくう /航空/ こうぐ /工具/ こうけい /光景/ こうけいしゃ /後継者/ こうけん /貢献/ こうげき /攻撃/ こうこう /高校/航行/ こうこうせい /高校生/ こうこく /広告/ こうご /交互/ こうごう /皇后/ こうさ /交差/ こうさく /耕作/ こうさつ /考察/ こうざ /口座/講座/ こうざん /鉱山/ こうし /講師/格子/講士/ こうしき /公式/ こうしぎょらい /光子魚雷/ こうしつ /皇室/ こうしてん /格子点/ こうしゃ /後者/公社/校舎/ こうしゅう /講習/公衆/ こうしゅうかい /講習会/ こうしょう /交渉/ こうしん /更新/交信/ こうじ /麹/孝二/高次/工事/ こうじつ /口実/ こうじゅつ /後述/ こうじょう /工場/向上/ こうすいい /高水位/ こうすう /工数/ こうず /構図/ こうせい /構成/更生/後世/校正/恒星/ こうせいきそく /構成規則/ こうせいけい /恒星系/ こうせいし /構成子/ こうせいてき /構成的/ こうせいてきすうがく /構成的数学/ こうせいのう /高性能/ こうせいようそ /構成要素/ こうせん /高専/光線/ こうそう /高層/ こうそく /高速/拘束/ こうそくか /高速化/ こうぞう /構造/ こうぞうたい /構造体/ こうぞうてき /構造的/ こうた /小唄/ こうたい /交代/ こうだい /工大/ こうだんしゃ /講談社/ こうち /高知/ こうちく /構築/ こうちゃ /紅茶/ こうちょう /好調/校長/ こうちょうしつ /校長室/ こうつう /交通/ こうつうこうしゃ /交通公社/ こうつうひ /交通費/ こうつごう /好都合/ こうてい /肯定/高低/工程/ こうてん /交点/ こうでん /光電/ こうとう /高等/恒等/後頭/ こうとうく /江東区/ こうとうぶ /後頭部/ こうど /高度/ こうどう /行動/講堂/ こうどく /講読/ こうにゅう /購入/ こうの /河野/ こうはい /後輩/荒廃/ こうはく /工博/ こうはん /後半/ こうばい /公倍/ こうひ /校費/ こうひょう /公表/好評/講評/ こうふ /甲府/交付/ こうふく /幸福/ こうふし /甲府市/ こうぶん /構文/ こうぶんきそく /構文規則/ こうぶんし /高分子/ こうぶんろん /構文論/ こうへい /公平/ こうべ /頭/神戸/ こうほ /候補/ こうほう /広報/ こうほしゃ /候補者/ こうぼ /公募/ こうみょう /巧妙/ こうむ /公務/ こうむいん /公務員/ こうもく /項目/ こうや /荒野/ こうよう /紅葉/効用/ こうらくえん /後楽園/ こうり /公理/ こうりけい /公理系/ こうりつ /効率/ こうりつてき /効率的/ こうりゅう /交流/ こうりょ /考慮/ こうりょs /考慮/ こうりょう /荒涼/ こうろ /航路/ こえ /声/越/ こえt /超/ こおr /凍/ こおり /氷/ こがた /小型/ こきゅう /呼吸/ こきゅうおん /呼吸音/ こく /国/黒/鵠/酷/穀/告/刻/克/ こくおう /国王/ こくこうりつ /国公立/ こくご /国語/ こくごじてん /国語辞典/ こくさい /国際/ こくさいかいぎ /国際会議/ こくさいけん /国際研/ こくさいしょく /国際色/ こくてつ /国鉄/ こくどう /国道/ こくない /国内/ こくばん /黒板/ こくびゃく /黒白/ こくぶんちょう /国分町/ こくみん /国民/ こくりつ /国立/ ここ /個々/ ここち /心地/ こころ /心/ こころh /心/ こころm /試/ こころざし /志/ ここん /古今/ こごe /凍/ こごえ /小声/ こさめ /小雨/ こし /腰/ こしき /甑/ こしつ /個室/ こしょう /故障/ こしょうちゅう /故障中/ こじ /誇示/ こじs /誇示/ こじま /小島/児島/ こじん /個人/ こじんじょうほう /個人情報/ こじんてき /個人的/ こすう /個数/ こせい /個性/ こせき /戸籍/ こせきとうほん /戸籍謄本/ こぜに /小銭/ こたe /答/応/ こたえ /答/ こたつ /炬燵/ こたに /小谷/ こっか /)/】/]/ こつ /骨/惚/忽/ こてい /固定/ こていてき /固定的/ こと /事/琴/ ことn /異/ ことw /断/ ことがら /事柄/ ことごとk /尽/ ことし /今年/ ことなr /異/ ことば /言葉/ ことぶき /寿/ ことり /小鳥/ ことわr /断/ ことわt /断/ こども /子供/小人/ このm /好/ こはく /琥珀/ こはる /小春/ こばし /小橋/ こばやし /小林/ こぶし /拳/ こべつ /個別/ こま /細/駒/ こまk /細/ こまr /困/ こまt /困/ こまいぬ /狛/ こまごめ /駒込/ こまざわ /駒沢/ こまつ /小松/ こまつだ /小松田/ こまつばら /小松原/ こまば /駒場/ こまめ /細目/ こみ /込/ こむ /込/ こむら /古村/ こめ /米/ こもじ /小文字/ こもん /顧問/ こやま /小山/ こゆう /固有/個有/ こよみ /暦/ これ /此/ ころ /頃/ ころb /転/ ころg /転/ ころn /転/ ころs /殺/ こわg /怖/恐/ こわi /恐/怖/ こわk /恐/怖/ こわr /壊/ こわs /壊/ こわね /声音/ こん /今/金/混/根/魂/艮/紺/痕/梱/昆/昏/懇/恨/婚/墾/坤/困/琴/ こんかい /今回/ こんき /根気/ こんきょ /根拠/ こんげつ /今月/ こんげつごう /今月号/ こんげつちゅう /今月中/ こんげん /根源/ こんご /今後/ こんざい /混在/ こんざつ /混雑/ こんしゅう /今週/ こんしん /懇親/ こんじょう /根性/ こんせい /混成/ こんだんかい /懇談会/ こんど /今度/ こんどう /混同/ こんなん /困難/ こんにち /今日/ こんねん /今年/ こんねんど /今年度/ こんばん /今晩/ こんぽん /根本/ こんや /今夜/ こんらん /混乱/ こんわく /困惑/ ご /後/語/御/誤/醐/護/碁/瑚/檎/梧/悟/娯/吾/呉/午/伍/互/五/児/ ごあんない /御案内/ ごい /語彙/ ごいけん /御意見/ ごう /合/号/強/轟/豪/濠/拷/壕/劫/剛/郷/傲/ ごうい /合意/ ごういん /強引/ ごうかく /合格/ ごうかん /号館/ ごうけい /合計/ ごうしつ /号室/ ごうせい /合成/ ごうとう /強盗/ ごうどう /合同/ ごうまん /傲慢/ ごうりか /合理化/ ごうりゅう /合流/ ごえ /声/ ごかい /誤解/ ごかん /互換/ ごかんせい /互換性/ ごがく /語学/ ごく /獄/極/ ごくひ /極秘/ ごくろう /御苦労/ ごご /午後/ ごしゅっせき /御出席/ ごしょく /誤殖/ ごじつ /後日/ ごじゅん /語順/ ごじょ /互除/ ごじょげん /御助言/ ごぜん /午前/ ごぜんちゅう /午前中/ ごぞんz /御存/ ごぞんじ /御存知/ ごと /毎/ ごとう /後藤/ ごはん /御飯/ ごふく /五福/ ごぶさた /御無沙汰/ ごへんじ /御返事/ ごめいわく /御迷惑/ ごめん /御免/ ごよう /御用/ ごようぼう /御要望/ ごらん /御覧/ ごりょう /御陵/ ごろ /頃/語呂/ ごん /言/権/ ごんご /言語/ ごんごどうだん /言語道断/ さ /差/左/茶/裟/鎖/詐/砂/瑳/沙/査/嵯/唆/叉/佐/些/作/ さe /冴/ さg /下/ さi /咲/裂/ さk /避/咲/裂/ さm /覚/ さr /去/ さs /指/差/刺/ さt /去/ さい /際/最/歳/才/西/再/妻/載/裁/菜/細/斎/祭/砦/砕/犀/采/災/済/栽/採/彩/宰/塞/哉/催/債/差異/齋/ さいあく /最悪/ さいかい /最下位/再開/ さいがい /災害/ さいき /再帰/ さいきてき /再帰的/ さいきょう /最強/ さいきん /最近/細菌/ さいく /細工/ さいけん /再見/ さいけんさ /再検査/ さいげん /再現/ さいこう /最高/再考/ さいこうせい /再構成/ さいご /最後/ さいさく /製作所/ さいしゅう /最終/ さいしゅうかい /最終回/ さいしゅうてき /最終的/ さいしょ /最初/ さいしょう /最少/最小/ さいしょうかもんだい /最小化問題/ さいしょうげん /最小限/ さいしょうこうばいすう /最小公倍数/ さいしょうち /最小値/ さいしょく /彩色/ さいしん /最新/細心/ さいしんえい /最新鋭/ さいしんばん /最新版/ さいじつ /祭日/ さいじょう /西条/ さいじょうい /最上位/ さいせい /再生/ さいせん /細線/ さいせんか /細線化/ さいぜん /最善/ さいそう /再送/ さいそく /催促/ さいたま /埼玉/ さいたん /最短/ さいだい /最大/ さいだいげん /最大限/ さいだいち /最大値/ さいちゅう /最中/ さいてい /最低/ さいていげん /最低限/ さいてき /最適/最的/ さいてきか /最適化/ さいてん /採点/ さいとう /斉藤/斎藤/齋藤/ さいど /再度/ さいはいふ /再配布/ さいはつ /再発/ さいふ /財布/ さいぶ /細部/ さいぶん /細分/ さいゆうせん /最優先/ さいよう /採用/ さいりょう /最良/ さいりよう /再利用/ さいわi /幸/ さか /酒/坂/阪/ さかn /盛/ さかr /盛/ さかい /堺/境/酒井/坂井/ さかえ /栄/ さかお /阪尾/ さかき /榊/ さかきばら /榊原/ さかさ /逆/ さかた /坂田/ さかな /魚/肴/ さかむら /坂村/ さかもと /坂本/ さかや /酒屋/ さが /性/佐賀/ さがs /捜/探/ さがみはら /相模原/ さがわ /佐川/ さがわきゅうびん /佐川急便/ さき /先/碕/埼/崎/咲/嵜/ さきごろ /先頃/ さきほど /先程/ さきょう /左京/ さぎ /鷺/ さぎょう /作業/ さく /作/冊/錯/索/策/窄/柵/朔/昨/搾/咋/削/ さくいん /索引/ さくご /錯誤/ さくし /索師/作詩/ さくしゃ /作者/ さくじつ /昨日/ さくじょ /削除/ さくせい /作成/ さくせいしゃ /作成者/ さくせいび /作成日/ さくそう /錯綜/ さくねん /昨年/ さくばん /昨晩/ さくひん /作品/ さくふ /作譜/ さくふしゃ /作譜者/ さくま /佐久間/ さくや /昨夜/ さくら /桜/ さくらい /桜井/ さぐr /探/ さけ /酒/鮭/ さけb /叫/ さけn /叫/ さこ /迫/ さこう /酒匂/ ささ /笹/ ささe /支/ ささい /些細/ ささき /佐々木/ さしだしにん /差出人/ さじ /匙/ さずk /授/ さそi /誘/ さそt /誘/ さそu /誘/ さそw /誘/ さた /沙汰/ さだ /貞/ さだk /定/ さだm /定/ さだかた /定方/ さち /幸/ さっか /作家/ さっき /殺気/ さっきょく /作曲/ さっきん /殺菌/ さっそく /早速/ さっち /察知/ さっちs /察知/ さっぽろ /札幌/ さつ /札/冊/擦/薩/殺/撮/拶/察/刷/ さつき /皐/ さつたば /札束/ さと /里/智/ さとr /悟/ さとt /悟/ さとう /佐藤/砂糖/ さとし /聡/ さとる /達/ さどう /作動/ さどうちゅう /作動中/ さどく /査読/ さはんじ /茶飯事/ さば /鯖/ さばk /捌/ さび /錆/ さびs /寂/淋/ さぶん /差分/ さへん /左辺/ さほう /作法/ さま /様/ さまざま /様々/ さみs /淋/寂/ さむi /寒/ さむk /寒/ さむs /寒/ さむらい /士/ さめ /鮫/ さゆう /左右/ さゆうたいしょう /左右対称/ さよう /作用/ さら /更/皿/ さらn /更/ さらs /晒/ さらす /晒/ さる /猿/ さわ /澤/沢/ さわg /騒/ さわi /騒/ さわt /触/ さわだ /沢田/ さわむら /沢村/ さん /山/三/散/餐/酸/賛/讃/蚕/纂/算/産/珊/燦/桟/撒/惨/参/傘/ さんか /参加/ さんかい /三階/ さんかく /▽/ さんかしゃ /参加者/ さんがつ /三月/ さんぎょう /産業/ さんげんじゃや /三軒茶屋/ さんこう /参考/ さんこうしりょう /参考資料/ さんこうぶんけん /参考文献/ さんしゃ /三者/ さんしょう /参照/ さんじ /参事/ さんじゅうし /三銃士/ さんじゅつ /算術/ さんすう /算数/ さんせい /賛成/ さんちょう /山頂/ さんにゅう /参入/ さんにんぐみ /三人組/ さんねん /三年/ さんのう /山王/ さんばんちょう /三番町/ さんぱく /三拍/ さんぱつ /散髪/散発/ さんぶ /三部/ さんぷ /算譜/ さんぽ /散歩/ さんぽう /算法/ さんめい /三名/ さんよ /参与/ さんりく /三陸/ ざ /座/挫/坐/ ざい /財/在/罪/材/剤/済/ ざいがく /在学/ ざいけい /財形/ ざいこ /在庫/ ざいさん /財産/ ざいしょく /在職/ ざいせき /在籍/ ざいせきs /在籍/ ざいだん /財団/ ざいだんほうじん /財団法人/ ざいむ /財務/ ざいりょう /材料/ ざき /崎/ ざた /沙汰/ ざちょう /座長/ ざっし /雑誌/ ざっそう /雑草/ ざっとう /雑踏/ ざっぱ /雑破/ ざつ /雑/ ざつおん /雑音/ ざつよう /雑用/ ざひょう /座標/ ざひょうけい /座標系/ ざひょうへんかん /座標変換/ ざわ /沢/ ざん /残/暫/斬/ ざんがい /残骸/ ざんがく /残額/ ざんぎょう /残業/ ざんしょ /残暑/ ざんだんすう /残弾数/ ざんてい /暫定/ ざんねん /残念/ ざんりょう /残量/ し /私/子/氏/指/紙/覗/使/誌/死/旨/姿/姉/伺/至/師/歯/止/試/飼/雌/賜/資/諮/詩/詞/視/脂/肢/紫/糸/祉/獅/枝/施/斯/孜/支/思/志/市/屍/始/士/四/嗣/史/司/刺/仔/仕/岐/知/ しi /強/ しk /敷/ しm /締/占/閉/ しn /死/ しr /知/ しt /知/ しあg /仕上/ しあい /試合/ しあげ /仕上/ しあわs /幸/ しあん /思案/試案/ しい /椎/ しいな /椎名/ しいの /椎野/ しいん /子音/ しえん /支援/ しえんけい /支援系/ しお /汐/塩/潮/ しおかぜ /汐風/潮風/ しおた /塩田/ しか /鹿/歯科/ しかk /仕掛/ しかr /叱/ しかt /叱/ しかい /司会/ しかいしゃ /司会者/ しかく /資格/視覚/四角/■/□/ しかくi /四角/ しかけ /仕掛/ しかた /仕方/ しがい /市外/ しがくぶ /歯学部/ しがん /志願/ しき /色/式/拭/識/指揮/敷/ しきじょう /式場/ しきべつ /識別/ しきべつし /識別子/ しきゅう /至急/支給/ しぎ /鴫/ しくm /仕組/ しけん /試験/私見/ しげ /滋/茂/重/ しげき /滋樹/茂樹/刺激/ しげる /茂/滋/ しげん /資源/ しこう /指向/思考/施行/ しこく /四国/ しご /死後/ しごと /仕事/ しさく /試作/ しさつ /視察/ しさん /資産/ しさんか /資産家/ ししつ /資質/ ししゃ /支社/死者/ ししょ /支所/ ししょう /支障/ ししょばこ /私書箱/ ししん /私信/指針/ しじ /指示/支持/ しじょう /市上/ しじょうさいきょう /史上最強/ しじん /詩人/ しすう /指数/ しず /静/ しずk /静/ しずm /沈/ しずn /沈/ しずお /静雄/ しずおか /静岡/ しずおかだい /静岡大/ しずおかだいがく /静岡大学/ しずか /静香/ しずく /雫/ しずや /静谷/ しせい /姿勢/ しせつ /施設/ しぜん /自然/ しぜんえんえきたいけい /自然演繹体系/ しぜんすう /自然数/ しぜんすうしき /自然数式/ しそう /思想/ しそく /四則/ した /下/舌/↓/ したs /親/ したい /死体/ したがe /従/ したがi /従/ したがt /従/ したがu /順/従/ したがw /従/ したたr /舌足/ したみ /下見/ しだい /次第/ しち /質/七/ しちょうかく /視聴覚/ しっぱい /失敗/ しっぴつ /執筆/ しつ /失/質/疾/漆/湿/悉/室/嫉/執/叱/ しつちょう /室長/ しつない /室内/ しつぼう /失望/ しつもん /質問/ しつもんしゃ /質問者/ しつれい /失礼/ しつれん /失恋/ してい /指定/ してき /指摘/私的/ してつ /私鉄/ してん /支店/始点/視点/ しとみ /蔀/ しどう /指導/ しどういん /指導員/ しどうきょうかん /指導教官/ しどうしゃ /指導者/ しな /品/支那/科/ しない /市内/ しながわ /品川/ しなもの /品物/ しなん /至難/ しの /篠/紫乃/ しのb /偲/ しのg /凌/ しのばず /不忍/ しはい /支配/ しはらi /支払/ しはらt /支払/ しはらu /支払/ しはらw /支払/ しば /芝/柴/ しばr /縛/ しばうら /芝浦/ しばこうえん /芝公園/ しばしば /屡/ しばた /柴田/ しばやま /柴山/ しひ /私費/ しぶ /渋/支部/ しぶi /渋/ しぶt /渋/ しぶや /渋谷/ しへい /紙幣/ しべ /蕊/ しほう /紫峰/ しほん /資本/ しぼr /絞/ しぼt /絞/ しぼう /死亡/脂肪/ しぼうさいぼう /脂肪細胞/ しま /縞/嶋/島/ しまい /姉妹/ しまうち /島内/ しまだ /島田/ しまね /島根/ しまむら /島村/ しみず /清水/ しめp /湿/ しめs /示/ しめい /氏名/ しめきr /締切/ しめきり /締切/ しも /下/霜/ しもきた /下北/ しもだ /下田/ しもだいら /下平/ しもて /下手/ しゃ /車/者/社/煮/写/斜/遮/謝/紗/赦/捨/射/舎/砂/ しゃいん /社員/ しゃかい /社会/ しゃがい /社外/ しゃきん /謝金/ しゃく /昔/錫/釈/酌/爵/灼/杓/尺/勺/借/ しゃくぜん /釈然/ しゃくぶく /折伏/ しゃくよう /借用/ しゃくようしょ /借用書/ しゃげき /射撃/ しゃしょう /車掌/捨象/ しゃしょく /写植/ しゃしん /写真/ しゃじ /謝辞/ しゃぞう /写像/ しゃだん /社団/ しゃちょう /社長/ しゃない /社内/ しゃべr /喋/ しゃべt /喋/ しゃりょう /車両/ しゃんはい /上海/ しゅ /手/主/種/修/首/酒/取/趣/腫/珠/狩/殊/朱/守/ しゅう /集/修/週/秋/祝/拾/習/醜/酬/酋/輯/蹴/讐/襲/衆/蒐/舟/臭/繍/終/秀/洲/愁/州/就/宗/周/収/囚/ しゅうい /修理/周囲/ しゅうえいしゃ /集英社/ しゅうかい /集会/ しゅうかん /週間/ しゅうきょう /宗教/ しゅうぎ /祝儀/ しゅうけい /集計/ しゅうけつ /終結/ しゅうごう /集合/ しゅうごうかた /集合型/ しゅうごうばしょ /集合場所/ しゅうごうろん /集合論/ しゅうし /修士/ しゅうしかてい /修士課程/ しゅうしゅう /収拾/収集/ しゅうしょく /就職/ しゅうしろんぶん /修士論文/ しゅうじつ /終日/ しゅうせい /修正/ しゅうせき /集積/ しゅうそく /収束/ しゅうだん /集団/ しゅうち /周知/ しゅうちゃく /執着/ しゅうちゅう /集中/ しゅうちゅうこうぎ /集中講義/ しゅうてん /終点/ しゅうとく /修得/ しゅうにゅう /収入/ しゅうねん /周年/執念/ しゅうのう /収納/ しゅうは /宗派/ しゅうはい /集配/ しゅうはすう /周波数/ しゅうふく /修復/ しゅうふくさぎょう /修復作業/ しゅうぶん /秋分/ しゅうへん /周辺/ しゅうへんきき /周辺機器/ しゅうへんそうち /周辺装置/ しゅうほう /週報/ しゅうまつ /週末/ しゅうもく /衆目/ しゅうやく /集約/ しゅうり /修理/ しゅうりちゅう /修理中/ しゅうりょう /終了/修了/ しゅうろく /収録/ しゅうろん /修論/ しゅうわ /秀和/ しゅかん /主幹/主管/ しゅきおく /主記憶/ しゅきおくそうち /主記憶装置/ しゅぎ /主義/ しゅぎょう /修行/ しゅく /宿/祝/粛/縮/淑/夙/叔/ しゅくが /祝賀/ しゅくしゃ /宿舎/ しゅくしょう /縮小/縮少/ しゅくだい /宿題/ しゅくはく /宿泊/ しゅくめい /宿命/ しゅご /主語/ しゅさ /主査/ しゅさい /主催/ しゅし /主旨/趣旨/ しゅしゃ /取捨/ しゅしゅ /種々/ しゅじ /主事/ しゅじんこう /主人公/ しゅせき /主席/ しゅたい /主体/ しゅだい /主題/ しゅだいか /主題歌/ しゅだん /手段/ しゅちょう /主張/ しゅっか /出荷/ しゅっきん /出勤/ しゅっけつ /出欠/ しゅっこう /出向/出航/ しゅっしゃ /出社/ しゅっしょ /出所/ しゅっしん /出身/ しゅっすい /出水/ しゅっせ /出世/ しゅっせい /出生/ しゅっせき /出席/ しゅったいきん /出退勤/ しゅっちょう /出張/ しゅっちょうちゅう /出張中/ しゅってん /出典/出展/ しゅっぱつ /出発/ しゅっぱつてん /出発点/ しゅっぱん /出版/ しゅっぱんしゃ /出版社/ しゅつ /出/ しゅつえん /出演/ しゅつえんしゃ /出演者/ しゅつがん /出願/ しゅつげん /出現/ しゅつげんいち /出現位置/ しゅつじょう /出場/ しゅつりょく /出力/ しゅつりょくほう /出力法/ しゅとく /取得/ しゅどう /手動/ しゅにん /主任/ しゅび /守備/ しゅふ /主婦/ しゅべつ /種別/ しゅほう /手法/ しゅみ /趣味/ しゅむ /主務/ しゅもく /種目/ しゅよう /主要/ しゅりゅう /主流/ しゅるい /種類/ しゅん /春/瞬/駿/舜/竣/峻/俊/旬/ しゅんかん /瞬間/ しゅんぶん /春分/ しょ /所/初/書/暑/諸/藷/薯/署/緒/庶/渚/曙/処/ しょう /上/松/少/章/性/勝/傷/正/尚/姓/称/小/消/笑/焼/鞘/障/鐘/鍾/鉦/醤/賞/象/詳/詔/証/訟/裳/衝/蕉/蒋/菖/肖/紹/粧/祥/礁/硝/省/症/照/焦/湘/渉/沼/樵/樟/梢/晶/昭/昌/昇/捷/掌/招/抄/承/彰/廠/床/庄/将/宵/娼/妾/奨/嘗/唱/商/哨/召/升/匠/償/生/漿/璋/ しょうj /生/ しょうs /称/ しょういち /正一/ しょううちゅう /小宇宙/ しょうかい /紹介/照会/ しょうがい /障害/生涯/渉外/傷害/ しょうがいぶつ /障害物/ しょうがく /小学/ しょうがくかん /小学館/ しょうがくきふきん /奨学寄付金/ しょうがくきん /奨学金/ しょうがくせい /小学生/ しょうがっこう /小学校/ しょうがつ /正月/ しょうきぼ /小規模/ しょうきょ /消去/ しょうきょく /消極/ しょうぎょう /商業/ しょうぎょうてき /商業的/ しょうぎょうもくてき /商業目的/ しょうけん /証券/ しょうげき /衝撃/ しょうこ /証拠/ しょうこう /商工/ しょうこうし /小公子/ しょうこうもく /小項目/ しょうご /正午/ しょうごう /照合/ しょうさい /詳細/ しょうしゅう /召集/ しょうしょう /少々/ しょうじ /商事/ しょうじき /正直/ しょうじょ /少女/ しょうじょう /症状/ しょうすう /小数/ しょうせつ /小説/小節/ しょうたい /招待/正体/ しょうだく /承諾/ しょうだくしょ /承諾書/ しょうち /承知/ しょうちょう /象徴/ しょうちょうてき /象徴的/ しょうてん /商店/焦点/ しょうとくてき /生得的/ しょうとつ /衝突/ しょうどう /衝動/ しょうなり /≦/ しょうにん /承認/証人/ しょうねん /少年/ しょうねんひこう /少年非行/ しょうばい /商売/ しょうひ /消費/ しょうひしゃ /消費者/ しょうひょう /商標/ しょうひょうけん /商標権/ しょうひん /商品/賞品/小品/ しょうひんめい /商品名/ しょうぶ /勝負/ しょうめい /証明/ しょうめいしょ /証明書/ しょうめいず /証明図/ しょうめいろん /証明論/ しょうめつ /消滅/ しょうもう /消耗/ しょうもうひん /消耗品/ しょうよう /商用/ しょうらい /将来/ しょうりゃく /省略/ しょうりょう /少量/ しょうれい /奨励/ しょうわ /昭和/ しょき /初期/書記/ しょきか /初期化/ しょきけい /初期型/ しょきち /初期値/ しょきゅう /初級/ しょく /色/燭/拭/食/蝕/触/職/織/殖/植/飾/埴/嘱/ しょくいん /職員/ しょくいんしつ /職員室/ しょくぎょう /職業/ しょくぎょうがら /職業柄/ しょくじ /食事/ しょくどう /食堂/ しょくどうしゃ /食堂車/ しょくば /職場/ しょくひん /食品/ しょくぶつ /植物/ しょくみん /植民/ しょくみんせい /植民星/ しょくみんち /植民地/ しょくよく /食欲/ しょくん /諸君/ しょぐう /処遇/ しょけん /所見/ しょこく /諸国/ しょしき /書式/ しょしんしゃ /初心者/ しょじ /所持/ しょじs /所持/ しょじゅん /初旬/ しょせき /書籍/ しょぞく /所属/ しょたいめん /初対面/ しょだな /書棚/ しょち /処置/ しょちょう /所長/ しょっき /食器/ しょてん /書店/ しょとうてき /初等的/ しょとうてきろんりしき /初等的論理式/ しょない /所内/ しょにち /初日/ しょはん /初版/ しょほ /初歩/ しょほてき /初歩的/ しょぼう /書房/ しょむ /庶務/ しょむかかり /庶務掛/ しょめい /署名/書名/ しょゆう /所有/ しょり /処理/ しょりけい /処理系/ しょりそうち /処理装置/ しょりちゅう /処理中/ しょりほうしき /処理方式/ しょるい /書類/ しよう /使用/仕様/私用/ しようs /使用/ しようご /使用後/ しようしゃ /使用者/ しようしょ /仕様書/ しようちゅう /使用中/ しようほう /使用法/ しようれい /使用例/ しらb /調/ しらい /白井/ しらかわ /白川/ しらゆり /白百合/ しり /尻/ しりつ /私立/ しりつちゅうがく /私立中学/ しりょ /思慮/ しりょう /資料/ しりょく /視力/ しるs /記/ しるし /印/ しれい /指令/ しろ /城/白/ しろi /白/ しろk /白/ しろうと /素人/ しろぼし /白星/ しろまる /白丸/〇/ しろもの /代物/ しわく /思惑/ しわす /師走/ しん /心/新/真/親/身/神/伸/森/寝/辛/辰/進/信/震/針/診/薪/芯/臣/紳/秦/疹/申/深/浸/榛/晋/振/慎/審/娠/唇/侵/清/眞/ しんj /信/ しんz /信/ しんいち /伸一/真一/ しんか /進化/ しんかん /新館/ しんかんせん /新幹線/ しんがい /侵害/ しんがく /進学/ しんがくぎほう /信学技報/ しんがくろん /信学論/ しんき /新規/ しんきょく /新曲/ しんぎ /審議/ しんくうでんし /真空電子/ しんけい /神経/ しんけいけい /神経系/ しんけいしつ /神経質/ しんけいじょうほうしょり /神経情報処理/ しんけん /真剣/ しんこう /進行/振興/信仰/ しんこうかい /振興会/ しんこうちゅう /進行中/ しんこうべ /新神戸/ しんこく /深酷/ しんご /伸吾/ しんごう /信号/ しんさ /審査/ しんさく /新作/ しんさつ /診察/ しんざん /新参/ しんしゃ /新車/ しんしゅう /信州/ しんしゅつ /新出/進出/ しんしょ /新書/ しんじつ /真実/ しんじゅく /新宿/ しんじゅくく /新宿区/ しんじん /新人/ しんすう /進数/ しんせい /申請/新星/ しんせいしょ /申請書/ しんせいひん /新製品/ しんせき /親戚/ しんせだい /新世代/ しんせつ /親切/新設/ しんせん /新鮮/ しんそう /真相/ しんたい /身体/ しんたく /信託/ しんたまがわせん /新玉川線/ しんだん /診断/ しんだんしょ /診断書/ しんちょう /慎重/ しんちょく /進捗/ しんてん /進展/親展/ しんとう /新棟/浸透/ しんにってつ /新日鉄/ しんにほんせいてつ /新日本製鉄/ しんにゅう /侵入/新入/ しんねん /信念/新年/ しんねんかい /新年会/ しんばし /新橋/ しんばんぐみ /新番組/ しんぱい /心配/ しんぴん /新品/ しんぶん /新聞/ しんぶんしゃ /新聞社/ しんぷく /振幅/ しんぼく /親睦/ しんぼくかい /親睦会/ しんぽ /進歩/ しんみつ /親密/ しんや /深夜/ しんよう /信用/ しんらい /信頼/ しんらいせい /信頼性/ しんり /真理/心理/ しんりかんすう /真理関数/ しんりがく /心理学/ しんりち /真理値/ しんりひょう /真理表/ しんろ /進路/ しんわ /神話/親和/新和/ しんわせい /親和性/ じ /時/次/事/字/二/耳/自/地/持/辞/蒔/而/示/磁/痔/璽/爾/治/滋/慈/寺/児/侍/似/子/除/路/ じあい /自愛/ じいしき /自意識/ じいん /寺院/ じえい /自衛/自営/ じえいそしき /自衛組織/ じかい /次回/磁界/ じかく /自覚/ じかん /時間/ じかんえいぎょう /時間営業/ じき /直/時期/磁気/次期/自棄/ じきあらし /磁気嵐/ じきてき /自棄的/ じきゅう /自給/時給/ じぎょう /事業/事行/ じぎょうぶ /事業部/ じぎょうほんぶ /事業本部/ じく /宍/軸/竺/ じけい /自警/ じけいだん /自警団/ じけん /事件/ じげん /次元/ じげんじょう /次元上/ じこ /事故/自己/ じこう /事項/時効/自校/ じこく /時刻/ じこし /事故死/ じこしゅうふく /自己修復/ じこしゅうふくきのう /自己修復機能/ じこしょうかい /自己紹介/ じご /事後/ じごう /次号/ じごく /地獄/ じさ /時差/ じさく /自作/ じさつ /自殺/ じさん /自参/ じしき /次式/ じしつ /自室/ じしゃ /自社/ じしゃく /磁石/ じしゅく /自粛/ じしょ /辞書/ じしょう /事象/次章/ じしょとうろく /辞書登録/ じしん /自身/自信/地震/ じじこくこく /時々刻々/ じじつ /事実/ じじつじょう /事実上/ じじょう /事情/ じせい /時制/自制/時世/ じせつ /次節/時節/ じぜん /事前/ じそう /時相/ じそく /自足/ じたい /自体/事態/辞退/字体/ じたく /自宅/ じだ /耳朶/ じだい /時代/ じちょう /次長/ じっか /実家/ じっかん /実感/ じっけん /実験/実権/ じっけんしつ /実験室/ じっこう /実行/実効/ じっこうちゅう /実行中/ じっさい /実際/ じっさいてき /実際的/ じっし /実施/ じっしゅう /実習/ じっしん /実身/ じっすう /実数/ じっせいかつ /実生活/ じっせかい /実世界/ じっせき /実績/ じっせん /実践/ じっそう /実装/ じっそく /実測/ じったい /実体/ じっぴ /実費/ じつ /日/実/ じつぎ /実技/ じつげん /実現/ じつげんか /実現化/ じつざい /実在/ じつざいろん /実在論/ じつじょう /実状/ じつぶつ /実物/ じつよう /実用/ じつようか /実用化/ じつようせい /実用性/ じつようてき /実用的/ じつれい /実例/ じてん /時点/辞典/ じてんd /時点/ じてんしゃ /自転車/ じどう /自動/ じどうか /自動化/ じどうしゃ /自動車/ じどうてき /自動的/ じどうはんばいき /自動販売機/ じはく /自白/ じはつ /自発/ じばく /自爆/ じひ /自費/ じふ /自負/ じぶん /自分/ じぶんかつ /時分割/ じぶんじしん /自分自身/ じぶんよう /自分用/ じま /島/ じまえ /自前/ じみ /地味/ じむ /事務/ じむきょく /事務局/ じむしつ /事務室/ じむしょ /事務所/ じむしょるい /事務書類/ じむてき /事務的/ じめい /自明/ じめん /地面/ じもと /地元/ じゃ /邪/蛇/ じゃく /寂/惹/弱/若/雀/ じゃけん /邪険/ じゃっかん /若干/ じゃどう /邪道/ じゃま /邪魔/ じゅ /受/需/綬/樹/授/寿/呪/儒/ じゅう /重/十/住/渋/銃/縦/獣/汁/柔/戎/従/充/什/中/ じゅうこう /重工/ じゅうし /重視/ じゅうしょ /住所/ じゅうしん /重心/ じゅうじ /従事/ じゅうじつ /充実/ じゅうせい /獣性/ じゅうたい /渋滞/ じゅうたく /住宅/ じゅうたくがい /住宅街/ じゅうだい /重大/ じゅうてん /重点/ じゅうどう /柔道/ じゅうなん /柔軟/ じゅうなんせい /柔軟性/ じゅうふく /重複/ じゅうぶん /十分/充分/ じゅうめん /渋面/ じゅうよう /重要/ じゅうらい /従来/ じゅうりょく /重力/ じゅぎょう /授業/ じゅく /熟/塾/ じゅくご /熟語/ じゅくれん /熟練/ じゅけん /受験/ じゅけんしゃ /受験者/ じゅこう /受講/ じゅこうせい /受講生/ じゅしょう /受賞/ じゅしょうしき /授賞式/ じゅしん /受信/受身/ じゅしんしゃ /受信者/ じゅじゅ /授受/ じゅたく /受託/ じゅちゅう /受注/ じゅつ /述/術/ じゅつご /述語/ じゅもん /呪文/ じゅよ /授与/ じゅよう /需要/ じゅり /受理/ じゅん /順/醇/遵/巡/純/盾/潤/準/淳/殉/楯/旬/循/准/ じゅんz /準/ じゅんい /順位/ じゅんいち /淳一/ じゅんかい /巡回/ じゅんかん /循環/ じゅんかんしょうすう /循環小数/ じゅんきょ /準拠/ じゅんぎょう /巡業/ じゅんこ /絢子/ じゅんじ /順次/ じゅんじょ /順序/ じゅんじょつい /順序対/ じゅんすい /純粋/ じゅんせい /純正/ じゅんせんもん /準専門/ じゅんちょう /順調/ じゅんどうけい /準同形/ じゅんどうけいしゃぞう /準同形写像/ じゅんばん /順番/ じゅんび /準備/ じゆう /自由/ じゆうど /自由度/ じゆうへんすう /自由変数/ じょ /女/如/除/鋤/恕/徐/序/叙/助/ じょう /上/生/場/常/定/成/条/城/状/情/乗/錠/醸/譲/蒸/穣/畳/浄/杖/擾/嬢/壌/剰/丞/丈/冗/條/ じょうい /上位/ じょうえい /上映/ じょうえつ /上越/ じょうき /上記/ じょうきょう /状況/ じょうきょういみろん /状況意味論/ じょうきょうりろん /状況理論/ じょうけん /条件/ じょうけんしき /条件式/ じょうけんぶ /条件部/ じょうげ /上下/ じょうげん /上限/ じょうざん /乗算/ じょうし /上司/ じょうしき /常識/ じょうしゃ /乗車/ じょうしゃけん /乗車券/ じょうじ /常時/ じょうじゅつ /上述/ じょうじゅん /上旬/ じょうず /上手/ じょうたい /状態/ じょうたいせんいず /状態遷移図/ じょうたん /上端/ じょうだん /冗談/ じょうち /上智/ じょうちょう /冗長/ じょうなん /城南/ じょうにん /常任/ じょうひん /上品/ じょうぶ /丈夫/ じょうほう /情報/ じょうほうか /情報科/ じょうほうかがく /情報科学/ じょうほうかがくか /情報科学科/ じょうほうかがっか /情報科学科/ じょうほうがく /情報学/ じょうほうきき /情報機器/ じょうほうけんさく /情報検索/ じょうほうこうかん /情報交換/ じょうほうこうがく /情報工学/ じょうほうこうがくか /情報工学科/ じょうほうこうがっか /情報工学科/ じょうほうしょり /情報処理/ じょうほうしょりがっかい /情報処理学会/ じょうほうりろん /情報理論/ じょうむ /常務/ じょうよ /剰余/ じょうりゅう /上流/ じょうれん /常連/ じょがい /除外/ じょきょ /除去/ じょきょうじゅ /助教授/ じょきょく /序曲/ じょく /辱/ じょげん /助言/ じょざん /除算/ じょし /女子/ じょしつ /除湿/ じょしつき /除湿機/ じょしゅ /助手/ じょしゅせき /助手席/ じょじょ /徐々/ じょせい /女性/助成/ じょぶん /序文/ じょゆう /女優/ じょりょく /助力/ じりき /自力/ じりゅう /自流/ じりょく /磁力/ じれい /事例/ じろう /二郎/ じん /人/尽/靭/陣/迅/訊/腎/甚/尋/壬/塵/刃/仁/神/臣/ じんいん /人員/ じんく /甚句/ じんこう /人工/ じんこうちのう /人工知能/ じんしゅ /人種/ じんじ /人事/ じんじゃ /神社/ じんせい /人生/ じんそく /迅速/ じんたい /人体/ じんとく /人徳/ じんぶつ /人物/ じんりょく /尽力/ す /酢/須/諏/笥/素/寿/洲/ すe /据/ すg /過/ すi /済/吸/ すk /好/ すm /済/住/澄/ すn /住/済/ すr /擦/摺/刷/ すt /捨/吸/ すu /吸/ すい /水/吹/錘/錐/酔/遂/衰/翠/粋/睡/炊/推/帥/垂/ すいい /推移/水位/ すいけい /水系/ すいこう /推敲/遂行/ すいしつ /水質/ すいしょう /推奨/ すいしん /推進/ すいしんねんりょう /推進燃料/ すいじゅん /水準/ すいず /水津/ すいせん /推薦/ すいそく /推測/ すいた /吹田/ すいちょく /垂直/ すいてい /推定/ すいてんぐう /水天宮/ すいとう /水筒/ すいどう /水道/ すいへい /水平/ すいま /睡魔/ すいみん /睡眠/ すいよう /水曜/ すいようえき /水溶液/ すいようび /水曜日/ すいり /推理/ すいりょう /水量/ すいりょく /水力/ すいろん /推論/ すいろんきそく /推論規則/ すう /数/雛/趨/枢/嵩/崇/ すうがく /数学/ すうがくか /数学科/ すうがくきょうしつ /数学教室/ すうがくてき /数学的/ すうがっか /数学科/ すうぎょう /数行/ すうこ /数個/ すうしゅうかん /数週間/ すうじ /数字/ すうじかん /数時間/ すうじつ /数日/ すうじゅう /数十/ すうだい /数台/ すうち /数値/ すうにん /数人/ すうねん /数年/ すうふん /数分/ すうぶつ /数物/ すうめい /数名/ すうり /数理/ すうりかいせき /数理解析/ すえ /末/ すえひろ /末広/ すが /菅/須賀/ すがた /姿/ すがの /菅野/ すき /隙/ すきま /隙間/ すぎ /椙/杉/ すぎなみ /杉並/ すぎなみく /杉並区/ すぎもと /杉本/ すぎやま /杉山/ すくi /救/ すくn /少/ すくw /救/ すぐ /直/ すぐr /優/ すけ /介/助/ すけっと /助っ人/助人/ すげ /菅/ すこs /少/ すこぶる /頗/ すごi /凄/ すごk /凄/ すごm /凄/ すごs /凄/過/ すじ /筋/ すすm /進/勧/薦/ すすn /進/ すすむ /晋/進/ すず /鈴/ すずs /涼/ すずか /鈴鹿/ すずき /鈴木/ すずめ /雀/ すそ /裾/ すだ /須田/ すてき /素敵/ すで /既/素手/ すでn /既/ すな /砂/ すなお /素直/ すなわc /即/ すなわt /即/ すばr /素晴/ すばやi /素早/ すばらs /素晴/ すべr /滑/ すべt /全/滑/ すべて /総/ すみ /墨/純/済/ すみとも /住友/ するが /駿河/ するがだい /駿河台/ するどi /鋭/ すわr /座/ すわt /座/ すん /寸/ すんぜん /寸前/ すんだい /駿台/ すんぴょう /寸評/ すんぽう /寸法/ ず /頭/逗/厨/図/津/ ずm /済/ ずい /髄/瑞/随/ ずいじ /随時/ ずいぶん /随分/ ずけい /図形/ ずけいもじ /図形文字/ ずし /図示/ ずしき /図式/ ずみ /済/ ずめ /詰/ ずめん /図面/ せ /世/背/瀬/畝/ せm /責/ せs /接/ せい /生/声/世/星/成/性/西/製/正/姓/青/勢/斉/静/醒/逝/請/誓/誠/聖/精/盛/牲/清/栖/棲/晴/整/政/征/制/凄/省/靖/ せいか /成果/ せいかい /正解/盛会/ せいかく /正確/性格/ せいかつ /生活/ せいかつたいど /生活態度/ せいかん /青函/ せいがん /請願/ せいき /世紀/精気/生起/正規/ せいきけい /正規形/ せいきこう /正規項/ せいきゅう /請求/ せいきゅうしょ /請求書/ せいきょ /逝去/ せいきょう /盛況/生協/ せいぎ /正義/ せいぎょ /制御/ せいぎょこうがく /制御工学/ せいぎょそうち /制御装置/ せいげん /制限/ せいこ /聖子/ せいこう /成功/ せいご /清吾/ せいごう /整合/ せいごうせい /整合性/ せいさく /製作/ せいさくしゃ /製作者/ せいさくしょ /製作所/ せいさん /生産/ せいし /正視/ せいしき /正式/ せいしつ /性質/ せいしゅん /青春/ せいしょ /成書/ せいしん /精神/ せいじ /政治/ せいじか /政治家/ せいじつ /誠実/ せいじょう /正常/成城/ せいじん /成人/ せいすう /整数/ せいせい /生成/ せいせいきそく /生成規則/ せいせいぶんぽう /生成文法/ せいせいほうほう /生成方法/ せいせき /成績/ せいそ /整礎/ せいぞう /製造/ せいたい /生態/ せいちょう /成長/ せいちょうs /成長/ せいてき /静的/ せいてつ /製鉄/ せいてん /晴天/ せいでんき /静電気/ せいと /生徒/ せいとう /正当/政党/ せいとうか /正当化/ せいとうせい /正当性/ せいとうぼうえい /正当防衛/ せいとくてき /生得的/ せいど /制度/精度/ せいねん /生年/青年/ せいねんがっぴ /生年月日/ せいのう /性能/ せいひ /正否/ せいひん /製品/ せいび /整備/ せいびし /整備士/ せいふ /政府/ せいぶ /西武/ せいぶつ /生物/ せいぶん /成分/ せいほう /正方/ せいほん /製本/ せいみつ /精密/ せいみつか /精密化/ せいめい /生命/ せいやく /制約/ せいよう /西洋/静養/ せいようけん /精養軒/ せいり /整理/ せいりつ /成立/ せいりょく /勢力/ せいれき /西暦/ せいれつ /整列/ せいれん /精錬/ せいろんりしき /正論理式/ せかい /世界/ せかいじゅう /世界中/ せかいてき /世界的/ せがみ /瀬上/ せがわ /瀬川/ せき /昔/積/席/夕/関/寂/碩/蹟/跡/赤/責/脊/績/籍/石/析/斥/戚/惜/隻/晰/ せきぐち /関口/ せきにん /責任/ せきにんしゃ /責任者/ せきぶん /積分/ せけん /世間/ せじ /世辞/ せすじ /背筋/ せた /瀬田/ せたがや /世田谷/ せたがやく /世田谷区/ せだい /世代/ せっかく /折角/ せっきょく /積極/ せっきょくてき /積極的/ せっきん /接近/ せっきんs /接近/ せっく /節句/ せっけい /設計/ せっし /℃/ せっしょう /折衝/ せっしょく /接触/ せっしょくs /接触/ せっち /設置/ せっちゅう /折衷/ せってい /設定/ せっとく /説得/ せつ /雪/説/節/切/設/折/窃/摂/接/拙/ せつお /節夫/ せつじょくせん /雪辱戦/ せつぞく /接続/ せつぞくかんけい /接続関係/ せつだん /切断/ せつど /節度/ せつなん /摂南/ せつび /設備/ せつめい /説明/ せつめいs /説明/ せつめいかい /説明会/ せつめいしょ /説明書/ せつやく /節約/ せつわ /説話/ せとおおはし /瀬戸大橋/ せびょうし /背表紙/ せびろ /背広/ せびろふう /背広風/ せまi /狭/ せまr /迫/ せまt /迫/ せみ /蝉/ せりふ /台詞/ せろん /世論/ せわ /世話/ せわにん /世話人/ せん /先/線/戦/繊/船/川/選/占/鮮/閃/銑/銭/遷/践/賎/詮/薦/舛/腺/羨/箭/穿/旋/煽/煎/潜/染/洗/浅/泉/栴/栓/撰/扇/尖/専/宣/千/仙/箋/ せんい /遷移/繊維/ せんが /線画/ せんきょく /選曲/ せんけい /線型/ せんけつごう /線結合/ せんげん /宣言/ せんこう /先行/選考/専攻/ せんざい /潜在/ せんしゅ /選手/ せんしゅう /先週/ せんしゅけん /選手権/ せんしん /先進/ せんじつ /先日/ せんじょう /線状/ せんせい /先生/ せんそう /戦争/ せんたく /選択/ せんたくし /選択肢/ せんだい /仙台/ せんだいし /仙台市/ せんちめーとる /糎/ せんちょう /線長/ せんちょうかいせき /線長解析/ せんてい /選定/ せんでん /宣伝/ せんとう /先頭/戦闘/銭湯/ せんにゅうかん /先入観/ せんにん /専任/ せんば /仙波/ せんぱい /先輩/ せんぱん /先般/ せんぷう /旋風/ せんべつ /選別/ せんぼく /泉北/ せんぽう /先方/ せんむ /専務/ せんもん /専門/ せんもんか /専門家/ せんゆう /占有/ せんよう /専用/ せんようかいせん /専用回線/ せんようせん /専用線/ せんりゃく /戦略/ せんりょう /占領/ せんりんかく /線輪郭/ せんれん /洗練/ せんれんけつ /線連結/ せんろ /線路/ ぜ /是/ ぜい /税/脆/ ぜいきん /税金/ ぜいりし /税理士/ ぜっs /絶/ ぜっく /絶句/ ぜっしょく /絶食/ ぜったい /絶対/ ぜつ /絶/舌/ ぜつみょう /絶妙/ ぜひ /是非/ ぜん /前/全/膳/繕/禅/然/漸/善/ ぜんk /前/ ぜんいん /全員/ ぜんえい /全英/ ぜんかい /前回/ ぜんかく /全角/ ぜんかくかな /全角仮名/ ぜんがく /全学/全額/ ぜんき /前期/ ぜんこう /前項/ ぜんこく /全国/ ぜんこくたいかい /全国大会/ ぜんこくてき /全国的/ ぜんご /前後/ ぜんごさゆう /前後左右/ ぜんしゃ /前者/全社/ ぜんしゅう /全集/ ぜんしょう /前章/全称/ ぜんじつ /前日/ ぜんじゅつ /前述/ ぜんじゅんじょ /全順序/ ぜんじんるい /全人類/ ぜんせつ /前節/ ぜんぜん /全然/ ぜんたい /全体/ ぜんちきゅう /全地球/ ぜんちょう /全長/ ぜんてい /前提/ ぜんねん /前年/ ぜんねんど /前年度/ ぜんはん /前半/ ぜんぱん /全般/ ぜんぶ /全部/ ぜんぶん /全文/ ぜんぷく /全幅/ ぜんめつ /全滅/ ぜんめんてき /全面的/ ぜんりゃく /前略/ そ /組/鼠/遡/阻/訴/蘇/素/粗/租/祖/礎/疎/疏/狙/楚/曽/曾/措/岨/塑/噌/ そe /添/ そi /沿/ そm /初/染/ そt /沿/添/ そいんすう /素因数/ そいんすうぶんかい /素因数分解/ そう /騒/総/層/相/想/送/早/霜/鎗/遭/走/装/藻/蒼/葬/荘/草/聡/綜/糟/窓/痩/争/燥/漕/槽/槍/巣/曹/操/掻/挿/掃/捜/惣/匝/宋/爽/奏/壮/喪/倉/叢/双/創/僧/噪/ そうい /相違/相異/ そういてん /相異点/相違点/ そうおう /相応/ そうかい /総会/ そうかつ /総括/ そうかん /壮観/ そうき /早期/ そうきゅう /早急/ そうきん /送金/ そうぐう /遭遇/ そうこ /倉庫/ そうこう /走行/草稿/ そうご /相互/ そうごう /総合/綜合/ そうごうかがくぶ /総合科学部/ そうごうけんきゅう /総合研究/ そうさ /操作/走査/ そうさいん /操作員/ そうさく /創作/ そうし /創始/ そうししゃ /総支社/ そうしゃ /奏者/ そうしゅつ /送出/ そうしょう /総称/ そうしん /送信/ そうじ /掃除/ そうじゅ /送受/ そうじゅしん /送受信/ そうすう /総数/ そうそう /草々/早々/ そうぞう /想像/創造/ そうたい /相対/ そうだ /操舵/ そうだん /相談/ そうだんいん /相談員/ そうだんしょ /相談所/ そうち /装置/ そうちゃく /装着/ そうてい /想定/ そうでん /送電/ そうとう /相当/争闘/ そうにゅう /挿入/ そうび /装備/ そうふ /送付/ そうふさき /送付先/ そうほう /双方/ そうま /相馬/ そうむ /創夢/総務/ そうりつ /創立/ そうりょう /送料/ そえ /添/ そえだ /添田/ そが /蘇我/ そがい /阻害/ そく /足/側/速/息/即/測/束/捉/則/促/ そくざ /即座/ そくしん /促進/ そくせん /側線/ そくたつ /速達/ そくてい /測定/ そくど /速度/測度/ そくばく /束縛/ そくめん /側面/ そけつごう /疎結合/ そこ /底/ そこう /粗稿/ そしき /組織/ そしきぼうりょく /組織暴力/ そしきぼうりょくはんざいしゃ /組織暴力犯罪者/ そすう /素数/ そすうぶんかい /素数分解/ そだt /育/ そち /措置/ そっき /測器/ そつ /率/卒/ そつぎょう /卒業/ そつけん /卒研/ そで /袖/ そと /外/ そとがわ /外側/ そなe /備/ そね /曽根/ その /其/園/ そのた /その他/ そば /側/ そふ /祖父/ そぼ /祖母/ そぼう /粗暴/ そぼく /素朴/ そら /空/ そらいろ /空色/ それい /租霊/ それがし /某/ それぞれ /各々/ そろe /揃/ そろi /揃/ そろt /揃/ そん /損/存/遜/村/尊/孫/ そんがい /損害/ そんけい /尊敬/ そんけいご /尊敬語/ そんざい /存在/ そんしつ /損失/ そんしょう /損傷/ そんしょうど /損傷度/ そんぞく /存続/ そんちょう /尊重/ ぞう /臓/贈/造/蔵/憎/増/像/象/三/ ぞうか /増加/ ぞうかん /増刊/ ぞうき /臓器/ ぞうご /造語/ ぞうさつ /増刷/ ぞうせつ /増設/ ぞうせん /造船/ ぞうだい /増大/ ぞうぶん /増分/ ぞく /続/族/賊/属/俗/ ぞくs /属/ ぞくご /俗語/ ぞくせい /属性/ ぞくせつ /俗説/ ぞくへん /続編/ ぞくほう /続報/ ぞん /存/ ぞんj /存/ ぞんz /存/ ぞんじ /存知/ ぞんぶん /存分/ ぞんめい /存命/ た /他/太/多/詑/汰/田/ たb /食/ たc /立/ たe /耐/絶/ たm /溜/ たn /他/ たr /足/ たs /足/達/ たt /立/建/断/経/ たい /大/代/袋/体/隊/対/態/鯛/黛/逮/退/貸/苔/腿/胎/滞/泰/替/戴/怠/待/帯/岱/耐/堆/他意/太/ たいs /対/大/ たいあん /大安/ たいい /大意/ たいおう /対応/ たいおん /体温/ たいかい /大会/ たいかく /体格/ たいかん /退官/ たいがい /大概/ たいがく /退学/ たいき /大気/ たいきゅう /耐久/ たいきゅうりょく /耐久力/ たいきょく /対極/ たいきん /大金/ たいく /体躯/ たいくつ /退屈/ たいけい /体系/体型/ たいけん /体験/ たいこう /対抗/ たいさ /大差/ たいさく /大作/対策/ たいざい /大罪/滞在/ たいし /大史/ たいしかん /大使館/ たいしつ /退室/ たいしゃ /退社/ たいしゃく /貸借/ たいしょ /対処/ たいしょう /対象/大将/対称/大賞/大正/対症/対照/ たいしょうせい /対称性/ たいしょうぶつ /対象物/ たいしょく /退職/ たいしん /耐震/ たいせい /態勢/体制/ たいせき /体積/退席/ たいせつ /大切/ たいせん /大戦/ たいちょう /体調/ たいてい /大抵/ たいでん /帯電/ たいとう /台東/ たいど /態度/ たいはく /太白/ たいひ /退避/対比/ たいふう /台風/ たいへん /大変/ たいまん /怠慢/ たいめん /対面/ たいやく /対訳/ たいよう /大要/太陽/ たいら /平/ たいりょう /大量/ たいわ /対話/ たえ /妙/ たえこ /妙子/ たおr /倒/ たおs /倒/ たか /鷹/高/隆/貴/孝/亨/ たかi /高/ たかk /高/ たかm /高/ たかs /高/ たかい /高井/ たかぎ /高木/ たかし /貴史/尚史/喬/ たかす /高須/ たかだ /高田/ たかの /高野/ たかのり /高徳/ たかはし /高橋/ たかふみ /貴文/ たかまつ /高松/ たかみ /高見/ たかやす /貴康/ たかやま /高山/ たかゆき /高之/ たから /宝/ たからだ /宝田/ たがi /互/ たがじょう /多賀城/ たがわ /田川/ たき /瀧/滝/多岐/ たきうち /瀧内/ たく /鐸/託/琢/濯/沢/拓/択/托/宅/啄/卓/澤/ たくいつ /択一/ たくさん /沢山/ たくぼ /田窪/ たぐい /類/ たけ /茸/竹/武/丈/健/ たけいち /武市/ たけうち /武内/竹内/ たけし /猛/武志/ たけだ /武田/竹田/ たけはら /竹原/ たけひさ /竹久/ たけやま /武山/ たこ /蛸/凧/ たこう /他校/ たこうしき /多項式/ たこうせい /他校生/ たしk /確/ たしゃ /他社/ たしょう /多少/ たじげん /多次元/ たじま /田島/ たじゅう /多重/ たじゅうしょり /多重処理/ たじゅうせきぶん /多重積分/ たすk /助/ たすう /多数/ たずn /尋/ たぜい /多勢/ たそう /多相/ たそうがた /多相型/ たそがれ /黄昏/ たたk /叩/ たたかt /闘/戦/ たたかu /闘/ たたみ /疊/畳/ ただ /唯/只/忠/ ただs /正/但/ ただt /直/ ただあき /理顕/ ただい /多大/ ただし /正/ ただち /直/ たち /達/立/ たちぎ /立木/ たちば /立場/ たちまち /立町/ たっs /達/ たっきゅうびん /宅急便/ たっしゃ /達者/ たっせい /達成/ たつ /辰/達/龍/ たつた /龍田/ たつみ /巽/ たて /竪/│/縦/立/ たていし /立石/ たてぼう /縦棒/ たてもの /建物/ たとe /例/ たどr /辿/ たどころ /田所/ たな /棚/ たなか /田中/ たなばた /七夕/ たに /谷/ たにやま /谷山/ たにん /他人/ たぬき /狸/ たね /種/ たのm /頼/ たのn /頼/ たのs /楽/ たば /束/ たばら /田原/ たび /度/旅/ たびたび /度々/ たぶん /多分/ たぼう /多忙/ たま /玉/弾/多摩/球/ たまr /溜/ たまt /溜/ たまがわ /多摩川/玉川/ たまき /玉木/ たましま /玉島/ たまち /田町/ たまねぎ /玉葱/ たむら /田村/ ため /為/ ためn /為/ ためs /試/ ためいき /溜息/ たもt /保/ たよr /頼/便/ たよt /頼/ たよう /多様/ たようがた /多様型/ たら /鱈/ たる /樽/ たろう /太郎/太朗/ たん /単/端/反/鍛/誕/蛋/胆/耽/綻/箪/短/炭/湛/淡/歎/旦/探/担/坦/嘆/丹/ たんn /単/ たんい /単位/ たんいげん /単位元/ たんいつ /単一/ たんいつか /単一化/ たんき /短期/ たんきょり /短距離/ たんけん /探検/ たんこう /単項/ たんこうぼん /単行本/ たんご /単語/ たんさ /探査/ たんさき /探査機/ たんさく /探索/ たんしゃ /単写/ たんしゅく /短縮/ たんしょ /短所/ たんじゅん /単純/ たんじょう /誕生/ たんじょうび /誕生日/ たんすう /単数/ たんち /探知/ たんちょう /単調/短調/ たんとう /担当/ たんとうしゃ /担当者/ たんどく /単独/ たんにん /担任/ たんば /丹羽/ たんぱく /蛋白/ たんぺん /短編/ たんまつ /端末/ たんまつまど /端末窓/ たんらく /短絡/ だ /騨/駄/陀/楕/舵/柁/打/惰/妥/堕/唾/田/朶/ だs /出/ だい /大/第/内/代/台/題/醍/ だいいち /第一/ だいがく /大学/ だいがくいん /大学院/ だいがくいんせい /大学院生/ だいがくせい /大学生/ だいがくない /大学内/ だいきぼ /大規模/ だいきん /代金/ だいこう /代行/ だいこん /大根/ だいご /醍醐/第五/ だいさん /第三/ だいさんけいひん /第三京浜/ だいさんしゃ /第三者/ だいさんせい /大賛成/ だいしょう /代償/ だいじ /大事/ だいじょうぶ /大丈夫/ だいすk /大好/ だいすう /台数/代数/ だいぜんてい /大前提/ だいそう /体操/ だいたい /大体/ だいたん /大胆/ だいち /大地/ だいに /第二/ だいにゅう /代入/ だいにゅうぶん /代入文/ だいひゃっか /大百科/ だいひょう /代表/ だいひょうしゃ /代表者/ だいひょうてき /代表的/ だいぶぶん /大部分/ だいめい /題名/ だいもく /題目/ だいよう /代用/ だいり /代理/ だいりてん /代理店/ だえん /楕円/ だく /諾/濁/ だしん /打診/ だそく /蛇足/ だち /達/ だっ /脱/ だつ /奪/脱/ だて /館/ だとう /妥当/ だな /棚/ だまr /黙/ だまs /騙/ だまt /黙/ だめ /駄目/ だれ /誰/ だん /男/段/断/弾/暖/談/檀/壇/団/ だんいん /団員/ だんかい /段階/ だんき /暖機/ だんけつ /団結/ だんし /男子/ だんすう /弾数/ だんそう /断層/ だんたい /団体/ だんだん /段々/ だんち /団地/ だんぼう /暖房/ だんめん /断面/ だんらく /段落/ だんわ /談話/ だんわかい /談話会/ ち /値/恥/地/知/茅/馳/遅/蜘/致/置/稚/痴/池/智/弛/血/千/ ちr /散/ ちい /地位/ ちいs /小/ ちいき /地域/ ちえ /知恵/ ちえん /遅延/ ちか /地下/近/ ちかi /近/ ちかk /近/ ちかt /誓/ ちかu /誓/ ちかく /地殻/ ちかごろ /近頃/ ちかづi /近付/ ちかてつ /地下鉄/ ちから /力/ ちがe /違/ ちがi /違/ ちがt /違/ ちがu /違/ ちがw /違/ ちがく /地学/ ちきゅう /地球/ ちきゅうじん /地球人/ ちきゅうれんぽう /地球連邦/ ちく /逐/蓄/筑/竹/畜/築/地区/ ちくきょう /地区協/ ちくさ /千種/ ちくさく /千種区/ ちくじ /逐次/ ちくせき /蓄積/ ちくりん /竹林/ ちこく /遅刻/ ちしき /知識/ ちじm /縮/ ちじき /地磁気/ ちず /地図/ ちずこ /千寿子/ ちせい /知性/ ちだ /千田/ ちち /父/ ちつ /窒/秩/ ちつじょ /秩序/ ちてき /知的/ ちてきしょり /知的処理/ ちてん /地点/ ちとせ /千歳/ ちなつ /千夏/ ちのう /知能/ ちのうはん /知能犯/ ちのけ /血の気/ ちはる /千春/ ちば /千葉/ ちばけん /千葉県/ ちほう /地方/ ちまよt /血迷/ ちめい /地名/ ちゃ /茶/ ちゃく /着/嫡/ ちゃくしん /着信/ ちゃくそう /着想/ ちゃくにん /着任/ ちゃくもく /着目/ ちゃくりく /着陸/ ちゃだい /茶代/ ちゃっかん /着艦/ ちゃわん /茶腕/ ちゅう /中/注/昼/虫/宙/駐/鋳/酎/註/衷/柱/抽/忠/仲/ ちゅうい /注意/ ちゅういほう /注意報/ ちゅうおう /中央/ ちゅうおうしょりそうち /中央処理装置/ ちゅうか /中華/ ちゅうかがい /中華街/ ちゅうかく /中核/ ちゅうかん /中間/ ちゅうがく /中学/ ちゅうがっこう /中学校/ ちゅうきゅう /中級/ ちゅうきょう /中京/ ちゅうきょり /中距離/ ちゅうぎ /忠義/ ちゅうけい /中継/ ちゅうこ /中古/ ちゅうごく /中国/ ちゅうし /中止/ ちゅうしゃ /駐車/ ちゅうしゃく /註釈/注釈/ ちゅうしゃじょう /駐車場/ ちゅうしゅつ /抽出/ ちゅうしょう /抽象/ ちゅうしょうか /抽象化/ ちゅうしょうきぎょう /中小企業/ ちゅうしょうつい /抽象対/ ちゅうしょうてき /抽象的/ ちゅうしょく /昼食/ ちゅうしん /中心/ ちゅうじゅん /中旬/ ちゅうじょう /中條/ ちゅうだん /中断/ ちゅうと /中途/ ちゅうとはんぱ /中途半端/ ちゅうどく /中毒/ ちゅうばち /中鉢/ ちゅうび /中火/ ちゅうぶ /中部/ ちゅうもく /注目/ ちゅうもん /注文/ ちゅうりつ /中立/ ちゅうりゃく /中略/ ちゅしょう /中小/ ちょ /貯/著/苧/猪/瀦/樗/ ちょう /長/超/肇/弔/重/帳/調/張/鳥/頂/銚/跳/諜/蝶/腸/脹/聴/眺/町/牒/潮/朝/暢/挑/懲/徴/彫/庁/帖/寵/喋/凋/兆/丁/嘲/ ちょうおん /長音/ ちょうか /超過/ ちょうかく /聴覚/ ちょうかん /長官/ ちょうき /長期/ ちょうきょり /長距離/ ちょうきん /超勤/ ちょうこう /徴候/聴講/ ちょうさ /調査/ ちょうし /調子/ ちょうしゃ /庁舎/ ちょうしゅう /徴収/長洲/ ちょうしょ /調書/長所/ ちょうしょう /嘲笑/ ちょうじかん /長時間/ ちょうじゅん /超準/ ちょうじょう /長上/ ちょうじょうしゃ /長上者/ ちょうせい /調整/ ちょうせつ /調節/ ちょうせん /挑戦/朝鮮/ ちょうたん /長短/ ちょうちょう /長調/ ちょうてん /頂点/ ちょうでん /弔電/ ちょうど /丁度/ ちょうはつ /長髪/ ちょうひょう /帳表/帳票/ ちょうふ /調布/ ちょうふく /重複/ ちょうへい /徴兵/ ちょうほう /重宝/ ちょうほうけい /長方形/ ちょうめ /丁目/ ちょうめい /町名/ ちょきん /貯金/ ちょく /直/捗/勅/ ちょくげき /直撃/ ちょくご /直後/ ちょくせき /直積/ ちょくせつ /直接/ ちょくせつてき /直接的/ ちょくせん /直線/ ちょくぜん /直前/ ちょくつう /直通/ ちょくめん /直面/ ちょくれつ /直列/ ちょくわ /直和/ ちょさく /著作/ ちょさくけん /著作権/ ちょさくけんほう /著作権法/ ちょさくしゃ /著作者/ ちょさくぶつ /著作物/ ちょしゃ /著者/ ちょしゃめい /著者名/ ちょしょ /著書/ ちょすい /貯水/ ちょすいりょう /貯水量/ ちょちく /貯蓄/ ちょっかん /直観/直感/ ちょっけつ /直結/ ちょっこう /直交/ ちょっこうせい /直交性/ ちょめい /著名/ ちよだ /千代田/ ちよだく /千代田区/ ちり /地理/ ちん /椿/陳/鎮/賃/珍/沈/朕/ ちんぎん /賃金/ ぢめん /地面/ つ /津/都/付/ つg /告/ つi /付/着/突/憑/ つk /付/着/突/漬/尽/使/点/尾/ つm /詰/積/ つn /積/ つr /連/ つt /突/ つい /対/鎚/追/槌/椎/墜/ ついy /費/ ついか /追加/ ついきゅう /追及/追求/ ついしん /追伸/ ついたち /一日/ ついび /追尾/ ついびそうち /追尾装置/ つう /通/痛/ つうj /通/ つううん /通運/ つうか /通過/ つうかい /痛快/ つうがく /通学/ つうきん /通勤/ つうけん /通研/ つうさん /通産/ つうしょう /通称/ つうしん /通信/ つうしんこうがっか /通信工学科/ つうしんほうしき /通信方式/ つうじょう /通常/ つうち /通知/ つうほう /通報/ つうほうs /通報/ つうやく /通訳/ つうよう /通用/痛痒/ つか /塚/ つかe /使/ つかi /使/遣/ つかm /捕/掴/ つかo /使/ つかr /疲/ つかt /使/ つかu /使/ つかw /使/ つかいかた /使い方/ つかいがって /使い勝手/ つかさどr /司/ つかもと /塚本/ つが /栂/ つき /月/付/槻/築/ つきじ /築地/ つぎ /次/ つぎつぎ /次々/ つく /筑/ つくr /作/創/造/ つくt /作/ つくえ /机/ つくだ /佃/ つくば /筑波/ つくばだい /筑波大/ つくばだいがく /筑波大学/ つくりかた /作り方/ つくりて /作り手/ つけかた /付け方/ つけくわe /付け加/ つげ /柘/柘植/ つごう /都合/ つしま /津島/ つじ /辻/ つじい /辻井/ つずr /綴/ つた /蔦/ つたe /伝/ つたt /伝/ つたu /伝/ つたw /伝/ つだ /津田/ つだi /伝/ つだじゅく /津田塾/ つだぬま /津田沼/ つち /土/ つちうら /土浦/ つちや /土屋/ つつ /砲/筒/ つつm /包/ つつしm /慎/ つつしn /謹/ つつみ /提/ つづi /続/ つづk /続/ つづr /綴/ つとm /勤/務/努/ つとむ /務/勉/ つど /都度/ つどい /集/ つなg /繋/ つなi /継/ つね /常/桓/ つねn /常/ つねじ /常次/ つば /鍔/ つばき /椿/ つぶs /潰/ つぼ /壷/坪/ つま /妻/嬬/ つみ /罪/ つみき /積木/ つみたて /積立/ つむぎ /紬/ つむじかぜ /旋風/ つめ /爪/詰/ つめt /冷/ つゆ /露/梅雨/ つよi /強/ つよk /強/ つよき /強気/ つら /面/ つらi /辛/ つらn /連/ つり /釣/吊/ つる /鶴/ づk /付/ づけ /付/ づめ /詰/ て /手/ てr /照/ てあt /手当/ てい /定/袋/程/鼎/釘/鄭/邸/逓/蹄/諦/訂/艇/締/禎/碇/汀/梯/提/挺/抵/悌/弟/廷/庭/底/帝/堤/呈/貞/剃/偵/停/低/亭/ ていあん /提案/ ていいん /定員/ ていおん /低温/ ていか /定価/低下/ ていき /定期/提起/ ていきょう /提供/ ていぎ /定義/ ていぎいき /定義域/ ていけい /提携/ ていげん /提言/ ていこく /帝国/ ていし /停止/ ていしき /定式/ ていしきか /定式化/ ていしせい /停止性/ ていしゅつ /提出/ ていしょう /提唱/ ていじ /提示/定時/ ていすう /定数/ ていせい /訂正/定性/ ていせいてき /定性的/ ていそく /低速/ ていでん /停電/ ていど /程度/ ていねい /丁寧/ ていり /定理/ ていりつ /定立/ ていりょう /定量/ ていれい /定例/ ておくr /手遅/ てかず /手数/ てがk /手書/ てがみ /手紙/ てがる /手軽/ てき /的/敵/鏑/適/笛/滴/擢/摘/ てきs /適/ てきおう /適応/ てきかく /的確/適格/ てきかん /敵艦/ てきぎ /適宜/ てきごう /適合/ てきせつ /適切/ てきとう /適当/ てきど /適度/ てきにん /適任/ てきよう /適用/ てぎわ /手際/ てくび /手首/ てごろ /手頃/ てごわi /手強/ てごわs /手強/ てさぎょう /手作業/ てじゅん /手順/ てすう /手数/ てすうりょう /手数料/ てちがi /手違/ てちょう /手帳/ てっこつ /鉄骨/ てってい /徹底/ てつ /鉄/迭/轍/撤/徹/哲/鐵/ てつお /哲雄/ てつがく /哲学/ てつがくしゃ /哲学者/ てつだe /手伝/ てつだi /手伝/ てつだt /手伝/ てつだu /手伝/ てつづk /手続/ てつどう /鉄道/ てつや /徹夜/哲弥/ てなおs /手直/ てはい /手配/ てびk /手引/ てびき /手引/ てふだ /手札/ てほん /手本/ てま /手間/ てまえ /手前/ てまどr /手間取/ てもと /手元/ てら /寺/ てらした /寺下/ てる /輝/照/ てるい /照井/ てるお /輝男/ てれや /照れ屋/ てん /点/店/天/転/顛/甜/纏/添/展/填/典/・/./殿/ てんい /転移/ てんいん /店員/ てんか /転嫁/点火/天下/ てんかい /展開/ てんかん /転換/ てんき /天気/ てんきん /転勤/ てんくう /天空/ てんけいてき /典型的/ てんけつごう /点結合/ てんけん /点検/ てんこう /天候/ てんこうせい /転校生/ てんごく /天国/ てんさい /転載/天才/ てんさく /添削/ てんし /天使/ てんしゅうごう /点集合/ てんしゅつ /転出/ てんしゅつこう /転出校/ てんじ /展示/ てんじん /天神/ てんそう /転送/ てんつい /点対/ てんてん /転々/・・・/…/‥/ てんとう /店頭/点灯/転倒/ てんにゅう /転入/ てんにゅうせい /転入生/ てんにん /転任/ てんねん /天然/ てんのう /天皇/ てんのうだい /天王台/ てんぱん /典範/ てんぷ /添付/ てんぼう /展望/ てんもん /天文/ てんり /天理/ てんれつ /点列/ てんれんけつ /点連結/ で /出/ でm /出/ でn /出/ でr /出/ でs /出/ でt /出/ でy /出/ であt /出逢/ であu /出逢/ でい /泥/ でいりぐち /出入口/ でかk /出掛/ でき /出来/溺/ できm /出来/ できn /出来/ できr /出来/ できs /出来/ できt /出来/ できごと /出来事/ でぐち /出口/ でこぼこ /凸凹/ でし /弟子/ でばん /出番/ でまわr /出回/ でん /電/田/澱/殿/伝/ でんえんとしせん /田園都市線/ でんか /殿下/ でんかせいひん /電化製品/ でんき /電気/電機/伝記/電器/ でんきけい /電気系/ でんきけいそくがく /電気計測学/ でんきこうがく /電気工学/ でんきこうがくか /電気工学科/ でんきこうがっか /電気工学科/ でんきつうしんけんきゅうしょ /電気通信研究所/ でんきつうしんけんきゅうじょ /電気通信研究所/ でんげん /電源/ でんごん /伝言/ でんごんばん /伝言板/ でんさん /電算/ でんさんき /電算機/ でんし /電子/ でんしけいさん /電子計算/ でんしこうがっか /電子工学科/ でんしじょうほうけい /電子情報系/ でんしぶつり /電子物理/ でんしゃ /電車/ でんしょく /電飾/ でんしん /電信/ でんしんでんわ /電信電話/ でんそう /電装/伝送/ でんそうけん /電総研/ でんたく /電卓/ でんたつ /伝達/ でんつう /電通/ でんつうだい /電通大/ でんとう /伝統/ でんぱ /電波/ でんぱけん /電波研/ でんぴょう /伝票/ でんまちょう /伝馬町/ でんりゅう /電流/ でんりょく /電力/ でんわ /電話/ でんわだい /電話代/ でんわばんごう /電話番号/ と /土/十/登/砺/砥/鍍/都/途/賭/菟/渡/杜/斗/徒/屠/妬/塗/堵/吐/兎/戸/富/人/図/ とb /飛/跳/ とi /問/解/ とj /綴/閉/ とk /解/溶/説/ とm /止/泊/ とn /飛/ とr /取/撮/捕/採/ とt /取/撮/採/ とu /問/ とz /閉/ とい /問/桶/ といあw /問い合/ とう /等/頭/当/討/董/東/投/冬/盗/闘/騰/陶/鐙/透/逃/踏/豆/謄/藤/蕩/到/統/糖/筒/答/祷/痘/燈/灯/涛/湯/淘/棟/梼/桃/搭/悼/嶋/島/宕/套/塘/塔/唐/刀/凍/党/倒/父/ とうj /投/ とういつ /統一/ とういつか /統一化/ とうえい /投影/ とうか /十日/ とうかい /東海/ とうかいどう /東海道/ とうかつ /統轄/ とうかんかく /等間隔/ とうがい /当該/ とうき /冬季/冬期/ とうきゅう /東急/ とうきょう /東京/ とうきょうきんぺん /東京近辺/ とうきょうこうぎょうだいがく /東京工業大学/ とうきょうだいがく /東京大学/ とうきょうと /東京都/ とうきょうほうめん /東京方面/ とうけい /統計/ とうけいじょうほう /統計情報/ とうけいてき /統計的/ とうげ /峠/ とうこう /投稿/等高/ とうこうしゃ /投稿者/ とうこうせん /等高線/ とうこうだい /東工大/ とうごう /統合/等号/ とうごうか /統合化/ とうさい /塔載/ とうさんさい /唐三彩/ とうざ /当座/ とうざい /東西/ とうしき /等式/ とうしば /東芝/ とうしゃ /投射/ とうしょ /当初/ とうしょう /闘将/ とうじ /当時/ とうじしゃ /当事者/ とうじつ /当日/ とうじょう /登場/ とうぜん /当然/ とうたつ /到達/ とうだい /東大/ とうち /当地/ とうちゃく /到着/ とうちょう /盗聴/ とうにん /当人/ とうばん /当番/ とうひょう /投票/ とうふ /豆腐/ とうぶん /当分/ とうほう /当方/ とうほく /東北/ とうほくししゃ /東北支社/ とうほくだい /東北大/ とうほくだいがく /東北大学/ とうほん /謄本/ とうめい /東名/透明/ とうめいせい /透明性/ とうめん /当面/ とうよう /東洋/東陽/ とうようちょう /東陽町/ とうよこ /東横/ とうらい /到来/ とうろく /登録/ とうろん /討論/闘論/ とお /十/ とおi /遠/ とおk /遠/ とおr /通/ とおs /遠/通/ とおt /通/ とおz /遠/ とおり /通/ とおる /徹/透/ とかい /都会/ とき /時/鴇/ ときどき /時々/ ときわ /常盤/ とく /特/得/篤/禿/督/涜/徳/匿/ とくn /特/ とくい /得意/ とくがわ /徳川/ とくぎ /特技/ とくさつ /特撮/ とくしつ /特質/ とくしま /徳島/ とくしゅ /特殊/ とくしゅう /特集/ とくしゅうごう /特集号/ とくしょく /特色/ とくせい /特性/ とくだ /徳田/ とくちょう /特徴/特長/ とくちょうづk /特徴付/ とくてい /特定/ とくてん /得点/特典/ とくなが /徳永/ とくはら /徳原/ とくばん /特番/ とくべつ /特別/ とくゆう /特有/ とくろん /特論/ とけい /時計/ とけつ /吐血/ とこ /常/床/ ところ /所/ とざん /登山/ とし /年/歳/利/都市/俊/寿/捷/敏/ としあき /利明/ としお /利夫/ としたか /敏隆/ としはる /季栄/ としひさ /俊久/ としま /豊島/ としまく /豊島区/ としゆき /利之/ としょ /図書/ としょかん /図書館/ としょかんじょうほうだいがく /図書館情報大学/ とせ /歳/ とたん /途端/ とだ /戸田/ とち /土地/橡/栃/ とちゅう /途中/ とっきょ /特許/ とっけん /特権/ とっしん /突進/ とっしんs /突進/ とっとり /鳥取/ とっぴ /突飛/ とつ /突/凸/ とつぜん /突然/ ととう /徒党/ ととのt /整/ ととのu /整/ とどi /届/ とどk /届/ とどm /留/ とどうふけん /都道府県/ となr /隣/ とない /都内/ となり /隣/ との /殿/ とび /鳶/ とびら /扉/ とぼs /乏/ とま /苫/ とまt /止/ とみ /富/當/冨/ とみおか /富岡/ とむら /戸村/ とも /共/友/知/智/ ともr /燈/ ともお /友雄/ ともこ /知子/ ともだち /友達/ ともなi /伴/ ともなt /伴/ ともなu /伴/ ともなw /伴/ ともみ /知美/ とやま /富山/ とよ /豊/ とよなか /豊中/ とよはし /豊橋/ とら /寅/虎/ とらe /捕/ とらい /渡来/ とらのもん /虎の門/ とり /酉/鳥/ とりあe /取り敢/ とりあつかi /取り扱/ とりあつかu /取り扱/ とりいr /取り入/取入/ とりしまりやく /取締役/ とりだs /取出/ とりつ /都立/ とりのぞi /取り除/ とりはかr /取り計/ とろ /瀞/ とん /豚/頓/遁/沌/敦/惇/屯/噸/ ど /度/奴/土/怒/努/ どあい /度合/ どう /道/動/瞳/導/同/銅/萄/胴/童/洞/撞/憧/堂/働/藤/ どうい /同意/ どういつ /同一/ どういつし /同一視/ どういん /動員/ どうかん /同感/ どうき /同期/動機/ どうぎ /同義/ どうくん /同君/ どうぐ /道具/ どうけい /同型/同形/ どうげんざか /道玄坂/ どうこう /瞳孔/動向/同行/ どうさ /動作/ どうさつ /洞察/ どうし /動詞/同士/同志/ どうしゃ /同社/ どうしゅつ /導出/ どうじ /同時/童子/ どうじく /同軸/ どうじつ /同日/ どうじょう /同上/同情/ どうじょうしゃ /同乗者/ どうじん /同人/ どうじんし /同人誌/ どうせいどうめい /同姓同名/ どうせき /同席/ どうせきs /同席/ どうそう /同窓/ どうそうかい /同窓会/ どうたい /導体/ どうだん /道断/ どうち /同値/ どうちかんけい /同値関係/ どうちせい /同値性/ どうちょう /同調/ どうてき /動的/ どうとう /同等/ どうにゅう /導入/ どうねん /同年/ どうねんれい /同年齢/ どうふう /同封/ どうぶつ /動物/ どうぶん /同文/ どうほう /同報/ どうめい /同名/ どうよう /同様/ どうり /道理/ どうりょう /同僚/ どうるい /同類/ どうろ /道路/ どがいし /度外視/ どきょう /度胸/ どく /毒/読/独/ どくがく /独学/ どくしゃ /読者/ どくしゅう /独習/ どくしょ /読書/ どくしん /独身/ どくじ /独自/ どくせん /独占/ どくそう /独創/ どくだん /独断/ どくとく /独特/ どくりつ /独立/ どくりょく /独力/ どこ /何処/ どしゃ /土砂/ どだい /土台/ どて /土手/ どにち /土日/ どの /殿/ どぼく /土木/ どよう /土曜/ どようび /土曜日/ どりょく /努力/ どろつち /泥土/ どん /鈍/曇/呑/貪/丼/ どんき /鈍器/ どんてん /曇天/ どんよく /貪欲/ な /名/那/奈/ なg /投/薙/ なi /無/鳴/泣/ なk /無/鳴/亡/泣/ なr /慣/鳴/馴/成/ なs /無/成/ なt /鳴/成/ ない /内/無/ ないがい /内外/ ないき /内記/ ないしょ /内緒/ ないせん /内線/ ないぞう /内臓/内蔵/ ないち /内地/ ないてい /内定/ ないぶ /内部/ ないぶしりょう /内部資料/ ないぶひょうげん /内部表現/ ないぶへんすう /内部変数/ ないよう /内容/ ないようてき /内容的/ ないりん /内輪/ なえば /苗場/ なお /直/尚/ なおr /直/治/ なおs /直/ なおt /治/直/ なおた /直田/ なおと /直人/ なおゆき /直幸/ なか /中/仲/ なかb /半/ なかお /中尾/ なかがわ /中川/ なかごろ /中頃/ なかしま /中島/ なかじま /中島/ なかず /中頭/ なかた /中田/ なかてん /・/ なかにし /中西/ なかの /中野/ なかはら /中原/ なかま /仲間/ なかまどうし /仲間同士/ なかみ /中身/ なかむら /中村/ なかやま /中山/ なが /長/永/ ながi /長/永/ ながk /長/ ながm /眺/ ながr /流/ ながs /流/長/ ながい /永井/ ながお /長尾/ ながおか /長岡/ ながさき /長崎/ ながさわ /永沢/ ながしま /長島/ ながた /永田/ ながなが /長々/ ながの /長野/永野/ ながまち /長町/ ながら /乍/ ながれず /流れ図/ なぎ /凪/ なぐ /薙/ なごr /名残/ なごや /名古屋/ なごやし /名古屋市/ なごやだい /名古屋大/ なごやだいがく /名古屋大学/ なさk /情/ なさけ /情/ なし /梨/ なす /那須/ なぜ /何故/ なぞ /謎/ なだ /灘/ なっとく /納得/ なつ /夏/捺/ なつじかん /夏時間/ なつやすm /夏休/ など /等/ なな /七/ ななm /斜/ ななえ /七重/ ななくさ /七草/ なに /何/ なにげ /何気/ なにげn /何気/ なのr /名乗/ なべ /鍋/ なま /生/ なまk /怠/ なまえ /名前/ なまり /鉛/ なみ /波/並/奈美/〜/ なみだ /涙/泪/ なめr /滑/ なやm /悩/ なやn /悩/ なら /奈良/楢/ ならb /並/ ならi /習/ ならn /並/ ならt /習/ ならu /習/ ならべかe /並べ変/ なり /成/ なりさわ /成沢/ なりた /成田/ なりたt /成り立/ なわ /縄/ なわて /畷/ なん /何/難/南/軟/楠/ なんい /難易/ なんいど /難易度/ なんかい /何回/南海/ なんきょく /南極/ なんぎ /難儀/ なんぎょう /何行/ なんこうだい /南光台/ なんざん /南山/ なんしょ /難所/ なんじ /汝/何時/ なんじかん /何時間/ なんだい /何台/ なんつう /何通/ なんど /何度/ なんにち /何日/ なんにん /何人/ なんねん /何年/ なんの /南野/ なんば /難波/ なんばん /何番/ なんぷん /何分/ なんまい /何枚/ なんもん /難問/ に /二/迩/弐/尼/荷/煮/ にg /逃/ にr /煮/似/ にs /似/ にt /似/ にy /煮/ にあi /似合/ にあt /似合/ にあu /似合/ にあw /似合/ にい /新/兄/ にいがた /新潟/ におe /匂/ におi /匂/ におu /匂/ におw /匂/ にかい /二階/ にがi /苦/ にがて /苦手/ にぎr /握/ にぎt /握/ にぎw /賑/ にく /肉/ にこう /二項/ にごr /濁/ にごs /濁/ にごうかん /二号館/ にし /西/ にしかど /西門/ にしかわ /西川/ にしき /錦/ にしだ /西田/ にしな /仁科/ にしはら /西原/ にしふなばし /西船橋/ にしむら /西村/ にしゃたくいつ /二者択一/ にしやま /西山/ にしんほう /2進法/ にじ /虹/二次/ にじかい /二次会/ にち /日/ にちじ /日時/ にちじょう /日常/ にちじょうさはんじ /日常茶飯事/ にちべい /日米/ にちや /日夜/ にちょうめ /二丁目/ にちよう /日曜/ にちようび /日曜日/ にっかん /日刊/ にっかんこうぎょう /日刊工業/ にっき /日記/ にっけい /日経/ にっしん /日清/日進/ にっすう /日数/ にっちゅう /日中/ にってい /日程/ にってつ /日鉄/ にっとう /日当/ にっぽん /日本/ にど /二度/ にどめ /二度目/ になt /担/ になu /担/ にねん /二年/ にはく /二泊/二拍/ にばい /二倍/ にばいす /二杯酢/ にぶんぎ /二分木/ にほん /日本/二本/ にほんがわ /日本側/ にほんこくない /日本国内/ にほんご /日本語/ にほんごか /日本語化/ にほんごにゅうりょく /日本語入力/ にほんごにゅうりょくきこう /日本語入力機構/ にほんごやく /日本語訳/ にほんしゅ /日本酒/ にほんじん /日本人/ にほんだいら /日本平/ にほんばし /日本橋/ にほんりょうり /日本料理/ にもつ /荷物/ にもの /煮物/ にゃく /若/ にゅう /入/乳/廿/ にゅういん /入院/ にゅうかい /入会/ にゅうがく /入学/ にゅうしゃ /入社/ にゅうしゅ /入手/ にゅうしゅかのう /入手可能/ にゅうしゅつりょく /入出力/ にゅうしゅつりょくh /入出力/ にゅうじょう /入場/ にゅうでん /入電/ にゅうもん /入門/ にゅうりょく /入力/ にょ /女/如/ にょう /尿/ にら /韮/ にわ /庭/ にん /人/任/妊/忍/刃/認/ にんい /任意/ にんき /人気/任期/ にんぎょう /人形/ にんげん /人間/ にんしき /認識/ にんじゃ /忍者/ にんずう /人数/ にんち /認知/ にんてい /認定/ にんむ /任務/ にんめ /人目/ ぬ /奴/怒/ ぬi /抜/ ぬk /抜/ ぬr /塗/濡/ ぬt /塗/縫/ ぬき /貫/ ぬし /主/ ぬすm /盗/ ぬの /布/ ぬま /沼/ ぬまず /沼津/ ね /音/値/寝/根/ ねr /寝/練/ ねい /寧/祢/禰/ ねうち /値打/ ねがi /願/ ねがt /願/ ねがu /願/ ねぎ /葱/ ねぎし /根岸/ ねこ /猫/ ねこか /猫科/ ねだん /値段/ ねっとう /熱湯/ ねつ /熱/ ねつい /熱意/ ねびk /値引/ ねぼう /寝坊/ ねむi /眠/ ねむr /眠/ ねむt /眠/ ねもと /根本/ ねやがわ /寝屋川/ ねらi /狙/ ねらt /狙/ ねらu /狙/ ねり /練/ ねりま /練馬/ ねん /年/念/粘/燃/撚/捻/ ねんかん /年間/ ねんがっぴ /年月日/ ねんきゅう /年休/ ねんし /年始/ ねんしょう /年少/燃焼/ ねんじゅう /年中/ ねんせい /年生/ ねんだい /年代/ ねんちょう /年長/ ねんとう /念頭/ ねんど /年度/ ねんない /年内/ ねんばん /年版/ ねんぴ /燃費/ ねんまえ /年前/ ねんまつ /年末/ ねんりょう /燃料/ ねんりょうひ /燃料費/ ねんれい /年齢/ の /埜/之/廼/乃/野/濃/ のb /述/伸/延/ のk /退/ のm /飲/呑/ のn /飲/ のr /乗/載/ のs /載/乗/ のt /乗/載/ のう /農/膿/脳/能/納/濃/悩/嚢/王/皇/ のうがくぶ /農学部/ のうき /農機/ のうぎょう /農業/ のうこうだい /農工大/ のうそん /農村/ のうど /濃度/ のうにゅう /納入/ のうひん /納品/ のうひんけつ /脳貧血/ のうひんしょ /納品書/ のうりょく /能力/ のぐち /野口/ のこr /残/ のこs /残/ のこt /残/ のした /野下/ のじま /野島/ のぞi /除/覗/ のぞk /除/覗/ のぞm /望/臨/ のぞn /望/ のち /後/ のとせん /能登線/ のはら /野原/ のぶ /信/伸/宣/ のぶお /信夫/信男/ のぶひろ /伸浩/信寛/ のぼr /登/昇/ のぼt /登/ のぼる /昇/ のみ /蚤/ のみかい /飲み会/ のむら /野村/ のり /法/紀/則/典/憲/徳/範/ のりお /典夫/徳雄/ のりこ /範子/典子/法子/ のりひさ /則久/ のりゆき /範幸/ は /破/葉/歯/波/端/琶/派/杷/覇/播/把/巴/羽/刃/ はe /生/ はk /掃除/ はn /跳/ はr /張/貼/晴/ はs /発/ はt /果/貼/張/ はu /這/ はz /恥/ はあく /把握/ はい /背/配/輩/肺/牌/盃/杯/敗/排/拝/廃/俳/ はいr /入/ はいs /排/ はいt /入/ はいいろ /灰色/ はいけい /背景/拝啓/ はいけん /拝見/ はいご /背後/ はいし /廃止/ はいじょ /排除/ はいせん /配線/ はいそう /配送/ はいぞく /配属/ はいた /排他/ はいたつ /配達/ はいち /配置/ はいちゅうりつ /排中律/ はいふ /配布/ はいふはんい /配布範囲/ はいふほうほう /配布方法/ はいぶん /配分/ はいぼく /敗北/ はいり /背理/ はいりほう /背理法/ はいりょ /配慮/ はいれつ /配列/ はえ /蝿/ はか /墓/ はかr /図/計/ はかt /計/ はかい /破壊/ はかいてき /破壊的/ はかいりょく /破壊力/ はかく /破格/ はかせ /博士/ はかせかてい /博士課程/ はかり /秤/ はき /破棄/ はぎ /萩/矧/ はぎや /萩谷/ はく /泊/白/薄/迫/舶/粕/箔/柏/拍/博/剥/伯/珀/ はくい /白衣/ はくがい /迫害/ はくさん /白山/ はくし /博士/ はくしかてい /博士課程/ はくしゃく /伯爵/ はくじょう /白状/薄情/ はくじん /白人/ はくぶつかん /博物館/ はくりょく /迫力/ はぐろ /羽黒/ はけん /派遣/ はげm /励/ はげs /激/ はこ /箱/函/ はこb /運/ はこn /運/ はこざき /箱崎/ はこだて /函館/ はこね /箱根/ はさm /狭/ はさん /破産/ はざま /硲/ はし /箸/橋/端/ はしr /走/ はしt /走/ はしだ /橋田/ はじ /恥/ はじm /始/初/ はじめ /肇/一/ はす /蓮/ はず /筈/ はずr /外/ はずれ /外/ はせがわ /長谷川/ はぜ /櫨/ はた /幡/畑/ はたけ /畠/畑/ はたらi /働/ はたらk /働/ はだ /肌/ はち /鉢/八/ はっかん /発刊/ はっき /発揮/ はっきょう /発狂/ はっくつ /発掘/ はっけい /八景/ はっけん /発見/ はっこう /発行/発酵/ はっこうねん /発行年/ はっさん /発散/ はっしゃ /発射/ はっしょう /発祥/ はっしん /発信/ はっしんび /発信日/ はっせい /発生/ はっせいほう /発生法/ はっそう /発送/発想/ はったつ /発達/ はっちゅう /発注/ はってん /発展/ はっぴゃく /八百/ はっぴょう /発表/ はっぴょうかい /発表会/ はっぴょうしゃ /発表者/ はっぴょうないよう /発表内容/ はっぴよう /発表/ はつ /髪/初/発/醗/溌/ はつおん /発音/ はつげん /発言/ はつさわ /初沢/ はつでん /発電/ はつでんしょ /発電所/ はつに /初荷/ はつばい /発売/ はつひので /初日の出/ はつほん /発本/ はつめい /発明/ はつもうで /初詣/ はつゆめ /初夢/ はてな /?/ はで /派手/ はと /鳩/ はな /花/鼻/ はなr /離/ はなs /離/話/放/ はなy /華/ はないずみ /花泉/ はなし /話/噺/ はなたば /花束/ はなび /花火/ はなもじ /花文字/ はなよめ /花嫁/ はなわ /塙/ はね /羽/羽根/ はねだ /羽田/ はは /母/ ははおや /母親/ はば /幅/ はぶk /省/ はへん /破片/ はま /浜/ はまかわ /浜川/ はまぐり /蛤/ はまだ /浜田/ はままつ /浜松/ はままつし /浜松市/ はもの /刃物/ はもん /波紋/ はや /早/ はやi /速/早/ はやk /早/速/ はやm /早/速/ はやs /速/早/ はやt /流行/ はやかわぶんこ /早川文庫/ はやがわr /早変/ はやし /林/ はやばや /早々/ はやぶさ /隼/ はやめ /早目/ はやり /流行/ はら /腹/原/ はらe /払/ はらi /払/ はらo /払/ はらt /払/ はらu /払/ はらw /払/ はらだ /原田/ はらん /波乱/ はり /張/針/ はる /春/治/ はるk /遥/ はるか /遥/ はるき /春木/ はん /版/半/坂/判/反/飯/頒/煩/釆/範/販/藩/般/繁/畔/班/犯/汎/氾/板/斑/搬/帆/叛/伴/ はんs /反/ はんい /範囲/ はんえい /反映/ はんかく /半角/ はんかくかたかな /半角片仮名/ はんかくかな /半角仮名/ はんがく /半額/ はんきゅう /阪急/ はんきょう /反響/ はんざい /犯罪/ はんざいしゃ /犯罪者/ はんしゃ /反射/ はんしゃてき /反射的/ はんしょく /繁殖/ はんしょくち /繁殖地/ はんしん /阪神/ はんせい /反省/ はんせいかい /反省会/ はんたい /反対/ はんだ /半田/ はんだい /阪大/ はんだん /判断/ はんてい /判定/ はんていかいろ /判定回路/ はんていかのう /判定可能/ はんてん /反転/ はんとし /半年/ はんどうたい /半導体/ はんにん /犯人/ はんのう /反応/ はんばい /販売/ はんばいてん /販売店/ はんぱ /半端/ はんぶん /半分/ はんぷく /反復/ はんべつ /判別/ はんめい /判明/ はんめん /反面/ はんよう /汎用/ はんようき /汎用機/ はんようてき /汎用的/ はんらん /氾濫/ はんろん /反論/ ば /場/馬/芭/罵/婆/羽/ ばk /化/ ばあい /場合/ ばあいわk /場合分/ ばい /倍/陪/賠/売/買/狽/煤/楳/梅/媒/培/ ばいう /梅雨/ ばいかい /媒介/ ばいかく /倍角/ ばいすう /倍数/ ばいたい /媒体/ ばいばい /売買/ ばいゆう /培雄/ ばか /馬鹿/ ばく /麦/駁/莫/縛/爆/漠/曝/獏/ ばくしょう /爆笑/ ばくぜん /漠然/ ばくだい /莫大/ ばくは /爆破/ ばくはつ /爆発/ ばくはつてき /爆発的/ ばし /橋/ ばしょ /場所/ ばせい /罵声/ ばっすい /抜粋/ ばつ /罰/閥/筏/抜/伐/×/ ばめん /場面/ ばん /版/番/万/判/蛮/蕃/磐/盤/晩/挽/坂/伴/板/ ばんがい /番外/ ばんぐみ /番組/ ばんこく /万国/ ばんごう /番号/ ばんしょう /万障/ ばんそう /伴奏/ ばんち /番地/ ばんのう /万能/ ばんめ /番目/ ばんり /万里/ ぱ /波/破/ ぱん /版/ ひ /日/彼/比/扉/火/陽/費/樋/飛/非/避/誹/被/肥/罷/緋/秘/碑/皮/疲/泌/斐/披/批/悲/庇/妃/否/卑/匪/痺/ ひe /冷/ ひi /引/弾/ ひk /引/弾/挽/ ひt /引/ ひy /冷/ ひいらぎ /柊/ ひえ /稗/ ひかe /控/ ひかr /光/ ひかかい /非可解/ ひかく /比較/ ひかくてき /比較的/ ひかげ /日陰/ ひかり /光/ ひかん /悲観/ ひがい /被害/ ひがえr /日帰/ ひがし /東/ ひがしの /東野/ ひき /匹/疋/引/比企/ ひきうk /引き受/ ひきすう /引数/ ひきだs /引出/ ひきつづk /引き続/ ひくi /低/ ひくk /低/ ひくs /低/ ひぐち /樋口/ ひけっていせい /非決定性/ ひげ /髭/ ひげき /悲劇/ ひげんじつてき /非現実的/ ひこ /彦/ ひこう /飛行/非行/ ひこうき /飛行機/ ひこうしょうねん /非行少年/ ひごろ /日頃/ ひさ /久/寿/ ひさs /久/ ひさお /久雄/ ひさき /寿樹/ ひさん /悲惨/ ひざ /膝/ ひし /菱/ ひしがた /菱形/ ひしだ /菱田/ ひしょ /秘書/ ひじ /肘/ ひじゅうふく /非重複/ ひじゅうふくわ /非重複和/ ひじょう /非常/ ひじょうきん /非常勤/ ひそn /潜/ ひたい /額/ ひたち /日立/ ひたんちょう /非単調/ ひたんちょうすいろん /非単調推論/ ひだ /飛田/ ひだい /肥大/ ひだいか /肥大化/ ひだか /日高/ ひだり /左/←/ ひだりかんやくほうそく /左簡約法則/ ひだりがわ /左側/ ひだりようそ /左要素/ ひっ /必/ ひっこs /引越/ ひっし /必死/ ひっしゃ /筆者/ ひっす /必須/ ひっちゃく /必着/ ひつ /必/逼/筆/畢/弼/ ひつじ /未/ ひつじゅ /必需/ ひつぜん /必然/ ひつぜんせい /必然性/ ひつぜんてき /必然的/ ひつどく /必読/ ひつよう /必要/ ひつようじゅうぶんじょうけん /必要十分条件/ ひつようせい /必要性/ ひづけ /日付/ ひてい /否定/ ひで /英/秀/ ひであき /秀昭/ ひでき /秀樹/ ひでひこ /英彦/ ひでゆき /秀之/ ひと /人/ ひとs /等/ ひとt /一/ ひといき /一息/ ひとくち /一口/ ひとけ /人気/ ひとこえ /一声/ ひとこと /一言/ ひとごと /人事/ ひとすじ /一筋/ ひとすじなわ /一筋縄/ ひとたち /人達/ ひとたび /一度/ ひとで /人手/人出/ ひとなみ /人波/ ひとびと /人々/ ひとみ /瞳/ ひとめ /人目/ ひとり /一人/ ひどうき /非同期/ ひなた /日向/ ひなん /非難/ ひにく /皮肉/ ひの /日野/ ひのき /桧/ ひはん /批判/ ひび /日々/ ひびk /響/ ひびや /日比谷/ ひま /暇/ ひみつ /秘密/ ひめ /媛/姫/ ひめい /悲鳴/ ひも /紐/ ひゃく /百/ ひやs /冷/ ひやあせ /冷汗/ ひょう /表/豹/評/票/瓢/漂/氷/標/彪/俵/剽/憑/ ひょうか /評価/ ひょうかけっか /評価結果/ ひょうかご /評価後/ ひょうかじゅんじょ /評価順序/ ひょうかず /評価図/ ひょうかち /評価値/ ひょうかほう /評価法/ ひょうかよう /評価用/ ひょうき /表記/標記/ ひょうきほう /表記法/ ひょうぎ /評議会/ ひょうぎかい /評議会/ ひょうげん /表現/ ひょうし /表紙/拍子/ ひょうしょう /表象/表彰/ ひょうじ /表示/ ひょうじゅん /標準/ ひょうじゅんか /標準化/ ひょうじゅんご /標準語/ ひょうじゅんてき /標準的/ ひょうじょう /表情/ ひょうだい /表題/標題/ ひょうばん /評判/ ひょうへん /豹変/ ひょうへんs /豹変/ ひょうほん /標本/ ひょうめい /表明/ ひょうめん /表面/ ひょうめんせき /表面積/ ひょうろん /評論/ ひょうろんしゃ /評論社/ ひよう /費用/ ひより /日和/ ひら /平/ ひらi /開/ ひらk /開/ ひらい /平井/ ひらた /平田/ ひらの /平野/ ひらばる /平原/ ひらやま /平山/ ひりき /非力/ ひる /昼/蛭/蒜/簸/ ひるま /昼間/ ひるめし /昼飯/ ひれ /鰭/ ひれい /非礼/比例/ ひれつ /卑劣/ ひろ /裕/広/博/弘/洋/尋/寛/比呂/廣/宏/ ひろg /広/ ひろi /広/ ひろk /広/ ひろu /拾/ ひろう /疲労/ ひろうえん /披露宴/ ひろこ /浩子/ ひろし /宏/博/博史/浩/ ひろしま /広島/ ひろしまだい /広島大/ ひろせ /広瀬/ ひろふみ /寛文/弘文/ ひろみ /博美/ ひろゆき /周行/ ひん /頻/賓/貧/瀕/浜/斌/彬/品/ ひんい /品位/ ひんけつ /貧血/ ひんこん /貧困/ ひんじゃく /貧弱/ ひんど /頻度/ ひんぱん /頻繁/ び /鼻/美/眉/琵/毘/枇/微/尾/備/日/ びおんか /鼻音化/ びこう /備考/ びしょう /微少/ びしょうじょ /美少女/ びしょうねん /美少年/ びじん /美人/ びだくおん /鼻濁音/ びっくり /!/ びと /人/ びどう /微動/ びひん /備品/ びぶん /微分/ びみ /美味/ びみょう /微妙/ びゅう /謬/ びょう /秒/平/鋲/錨/苗/病/描/廟/ びょういん /病院/ びょうき /病気/ びょうげんきん /病源菌/ びよういん /美容院/ びりょう /鼻梁/ びん /瓶/敏/便/ びんじょう /便乗/ びんせん /便箋/ びんぼう /貧乏/ びんめい /便名/ びんらん /便覧/ ふ /父/負/附/阜/赴/賦/譜/芙/膚/腐/符/浮/普/斧/敷/扶/怖/府/布/冨/富/婦/夫/埠/付/不/ ふe /増/ ふi /吹/ ふk /吹/ ふm /踏/ ふn /踏/ ふr /振/触/降/ ふs /付/ ふt /降/振/ ふy /増/ ふあん /不安/ ふあんてい /不安定/ ふう /風/楓/封/ ふうけい /風景/ ふうちょう /風潮/ ふうとう /封筒/ ふうふ /夫婦/ ふうみ /風味/ ふえ /笛/ ふか /付加/負荷/不可/ ふかi /深/ ふかk /深/ ふかm /深/ ふかけつ /不可欠/ ふかさわ /深沢/ ふかざわ /深沢/ ふかのう /不可能/ ふかや /深谷/ ふかんぜん /不完全/ ふき /蕗/葺/ ふきゅう /普及/ ふきょう /布教/ ふきん /付近/ ふく /覆/幅/腹/福/服/複/復/副/伏/ ふくm /含/ ふくn /含/ ふくい /福井/ ふくおか /福岡/ ふくおかこうぎょうだいがく /福岡工業大学/ ふくおかし /福岡市/ ふくげん /復元/ ふくごう /復号/複合/ ふくさよう /副作用/ ふくざつ /複雑/ ふくざつか /複雑化/ ふくしゃ /複写/ ふくしゅ /副手/ ふくすう /複数/ ふくせい /複製/ ふくそう /服装/ ふくちょう /復調/ ふくぶ /腹部/ ふくぶくろ /福袋/ ふくもと /福本/ ふくろ /袋/ ふこう /不幸/ ふごう /符号/ ふごうか /符号化/ ふごうかく /不合格/ ふごうご /符号語/ ふさ /総/房/ ふさんか /不参加/ ふざい /不在/ ふし /節/ ふしぎ /不思議/ ふしぜん /不自然/ ふじ /富士/藤/ ふじい /藤井/ ふじさん /富士山/ ふじた /藤田/ ふじたに /藤谷/ ふじつう /富士通/ ふじみ /富士見/ ふじゅうぶん /不十分/ ふじわら /藤原/ ふずい /付随/附随/ ふせg /防/ ふせi /防/ ふせいかく /不正確/ ふそく /不足/ ふぞく /附属/付属/ ふた /二/ ふたt /二/ ふたがみ /二上/ ふたござ /双子座/ ふたたb /再/ ふたつ /二/ ふたつぎ /二木/ ふたばしゃ /双葉社/ ふたむら /二村/ ふたり /二人/ ふたん /負担/ ふだ /札/ ふだん /普段/ ふち /淵/縁/ ふちゅう /府中/ ふちょう /不調/ ふっかつ /復活/ ふっき /復帰/ ふっきゅう /復旧/ ふっきん /腹筋/ ふつ /沸/払/弗/仏/ ふつう /普通/不通/ ふつごう /不都合/ ふてき /不適/ ふてきとう /不適当/ ふてん /符点/ ふで /筆/ ふとi /太/ ふとt /太/ ふところ /懐/ ふとどk /不届/ ふとん /布団/ ふどう /浮動/ ふどうてん /不動点/浮動点/ ふな /鮒/ ふなばし /船橋/ ふにん /赴任/ ふね /船/ ふのう /不能/ ふひつよう /不必要/ ふへん /不変/ ふべん /不便/ ふまん /不満/ ふみ /文/ ふめい /不明/ ふもん /不問/ ふゆ /冬/ ふよ /付与/ ふよう /不要/ ふり /振/ ふりかえ /振替/ ふりこm /振り込/ ふりつ /府立/ ふりょう /不良/ ふるb /古/ ふるe /震/ ふるi /古/ ふるk /古/ ふるm /古/ ふるs /古/ ふるかわ /古川/ ふるさと /故郷/ ふるさとh /故郷/ ふれんぞく /不連続/ ふろ /風呂/ ふろう /不老/ ふろうちょう /不老町/ ふろく /付録/ ふろしき /風呂敷/ ふろんりしき /負論理式/ ふん /分/糞/雰/紛/粉/奮/焚/扮/憤/墳/噴/吻/ ふんいき /雰囲気/ ふんいんき /雰囲気/ ふんか /噴火/ ふんさい /粉砕/ ふんしつ /紛失/ ぶ /分/部/無/蕪/葡/舞/武/撫/侮/ ぶr /振/ ぶあつi /分厚/ ぶいん /部員/ ぶき /武器/ ぶきみ /不気味/ ぶきょく /部局/ ぶさいく /不細工/ ぶさた /無沙汰/ ぶしょ /部署/ ぶじ /無事/ ぶすう /部数/ ぶぜい /無勢/ ぶた /豚/ ぶたい /舞台/ ぶちょう /部長/ ぶっけん /物件/ ぶっし /物資/ ぶっせい /物性/ ぶったい /物体/ ぶつ /物/仏/ ぶつめつ /仏滅/ ぶつり /物理/ ぶつりがく /物理学/ ぶつりてき /物理的/ ぶつりゅう /物流/ ぶどう /葡萄/ ぶなん /無難/ ぶひん /部品/ ぶひんか /部品化/ ぶぶん /部分/ ぶぶんぐん /部分群/ ぶぶんてき /部分的/ ぶもん /部門/ ぶん /分/文/聞/ ぶんか /文化/分科/分化/ ぶんかい /分解/ ぶんかかい /分科会/ ぶんかつ /分割/ ぶんがく /文学/ ぶんがくぶ /文学部/ ぶんきょう /文京/文教/ ぶんきょうく /文京区/ ぶんけん /文献/ ぶんこ /文庫/ ぶんさん /分散/ ぶんさんかんきょう /分散環境/ ぶんさんしょり /分散処理/ ぶんし /分子/ ぶんしょ /文章/文書/ ぶんしょう /文章/ ぶんしょしょり /文書処理/ ぶんじん /文人/ ぶんせき /分析/ ぶんせつ /文節/ ぶんたい /文体/ ぶんたん /分担/ ぶんたんしゃ /分担者/ ぶんちゅう /文中/ ぶんぱい /分配/ ぶんぽう /文法/ ぶんぽうてき /文法的/ ぶんみゃく /文脈/ ぶんめい /文明/ ぶんや /分野/ ぶんり /分離/ ぶんりょう /分量/ ぶんるい /分類/ ぷん /分/ へr /減/ へt /減/経/ へい /閉/平/陛/蔽/並/柄/弊/幣/塀/兵/併/丙/ へいか /陛下/ へいがい /弊害/ へいき /平気/ へいきん /平均/ へいきんち /平均値/ へいきんちょう /平均長/ へいきんてん /平均点/ へいげん /平原/ へいこう /並行/平行/平向/ へいごう /併合/ へいさ /閉鎖/ へいにん /併任/ へいほう /閉包/平方/ へいめん /平面/ へいめんじょう /平面上/ へいよう /併用/ へいれつ /並列/ へいれつしょり /並列処理/ へいれつせい /並列性/ へいわ /平和/ へき /壁/碧/癖/僻/ へた /下手/ へび /蛇/ へや /部屋/ へら /箆/ へり /辺/ へん /変/辺/編/返/遍/篇/片/偏/ へんか /変化/ へんかん /変換/ へんかんg /変換/ へんかんりつ /変換率/ へんきゃく /返却/ へんきゃくきげん /返却期限/ へんきょく /編曲/ へんけい /変形/辺形/ へんけん /偏見/ へんげ /変化/ へんこう /変更/ へんこうてん /変更点/ へんさい /返済/ へんしゅう /編集/ へんしゅうぶ /編集部/ へんしん /返信/ へんじ /返事/ へんすう /変数/ へんすうめい /変数名/ へんせい /編成/ へんぜん /平然/ へんそう /返送/ へんそうきょく /変奏曲/ へんそく /変則/ へんとう /返答/ へんどう /変動/ へんにゅう /編入/ へんにゅうs /編入/ へんぴん /返品/ へんぶん /変分/ へんみ /辺見/ べ /辺/部/ べい /米/ べいこく /米国/ べっかく /別格/ べっかん /別館/ べっさつ /別冊/ べっし /別紙/ べっそう /別荘/ べっと /別途/ べっぴょう /別表/ べつ /別/蔑/瞥/ べつず /別図/ べつびん /別便/ べつべつ /別々/ べつめい /別名/ べに /紅/ べん /勉/鞭/弁/娩/便/ べんきょう /勉強/ べんきょうかい /勉強会/ べんぎ /便宜/ べんごし /弁護士/ べんとう /弁当/ べんべつ /弁別/ べんり /便利/ ぺーじ /頁/ ぺい /平/閉/ ほ /保/穂/輔/補/甫/歩/捕/圃/鋪/舗/帆/ ほe /吠/ ほr /掘/惣/ ほs /欲/ ほう /方/法/縫/泡/砲/放/報/鵬/鳳/飽/鋒/邦/豊/訪/褒/蜂/蓬/萌/芳/胞/縫/烹/朋/捧/抱/庖/崩/峯/峰/宝/奉/呆/包/俸/倣/ ほうt /放/ ほうい /方位/ ほうえい /放映/ ほうかつ /包括/ ほうがん /包含/ ほうき /放棄/ ほうげん /方言/ ほうこう /方向/ ほうこく /報告/ ほうこくしょ /報告書/ ほうこくじこう /報告事項/ ほうさく /方策/ ほうしき /方式/ ほうしゅう /報酬/ ほうしょく /奉職/ ほうしん /方針/ ほうじん /法人/ ほうそう /放送/包装/ ほうそく /法則/ ほうたい /包帯/ ほうち /放置/ ほうていしき /方程式/ ほうとう /本当/ ほうどう /報道/ ほうふ /豊富/ ほうぶつ /放物/ ほうぶつせん /放物線/ ほうほう /方法/ ほうほうろん /方法論/ ほうむ /法務/ ほうめん /方面/ ほうもん /訪問/ ほうりつ /法律/ ほうりつろん /法律論/ ほうろう /放浪/ ほうろうへき /放浪癖/ ほお /頬/ ほか /他/外/ ほかん /保管/ ほきゅう /補給/ ほきゅうぶっし /補給物資/ ほきゅうりょう /補給量/ ほく /北/ ほくだい /北大/ ほくと /北斗/ ほくりく /北陸/ ほけん /保険/保健/ ほけんしょう /保険証/ ほこ /盾/鉾/ ほこr /誇/ ほこう /歩行/ ほこうしゃ /歩行者/ ほご /保護/ ほごしゃ /保護者/ ほさ /補佐/ ほさか /保坂/ ほし /星/※/☆/★/ ほしくず /星屑/ ほしとりひょう /星取表/ ほしゅ /保守/ ほしょう /保証/ ほじ /保持/ ほじょ /補助/ ほずみ /穂積/ ほぜん /保全/ ほそ /細/ ほそi /細/ ほそk /細/ ほそm /細/ ほそs /細/ ほそい /細井/ ほそく /補足/ ほそじ /細字/ ほそながi /細長/ ほその /細野/ ほぞん /保存/ ほっ /発/ ほっかいどう /北海道/ ほっさ /発作/ ほっそく /発足/ ほったん /発端/ ほとけ /仏/ ほとり /辺/ ほとんd /殆/ ほとんど /殆ど/ ほど /程/ ほどう /補導/ ほどうれき /補導歴/ ほどこs /施/ ほね /骨/ ほねおr /骨折/ ほねみ /骨身/ ほのお /焔/炎/ ほゆう /保有/ ほゆうりょう /保有量/ ほり /堀/ ほりうち /堀内/ ほりかわ /堀川/ ほろ /幌/ ほん /本/翻/奔/ ほんかく /本格/ ほんかくてき /本格的/ ほんかん /本館/本艦/ ほんき /本気/ ほんぎょう /本業/ ほんけんきゅう /本研究/ ほんこう /本稿/ ほんこまごめ /本駒込/ ほんごう /本郷/ ほんしつ /本質/ ほんしつてき /本質的/ ほんしゃ /本社/ ほんしょ /本書/ ほんしょう /本章/ ほんじつ /本日/ ほんじょう /本庄/ ほんすじ /本筋/ ほんせつ /本節/ ほんせん /本線/ ほんたい /本体/ ほんだ /本田/本多/ ほんだい /本題/ ほんちょう /本町/ ほんとう /本当/ ほんにん /本人/ ほんね /本音/ ほんねん /本年/ ほんねんど /本年度/ ほんのう /本能/ ほんのうてき /本能的/ ほんば /本場/ ほんぶ /本部/ ほんぶん /本文/ ほんまち /本町/ ほんみょう /本名/ ほんもの /本物/ ほんや /本屋/ ほんやく /翻訳/ ほんらい /本来/ ほんろんぶん /本論文/ ぼ /母/暮/菩/簿/戊/慕/墓/募/模/保/ ぼいん /母音/ ぼう /某/妨/防/鉾/貿/貌/謀/膨/肪/紡/冒/棒/望/暴/房/忙/忘/帽/坊/剖/傍/亡/乏/ ぼうえい /防衛/ ぼうえいs /防衛/ ぼうえき /貿易/ ぼうけん /冒険/ ぼうこう /暴行/ ぼうこうざた /暴行沙汰/ ぼうし /防止/ ぼうそう /暴走/ ぼうだい /膨大/ ぼうとう /冒頭/ ぼうねんかい /忘年会/ ぼうり /暴利/ ぼうりょく /暴力/ ぼうりょくざた /暴力沙汰/ ぼうりょくだん /暴力団/ ぼうれい /亡霊/ ぼく /僕/木/穆/睦/牧/朴/撲/墨/卜/ ぼこう /母校/ ぼこくご /母国語/ ぼしゅう /募集/ ぼしゅうこうこく /募集広告/ ぼたい /母体/ ぼたん /釦/ ぼっとう /没頭/ ぼつ /没/勃/ ぼん /盆/凡/ ぽん /本/ ま /間/目/真/麻/魔/磨/摩/馬/眞/ まc /待/ まi /舞/ まj /交/ まk /負/巻/ まs /増/ まt /待/ まu /舞/ まz /混/ まーじゃん /麻雀/ まい /枚/毎/昧/妹/埋/舞/米/ まいr /参/ まいt /参/ まいあさ /毎朝/ まいかい /毎回/ まいご /迷子/ まいごう /毎号/ まいしゅう /毎週/ まいすう /枚数/ まいつき /毎月/ まいとし /毎年/ まいど /毎度/ まいにち /毎日/ まいねん /毎年/ まいる /哩/ まえ /前/ まえかわ /前川/ まえしょり /前処理/ まえの /前野/ まかs /任/ まがr /曲/ まき /巻/槙/牧/ まきた /真北/ まきの /牧野/ まぎr /紛/ まく /膜/幕/ まくはり /幕張/ まくら /枕/ まぐろ /鮪/ まこと /真/誠/ まさ /正/柾/雅/昌之/政/真/昌/征/ まさかず /正和/ まさし /仁/ まさはる /正晴/ まさひこ /雅彦/ まさひろ /雅洋/ まさゆき /昌之/ ましこ /益子/ まじw /交/ まじか /真近/ まじめ /真面目/ まじん /魔神/ ます /桝/鱒/益/増/升/ ますだ /増田/益田/ まずs /貧/ また /又/俣/亦/股/ またh /又/ まち /街/町/ まちがe /間違/ まちがi /間違/ まちがt /間違/ まちがu /間違/ まちこ /眞智子/ まちなか /街中/町中/ まっか /真赤/ まっしょう /抹消/ まったk /全/ まったく /全/ まったん /末端/ まつ /松/末/沫/抹/ まつい /松井/ まつうら /松浦/ まつえ /松江/ まつおか /松岡/ まつかた /松方/ まつくら /松倉/ まつざわ /松沢/ まつした /松下/ まつしま /松島/ まつじつ /末日/ まつだ /松田/ まつばら /松原/ まつび /末尾/ まつもと /松本/ まつやま /松山/ まつり /祭/ まで /迄/ まと /的/ まど /窓/ まどu /惑/ まどぐち /窓口/ まどべ /窓辺/ まなb /学/ まなn /学/ まなつ /真夏/ まなみ /真奈美/ まね /真似/ まねi /招/ まねk /招/ まひ /麻痺/ まひがし /真東/ まほう /魔法/ まぼろし /幻/ まま /侭/ まみこ /真美子/ まみなみ /真南/ まめ /豆/ まもr /守/ まもt /守/ まやく /麻薬/ まゆ /繭/ まよe /迷/ まよi /迷/ まよt /迷/ まよu /迷/ まよw /迷/ まよなか /真夜中/ まりお /真理雄/ まりこ /真理子/ まりな /満里奈/ まる /円/丸/○/●/◎/ まるおか /丸岡/ まるぜん /丸善/ まるばやし /丸林/ まるやま /丸山/ まれ /稀/ まろ /麿/ まわr /周/回/ まわs /周/回/ まわt /回/ まん /万/満/蔓/漫/慢/饅/ まんいち /万一/ まんえん /万円/ まんかい /満開/ まんが /漫画/ まんじ /卍/ まんじゅう /饅頭/ まんすい /満水/ まんせい /慢性/ まんぞく /満足/ まんてん /満点/ まんなか /真中/ まんめん /満面/ み /実/味/三/身/未/箕/巳/魅/美/見/己/ みe /見/ みk /見/ みm /見/ みn /見/ みr /見/観/ みs /見/ みt /見/満/観/ みy /見/ みz /見/ みあt /見当/ みあw /見合/ みいだs /見出/ みうち /身内/ みえ /三重/ みおt /見落/ みおとs /見落/ みかk /見掛/ みかいけつ /未解決/ みかくにん /未確認/ みかた /味方/見方/ みかみ /三上/ みかみね /三神峯/ みかんせい /未完成/ みがる /身軽/ みき /美紀/ みきお /幹雄/ みぎ /右/→/ みぎがわ /右側/ みぎて /右手/ みぎまわr /右回/ みぎようそ /右要素/ みぎよこ /右横/ みこm /見込/ みごと /見事/ みさき /岬/ みさだm /見定/ みさわ /三澤/三沢/ みしr /見知/ みしま /三島/ みじか /身近/ みじかi /短/ みじかk /短/ みじかm /短/ みじゅく /未熟/ みじゅくもの /未熟者/ みず /水/ みずた /水田/ みずたに /水谷/ みずの /水野/ みせ /店/ みぜん /未然/ みぞ /溝/ みた /三田/ みたか /三鷹/ みたに /三谷/ みだr /乱/ みだs /乱/ みち /道/路/未知/ みちがu /見違/ みちびi /導/ みちびk /導/ みっか /三日/ みっせつ /密接/ みっぺい /密閉/ みつ /蜜/密/光/ みつk /見付/ みつい /三井/ みつけつごう /密結合/ みつど /密度/ みつびし /三菱/ みつびしでんき /三菱電機/ みつもr /見積/ みつゆき /光之/ みてい /未定/ みていぎ /未定義/ みと /水戸/ みとm /認/ みとおs /見通/ みどく /未読/ みどり /緑/ みな /皆/ みなr /見慣/ みなs /皆/ みなかた /皆方/ みなこ /美奈子/ みなさま /皆様/ みなと /湊/港/ みなとく /港区/ みなみ /南/ みなみの /南野/ みなもと /源/ みにくi /醜/ みね /峯/峰/ みの /蓑/美濃/ みのr /実/ みのる /稔/實/ みはr /見張/ みはt /見張/ みはら /三原/ みぶん /身分/ みほ /三保/ みほん /見本/ みまi /見舞/ みまもr /見守/ みみ /耳/ みみもと /耳許/ みめい /未明/ みゃく /脈/ みや /宮/ みやうち /宮内/ みやぎ /宮城/ みやけ /三宅/ みやげ /土産/ みやこ /都/宮古/ みやさか /宮坂/ みやざき /宮崎/ みやした /宮下/ みやすk /見易/ みやの /宮野/ みやはら /宮原/ みやぶr /見破/ みやもと /宮本/ みょう /名/明/命/妙/ みょうごにち /明後日/ みょうじ /苗字/ みょうじん /明神/ みょうにち /明日/ みよし /三好/ みらい /未来/ みりめーとる /粍/ みりょく /魅力/ みん /眠/民/ みんぞく /民族/ みんな /皆/ む /夢/無/鵡/霧/矛/牟/務/ むi /向/ むk /向/ むいみ /無意味/ むかe /迎/ むかi /向/ むかい /向井/ むかいの /向野/ むかし /昔/ むかしつ /無過失/ むかしつせきにん /無過失責任/ むかんけい /無関係/ むく /椋/ むくw /報/ むげん /無限/ むこ /婿/ むこう /無効/ むさし /武蔵/ むさしの /武蔵野/ むさしのし /武蔵野市/ むし /無視/虫/ むしょう /無償/無性/ むじゅん /矛盾/ むじょうけん /無条件/ むすb /結/ むすn /結/ むすう /無数/ むすこ /息子/ むすめ /娘/ むずかs /難/ むせいか /無声化/ むせいげん /無制限/ むせきにん /無責任/ むせん /無線/ むだ /無駄/ むち /無知/ むちゃ /無茶/ むづかs /難/ むね /旨/胸/宗/ むねん /無念/ むのうしゃ /無能者/ むひょうじょう /無表情/ むぼう /無謀/ むよう /無用/ むら /村/ むらい /村井/ むらかみ /村上/ むらさき /紫/ むらた /村田/ むり /無理/ むりょう /無料/ むりょく /無力/ むれ /群/ むろまち /室町/ むろらん /室蘭/ め /目/女/茅/眼/ めs /召/ めい /名/明/命/迷/姪/鳴/銘/盟/冥/ めいr /滅入/ めいかく /明確/ めいき /明記/ めいきょく /名曲/ めいぎ /名義/ めいさい /明細/ めいさいしょ /明細書/ めいさくげきじょう /名作劇場/ めいし /名詞/名刺/ めいしょ /名所/ めいしょう /名称/ めいじ /明示/明治/ めいじてき /明示的/ めいじや /明治屋/ めいだい /命題/ めいだいへんすう /命題変数/ めいちゅう /命中/ めいてつ /名鉄/ めいはく /明白/ めいぶつ /名物/ めいぼ /名簿/ めいもく /名目/ めいよ /名誉/ めいれい /命令/ めいろ /迷路/ めいわく /迷惑/ めがみ /女神/ めぐm /恵/ めぐろ /目黒/ めぐろく /目黒区/ めざs /目指/ めし /飯/ めす /牝/♀/ めずらs /珍/ めだt /目立/ めだまやき /目玉焼/ めった /滅多/ めつ /滅/ めつk /目付/ めど /目途/ めやす /目安/ めん /面/麺/緬/綿/棉/免/ めんきょ /免許/ めんけつごう /面結合/ めんしき /面識/ めんじょ /免除/ めんせき /面積/ めんせつ /面接/ めんどう /面倒/面堂/ めんめん /面々/ めんれんけつ /面連結/ も /茂/母/模/摸/ もc /持/ もe /燃/ もr /盛/漏/ もt /持/盛/ もy /燃/ もう /蒙/耗/網/盲/猛/毛/孟/妄/ もうk /設/儲/ もうs /申/ もうしあg /申し上/ もうしこみしょ /申込書/ もうしで /申し出/ もうしわけ /申し訳/ もうそう /妄想/ もうだ /猛打/ もうで /詣/ もうら /網羅/ もうりょう /魍魎/ もく /目/木/杢/黙/ もくし /目指/ もくじ /目次/ もくせい /木星/ もくてき /目的/ もくてきご /目的語/ もくひょう /目標/ もくようび /木曜日/ もくろく /目録/ もけい /模型/ もじ /文字/ もじじょうほう /文字情報/ もじれつ /文字列/ もち /餅/持/ もちi /用/ もちづき /望月/ もちろん /勿論/勿/ もっとm /最/尤/ もっとも /尤も/ もっぱr /専/ もつ /物/ もと /下/本/元/基/許/素/ もとd /基/ もとm /求/ もとz /基/ もとおか /元岡/ もとはし /本橋/ もとまち /元町/ もともと /元々/ もどr /戻/ もどs /戻/ もどt /戻/ もなか /最中/ もの /物/者/ ものがたり /物語/ ものごと /物事/ もはや /最早/ もはん /模範/ もみ /籾/ もみじ /紅葉/ もも /桃/ ももこ /桃子/ もよr /最寄/ もよう /模様/ もらe /貰/ もらi /貰/ もらt /貰/ もらu /貰/ もらw /貰/ もり /森/守/盛/杜/ もりおか /盛岡/ もりかわ /森川/ もりした /森下/ もろ /諸/ もろもろ /諸々/ もん /問/文/門/紋/悶/ もんがいかん /門外漢/ もんく /文句/ もんしょう /紋章/ もんだい /問題/ もんだいかいけつ /問題解決/ もんだいじ /問題児/ もんだいていき /問題提起/ もんだいてん /問題点/ もんぶ /文部/ もんぶしょう /文部省/ もんめ /匁/ や /屋/家/夜/矢/弥/野/耶/爺/冶/也/谷/↓/←/→/↑/八/彌/哉/ やi /焼/ やk /焼/ やm /止/ やs /痩/ やかん /夜間/ やき /夜気/ やきとり /焼き鳥/ やきとりや /焼き鳥屋/ やきにく /焼肉/ やきゅう /野球/ やぎ /八木/柳/ やぎやま /八木山/ やく /訳/役/約/薬/躍/厄/繹/ やくいん /役員/ やくがくぶ /薬学部/ やくご /訳語/ やくしまる /薬師丸/ やくしゃ /訳者/ やくしょ /役所/ やくすう /約数/ やくそう /薬草/ やくそく /約束/ やくたt /役立/ やくだt /役立/ やくちゅう /訳注/ やくぶん /約分/ やくほん /訳本/ やくわり /役割/ やさs /易/優/ やしなu /養/ やしろ /社/八代/ やじ /野次/ やじゅう /野獣/ やじるし /矢印/↓/↑/→/←/ やす /康/安/靖/泰/ やすi /安/易/ やすk /安/易/ やすm /休/ やすn /休/ やすs /安/ やすい /靖/安井/ やすうr /安売/ やすこ /靖子/康子/ やすざけ /安酒/ やすし /靖/康/ やすだ /安田/ やすひこ /康彦/靖彦/ やすもと /安本/ やすよし /康善/ やせい /野生/ やせいみ /野生味/ やっかい /厄介/ やっこ /奴/ やつ /奴/ やとu /雇/ やど /宿/ やなぎ /柳/ やね /屋根/ やの /矢野/ やばん /野蛮/ やひ /野卑/ やぶ /薮/ やぶr /破/敗/ やま /山/ やまうち /山内/ やまかげ /山影/ やまかみ /山上/ やまがた /山形/ やまがみ /山上/ やまぎし /山岸/ やまぐち /山口/ やまざき /山崎/ やました /山下/ やましな /山科/ やまだ /山田/ やまなし /山梨/ やまなしけん /山梨県/ やまむら /山村/ やまもと /山本/ やみ /闇/ やよい /弥生/ やり /鑓/矢理/ やろう /野郎/ ゆ /諭/油/由/輸/癒/愈/愉/湯/ ゆk /行/ ゆr /揺/ ゆい /由/唯/ ゆいいつ /唯一/ ゆいごん /遺言/ ゆいしょ /由緒/ ゆう /優/由/裕/夕/有/融/雄/郵/邑/遊/誘/祐/猷/猶/涌/湧/柚/揖/憂/悠/幽/宥/友/勇/佑/右/ ゆうs /有/ ゆうい /有為/ ゆううつ /憂鬱/ ゆうえき /有益/ ゆうが /優雅/ ゆうがた /夕方/ ゆうき /勇気/有機/ ゆうきぶつ /有機物/ ゆうげん /有限/ ゆうげんかい /有限回/ ゆうげんぐん /有限群/ ゆうげんこ /有限個/ ゆうこ /裕子/ ゆうこう /有効/有向/ ゆうこうか /有効化/ ゆうごう /融合/ ゆうし /勇史/有志/ ゆうしゅう /優秀/ ゆうしょう /優勝/ ゆうしょく /夕食/ ゆうじ /裕司/ ゆうじょう /友情/ ゆうじん /友人/ ゆうすけ /祐介/ ゆうせい /郵政/ ゆうせいしょう /郵政省/ ゆうせん /優先/ ゆうせんじゅんい /優先順位/ ゆうせんど /優先度/ ゆうそう /郵送/ ゆうづう /融通/ ゆうどう /誘導/ ゆうはつ /誘発/ ゆうはん /夕飯/ ゆうびん /郵便/〒/ ゆうびんきょく /郵便局/ ゆうびんばんごう /〒/郵便番号/ ゆうびんぶつ /郵便物/ ゆうめい /有名/ ゆうめいじん /有名人/ ゆうよう /有用/ ゆうらくちょう /有楽町/ ゆうり /有利/ ゆうりょう /有料/ ゆうりょく /有力/ ゆうわく /誘惑/ ゆえn /故/ ゆか /床/ ゆかわ /湯河/ ゆがm /歪/ ゆがn /歪/ ゆき /雪/之/由貴/由樹/由記/幸/行/ ゆきのり /行則/ ゆきよし /幸義/ ゆくえ /行方/ ゆずr /譲/ ゆずt /譲/ ゆずる /譲/ ゆたk /豊/ ゆたか /裕/ ゆだn /委/ ゆにゅう /輸入/ ゆび /指/ ゆびさき /指先/ ゆびわ /指輪/ ゆびわものがたり /指輪物語/ ゆみ /弓/ ゆみこ /弓子/由美子/ ゆめ /夢/ ゆめじ /夢二/ ゆやま /湯山/ ゆらい /由来/ ゆるs /許/ よ /代/世/余/夜/予/預/輿/誉/与/ よb /呼/ よi /良/酔/ よk /良/ よm /読/呼/ よn /読/呼/ よr /寄/因/依/ よs /寄/良/ よt /酔/寄/ よw /酔/ よう /用/様/要/陽/遥/葉/養/踊/謡/蓉/耀/羊/窯/熔/溶/洋/楊/曜/擁/揺/揚/庸/容/妖/幼/傭/雍/ ようn /様/ ようs /要/ ようい /用意/容易/ よういせい /容易性/ よういち /陽一/ よういん /要因/ ようがし /洋菓子/ ようき /容器/ ようきゅう /要求/ ようきゅうしよう /要求仕様/ ようけん /用件/ ようこ /葉子/陽子/ ようこう /要項/ ようご /用語/ ようし /用紙/ ようしき /様式/ ようしゃ /容赦/ ようしょ /洋書/ ようじ /用事/ ようじん /用心/ ようす /様子/ ようせい /要請/妖精/ ようせん /用箋/ ようそ /要素/ ようそう /様相/ ようそうろんり /様相論理/ ようたい /容体/ ようち /幼稚/ ようちえん /幼稚園/ ようてん /要点/ ようと /用途/ ようど /用度/ ようひん /用品/ ようび /曜日/ ようほう /用法/ ようぼう /要望/ ようやく /要約/ ようりょう /容量/要領/ よきん /預金/ よぎ /余儀/ よく /翼/翌/浴/沃/欲/抑/慾/ よくじつ /翌日/ よくせい /抑制/ よくばr /欲張/ よくぼう /欲望/ よけい /余計/ よけん /予見/ よげん /予言/ よこ /横/─/ よこう /予行/予稿/ よこうち /横内/ よこく /予告/ よこすか /横須賀/ よこせん /横線/ よこた /横田/ よこて /横手/ よこはま /横浜/ よこもじ /横文字/ よこやま /横山/ よごr /汚/ よさん /予算/ よし /由/吉/嘉/義/好/良/芳/ よしかわ /吉川/ よしき /佳樹/ よしだ /吉田/ よせがk /寄書/ よそう /予想/ よそく /予測/ よだん /余談/ よち /予知/ よてい /予定/ よど /淀/ よなか /夜中/ よね /米/ よねざわ /米澤/米沢/ よねだ /米田/ よのなか /世の中/ よは /余波/ よび /予備/ よびぐん /予備軍/ よびだs /呼出/ よぶん /余分/ よほど /余程/ よぼう /予防/ よみかk /読み書/ よみこm /読み込/読込/ よみせ /夜店/ よみて /読み手/ よめ /夜目/嫁/ よやく /予約/ よゆう /余裕/ より /和/ よりどころ /拠所/ よりょく /余力/ よる /夜/ よろs /宜/ よろい /鎧/ よろこb /喜/慶/ よろこn /喜/ よろず /万/ よわi /弱/ よわk /弱/ よわm /弱/ よわs /弱/ よわt /弱/ よん /四/ よんかい /四階/ ら /等/裸/螺/羅/ らい /来/雷/頼/莱/ らいげつ /来月/ らいこう /来航/ らいしゃ /来社/ らいしゅう /来週/ らいしゅん /来春/ らいてん /来店/ らいにち /来日/ らいねん /来年/ らいねんど /来年度/ らく /楽/落/酪/絡/洛/ らくさ /落差/ られつ /羅列/ らん /覧/欄/嵐/乱/蘭/藍/濫/卵/ らんすう /乱数/ らんぼう /乱暴/ り /裏/里/離/理/利/裡錙/痢/裡/璃/梨/李/履/吏/ りえき /利益/ りか /理科/ りかい /理解/ りかがく /理化学/ りかだい /理科大/ りがく /理学/ りがくけい /理学系/ りがくはくし /理学博士/ りがくぶ /理学部/ りき /力/ りきがく /力学/ りく /陸/ りくつ /理屈/ りけい /理経/理系/ りけん /理研/ りこう /理工/ りこうがく /理工学/ りこうがくぶ /理工学部/ りさん /離散/ りし /利子/ りじ /理事/ りじゅん /利潤/ りせい /理性/ りそう /理想/ りっきょう /立教/ りっこうは /立候補/ りったい /立体/ りっぱ /立派/ りっぽう /立方/ りっぽうがそ /立方画素/ りっぽうこうし /立方格子/ りっぽうたい /立方体/ りつ /率/立/葎/律/ りてん /利点/ りはく /理博/ りゃく /略/掠/ りゃっきほう /略記法/ りゅう /流/隆/立/龍/竜/粒/硫/留/琉/溜/劉/ りゅうがく /留学/ りゅうがくせい /留学生/ りゅうきゅう /琉球/ りゅうぎ /流儀/ りゅうこう /流行/ りゅうしつ /流出/ りゅうしゅつ /流出/ りゅうつう /流通/ りゅうど /粒度/ りゆう /理由/ りょ /虜/旅/慮/侶/ りょう /量/寮/両/領/陵/遼/諒/良/糧/稜/瞭/療/猟/涼/梁/料/凌/僚/亮/了/ りょうあし /両足/ りょういき /領域/ りょうか /量化/ りょうかい /了解/ りょうがわ /両側/ りょうきん /料金/ りょうこう /良好/ りょうしゃ /両者/ りょうしょう /了承/ りょうしん /両親/ りょうじつ /両日/ りょうて /両手/ りょうへん /両辺/ りょうほう /両方/療法/ りょうめ /両目/ りょうめん /両面/ りょうり /料理/ りょうりつ /両立/ りょく /力/緑/ りょこう /旅行/ りょひ /旅費/ りよう /利用/ りようけん /利用研/ りようしゃ /利用者/ りようほうほう /利用方法/ りれき /履歴/ りれきしょ /履歴書/ りろん /理論/ りろんてき /理論的/ りん /隣/輪/麟/鱗/臨/琳/燐/淋/林/厘/倫/鈴/ りんかい /臨海/ りんかく /隣隔/輪郭/ りんき /臨機/ りんきおうへん /臨機応変/ りんこう /輪講/ りんじ /臨時/ りんじょう /臨場/ りんせつ /隣接/ る /流/瑠/留/ るい /涙/類/累/塁/ るいじ /類似/ るいすい /類推/ るす /留守/ るすちゅう /留守中/ るすばん /留守番/ れい /例/齢/麗/霊/零/隷/鈴/苓/礼/玲/怜/嶺/励/冷/伶/令/ れいがい /例外/ れいき /冷気/ れいこ /玲子/ れいじ /玲二/ れいぜん /冷然/ れいだい /例題/ れいねん /例年/ れいふう /冷風/ れいふうき /冷風機/ れいふく /礼服/ れいぶん /例文/ れき /歴/暦/ れきし /歴史/ れっき /列記/ れっきょ /列挙/ れっしゃ /列車/ れつ /列/裂/烈/劣/ れん /恋/蓮/錬/錬/連/聯/練/簾/煉/漣/憐/廉/攣/ れんきゅう /連休/ れんけつ /連結/ れんけつせい /連結性/ れんこう /連行/ れんごう /連合/ れんさい /連載/ れんしゅう /練習/ れんせつ /連接/ れんそう /連想/ れんぞく /連続/ れんぞくち /連続値/ れんぞくてき /連続的/ れんだん /連弾/ れんどう /連動/ れんぱつ /連発/ れんぽう /連邦/ れんぽうかいぎ /連邦会議/ れんぽうぐん /連邦軍/ れんらく /連絡/ れんらくかい /連絡会/ れんらくさき /連絡先/ れんらくせん /連絡船/ れんりつ /連立/ ろ /露/路/賂/炉/櫓/魯/呂/ ろう /朗/郎/蝋/聾/老/篭/狼/牢/漏/浪/榔/楼/弄/廊/婁/労/ ろうか /廊下/ ろうかい /老獪/ ろうどう /労働/ ろうどく /朗読/ ろうひ /浪費/ ろうりょく /労力/ ろく /緑/録/肋/禄/麓/六/ ろくが /録画/ ろこつ /露骨/ ろじ /路地/ ろせん /路線/ ろっこう /六甲/ ろっこうだい /六甲台/ ろっぽんぎ /六本木/ ろっぽんまつ /六本松/ ろん /論/ ろんがい /論外/ ろんぎ /論議/ ろんぶん /論文/ ろんぶんし /論文誌/ ろんり /論理/ ろんりがく /論理学/ ろんりきごう /論理記号/ ろんりしき /論理式/ ろんりてき /論理的/ わ /話/輪/和/倭/羽/我/ わb /詫/ わk /分/ わr /割/ わい /歪/賄/隈/ わか /若/ わかi /若/ わかk /若/ わかr /判/解/分/ わかs /若/ わかt /判/解/分/ わかい /和賀井/ わかばやし /若林/ わかまつ /若松/ わが /我/ わがくに /我が国/ わき /脇/ わきやま /脇山/ わく /枠/惑/ わくせい /惑星/ わけ /訳/ わざ /技/ わし /鷲/儂/ わしつ /和室/ わしゃ /話者/ わじま /和嶋/ わすr /忘/ わずk /僅/ わずらw /煩/ わせだ /早稲田/ わせだだい /早稲田大/ わた /渡/ わたr /渡/亘/亙/ わたs /渡/ わたt /渡/ わたくし /私/ わたし /私/ わたしこじん /私個人/ わたしじしん /私自身/ わたしたち /私達/ わたなべ /渡辺/ わだ /和田/ わだい /話題/ わに /鰐/ わふう /和風/ わやく /和訳/ わら /藁/原/ わらe /笑/ わらi /笑/ わらt /笑/ わらu /笑/ わらw /笑/ わらび /蕨/ わり /割/ わりあt /割当/ わりあい /割合/ わりこm /割込/ わりこn /割り込/ わりばし /割箸/ わるi /悪/ わるk /悪/ わるs /悪/ わるくち /悪口/ われ /我/ われら /我等/ われわれ /我々/ わん /腕/碗/湾/椀/ わんがん /湾岸/ ng-1.5beta1/bin/SKG-JISYO.S100644 1750 1750 141713 7126003715 13734 0ustar amurausers* /*/ & /&/ # /#/ $ /$/ . /。/./,/./ , /、/,/ ... /‥/…/ - /―/ = /ー/ ? /?/?/ ! /!/!/ [ /「/『/[/【/〔/ ] /」/』/]/】/〕/ { /{/ } /}/ ( /)/ ) /(/ > />/》/〉/ < /</《/〈/ ~ /〜/ ̄/ @ /@/ Greek /Α/Β/Γ/Δ/Ε/Ζ/Η/Θ/Ι/Κ/Λ/Μ/Ν/Ξ/Ο/Π/Ρ/Σ/Τ/Υ/Φ/Χ/Ψ/Ω/ Russia /А/Б/В/Г/Д/Е/Ё/Ж/З/И/Й/К/Л/М/Н/О/П/Р/С/Т/У/Ф/Х/Ц/Ч/Ш/Щ/Ъ/Ы/Ь/Э/Ю/Я/ greek /α/β/γ/δ/ε/ζ/η/θ/ι/κ/λ/μ/ν/ξ/ο/π/ρ/σ/τ/υ/φ/χ/ψ/ω/ repeat /々/ russia /а/б/в/г/д/е/ё/ж/з/и/й/к/л/м/н/о/п/р/с/т/у/ф/х/ц/ч/ш/щ/ъ/ы/ь/э/ю/я/ yen /¥/ あ /阿/娃/唖/亜/ あe /合/ あg /挙/揚/ あi /合/ あk /飽/ あo /合/ あr /有/在/ あt /当/有/挙/ あu /合/逢/ あw /合/ あい /愛/哀/相/姶/挨/ あいかわr /相変/ あいさつ /挨拶/ あいだ /間/ あいて /相手/ あいよう /愛用/ あおi /青/ あおk /青/ あおい /葵/ あか /赤/垢/ あかi /赤/ あかn /赤/ あかね /茜/ あき /秋/穐/ あきらm /諦/ あく /悪/渥/握/ あくい /悪意/ あさ /朝/ あさi /浅/ あさk /浅/ あさひ /朝日/旭/ あざ /字/ あし /足/芦/葦/ あしがら /足柄/ あした /明日/ あじ /味/鯵/ あす /明日/ あずk /預/ あずさ /梓/ あずま /東/ あそb /遊/ あそn /遊/ あたe /与/ あたい /値/ あたかも /宛/ あたたk /暖/ あたたm /暖/ あたま /頭/ あたらs /新/ あたり /辺/ あっしゅく /圧縮/ あっとうてき /圧倒的/ あつ /篤/斡/圧/ あつi /熱/暑/厚/ あつk /厚/熱/暑/ あつかe /扱/ あつかi /扱/ あつかo /扱/ あつかt /扱/ あつかu /扱/ あつかw /扱/ あて /宛/ あてさき /宛先/ あと /後/ あな /穴/ あなた /貴方/ あに /兄/ あね /姉/姐/ あぶ /虻/ あぶn /危/ あぶら /油/ あま /天/甘/ あまi /甘/ あめ /雨/飴/ あや /文/綾/絢/ あやまr /誤/謝/ あやまt /誤/謝/ あゆ /鮎/ あゆm /歩/ あらe /洗/ あらi /洗/ あらt /新/洗/ あらu /洗/ あらかじめ /予/ あらし /嵐/ あらわr /現/ あらわs /現/ ありがたi /有難/ ありがとu /有難/ ある /或/ あるi /歩/ あるk /歩/ あるじ /主/ あわ /泡/粟/ あわせ /袷/ あん /安/案/暗/杏/鞍/闇/按/庵/ あんか /安価/ あんしん /安心/ あんぜん /安全/ あんない /案内/ い /位/為/意/井/唯/如/偉/異/亥/医/遺/違/謂/衣/萎/胃/緯/維/移/畏/椅/易/慰/惟/尉/威/委/夷/囲/依/伊/以/ いe /言/ いi /言/ いk /行/ いo /言/ いr /入/居/ いt /言/行/ いu /言/云/ いw /言/ いえ /家/ いか /以下/ いかr /怒/ いかt /怒/ いかが /如何/ いかん /如何/ いがい /以外/意外/ いき /息/域/ いきおi /勢/ いく /郁/育/ いくr /幾/ いくt /幾/ いくさ /戦/ いけん /意見/ いこう /以降/移行/意向/ いこま /生駒/ いご /以後/ いし /医師/ いしき /意識/ いしそつう /意志疎通/ いしばし /石橋/ いしゃ /医者/ いしょく /移植/ いじ /維持/ いじょう /以上/異常/ いず /伊豆/ いせん /緯線/ いぜん /以前/ いそ /磯/ いそg /急/ いそがs /忙/ いぞん /依存/ いた /板/ いたi /痛/ いたm /痛/ いたn /痛/ いたr /至/ いたs /致/ いただi /頂/戴/ いただk /頂/戴/ いだi /抱/ いだk /抱/ いち /一/位置/壱/ いちおう /一応/ いちぎょう /一行/ いちげん /一言/ いちじ /一時/ いちど /一度/ いちばん /一番/ いちぶ /一部/ いちらん /一覧/ いっかい /一回/ いっき /一気/ いっけん /一見/ いっこう /一行/ いっさくねん /一昨年/ いっしゅ /一種/ いっしょ /一緒/ いったい /一体/ いっち /一致/ いってい /一定/ いっとき /一時/ いっぱつ /一発/ いっぱん /一般/ いっぱんてき /一般的/ いっぽう /一方/ いっぽん /一本/ いつ /逸/溢/ いと /意図/ いどう /移動/ いなか /田舎/ いぬ /犬/ いね /稲/ いのr /祈/ いのち /命/ いはん /違反/ いばら /茨/ いま /今/ いまだ /未/ いみ /意味/ いも /芋/ いらい /以来/依頼/ いりぐち /入口/ いろ /色/ いわし /鰯/ いん /音/引/印/隠/陰/因/韻/院/蔭/胤/淫/飲/姻/員/咽/允/ いんさつ /印刷/ いんしょう /印象/ いんじ /印字/ いんたい /引退/ いんち /吋/ いんよう /引用/ いんようかいし /引用開始/ う /雨/右/有/鵜/卯/迂/羽/烏/宇/ うi /浮/ うk /受/浮/ うm /埋/ うr /売/ うt /売/打/ うい /初/ うえ /上/ うお /魚/ うかがu /窺/ うけとりにん /受取人/ うごi /動/ うごk /動/ うし /丑/ うしなu /失/ うしろ /後/ うじ /氏/ うす /臼/碓/ うすi /薄/ うすk /薄/ うすr /薄/ うず /渦/ うそ /嘘/ うた /歌/唄/ うち /内/家/ うちがわ /内側/ うつ /蔚/欝/ うつr /移/ うつs /移/映/ うつt /移/ うつくs /美/ うで /腕/ うなぎ /鰻/ うば /姥/ うばt /奪/ うばu /奪/ うまや /厩/ うみ /海/ うら /裏/浦/ うらなi /占/ うり /瓜/ うるう /閏/ うるうどし /閏年/ うれs /嬉/ うわさ /噂/ うん /云/運/雲/ うんえい /運営/ うんてん /運転/ うんてんしゅ /運転手/ うんよう /運用/ え /回/会/絵/重/恵/餌/荏/ えr /得/ えt /得/ えい /英/映/影/鋭/詠/衛/頴/穎/盈/瑛/洩/泳/永/栄/曳/嬰/営/叡/ えいえん /永遠/ えいが /映画/ えいきょう /影響/ えいぎょう /営業/ えいぎょうぶ /営業部/ えいぎょうほんぶ /営業本部/ えいご /英語/ えいりもくてき /営利目的/ えがi /描/ えがk /描/ えき /駅/役/益/疫/液/易/ えきめい /駅名/ えつ /閲/越/謁/悦/ えのき /榎/ えらb /選/ えらi /偉/ えらn /選/ えん /円/宛/延/煙/淵/演/塩/鴛/鉛/遠/薗/苑/艶/縁/猿/燕/焔/炎/沿/援/掩/怨/宴/奄/堰/園/厭/ えんぎ /演技/ えんそう /演奏/ お /汚/於/ おe /終/追/ おi /置/追/負/ おk /起/置/ おr /降/折/ おs /押/惜/ おt /落/折/負/追/ おu /負/追/ おw /終/追/ おい /甥/ おう /横/桜/応/黄/鴎/鴬/襖/翁/王/殴/欧/旺/押/往/奥/央/凹/ おうz /応/ おうしょう /王将/ おうとう /応答/ おうぼ /応募/ おうよう /応用/ おおi /多/ おおk /大/多/ おおm /多/ おおs /多/ おおいまちせん /大井町線/ おおえん /応援/ おおごえ /大声/ おおごと /大事/ おおさか /大阪/ おおさかだいがく /大阪大学/ おおはば /大幅/ おおむかし /大昔/ おおむね /概/ おおやけ /公/ おか /丘/岡/ おかs /犯/ おがわ /小川/ おき /沖/ おぎ /荻/ おく /屋/奥/臆/憶/億/ おくr /送/遅/ おくt /送/ おけ /桶/ おさ /長/ おさm /収/ おしe /教/ おす /牡/ おそi /遅/ おそk /遅/ おそr /恐/ おそs /遅/ おつ /乙/ おと /音/ おとこ /男/ おとな /大人/ おどろi /驚/ おどろk /驚/ おなz /同/ おぼe /覚/ おも /主/面/ おもe /思/ おもi /思/重/ おもm /重/ おもs /重/ おもt /思/重/ おもu /思/ おもw /思/ おもい /思/ おもしろ /面白/ おもしろi /面白/ おもしろk /面白/ おもしろs /面白/ おもて /表/面/ おや /親/ およb /及/ おれ /俺/ おろし /卸/ おわr /終/ おわり /終/ おん /音/御/穏/温/恩/ おんがく /音楽/ おんな /女/ か /下/日/歌/化/家/個/仮/花/夏/火/暇/香/靴/果/蚊/霞/過/迦/貨/嘩/課/蝦/菓/華/荷/茄/苛/箇/稼/禾/禍/珂/河/架/科/寡/嫁/嘉/可/加/佳/価/伽/何/ かe /変/替/買/ かi /書/買/ かk /書/掛/欠/ かm /噛/ かn /噛/ かo /買/ かr /借/苅/刈/ かs /貸/加/ かt /買/勝/ かu /買/ かw /買/替/ かい /回/皆/会/絵/改/海/階/懐/壊/魁/解/介/怪/開/甲斐/貝/蟹/芥/界/灰/械/晦/拐/戒/恢/悔/快/廻/塊/ かいいん /会員/ かいかん /快感/ かいがい /海外/ かいぎょう /改行/ かいけつ /解決/ かいごう /会合/ かいさい /開催/ かいさつ /改札/ かいし /開始/ かいしゃ /会社/ かいしゃく /解釈/ かいしゅう /回収/ かいしょう /解消/ かいじょ /解除/ かいじょう /会場/ かいすう /回数/ かいせき /解析/ かいせつ /解説/ かいせん /回線/ かいせんぞくせい /回線属性/ かいぜん /改善/ かいそう /階層/ かいぞう /改造/ かいてき /快適/ かいてん /回転/ かいとう /回答/ かいとうしゃ /回答者/ かいはつ /開発/ かいはつぶ /開発部/ かいへん /改変/ かいほう /開放/ かいらん /回覧/ かいり /浬/ かいりょう /改良/ かいわ /会話/ かえr /帰/ かえs /返/帰/ かえt /帰/返/ かえる /蛙/ かお /顔/ かおr /香/ かおる /馨/ かかe /抱/ かかw /関/ かかく /価格/ かがく /科学/ かがみ /鏡/ かき /下記/蛎/柿/垣/ かぎ /鍵/鈎/ かぎr /限/ かぎt /限/ かぎり /限/ かく /確/各/客/覚/革/隔/閣/郭/較/赫/角/穫/獲/殻/核/格/撹/拡/廓/嚇/劃/ かくr /隠/ かくご /覚悟/ かくしゃ /各社/ かくしゅ /各種/ かくじつ /確実/ かくだい /拡大/ かくちょう /拡張/ かくとく /獲得/ かくにん /確認/ かくのう /格納/ かくほ /確保/ かくりつ /確率/確立/ かぐら /神楽/ かけ /掛/ かげ /陰/影/ かげん /加減/ かこ /過去/ かさ /笠/ かさn /重/ かさん /加算/ かし /菓子/歌詞/橿/樫/ かしゅ /歌手/ かしら /頭/ かしわ /栢/ かじ /梶/ かじか /鰍/ かず /数/ かせg /稼/ かせつ /仮説/ かぜ /風/風邪/ かぞく /家族/ かた /方/形/型/肩/潟/ かたr /語/ かたt /語/ かたい /難/ かたかな /片仮名/ かたき /敵/ かたち /形/ かち /価値/ かっこ /括弧/ かって /勝手/ かっぱつ /活発/ かつ /割/滑/且/轄/褐/葛/渇/活/括/恰/喝/ かつお /鰹/ かつどう /活動/ かつやく /活躍/ かつよう /活用/ かてい /仮定/過程/ かどう /稼働/ かどくせい /可読性/ かどまつ /角松/ かなs /悲/ かなu /叶/ かなかんじへんかん /仮名漢字変換/ かなめ /要/ かならz /必/ かにゅう /加入/ かね /金/ かねつ /加熱/ かの /彼/ かのう /可能/ かのうせい /可能性/ かのじょ /彼女/ かば /樺/椛/ かばん /鞄/ かふんしょう /花粉症/ かぶ /株/ かぶしきがいしゃ /株式会社/ かぶと /兜/ かべ /壁/ かま /鎌/釜/蒲/ かまe /構/ かまi /構/ かまu /構/ かまw /構/ かまど /竃/ かみ /上/紙/髪/神/ かめい /仮名/ かめん /仮面/ かも /鴨/ かや /萱/茅/ かゆ /粥/ かよe /通/ かよi /通/ かよo /通/ かよt /通/ かよu /通/ かよw /通/ から /空/ からm /絡/ からn /絡/ かり /仮/ かりゅう /下流/ かるi /軽/ かるk /軽/ かるs /軽/ かれ /彼/ かわ /側/川/ かわr /変/ かわt /変/ かわいg /可愛/ かわいi /可愛/ かわいk /可愛/ かわいr /可愛/ かわら /瓦/ かん /間/換/巻/感/甘/観/完/函/関/舘/館/韓/陥/閑/鑑/還/貫/諌/莞/艦/肝/翰/缶/緩/簡/管/竿/看/監/環/潅/澗/漢/汗/歓/款/棺/桓/柑/敢/憾/慣/患/幹/干/寛/官/姦/堪/喚/勧/勘/刊/寒/冠/侃/乾/ かんs /関/ かんz /感/ かんかく /感覚/ かんがe /考/ かんきょう /環境/ かんきょうせってい /環境設定/ かんきょうへんすう /環境変数/ かんけい /関係/ かんけいせつ /関係節/ かんげい /歓迎/ かんこく /韓国/ かんさい /関西/ かんさいちく /関西地区/ かんさいちほう /関西地方/ かんしゃ /感謝/ かんしゅう /慣習/ かんしん /感心/ かんじ /漢字/幹事/ かんじょう /感情/ かんすう /関数/ かんすうめい /関数名/ かんせい /完成/ かんせつてき /間接的/ かんぜん /完全/ かんそう /感想/ かんそく /観測/ かんたん /簡単/ かんちがi /勘違/ かんてん /観点/ かんとう /関東/ かんとく /監督/ かんどう /感動/ かんぺき /完璧/ かんり /管理/ かんりしゃ /管理者/ かんりにん /管理人/ かんりょう /完了/ かんれん /関連/ かんんけつへん /完結編/ が /我/茅/駕/餓/雅/賀/蛾/芽/臥/画/牙/峨/俄/ がい /外/街/害/概/骸/鎧/該/蓋/碍/涯/慨/崖/咳/劾/凱/ がいかい /外界/ がいこく /外国/ がいじ /外字/ がいとう /該当/ がいねん /概念/ がいぶ /外部/ がいよう /概要/ がく /楽/額/学/顎/岳/ がくせい /学生/ がくぶ /学部/ がぞう /画像/ がぞうしょり /画像処理/ がぞうじょうほう /画像情報/ がっかい /学会/ がっかいし /学会誌/ がっこう /学校/ がっしょう /合唱/ がっち /合致/ がつ /月/ がまん /我慢/ がめん /画面/ がん /元/顔/丸/含/願/頑/雁/贋/翫/岩/眼/癌/玩/巌/岸/ がんばr /頑張/ がんばt /頑張/ き /気/既/木/机/基/記/機/危/起/祈/寄/亀/鬼/騎/飢/輝/軌/貴/規/徽/紀/稀/季/畿/汽/毅/帰/棄/棋/期/旗/揮/忌/幾/希/岐/嬉/奇/器/喜/伎/企/ きe /消/ きi /聞/聴/効/ きk /聞/聴/効/ きm /決/来/ きr /切/ きt /来/切/ きいろ /黄色/ きおく /記憶/ きおくせんめい /記憶鮮明/ きかい /機械/機会/ きかく /企画/規格/ きかくぶ /企画部/ きかん /期間/ きがる /気軽/ きぎょう /企業/ きく /鞠/菊/掬/ きけん /危険/ きこう /機構/ きごう /記号/〓/↓/↑/←/→/〒/※/▼/▽/▲/△/■/□/◆/◇/◎/●/○/★/☆/§/@/*/&/#/%/£/¢/$/¥/℃/″/′/°/♀/♂/∴/∞/≧/≦/>/</≠/=/÷/×/±/−/+/】/【/』/『/」/「/》/《/〉/〈/}/{/]/[/〕/〔/)/(/”/“/’/‘/‥/…/|/‖/〜/\///‐/―/ー/〇/〆/々/仝/〃/ゞ/ゝ/ヾ/ヽ/_/ ̄/^/¨/`/´/゜/゛/!/?/;/:/・/./,/。/、/ きさい /記載/ きしゅ /機種/ きじ /記事/ きじすう /記事数/ きじせんたく /記事選択/ きじゅつ /記述/ きじゅん /基準/ きず /傷/ きせき /奇跡/ きせつ /季節/ きそく /規則/ きぞく /帰属/ きた /北/ きたい /期待/ きちょう /貴重/ きっぷ /切符/ きつ /詰/橘/桔/喫/吃/吉/ きづi /気付/ きづk /気付/ きてい /規定/ きどう /起動/ きにゅう /記入/ きぬた /砧/ きね /杵/ きのう /機能/昨日/ きび /黍/ きふ /寄付/ きぶん /気分/ きほん /基本/ きほんてき /基本的/ きぼう /希望/ きみ /君/ きもt /気持/ きゃく /客/脚/却/ きゃくほん /脚本/ きゅう /久/吸/急/泣/救/休/及/求/旧/給/糾/級/笈/窮/究/球/灸/汲/朽/弓/宮/仇/丘/ きゅうがた /旧型/ きゅうきょく /究極/ きゅうけいじょ /休憩所/ きゅうしゅう /九州/ きゅうしゅうだいがく /九州大学/ きゅうじん /求人/ きゅうじんこうこく /求人広告/ きゅうだい /九大/ きゅうりょう /給料/ きょ /居/去/距/許/虚/渠/挙/拠/拒/巨/ きょう /今日/京/強/狭/橋/鏡/胸/共/香/狂/経/叫/教/驚/饗/響/郷/蕎/興/脅/矯/況/挟/恭/恐/怯/彊/峡/境/喬/卿/匡/協/凶/競/兇/僑/侠/供/享/亨/ きょういく /教育/ きょうきゅう /供給/ きょうくん /教訓/ きょうしゅく /恐縮/ きょうせい /強制/ きょうだい /京大/ きょうちょう /強調/ きょうつう /共通/ きょうつういちじ /共通一次/ きょうと /京都/ きょうふ /恐怖/ きょうみ /興味/ きょうゆう /共有/ きょうりつ /共立/ きょうりょく /協力/強力/ きょか /許可/ きょく /曲/局/極/ きょくしょうち /極小値/ きょくたん /極端/ きょくめい /曲名/ きょくもく /曲目/ きょしょ /拠所/ きょじん /巨人/ きょだい /巨大/ きょねん /去年/ きょひ /拒否/ きょり /距離/ きよみず /清水/ きらi /嫌/ きらt /嫌/ きらu /嫌/ きらw /嫌/ きり /桐/ きろく /記録/ きろめーとる /粁/ きわ /際/ きわm /極/ きん /今/近/金/筋/謹/襟/衿/菌/芹/緊/禽/禁/琴/欽/欣/斤/錦/巾/均/勤/僅/ きんけん /金券/ きんし /禁止/ きんじょ /近所/ きんてつ /近鉄/ きんぼう /近傍/ きんむ /勤務/ きんようび /金曜日/ ぎ /技/疑/議/誼/蟻/義/祇/犠/欺/擬/戯/宜/妓/儀/偽/ ぎじゅつ /技術/ ぎじゅつしゃ /技術者/ ぎじゅつてき /技術的/ ぎじゅつほんぶ /技術本部/ ぎもん /疑問/ ぎゃく /逆/虐/ ぎゃくかんすう /逆関数/ ぎゃくしゅう /逆襲/ ぎゅう /牛/ ぎゅうにゅう /牛乳/ ぎょ /魚/御/禦/漁/ ぎょう /行/仰/業/暁/尭/凝/ ぎょうかい /業界/ ぎょうしゃ /業者/ ぎょく /玉/ ぎろん /議論/ ぎん /銀/吟/ ぎんざ /銀座/ く /口/苦/工/駒/駈/駆/躯/矩/玖/狗/区/句/倶/九/ くe /喰/食/ くi /食/喰/ くr /来/繰/暮/ くt /食/喰/ くu /食/喰/ くw /食/喰/ くう /空/ くうかん /空間/ くうき /空気/ くうはく /空白/ くぎり /区切/ くし /釧/櫛/串/ くすり /薬/ くず /屑/ くそ /糞/ くち /口/ くつ /靴/掘/沓/窟/屈/ くつがえs /覆/ くつわ /轡/ くとうてん /句読点/ くどうりん /駆動輪/ くに /国/ くばr /配/ くばt /配/ くび /首/ くふう /工夫/ くべつ /区別/ くぼ /窪/ くま /熊/隈/ くまがい /熊谷/ くまがや /熊谷/ くみ /組/ くみあい /組合/ くめ /粂/ くらi /暗/ くらい /位/ くり /繰/栗/ くるi /狂/ くるま /車/ くろ /黒/ くろう /苦労/ くわ /鍬/桑/ くわe /加/ くわs /詳/ くわw /加/ くん /君/董/訓/薫/勲/ ぐ /虞/愚/具/ ぐあい /具合/ ぐう /隅/遇/寓/偶/ ぐうぜん /偶然/ ぐたいてき /具体的/ ぐん /群/郡/軍/ け /化/家/怪/祁/袈/卦/ けs /消/ けい /形/型/系/兄/計/継/恵/軽/経/傾/鶏/頚/警/詣/蛍/荊/茎/罫/繋/稽/畦/渓/桂/景/敬/携/掲/憩/慧/慶/径/契/珪/圭/啓/刑/係/ けいい /敬意/経緯/ けいか /経過/ けいかく /計画/ けいかん /警官/ けいけん /経験/ けいこう /傾向/ けいさい /掲載/ けいさん /計算/ けいさんき /計算機/ けいしき /形式/ けいしょう /継承/ けいじ /刑事/ けいせん /罫線/ けいぞく /継続/ けいぞくてき /継続的/ けいたい /形態/ けいだい /慶大/ けいやく /契約/ けいゆ /経由/ けいれつ /系列/ けいろ /経路/ けが /怪我/ けた /桁/ けっs /決/ けっか /結果/ けっきょく /結局/ けっこう /結構/ けっこん /結婚/ けっさく /傑作/ けってい /決定/ けってん /欠点/ けつ /穴/決/結/訣/血/潔/欠/傑/ けつごう /結合/ けつろん /結論/ けむり /煙/ けん /見/間/件/研/肩/犬/嫌/鍵/権/鹸/験/顕/険/遣/軒/賢/謙/県/絹/硯/献/牽/検/捲/拳/懸/憲/建/堅/圏/喧/剣/券/兼/健/倦/倹/ けんい /権威/ けんいち /健一/ けんか /喧嘩/ けんきゅう /研究/ けんきゅうしつ /研究室/ けんきゅうしゃ /研究者/ けんきゅうしょ /研究所/ けんきゅうじょ /研究所/ けんこう /健康/ けんさく /検索/ けんじょうご /謙譲語/ けんせつてき /建設的/ けんとう /検討/ けんり /権利/ げ /下/外/ げい /鯨/迎/芸/ げき /激/隙/撃/戟/劇/ げっかん /月刊/ げつ /月/ げん /言/元/現/原/限/諺/舷/絃/玄/源/減/弦/幻/厳/ げんz /減/ げんいん /原因/ げんき /元気/ げんきゅう /言及/ げんこう /原稿/ げんご /言語/ げんさく /原作/ げんざい /現在/ げんしょう /現象/ げんしりょく /原子力/ げんじつ /現実/ げんじつてき /現実的/ げんじょう /現状/ げんそく /原則/ げんてい /限定/ げんてん /原点/ げんぱつ /原発/ げんみつ /厳密/ こ /子/個/雇/鼓/顧/鈷/跨/誇/虎/菰/胡/股/袴/糊/狐/湖/枯/故/戸/弧/庫/己/孤/姑/固/呼/古/乎/ こe /越/ こi /濃/ こk /濃/ こm /込/ こn /込/来/ こs /越/漉/ こu /乞/ こい /恋/鯉/ こう /行/後/広/口/好/項/横/光/向/考/香/高/更/慌/垢/溝/稿/工/公/降/構/厚/鴻/閤/鋼/砿/鉱/酵/郊/購/貢/講/衡/荒/航/膏/腔/肱/肯/耕/綱/絞/紘/紅/糠/硬/皇/甲/港/浩/洪/江/梗/校/杭/晃/昂/攻/控/拘/抗/恒/弘/康/庚/幸/巷/巧/宏/孝/孔/坑/喉/后/勾/効/功/倖/候/侯/佼/交/ こうz /高/ こうい /行為/ こうえん /講演/公園/ こうか /効果/高架/ こうかい /公開/ こうかいろんり /高階論理/ こうかん /交換/ こうぎ /抗議/ こうけん /貢献/ こうこう /高校/ こうこく /広告/ こうさつ /考察/ こうしゃ /後者/ こうしん /更新/ こうじ /麹/ こうせい /構成/ こうせいようそ /構成要素/ こうそく /高速/ こうそくか /高速化/ こうぞう /構造/ こうだんしゃ /講談社/ こうちく /構築/ こうちゃ /紅茶/ こうど /高度/ こうどう /行動/ こうにゅう /購入/ こうはん /後半/ こうひょう /公表/ こうべ /頭/神戸/ こうほ /候補/ こうもく /項目/ こうりつ /効率/ こうりょ /考慮/ こえ /声/ こく /国/黒/鵠/酷/穀/告/刻/克/ こくさい /国際/ こくてつ /国鉄/ こくない /国内/ こころ /心/ こころm /試/ こし /腰/ こしき /甑/ こしょう /故障/ こじん /個人/ こじんじょうほう /個人情報/ こじんてき /個人的/ こせい /個性/ こたe /答/応/ こたえ /答/ こつ /骨/惚/忽/ こてい /固定/ こと /事/ ことn /異/ ことがら /事柄/ ことし /今年/ ことば /言葉/ こども /子供/ このm /好/ こべつ /個別/ こまk /細/ こまr /困/ こまt /困/ こまいぬ /狛/ こみ /込/ こむ /込/ こめ /米/ こもじ /小文字/ これ /此/ ころ /頃/ ころg /転/ ころn /転/ ころs /殺/ こわg /怖/恐/ こわi /恐/怖/ こわk /恐/怖/ こん /今/金/混/根/魂/艮/紺/痕/梱/昆/昏/懇/恨/婚/墾/坤/困/ こんかい /今回/ こんきょ /根拠/ こんげつ /今月/ こんげつごう /今月号/ こんご /今後/ こんざつ /混雑/ こんしゅう /今週/ こんじょう /根性/ こんど /今度/ こんどう /混同/ こんなん /困難/ こんにち /今日/ こんねん /今年/ こんぽん /根本/ こんや /今夜/ こんらん /混乱/ ご /後/語/御/誤/醐/護/碁/瑚/檎/梧/悟/娯/吾/呉/午/伍/互/五/ ごいけん /御意見/ ごう /合/号/強/轟/豪/濠/拷/壕/劫/剛/ ごうい /合意/ ごうけい /合計/ ごうせい /合成/ ごかい /誤解/ ごく /獄/極/ ごご /午後/ ごじゅん /語順/ ごぜん /午前/ ごぞんz /御存/ ごぞんじ /御存知/ ごと /毎/ ごろ /頃/ ごん /言/権/ ごんご /言語/ さ /差/左/茶/裟/鎖/詐/砂/瑳/沙/査/嵯/唆/叉/佐/些/ さe /冴/ さk /避/ さm /覚/ さr /去/ さt /去/ さい /際/最/歳/才/西/再/妻/載/裁/菜/細/斎/祭/砦/砕/犀/采/災/済/栽/採/彩/宰/塞/哉/催/債/ さいかい /最下位/ さいきん /最近/ さいこう /最高/ さいご /最後/ さいしゅうかい /最終回/ さいしゅうてき /最終的/ さいしょ /最初/ さいしょうかもんだい /最小化問題/ さいしょうち /最小値/ さいしん /最新/ さいしんばん /最新版/ さいせい /再生/ さいそう /再送/ さいたま /埼玉/ さいだい /最大/ さいちゅう /最中/ さいてい /最低/ さいど /再度/ さいはいふ /再配布/ さいよう /採用/ さいりよう /再利用/ さいわi /幸/ さか /酒/坂/阪/ さかn /盛/ さかい /堺/ さかき /榊/ さかさ /逆/ さかな /魚/肴/ さかや /酒屋/ さが /性/ さがs /捜/探/ さき /先/碕/埼/崎/咲/ さぎ /鷺/ さぎょう /作業/ さく /作/冊/錯/索/策/窄/柵/朔/昨/搾/咋/削/ さくしゃ /作者/ さくじつ /昨日/ さくじょ /削除/ さくせい /作成/ さくねん /昨年/ さくひん /作品/ さくら /桜/ さぐr /探/ さけ /酒/鮭/ さけb /叫/ ささ /笹/ ささe /支/ さしだしにん /差出人/ さじ /匙/ さっそく /早速/ さつ /札/冊/擦/薩/殺/撮/拶/察/刷/ さつき /皐/ さと /里/ さば /鯖/ さばk /捌/ さび /錆/ さびs /寂/ さま /様/ さむi /寒/ さむk /寒/ さむs /寒/ さめ /鮫/ さら /更/皿/ さらす /晒/ さわg /騒/ さわt /触/ さん /山/三/散/餐/酸/賛/讃/蚕/纂/算/産/珊/燦/桟/撒/惨/参/傘/ さんか /参加/ さんかしゃ /参加者/ さんげんじゃや /三軒茶屋/ さんこう /参考/ さんこうしりょう /参考資料/ さんこうぶんけん /参考文献/ さんしょう /参照/ さんじゅうし /三銃士/ さんせい /賛成/ さんちょう /山頂/ ざ /座/挫/坐/ ざい /財/在/罪/材/剤/ ざっし /雑誌/ ざつ /雑/ ざん /残/暫/斬/ ざんねん /残念/ し /私/子/氏/指/紙/覗/使/誌/死/旨/姿/姉/伺/至/師/歯/止/試/飼/雌/賜/資/諮/詩/詞/視/脂/肢/紫/糸/祉/獅/枝/施/斯/孜/支/思/志/市/屍/始/士/四/嗣/史/司/刺/仔/仕/ しm /締/占/ しn /死/ しr /知/ しt /知/ しあい /試合/ しあげ /仕上/ しあわs /幸/ しお /汐/ しか /鹿/ しかr /叱/ しかt /叱/ しかい /司会/ しかいしゃ /司会者/ しかく /資格/ しかた /仕方/ しき /色/式/拭/識/ しぎ /鴫/ しくm /仕組/ しげん /資源/ しこう /指向/ しこく /四国/ しごと /仕事/ しじ /指示/支持/ しじょうさいきょう /史上最強/ しずk /静/ しずおかだい /静岡大/ しずく /雫/ しせい /姿勢/ しぜん /自然/ しそう /思想/ した /下/ したがe /従/ したがi /従/ したがt /従/ したがu /順/従/ したがw /従/ しだい /次第/ しち /質/七/ しっぱい /失敗/ しつ /失/質/疾/漆/湿/悉/室/嫉/執/叱/ しつもん /質問/ しつれい /失礼/ してい /指定/ してき /指摘/ してつ /私鉄/ しとみ /蔀/ しの /篠/ しのb /偲/ しはらi /支払/ しはらt /支払/ しはらu /支払/ しはらw /支払/ しば /芝/柴/ しばしば /屡/ しぶ /渋/ しぶi /渋/ しぶや /渋谷/ しべ /蕊/ しぼうさいぼう /脂肪細胞/ しま /縞/ しみず /清水/ しめs /示/ しめい /氏名/ しも /下/ しもて /下手/ しゃ /車/者/社/煮/写/斜/遮/謝/紗/赦/捨/射/舎/ しゃいん /社員/ しゃかい /社会/ しゃく /昔/錫/釈/酌/爵/灼/杓/尺/勺/借/ しゃしょう /車掌/ しゃしん /写真/ しゃない /社内/ しゃべr /喋/ しゃべt /喋/ しゃりょう /車両/ しゅ /手/主/種/修/首/酒/取/趣/腫/珠/狩/殊/朱/守/ しゅう /集/修/週/秋/祝/拾/習/醜/酬/酋/輯/蹴/讐/襲/衆/蒐/舟/臭/繍/終/秀/洲/愁/州/就/宗/周/収/囚/ しゅうい /修理/周囲/ しゅうえいしゃ /集英社/ しゅうかん /週間/ しゅうごう /集合/ しゅうごうばしょ /集合場所/ しゅうせい /修正/ しゅうそく /収束/ しゅうだん /集団/ しゅうてん /終点/ しゅうはすう /周波数/ しゅうへん /周辺/ しゅうまつ /週末/ しゅうりょう /終了/ しゅうろん /修論/ しゅく /宿/祝/粛/縮/淑/夙/叔/ しゅご /主語/ しゅさい /主催/ しゅし /主旨/ しゅじんこう /主人公/ しゅだいか /主題歌/ しゅだん /手段/ しゅちょう /主張/ しゅっか /出荷/ しゅっちょう /出張/ しゅっぱつ /出発/ しゅっぱん /出版/ しゅっぱんしゃ /出版社/ しゅつ /出/ しゅつえん /出演/ しゅつりょく /出力/ しゅほう /手法/ しゅみ /趣味/ しゅるい /種類/ しゅん /春/瞬/駿/舜/竣/峻/俊/ しゅんかん /瞬間/ しょ /所/初/書/暑/諸/藷/薯/署/緒/庶/渚/曙/処/ しょう /上/松/少/章/性/勝/傷/正/尚/姓/称/小/消/笑/焼/鞘/障/鐘/鍾/鉦/醤/賞/象/詳/詔/証/訟/裳/衝/蕉/蒋/菖/肖/紹/粧/祥/礁/硝/省/症/照/焦/湘/渉/沼/樵/樟/梢/晶/昭/昌/昇/捷/掌/招/抄/承/彰/廠/床/庄/将/宵/娼/妾/奨/嘗/唱/商/哨/召/升/匠/償/ しょうかい /紹介/ しょうがい /障害/ しょうがくかん /小学館/ しょうきょ /消去/ しょうぎょう /商業/ しょうぎょうてき /商業的/ しょうぎょうもくてき /商業目的/ しょうこ /証拠/ しょうこうし /小公子/ しょうごう /照合/ しょうさい /詳細/ しょうじょ /少女/ しょうじょう /症状/ しょうせつ /小説/ しょうとくてき /生得的/ しょうねん /少年/ しょうばい /商売/ しょうひ /消費/ しょうひしゃ /消費者/ しょうひょう /商標/ しょうひょうけん /商標権/ しょうひん /商品/ しょうぶ /勝負/ しょうめい /証明/ しょうよう /商用/ しょうらい /将来/ しょうりゃく /省略/ しょうわ /昭和/ しょき /初期/ しょきけい /初期型/ しょきち /初期値/ しょく /色/燭/拭/食/蝕/触/職/織/殖/植/飾/埴/嘱/ しょくじ /食事/ しょくどうしゃ /食堂車/ しょしんしゃ /初心者/ しょぞく /所属/ しょめい /署名/ しょゆう /所有/ しょり /処理/ しょりけい /処理系/ しよう /使用/仕様/ しようほう /使用法/ しらb /調/ しり /尻/ しりょう /資料/ しるし /印/ しれい /指令/ しろ /城/白/ しろi /白/ しろk /白/ しろうと /素人/ しん /心/新/真/親/身/神/伸/森/寝/辛/辰/進/信/震/針/診/薪/芯/臣/紳/秦/疹/申/深/浸/榛/晋/振/慎/審/娠/唇/侵/ しんz /信/ しんかんせん /新幹線/ しんがい /侵害/ しんがくぎほう /信学技報/ しんがくろん /信学論/ しんけいじょうほうしょり /神経情報処理/ しんけん /真剣/ しんごう /信号/ しんさく /新作/ しんさつ /診察/ しんしゃ /新車/ しんしゅつ /新出/ しんじゅく /新宿/ しんじん /新人/ しんせいひん /新製品/ しんせだい /新世代/ しんせつ /親切/新設/ しんたまがわせん /新玉川線/ しんばんぐみ /新番組/ しんぱい /心配/ しんぶん /新聞/ しんぽ /進歩/ しんや /深夜/ しんよう /信用/ しんらい /信頼/ しんらいせい /信頼性/ しんわ /神話/ じ /時/次/事/字/二/耳/自/地/持/辞/蒔/而/示/磁/痔/璽/爾/治/滋/慈/寺/児/侍/似/ じいしき /自意識/ じかい /次回/ じかん /時間/ じかんえいぎょう /時間営業/ じき /直/時期/ じぎょうぶ /事業部/ じぎょうほんぶ /事業本部/ じく /宍/軸/竺/ じけん /事件/ じこ /事故/ じこう /事項/ じこく /時刻/ じこしょうかい /自己紹介/ じさく /自作/ じしょ /辞書/ じしん /自身/自信/地震/ じじつ /事実/ じじょう /事情/ じせい /時制/ じたい /自体/事態/ じたく /自宅/ じだい /時代/ じっか /実家/ じっけん /実験/ じっこう /実行/ じっさい /実際/ じっしゅう /実習/ じっせかい /実世界/ じっせき /実績/ じったい /実体/ じつ /日/実/ じつげん /実現/ じつざい /実在/ じつざいろん /実在論/ じつよう /実用/ じつようか /実用化/ じつれい /実例/ じてん /時点/ じてんしゃ /自転車/ じどう /自動/ じどうしゃ /自動車/ じどうてき /自動的/ じどうはんばいき /自動販売機/ じぶん /自分/ じぶんじしん /自分自身/ じむきょく /事務局/ じもと /地元/ じゃ /邪/蛇/ じゃく /寂/惹/弱/若/ じゃっかん /若干/ じゃま /邪魔/ じゅ /受/需/綬/樹/授/寿/呪/儒/ じゅう /重/十/住/渋/銃/縦/獣/汁/柔/戎/従/充/什/ じゅうし /重視/ じゅうしょ /住所/ じゅうしん /重心/ じゅうたい /渋滞/ じゅうふく /重複/ じゅうぶん /十分/ じゅうよう /重要/ じゅうらい /従来/ じゅく /熟/塾/ じゅしん /受信/ じゅつ /述/術/ じゅもん /呪文/ じゅよう /需要/ じゅん /順/醇/遵/巡/純/盾/潤/準/淳/殉/楯/旬/循/准/ じゅんかい /巡回/ じゅんすい /純粋/ じゅんせんもん /準専門/ じゅんちょう /順調/ じゅんばん /順番/ じゅんび /準備/ じゆう /自由/ じょ /女/如/除/鋤/恕/徐/序/叙/助/ じょう /上/生/場/常/定/成/条/城/状/情/乗/錠/醸/譲/蒸/穣/畳/浄/杖/擾/嬢/壌/剰/丞/丈/ じょうい /上位/ じょうえつ /上越/ じょうき /上記/ じょうきょう /状況/ じょうきょういみろん /状況意味論/ じょうきょうりろん /状況理論/ じょうけん /条件/ じょうし /上司/ じょうしき /常識/ じょうたい /状態/ じょうだん /冗談/ じょうち /上智/ じょうほう /情報/ じょうほうこうかん /情報交換/ じょうほうこうがくか /情報工学科/ じょうほうしょり /情報処理/ じょうほうしょりがっかい /情報処理学会/ じょうりゅう /上流/ じょうれん /常連/ じょがい /除外/ じょく /辱/ じょし /女子/ じょしゅせき /助手席/ じょせい /女性/ じょゆう /女優/ じょりょく /助力/ じん /人/尽/靭/陣/迅/訊/腎/甚/尋/壬/塵/刃/仁/ じんこうちのう /人工知能/ じんせい /人生/ す /酢/須/諏/笥/ すe /据/ すg /過/ すk /好/ すm /済/住/澄/ すn /住/済/ すr /擦/摺/ すt /捨/ すu /吸/ すい /水/吹/錘/錐/酔/遂/衰/翠/粋/睡/炊/推/帥/垂/ すいしん /推進/ すいそく /推測/ すいろん /推論/ すう /数/雛/趨/枢/嵩/崇/ すうじ /数字/ すうち /数値/ すうねん /数年/ すうふん /数分/ すえ /末/ すえひろ /末広/ すがた /姿/ すぎ /椙/杉/ すくi /救/ すくn /少/ すぐ /直/ すぐr /優/ すけ /介/ すげ /菅/ すこs /少/ すこぶる /頗/ すごi /凄/ すごk /凄/ すごm /凄/ すごs /凄/ すじ /筋/ すすm /進/勧/薦/ すすn /進/ すずか /鈴鹿/ すずめ /雀/ すそ /裾/ すで /既/ すなお /素直/ すなわt /即/ すばr /素晴/ すべr /滑/ すべt /全/滑/ すべて /総/ すわr /座/ すわt /座/ すん /寸/ ず /頭/逗/厨/図/ ずい /髄/瑞/随/ ずいぶん /随分/ ずけい /図形/ ずけいもじ /図形文字/ せ /世/背/瀬/畝/ せい /生/声/世/星/成/性/西/製/正/姓/青/勢/斉/静/醒/逝/請/誓/誠/聖/精/盛/牲/清/栖/棲/晴/整/政/征/制/凄/省/ せいか /成果/ せいかい /正解/ せいかく /正確/性格/ せいかつ /生活/ せいかん /青函/ せいき /世紀/ せいきゅう /請求/ せいぎょ /制御/ せいげん /制限/ せいこう /成功/ せいしき /正式/ せいしつ /性質/ せいしゅん /青春/ せいしん /精神/ せいじょう /正常/ せいせい /生成/ せいせいぶんぽう /生成文法/ せいせき /成績/ せいちょう /成長/ せいでんき /静電気/ せいとう /正当/ せいとくてき /生得的/ せいど /制度/ せいのう /性能/ せいひん /製品/ せいぶ /西武/ せいやく /制約/ せいり /整理/ せいりつ /成立/ せいれき /西暦/ せかい /世界/ せかいじゅう /世界中/ せき /昔/積/席/夕/関/寂/碩/蹟/跡/赤/責/脊/績/籍/石/析/斥/戚/惜/隻/ せきにん /責任/ せけん /世間/ せたがや /世田谷/ せっきょくてき /積極的/ せっけい /設計/ せってい /設定/ せつ /雪/説/節/切/設/折/窃/摂/接/拙/ せつじょくせん /雪辱戦/ せつぞく /接続/ せつぞくかんけい /接続関係/ せつめい /説明/ せとおおはし /瀬戸大橋/ せまi /狭/ せみ /蝉/ せりふ /台詞/ せわ /世話/ せわにん /世話人/ せん /先/線/戦/繊/船/川/選/占/鮮/閃/銑/銭/遷/践/賎/詮/薦/舛/腺/羨/箭/穿/旋/煽/煎/潜/染/洗/浅/泉/栴/栓/撰/扇/尖/専/宣/千/仙/ せんげん /宣言/ せんこう /先行/ せんしゅ /選手/ せんしゅう /先週/ せんしゅけん /選手権/ せんじつ /先日/ せんせい /先生/ せんそう /戦争/ せんたく /選択/ せんちめーとる /糎/ せんでん /宣伝/ せんとう /先頭/ せんぱい /先輩/ せんもん /専門/ せんもんか /専門家/ せんようかいせん /専用回線/ せんろ /線路/ ぜ /是/ ぜい /税/脆/ ぜいきん /税金/ ぜったい /絶対/ ぜつ /絶/舌/ ぜひ /是非/ ぜん /前/全/膳/繕/禅/然/漸/善/ ぜんいん /全員/ ぜんかい /前回/ ぜんかく /全角/ ぜんかくかな /全角仮名/ ぜんこく /全国/ ぜんこくたいかい /全国大会/ ぜんこくてき /全国的/ ぜんしゃ /前者/ ぜんじんるい /全人類/ ぜんぜん /全然/ ぜんたい /全体/ ぜんてい /前提/ ぜんぶ /全部/ ぜんぷく /全幅/ そ /組/鼠/遡/阻/訴/蘇/素/粗/租/祖/礎/疎/疏/狙/楚/曽/曾/措/岨/塑/噌/ そe /添/ そi /沿/ そm /初/ そt /沿/添/ そう /騒/総/層/相/想/送/早/霜/鎗/遭/走/装/藻/蒼/葬/荘/草/聡/綜/糟/窓/痩/争/燥/漕/槽/槍/巣/曹/操/掻/挿/掃/捜/惣/匝/宋/爽/奏/壮/喪/倉/叢/双/創/僧/ そうおう /相応/ そうさ /操作/ そうさく /創作/ そうしん /送信/ そうぞう /想像/ そうだん /相談/ そうち /装置/ そうちゃく /装着/ そうてい /想定/ そうとう /相当/ そうほう /双方/ そうむ /創夢/ そうりょう /送料/ そがい /阻害/ そく /足/側/速/息/即/測/束/捉/則/促/ そくせん /側線/ そくど /速度/ そしき /組織/ そだt /育/ そつ /率/卒/ そつぎょう /卒業/ そで /袖/ そと /外/ その /其/ そば /側/ そぼ /祖母/ そら /空/ それがし /某/ そろe /揃/ そろi /揃/ そろt /揃/ そん /損/存/遜/村/尊/孫/ そんけいご /尊敬語/ そんざい /存在/ そんちょう /尊重/ ぞう /臓/贈/造/蔵/憎/増/像/ ぞうか /増加/ ぞく /続/族/賊/属/俗/ ぞくs /属/ ぞん /存/ ぞんz /存/ ぞんじ /存知/ た /他/太/多/詑/汰/ たb /食/ たe /耐/絶/ たm /溜/ たt /立/建/断/ たい /大/代/袋/体/隊/対/態/鯛/黛/逮/退/貸/苔/腿/胎/滞/泰/替/戴/怠/待/帯/岱/耐/堆/ たいs /対/ たいおう /対応/ たいかい /大会/ たいけい /体系/ たいしょ /対処/ たいしょう /対象/大将/ たいしょうせい /対称性/ たいせつ /大切/ たいてい /大抵/ たいでん /帯電/ たいど /態度/ たいふう /台風/ たいへん /大変/ たいりょう /大量/ たえ /妙/ たおr /倒/ たおs /倒/ たか /鷹/ たかi /高/ たかk /高/ たかm /高/ たかs /高/ たかまつ /高松/ たがi /互/ たき /瀧/滝/ たく /鐸/託/琢/濯/沢/拓/択/托/宅/啄/卓/ たくさん /沢山/ たぐい /類/ たけ /茸/ たこ /蛸/凧/ たしょう /多少/ たすk /助/ たすう /多数/ たずn /尋/ たたk /叩/ ただ /唯/只/ ただs /正/但/ ただち /直/ たち /達/ たちぎ /立木/ たちば /立場/ たつ /辰/ たつみ /巽/ たて /竪/ たどr /辿/ たな /棚/ たに /谷/ たにん /他人/ たぬき /狸/ たね /種/ たのm /頼/ たのn /頼/ たび /度/ たぶん /多分/ たまr /溜/ たまがわ /多摩川/ ため /為/ ためs /試/ たもt /保/ たよr /頼/ たよt /頼/ たら /鱈/ たる /樽/ たん /単/端/反/鍛/誕/蛋/胆/耽/綻/箪/短/炭/湛/淡/歎/旦/探/担/坦/嘆/丹/ たんい /単位/ たんこうぼん /単行本/ たんご /単語/ たんじゅん /単純/ たんじょう /誕生/ たんじょうび /誕生日/ たんとう /担当/ たんまつ /端末/ たんまつまど /端末窓/ だ /騨/駄/陀/楕/舵/柁/打/惰/妥/堕/唾/ だい /大/第/内/代/台/題/醍/ だいいち /第一/ だいがく /大学/ だいがくいん /大学院/ だいきぼ /大規模/ だいこん /大根/ だいさんけいひん /第三京浜/ だいさんせい /大賛成/ だいじ /大事/ だいじょうぶ /大丈夫/ だいすk /大好/ だいたい /大体/ だいたん /大胆/ だいひゃっか /大百科/ だいひょう /代表/ だいひょうてき /代表的/ だいぶぶん /大部分/ だいめい /題名/ だく /諾/濁/ だそく /蛇足/ だち /達/ だつ /奪/脱/ だとう /妥当/ だまr /黙/ だまt /黙/ だめ /駄目/ だれ /誰/ だん /男/段/断/弾/暖/談/檀/壇/団/ だんかい /段階/ だんたい /団体/ ち /値/恥/地/知/茅/馳/遅/蜘/致/置/稚/痴/池/智/弛/ ちr /散/ ちいs /小/ ちいき /地域/ ちか /地下/ ちかてつ /地下鉄/ ちから /力/ ちがe /違/ ちがi /違/ ちがt /違/ ちがu /違/ ちがw /違/ ちきゅう /地球/ ちく /逐/蓄/筑/竹/畜/築/ ちくせき /蓄積/ ちしき /知識/ ちず /地図/ ちち /父/ ちつ /窒/秩/ ちてき /知的/ ちてん /地点/ ちほう /地方/ ちゃ /茶/ ちゃく /着/嫡/ ちゅう /中/注/昼/虫/宙/駐/鋳/酎/註/衷/柱/抽/忠/仲/ ちゅうい /注意/ ちゅうがく /中学/ ちゅうけい /中継/ ちゅうごく /中国/ ちゅうし /中止/ ちゅうしゃじょう /駐車場/ ちゅうしゅつ /抽出/ ちゅうしょう /抽象/ ちゅうしん /中心/ ちゅうとはんぱ /中途半端/ ちゅうもく /注目/ ちゅうもん /注文/ ちゅうりゃく /中略/ ちょ /貯/著/苧/猪/瀦/樗/ ちょう /長/超/肇/弔/重/帳/調/張/鳥/頂/銚/跳/諜/蝶/腸/脹/聴/眺/町/牒/潮/朝/暢/挑/懲/徴/彫/庁/帖/寵/喋/凋/兆/丁/ ちょうさ /調査/ ちょうし /調子/ ちょうせい /調整/ ちょうはつ /長髪/ ちょうふく /重複/ ちょく /直/捗/勅/ ちょくげき /直撃/ ちょくご /直後/ ちょくせつ /直接/ ちょくせつてき /直接的/ ちょくぜん /直前/ ちょさく /著作/ ちょさくけん /著作権/ ちょさくけんほう /著作権法/ ちょさくしゃ /著作者/ ちょさくぶつ /著作物/ ちょしゃ /著者/ ちょっこうせい /直交性/ ちん /椿/陳/鎮/賃/珍/沈/朕/ つ /津/ つi /付/着/突/ つk /付/着/突/漬/ つm /詰/ つt /突/ つい /対/鎚/追/槌/椎/墜/ ついy /費/ ついか /追加/ つう /通/痛/ つうか /通過/ つうかい /痛快/ つうがく /通学/ つうしん /通信/ つうじょう /通常/ つうち /通知/ つか /塚/ つかe /使/ つかi /使/ つかm /捕/掴/ つかo /使/ つかr /疲/ つかt /使/ つかu /使/ つかw /使/ つが /栂/ つき /月/付/槻/ つぎ /次/ つくr /作/ つくt /作/ つくえ /机/ つくだ /佃/ つくば /筑波/ つくばだい /筑波大/ つくばだいがく /筑波大学/ つげ /柘/ つごう /都合/ つじ /辻/ つた /蔦/ つたe /伝/ つたt /伝/ つたu /伝/ つたw /伝/ つち /土/ つつ /砲/ つづi /続/ つづk /続/ つづr /綴/ つとm /勤/ つどい /集/ つね /常/ つば /鍔/ つばき /椿/ つぶs /潰/ つぼ /壷/坪/ つま /妻/嬬/ つむぎ /紬/ つめ /爪/ つめt /冷/ つよi /強/ つよk /強/ つら /面/ つり /釣/吊/ つる /鶴/ て /手/ てr /照/ てい /定/袋/程/鼎/釘/鄭/邸/逓/蹄/諦/訂/艇/締/禎/碇/汀/梯/提/挺/抵/悌/弟/廷/庭/底/帝/堤/呈/貞/剃/偵/停/低/亭/ ていあん /提案/ ていか /定価/ ていきょう /提供/ ていぎ /定義/ ていじ /提示/ ていせい /訂正/ ていでん /停電/ ていど /程度/ ていねい /丁寧/ てかず /手数/ てがみ /手紙/ てき /的/敵/鏑/適/笛/滴/擢/摘/ てきせつ /適切/ てきとう /適当/ てきど /適度/ てきよう /適用/ てくび /手首/ てじゅん /手順/ てつ /鉄/迭/轍/撤/徹/哲/ てつがく /哲学/ てつがくしゃ /哲学者/ てつだe /手伝/ てつだi /手伝/ てつだt /手伝/ てつづk /手続/ てつどう /鉄道/ てつや /徹夜/ てびき /手引/ てふだ /手札/ てま /手間/ てまえ /手前/ てもと /手元/ てん /点/店/天/転/顛/甜/纏/添/展/填/典/ てんかい /展開/ てんき /天気/ てんくう /天空/ てんこうせい /転校生/ てんさい /転載/ てんそう /転送/ てんり /天理/ でm /出/ でn /出/ でr /出/ でs /出/ でt /出/ でy /出/ でい /泥/ でき /出来/溺/ できm /出来/ できn /出来/ できr /出来/ できs /出来/ できt /出来/ でぐち /出口/ でん /電/田/澱/殿/伝/ でんえんとしせん /田園都市線/ でんかせいひん /電化製品/ でんき /電気/ でんきこうがくか /電気工学科/ でんげん /電源/ でんし /電子/ でんしゃ /電車/ でんそうけん /電総研/ でんたつ /伝達/ でんつうだい /電通大/ でんぱけん /電波研/ でんわ /電話/ でんわだい /電話代/ でんわばんごう /電話番号/ と /土/十/登/砺/砥/鍍/都/途/賭/菟/渡/杜/斗/徒/屠/妬/塗/堵/吐/兎/ とb /飛/ とk /解/溶/説/ とm /止/ とn /飛/ とr /取/撮/捕/ とt /取/撮/ とz /閉/ とい /問/ とう /等/頭/当/討/董/東/投/冬/盗/闘/騰/陶/鐙/透/逃/踏/豆/謄/藤/蕩/到/統/糖/筒/答/祷/痘/燈/灯/涛/湯/淘/棟/梼/桃/搭/悼/嶋/島/宕/套/塘/塔/唐/刀/凍/党/倒/ とういつ /統一/ とうかいどう /東海道/ とうきゅう /東急/ とうきょう /東京/ とうきょうきんぺん /東京近辺/ とうきょうこうぎょうだいがく /東京工業大学/ とうきょうだいがく /東京大学/ とうきょうと /東京都/ とうきょうほうめん /東京方面/ とうけい /統計/ とうけいじょうほう /統計情報/ とうげ /峠/ とうこう /投稿/ とうこうしゃ /投稿者/ とうこうだい /東工大/ とうしょう /闘将/ とうじ /当時/ とうじつ /当日/ とうじょう /登場/ とうぜん /当然/ とうだい /東大/ とうちゃく /到着/ とうひょう /投票/ とうほう /当方/ とうほく /東北/ とうめい /東名/ とうめん /当面/ とうろく /登録/ とお /十/ とおi /遠/ とおk /遠/ とおr /通/ とおs /遠/ とおt /通/ とおz /遠/ とおり /通/ とかい /都会/ とき /時/鴇/ とく /特/得/篤/禿/督/涜/徳/匿/ とくさつ /特撮/ とくしゅ /特殊/ とくしゅう /特集/ とくしゅうごう /特集号/ とくせい /特性/ とくちょう /特徴/ とくてい /特定/ とくてん /得点/ とくばん /特番/ とくべつ /特別/ とけい /時計/ とこ /常/ ところ /所/ とし /年/歳/利/ としょかん /図書館/ としょかんじょうほうだいがく /図書館情報大学/ とち /土地/橡/栃/ とちゅう /途中/ とつ /突/凸/ とつぜん /突然/ とどi /届/ とどk /届/ とどm /留/ とない /都内/ となり /隣/ とび /鳶/ とびら /扉/ とま /苫/ とも /共/ ともだち /友達/ ともなi /伴/ ともなt /伴/ ともなu /伴/ ともなw /伴/ とら /寅/ とり /酉/ とろ /瀞/ とん /豚/頓/遁/沌/敦/惇/屯/噸/ ど /度/奴/土/怒/努/ どう /道/動/瞳/導/同/銅/萄/胴/童/洞/撞/憧/堂/働/ どういつ /同一/ どうかん /同感/ どうき /同期/ どうぐ /道具/ どうさ /動作/ どうし /動詞/同士/ どうじ /同時/ どうじょう /同上/ どうじょうしゃ /同乗者/ どうせいどうめい /同姓同名/ どうちょう /同調/ どうてき /動的/ どうにゅう /導入/ どうぶつ /動物/ どうよう /同様/ どうろ /道路/ どく /毒/読/独/ どくしゃ /読者/ どくじ /独自/ どくりつ /独立/ どこ /何処/ どにち /土日/ どよう /土曜/ どようび /土曜日/ どりょく /努力/ どん /鈍/曇/呑/ な /名/那/奈/ なi /無/鳴/ なk /無/鳴/ なr /慣/鳴/馴/ なs /無/ なt /鳴/ ない /内/ ないせん /内線/ ないぶ /内部/ ないぶしりょう /内部資料/ ないよう /内容/ ないりん /内輪/ なえば /苗場/ なか /中/ なかま /仲間/ なかみ /中身/ ながi /長/ ながk /長/ ながm /眺/ ながr /流/ ながs /流/長/ ながら /乍/ なぎ /凪/ なぐ /薙/ なごや /名古屋/ なさk /情/ なさけ /情/ なぜ /何故/ なぞ /謎/ なだ /灘/ なっとく /納得/ なつ /夏/捺/ など /等/ ななm /斜/ なに /何/ なべ /鍋/ なま /生/ なまえ /名前/ なみ /波/ なみだ /涙/ なやm /悩/ なやn /悩/ なら /奈良/楢/ ならb /並/ ならn /並/ ならt /習/ なわ /縄/ なわて /畷/ なん /何/難/南/軟/楠/ なんかい /何回/南海/ なんきょく /南極/ なんじ /汝/ なんど /何度/ なんにん /何人/ なんねん /何年/ に /二/迩/弐/尼/ にg /逃/ にs /似/ にt /似/ にy /煮/ にあi /似合/ にあt /似合/ にあu /似合/ にあw /似合/ にい /新/ におe /匂/ におi /匂/ におu /匂/ におw /匂/ にがi /苦/ にがて /苦手/ にぎw /賑/ にく /肉/ にし /西/ にじ /虹/ にち /日/ にちじ /日時/ にちや /日夜/ にちよう /日曜/ にちようび /日曜日/ にっけい /日経/ にっぽん /日本/ にほん /日本/ にほんがわ /日本側/ にほんこくない /日本国内/ にほんご /日本語/ にほんごか /日本語化/ にほんごにゅうりょく /日本語入力/ にほんごにゅうりょくきこう /日本語入力機構/ にほんごやく /日本語訳/ にほんじん /日本人/ にほんだいら /日本平/ にもの /煮物/ にゅう /入/乳/廿/ にゅういん /入院/ にゅうしゅ /入手/ にゅうしゅかのう /入手可能/ にゅうりょく /入力/ にょ /女/如/ にょう /尿/ にら /韮/ にん /人/任/妊/忍/ にんい /任意/ にんき /人気/ にんげん /人間/ にんしき /認識/ にんじゃ /忍者/ にんずう /人数/ ぬ /奴/ ぬi /抜/ ぬk /抜/ ぬr /塗/濡/ ぬt /塗/ ぬし /主/ ぬすm /盗/ ね /音/値/寝/根/ ねr /寝/ ねい /寧/祢/禰/ ねがi /願/ ねがt /願/ ねぎ /葱/ ねこ /猫/ ねだん /値段/ ねつ /熱/ ねむi /眠/ ねむr /眠/ ねむt /眠/ ねらi /狙/ ねらt /狙/ ねらu /狙/ ねん /年/念/粘/燃/撚/捻/ ねんかん /年間/ ねんだい /年代/ ねんばん /年版/ ねんぴ /燃費/ ねんまえ /年前/ ねんれい /年齢/ の /埜/之/廼/乃/ のb /述/ のm /飲/ のn /飲/ のr /乗/載/ のs /載/乗/ のt /乗/載/ のう /農/膿/脳/能/納/濃/悩/嚢/ のうぎょう /農業/ のうこうだい /農工大/ のうど /濃度/ のうにゅう /納入/ のうりょく /能力/ のこr /残/ のこs /残/ のこt /残/ のぞi /除/ のぞk /除/覗/ のぞm /望/ のぞn /望/ のち /後/ のとせん /能登線/ のぶ /信/ のぼr /登/ のぼt /登/ のみ /蚤/ のり /法/ は /破/葉/歯/波/端/琶/派/杷/覇/播/把/巴/ はr /張/貼/ はt /果/貼/張/ はu /這/ はあく /把握/ はい /背/配/輩/肺/牌/盃/杯/敗/排/拝/廃/俳/ はいt /入/ はいいろ /灰色/ はいけい /背景/ はいけん /拝見/ はいし /廃止/ はいそう /配送/ はいふ /配布/ はいふはんい /配布範囲/ はいふほうほう /配布方法/ はいり /背理/ はいりほう /背理法/ はいれつ /配列/ はえ /蝿/ はかr /図/計/ はかt /計/ はかい /破壊/ はかり /秤/ はぎ /萩/矧/ はく /泊/白/薄/迫/舶/粕/箔/柏/拍/博/剥/伯/ はくい /白衣/ はこ /箱/函/ はこb /運/ はこn /運/ はざま /硲/ はし /箸/橋/端/ はしr /走/ はしt /走/ はじ /恥/ はじm /始/ はじめ /肇/ はす /蓮/ はず /筈/ はずれ /外/ はぜ /櫨/ はた /幡/ はたけ /畠/畑/ はたらi /働/ はたらk /働/ はだ /肌/ はち /鉢/八/ はっけん /発見/ はっこう /発行/ はっしん /発信/ はっせい /発生/ はっそう /発送/発想/ はってん /発展/ はっぴょう /発表/ はっぴょうないよう /発表内容/ はつ /髪/初/発/醗/溌/ はつおん /発音/ はつげん /発言/ はつばい /発売/ はで /派手/ はと /鳩/ はな /花/鼻/ はなr /離/ はなs /離/ はなし /話/噺/ はなわ /塙/ はは /母/ ははおや /母親/ はば /幅/ はぶk /省/ はまぐり /蛤/ はやi /速/早/ はやk /早/速/ はやm /早/速/ はやs /速/早/ はやかわぶんこ /早川文庫/ はやぶさ /隼/ はら /腹/原/ はらe /払/ はらi /払/ はらo /払/ はらt /払/ はらu /払/ はらw /払/ はる /春/ はるか /遥/ はん /版/半/坂/判/反/飯/頒/煩/釆/範/販/藩/般/繁/畔/班/犯/汎/氾/板/斑/搬/帆/叛/伴/ はんs /反/ はんい /範囲/ はんえい /反映/ はんかく /半角/ はんかくかたかな /半角片仮名/ はんかくかな /半角仮名/ はんきゅう /阪急/ はんきょう /反響/ はんしん /阪神/ はんたい /反対/ はんだい /阪大/ はんだん /判断/ はんてい /判定/ はんのう /反応/ はんばい /販売/ はんぶん /半分/ はんろん /反論/ ば /場/馬/芭/罵/婆/ ばあい /場合/ ばい /倍/陪/賠/売/買/狽/煤/楳/梅/媒/培/ ばいすう /倍数/ ばか /馬鹿/ ばく /麦/駁/莫/縛/爆/漠/曝/ ばしょ /場所/ ばっすい /抜粋/ ばつ /罰/閥/筏/抜/伐/ ばめん /場面/ ばん /版/番/万/判/蛮/蕃/磐/盤/晩/挽/ ばんぐみ /番組/ ばんごう /番号/ ひ /日/彼/比/扉/火/陽/費/樋/飛/非/避/誹/被/肥/罷/緋/秘/碑/皮/疲/泌/斐/披/批/悲/庇/妃/否/卑/匪/ ひe /冷/ ひi /引/ ひk /引/ ひt /引/ ひy /冷/ ひいらぎ /柊/ ひえ /稗/ ひかe /控/ ひかr /光/ ひかく /比較/ ひかり /光/ ひがい /被害/ ひがえr /日帰/ ひがし /東/ ひき /匹/疋/ ひきすう /引数/ ひくi /低/ ひくk /低/ ひげ /髭/ ひげんじつてき /非現実的/ ひこ /彦/ ひさ /久/ ひざ /膝/ ひし /菱/ ひじ /肘/ ひじょう /非常/ ひたい /額/ ひたち /日立/ ひたんちょう /非単調/ ひたんちょうすいろん /非単調推論/ ひだり /左/ ひだりがわ /左側/ ひっ /必/ ひっす /必須/ ひつ /必/逼/筆/畢/弼/ ひつじ /未/ ひつよう /必要/ ひつようせい /必要性/ ひづけ /日付/ ひてい /否定/ ひで /英/ ひと /人/ ひとs /等/ ひとt /一/ ひとけ /人気/ ひとこと /一言/ ひとたち /人達/ ひとたび /一度/ ひとみ /瞳/ ひとり /一人/ ひなん /非難/ ひのき /桧/ ひはん /批判/ ひま /暇/ ひみつ /秘密/ ひめ /媛/姫/ ひも /紐/ ひゃく /百/ ひょう /表/豹/評/票/瓢/漂/氷/標/彪/俵/ ひょうか /評価/ ひょうき /表記/ ひょうげん /表現/ ひょうし /表紙/ ひょうしょう /表象/ ひょうじ /表示/ ひょうじゅん /標準/ ひょうじゅんてき /標準的/ ひょうばん /評判/ ひよう /費用/ ひら /平/ ひらi /開/ ひらk /開/ ひる /昼/蛭/蒜/簸/ ひるま /昼間/ ひれ /鰭/ ひろ /裕/ ひろu /拾/ ひん /頻/賓/貧/瀕/浜/斌/彬/品/ ひんぱん /頻繁/ び /鼻/美/眉/琵/毘/枇/微/尾/備/ びおんか /鼻音化/ びじん /美人/ びだくおん /鼻濁音/ びみ /美味/ びみょう /微妙/ びゅう /謬/ びょう /秒/平/鋲/錨/苗/病/描/廟/ びょういん /病院/ びょうき /病気/ びん /瓶/敏/ びんじょう /便乗/ ふ /父/負/附/阜/赴/賦/譜/芙/膚/腐/符/浮/普/斧/敷/扶/怖/府/布/冨/富/婦/夫/埠/付/不/ ふe /増/ ふi /吹/ ふk /吹/ ふm /踏/ ふn /踏/ ふr /振/触/ ふt /降/振/ ふy /増/ ふあん /不安/ ふう /風/楓/封/ ふうちょう /風潮/ ふうみ /風味/ ふか /付加/ ふかi /深/ ふかk /深/ ふかm /深/ ふかのう /不可能/ ふき /蕗/葺/ ふきゅう /普及/ ふく /覆/幅/腹/福/服/複/復/副/伏/ ふくm /含/ ふくn /含/ ふくざつ /複雑/ ふくしゃ /複写/ ふくすう /複数/ ふくせい /複製/ ふくろ /袋/ ふこう /不幸/ ふごうか /符号化/ ふさ /総/ ふし /節/ ふしぎ /不思議/ ふしぜん /不自然/ ふじ /富士/ ふじつう /富士通/ ふせg /防/ ふせi /防/ ふそく /不足/ ふた /二/ ふたござ /双子座/ ふたたb /再/ ふたつ /二/ ふたばしゃ /双葉社/ ふたり /二人/ ふたん /負担/ ふだ /札/ ふだん /普段/ ふち /淵/ ふちょう /不調/ ふっかつ /復活/ ふつ /沸/払/弗/ ふつう /普通/ ふつごう /不都合/ ふところ /懐/ ふな /鮒/ ふね /船/ ふべん /不便/ ふみ /文/ ふめい /不明/ ふゆ /冬/ ふるb /古/ ふるi /古/ ふるk /古/ ふるm /古/ ふるs /古/ ふん /分/糞/雰/紛/粉/奮/焚/扮/憤/墳/噴/吻/ ふんいんき /雰囲気/ ふんしつ /紛失/ ぶ /分/部/無/蕪/葡/舞/武/撫/侮/ ぶきみ /不気味/ ぶじ /無事/ ぶた /豚/ ぶつ /物/仏/ ぶつりてき /物理的/ ぶなん /無難/ ぶひん /部品/ ぶぶん /部分/ ぶもん /部門/ ぶん /分/文/聞/ ぶんか /文化/ ぶんかつ /分割/ ぶんけん /文献/ ぶんしょ /文章/文書/ ぶんしょう /文章/ ぶんぽう /文法/ ぶんや /分野/ ぶんるい /分類/ へr /減/ へt /減/ へい /閉/平/陛/蔽/並/柄/弊/幣/塀/兵/併/丙/ へいがい /弊害/ へいき /平気/ へいきん /平均/ へいげん /平原/ へいれつしょり /並列処理/ へき /壁/碧/癖/僻/ へた /下手/ へや /部屋/ へら /箆/ へん /変/辺/編/返/遍/篇/片/偏/ へんか /変化/ へんかん /変換/ へんけん /偏見/ へんげ /変化/ へんこう /変更/ へんしゅう /編集/ へんじ /返事/ へんすう /変数/ へんすうめい /変数名/ へんとう /返答/ へんぴん /返品/ べ /辺/ べい /米/ べいこく /米国/ べっと /別途/ べつ /別/蔑/瞥/ べつめい /別名/ べん /勉/鞭/弁/娩/便/ べんきょう /勉強/ べんぎ /便宜/ べんごし /弁護士/ べんとう /弁当/ べんり /便利/ ぺーじ /頁/ ほ /保/穂/輔/補/甫/歩/捕/圃/鋪/舗/ ほe /吠/ ほs /欲/ ほう /方/法/縫/泡/砲/放/報/鵬/鳳/飽/鋒/邦/豊/訪/褒/蜂/蓬/萌/芳/胞/縫/烹/朋/捧/抱/庖/崩/峯/峰/宝/奉/呆/包/俸/倣/ ほうえい /放映/ ほうき /放棄/ ほうげん /方言/ ほうこう /方向/ ほうこく /報告/ ほうしき /方式/ ほうしゅう /報酬/ ほうしん /方針/ ほうそう /放送/ ほうそく /法則/ ほうどう /報道/ ほうほう /方法/ ほうりつ /法律/ ほお /頬/ ほか /他/外/ ほく /北/ ほくりく /北陸/ ほけんしょう /保険証/ ほご /保護/ ほし /星/ ほしょう /保証/ ほそi /細/ ほそm /細/ ほそs /細/ ほそく /補足/ ほぞん /保存/ ほっ /発/ ほっかいどう /北海道/ ほとり /辺/ ほとんd /殆/ ほとんど /殆ど/ ほど /程/ ほのお /焔/炎/ ほり /堀/ ほろ /幌/ ほん /本/翻/奔/ ほんき /本気/ ほんぎょう /本業/ ほんしつてき /本質的/ ほんじつ /本日/ ほんせん /本線/ ほんたい /本体/ ほんだい /本題/ ほんとう /本当/ ほんにん /本人/ ほんぶん /本文/ ほんや /本屋/ ほんやく /翻訳/ ほんらい /本来/ ぼ /母/暮/菩/簿/戊/慕/墓/募/ ぼいん /母音/ ぼう /某/妨/防/鉾/貿/貌/謀/膨/肪/紡/冒/棒/望/暴/房/忙/忘/帽/坊/剖/傍/亡/乏/ ぼうそう /暴走/ ぼうとう /冒頭/ ぼく /僕/木/穆/睦/牧/朴/撲/墨/卜/ ぼしゅう /募集/ ぼしゅうこうこく /募集広告/ ぼたん /釦/ ぼつ /没/勃/ ぼん /盆/凡/ ま /間/目/真/麻/魔/磨/摩/ まk /負/ まt /待/ まい /枚/毎/昧/妹/埋/ まいすう /枚数/ まいにち /毎日/ まいる /哩/ まえ /前/ まえしょり /前処理/ まき /巻/槙/ まきた /真北/ まく /膜/幕/ まくら /枕/ まぐろ /鮪/ まこと /真/ まさ /正/柾/ まじめ /真面目/ ます /桝/鱒/ また /又/俣/亦/ まち /街/ まちがe /間違/ まちがi /間違/ まちがt /間違/ まちがu /間違/ まったk /全/ まつ /松/末/沫/抹/ まつもと /松本/ まつやま /松山/ まで /迄/ まと /的/ まど /窓/ まどぐち /窓口/ まなb /学/ まなn /学/ まね /真似/ まねi /招/ まねk /招/ まひがし /真東/ まほう /魔法/ まま /侭/ まみなみ /真南/ まもr /守/ まもt /守/ まゆ /繭/ まよe /迷/ まよi /迷/ まよt /迷/ まよw /迷/ まよなか /真夜中/ まる /円/丸/ まろ /麿/ まわr /周/ まわs /周/ まん /万/満/蔓/漫/慢/ まんえん /万円/ まんが /漫画/ まんぞく /満足/ み /実/味/三/身/未/箕/巳/魅/ みm /見/ みn /見/ みr /見/ みt /見/満/ みy /見/ みおt /見落/ みかk /見掛/ みぎ /右/ みぎがわ /右側/ みさき /岬/ みしま /三島/ みじかi /短/ みじかk /短/ みじかm /短/ みず /水/ みせ /店/ みぞ /溝/ みだr /乱/ みだs /乱/ みち /道/ みつ /蜜/密/ みつk /見付/ みつびし /三菱/ みつびしでんき /三菱電機/ みてい /未定/ みとm /認/ みどく /未読/ みどり /緑/ みな /皆/ みなさま /皆様/ みなと /湊/ みなみ /南/ みの /蓑/ みのる /稔/ みはら /三原/ みみ /耳/ みゃく /脈/ みょう /名/明/命/妙/ みょうにち /明日/ みらい /未来/ みりめーとる /粍/ みん /眠/民/ む /夢/無/鵡/霧/矛/牟/務/ むi /向/ むk /向/ むいみ /無意味/ むかし /昔/ むかんけい /無関係/ むく /椋/ むくw /報/ むげん /無限/ むこ /婿/ むこう /無効/ むし /無視/虫/ むしょう /無償/ むすb /結/ むすn /結/ むすこ /息子/ むすめ /娘/ むせいか /無声化/ むせきにん /無責任/ むせん /無線/ むだ /無駄/ むね /旨/胸/ むのうしゃ /無能者/ むり /無理/ むりょう /無料/ むれ /群/ め /目/女/茅/ めい /名/明/命/迷/姪/鳴/銘/盟/冥/ めいかく /明確/ めいき /明記/ めいさくげきじょう /名作劇場/ めいし /名詞/ めいしょう /名称/ めいじ /明示/ めいれい /命令/ めいわく /迷惑/ めざs /目指/ めす /牝/ めずらs /珍/ めだt /目立/ めつ /滅/ めん /面/麺/緬/綿/棉/免/ めんきょ /免許/ めんどう /面倒/ も /茂/母/模/摸/ もe /燃/ もr /盛/漏/ もt /持/盛/ もう /蒙/耗/網/盲/猛/毛/孟/妄/ もうk /設/儲/ もうs /申/ もく /目/木/杢/黙/ もくじ /目次/ もくてき /目的/ もくてきご /目的語/ もくひょう /目標/ もじ /文字/ もじれつ /文字列/ もち /餅/ もちろん /勿論/勿/ もっとも /尤も/ もつ /物/ もと /下/本/元/基/ もとd /基/ もとm /求/ もどr /戻/ もどs /戻/ もどt /戻/ もなか /最中/ もの /物/者/ ものがたり /物語/ もみ /籾/ もよr /最寄/ もらe /貰/ もらi /貰/ もらt /貰/ もらu /貰/ もらw /貰/ もり /森/ もん /問/文/門/紋/悶/ もんく /文句/ もんだい /問題/ もんだいていき /問題提起/ もんだいてん /問題点/ もんめ /匁/ や /屋/家/夜/矢/弥/野/耶/爺/冶/也/ やi /焼/ やk /焼/ やきゅう /野球/ やく /訳/役/約/薬/躍/厄/ やくしゃ /訳者/ やくそく /約束/ やくちゅう /訳注/ やくほん /訳本/ やくわり /役割/ やさs /易/優/ やしろ /社/ やじ /野次/ やすi /安/易/ やすk /安/易/ やすm /休/ やすs /安/ やすい /靖/ やすうr /安売/ やっこ /奴/ やつ /奴/ やとu /雇/ やど /宿/ やなぎ /柳/ やぶ /薮/ やぶr /破/ やま /山/ やまぐち /山口/ やり /鑓/ ゆ /諭/油/由/輸/癒/愈/愉/ ゆr /揺/ ゆい /由/唯/ ゆいいつ /唯一/ ゆう /優/由/裕/夕/有/融/雄/郵/邑/遊/誘/祐/猷/猶/涌/湧/柚/揖/憂/悠/幽/宥/友/勇/佑/ ゆうs /有/ ゆうい /有為/ ゆうが /優雅/ ゆうがた /夕方/ ゆうこう /有効/ ゆうしょう /優勝/ ゆうじん /友人/ ゆうせん /優先/ ゆうめい /有名/ ゆうめいじん /有名人/ ゆうよう /有用/ ゆうりょく /有力/ ゆがm /歪/ ゆがn /歪/ ゆき /雪/ ゆずr /譲/ ゆずt /譲/ ゆたか /裕/ ゆび /指/ ゆめ /夢/ ゆるs /許/ よ /代/世/余/夜/予/預/輿/誉/与/ よb /呼/ よi /良/酔/ よk /良/ よm /読/ よn /読/呼/ よr /寄/ よs /寄/良/ よt /酔/寄/ よw /酔/ よう /用/様/要/陽/遥/葉/養/踊/謡/蓉/耀/羊/窯/熔/溶/洋/楊/曜/擁/揺/揚/庸/容/妖/幼/傭/ ようい /用意/容易/ ようきゅう /要求/ ようし /用紙/ ようす /様子/ ようそうろんり /様相論理/ ようほう /用法/ ようぼう /要望/ ようやく /要約/ ようりょう /容量/ よく /翼/翌/浴/沃/欲/抑/慾/ よこ /横/ よこはま /横浜/ よごr /汚/ よし /由/ よそう /予想/ よそく /予測/ よだん /余談/ よてい /予定/ よど /淀/ よなか /夜中/ よね /米/ よぶん /余分/ よゆう /余裕/ よりどころ /拠所/ よる /夜/ よろs /宜/ よろい /鎧/ よろこb /喜/ よろこn /喜/ よろず /万/ よわi /弱/ よわk /弱/ よわm /弱/ よわs /弱/ ら /等/裸/螺/羅/ らい /来/雷/頼/莱/ らいしゅう /来週/ らいねんど /来年度/ らく /楽/落/酪/絡/洛/ らん /覧/欄/嵐/乱/蘭/藍/濫/卵/ り /裏/里/離/理/利/裡錙/痢/裡/璃/梨/李/履/吏/ りえき /利益/ りかい /理解/ りかだい /理科大/ りき /力/ りく /陸/ りけん /理研/ りじゅん /利潤/ りっぱ /立派/ りつ /率/立/葎/律/ りてん /利点/ りゃく /略/掠/ りゅう /流/隆/立/龍/竜/粒/硫/留/琉/溜/劉/ りゅうこう /流行/ りゅうつう /流通/ りゆう /理由/ りょ /虜/旅/慮/侶/ りょう /量/寮/両/領/陵/遼/諒/良/糧/稜/瞭/療/猟/涼/梁/料/凌/僚/亮/了/ りょういき /領域/ りょうかい /了解/ りょうきん /料金/ りょうこう /良好/ りょうしゃ /両者/ りょうほう /両方/ りょうめ /両目/ りょうり /料理/ りょく /力/緑/ りよう /利用/ りようしゃ /利用者/ りようほうほう /利用方法/ りろん /理論/ りろんてき /理論的/ りん /隣/輪/麟/鱗/臨/琳/燐/淋/林/厘/倫/ りんせつ /隣接/ る /流/瑠/ るい /涙/類/累/塁/ れい /例/齢/麗/霊/零/隷/鈴/苓/礼/玲/怜/嶺/励/冷/伶/令/ れいがい /例外/ れき /歴/暦/ れきし /歴史/ れっしゃ /列車/ れつ /列/裂/烈/劣/ れん /恋/蓮/錬/錬/連/聯/練/簾/煉/漣/憐/廉/ れんきゅう /連休/ れんさい /連載/ れんしゅう /練習/ れんぞく /連続/ れんぞくち /連続値/ れんらく /連絡/ れんらくさき /連絡先/ れんらくせん /連絡船/ ろ /露/路/賂/炉/櫓/魯/呂/ ろう /朗/郎/蝋/聾/老/篭/狼/牢/漏/浪/榔/楼/弄/廊/婁/労/ ろうひ /浪費/ ろうりょく /労力/ ろく /緑/録/肋/禄/麓/六/ ろくが /録画/ ろっぽんぎ /六本木/ ろん /論/ ろんぎ /論議/ ろんぶん /論文/ ろんり /論理/ わ /話/輪/和/倭/ わb /詫/ わい /歪/賄/ わかi /若/ わかk /若/ わかr /判/解/ わかs /若/ わかt /判/解/ わき /脇/ わく /枠/惑/ わくせい /惑星/ わけ /訳/ わざ /技/ わし /鷲/ わしゃ /話者/ わすr /忘/ わずらw /煩/ わせだ /早稲田/ わたr /渡/亘/亙/ わたs /渡/ わたt /渡/ わたくし /私/ わたし /私/ わたしこじん /私個人/ わたしじしん /私自身/ わたしたち /私達/ わだい /話題/ わに /鰐/ わら /藁/ わらe /笑/ わらi /笑/ わらt /笑/ わらw /笑/ わらび /蕨/ わり /割/ わりばし /割箸/ わるi /悪/ わるk /悪/ わるs /悪/ われ /我/ わん /腕/碗/湾/椀/ ng-1.5beta1/bin/SKG-ROMAN100644 1750 1750 3742 7126003715 13451 0ustar amurausers, 、 . 。 ? ? ! ! [ 「 ] 」 { 『 } 』 ( ( ) ) # # @ @ / ・ - ー 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 a あ i い u う e え o お ka か ki き ku く ke け ko こ kya きゃ kyu きゅ kyo きょ ga が gi ぎ gu ぐ ge げ go ご gya ぎゃ gyu ぎゅ gyo ぎょ sa さ si し shi し su す se せ so そ sya しゃ syu しゅ syo しょ za ざ ji じ zi じ zu ず ze ぜ zo ぞ ja じゃ ju じゅ jo じょ ta た ti ち chi ち tu つ tsu つ te て thi てぃ to と cha ちゃ chu ちゅ cho ちょ tya ちゃ tyu ちゅ tyo ちょ da だ di ぢ du づ de で do ど dya ぢゃ dyu ぢゅ dyo ぢょ na な ni に nu ぬ ne ね no の nya にゃ nyu にゅ nyo にょ ha は hi ひ hu ふ fu ふ he へ ho ほ hya ひゃ hyu ひゅ hyo ひょ fa ふぁ fi ふぃ fe ふぇ fo ふぉ ba ば bi び bu ぶ be べ bo ぼ bya びゃ byu びゅ byo びょ pa ぱ pi ぴ pu ぷ pe ぺ po ぽ pya ぴゃ pyu ぴゅ pyo ぴょ ma ま mi み mu む me め mo も mya みゃ myu みゅ myo みょ ya や yu ゆ yo よ ra ら ri り ru る re れ ro ろ la ら li り lu る le れ lo ろ rya りゃ ryu りゅ ryo りょ lya りゃ lyu りゅ lyo りょ wa わ wo を nn ん xya ゃ xyu ゅ xyo ょ xtu っ xa ぁ xi ぃ xu ぅ xe ぇ xo ぉ A ア I イ U ウ E エ O オ KA カ KI キ KU ク KE ケ KO コ KYA キャ KYU キュ KYO キョ GA ガ GI ギ GU グ GE ゲ GO ゴ GYA ギャ GYU ギュ GYO ギョ SA サ SI シ SU ス SE セ SO ソ SYA シャ SYU シュ SYO ショ ZA ザ JI ジ ZU ズ ZE ゼ ZO ゾ JA ジャ JU ジュ JO ジョ TA タ TI チ TU ツ TE テ TO ト THI ティ TYA チャ TYU チュ TYO チョ CHA チャ CHU チュ CHO チョ DA ダ DI ヂ DU ヅ DE デ DO ド DYA ヂャ DYU ヂュ DYO ヂョ DHI ディ NA ナ NI ニ NU ヌ NE ネ NO ノ NYA ニャ NYU ニュ NYO ニョ HA ハ HI ヒ HU フ HE ヘ HO ホ HYA ヒャ HYU ヒュ HYO ヒョ FA ファ FI フィ FU フ FE フェ FO フォ BA バ BI ビ BU ブ BE ベ BO ボ BYA ビャ BYU ビュ BYO ビョ PA パ PI ピ PU プ PE ペ PO ポ PYA ピャ PYU ピュ PYO ピョ MA マ MI ミ MU ム ME メ MO モ MYA ミャ MYU ミュ MYO ミョ YA ヤ YU ユ YO ヨ XYA ャ XYU ュ XYO ョ RA ラ RI リ RU ル RE レ RO ロ RYA リャ RYU リュ RYO リョ LA ラ LI リ LU ル LE レ LO ロ LYA リャ LYU リュ LYO リョ WA ワ WO ヲ NN ン XTU ッ XA ァ XI ィ XU ゥ XE ェ XO ォ ng-1.5beta1/sys/ 40755 1750 1750 0 7642273645 12211 5ustar amurausersng-1.5beta1/sys/amiga/ 40755 1750 1750 0 7642273645 13267 5ustar amurausersng-1.5beta1/sys/amiga/DMakefile100644 1750 1750 16755 7247657136 15170 0ustar amurausers# $Id: DMakefile,v 1.3 2001/03/02 08:48:30 amura Exp $ # Makefile for MicroEMACS. using DICE # # $Log: DMakefile,v $ # Revision 1.3 2001/03/02 08:48:30 amura # now AUTOSAVE feature implemented almost all (except for WIN32 # # Revision 1.2 2000/10/02 13:59:28 amura # edit for new ttymenu.c # # Revision 1.1.1.1 2000/06/27 01:48:01 amura # import to CVS # # Modified for Ng 1.4 AmigaDOS version by amura Mar.17.2000 # Modified for Ng 1.3 AmigaDOS version by H.Konishi Sep.4,1993 # Modified for Ng 1.3 AmigaDOS version by H.Ohkubo Dec.20,1992 SYS = amiga S = sys/$(SYS) # If defined USE_ARP, set LIBS ??. LIBS = # set compiler and compile option CC = dcc CFLAGS = -I. -I$(S) -Isys/default -DAMIGA -2.0 -mC -mD LFLAGS = -2.0 -mC -mD # Now, compile-time options (PREFS) are defined in config.h. # XOBJ is used to denote any extra object files needed for these # options. MENUOBJ and MOUSEOBJ denote the extra object files # needed for the menu, mouse and Browser. MOUSEOBJ = ttymouse.o MENUOBJ = ttymenu.o OFFSETOBJ = offset.o ICONIFYOBJ = iconify.o ttyicon.o CLIPOBJ = clipboard.o REXXOBJ = #REXXOBJ = rexx.o XOBJ = $(MOUSEOBJ) $(MENUOBJ) $(ICONIFYOBJ) $(OFFSETOBJ) $(CLIPOBJ) $(REXXOBJ) # Objects which only depend on the "standard" includes OBJS = basic.o dir.o dired.o shell.o version.o window.o \ kinsoku.o jump.o autosave.o # Those with unique requirements IND = buffer.o complt.o display.o cmode.o echo.o extend.o file.o \ help.o kbd.o keymap.o line.o macro.o main.o match.o modes.o \ paragraph.o random.o region.o regex.o re_search.o search.o \ skg.o kanji.o undo.o word.o # System dependent objects OOBJS = cinfo.o spawn.o ttyio.o tty.o ttykbd.o fileio.o sleep.o \ sysinit.o console.o dirio.o OBJ = $(OBJS) $(IND) $(OOBJS) $(XOBJ) zz_pointer.o OSRCS = cinfo.c fileio.c spawn.c ttyio.c tty.c ttykbd.c fileio.c sleep.c \ sysinit.c malloc.c console.c dirio.c SRCS = basic.c dir.c dired.c file.c line.c match.c paragraph.c \ random.c region.c search.c version.c window.c word.c \ buffer.c display.c echo.c extend.c help.c kbd.c keymap.c \ macro.c main.c modes.c regex.c re_search.c undo.c cmode.c \ shell.c kinsoku.c complt.c kanji.c compile.c skg.c jump.c autosave.c OINCS = $(S)/ttydef.h $(S)/sysdef.h sys/default/chrdef.h INCS = def.h config.h REINCS = regex_e.h regex_j.h regex_j.c regex_e.h kanji_.h kanji_.c #PROG = mg PROG = ng # # the editor # Building in Ram: saves a LOT of time in pass 2 of the linker. # $(PROG): $(OBJ) $(CC) -o ram:$(PROG) $(LFLAGS) $(OBJ) $(LIBS) copy ram:$(PROG) $(PROG) delete ram:$(PROG) clean: -delete $(OBJ) autosave.o: autosave.c $(INCS) $(OINCS) $(CC) $(CFLAGS) -c -o %(left) %(right:*.c) basic.o: basic.c $(INCS) $(OINCS) $(CC) $(CFLAGS) -c -o %(left) %(right:*.c) dir.o: dir.c $(INCS) $(OINCS) $(CC) $(CFLAGS) -c -o %(left) %(right:*.c) dired.o: dired.c $(INCS) $(OINCS) kbd.h $(CC) $(CFLAGS) -c -o %(left) %(right:*.c) jump.o: jump.c $(INCS) $(OINCS) $(CC) $(CFLAGS) -c -o %(left) %(right:*.c) kinsoku.o: kinsoku.c $(INCS) $(OINCS) $(CC) $(CFLAGS) -c -o %(left) %(right:*.c) shell.o: shell.c $(INCS) $(OINCS) $(CC) $(CFLAGS) -c -o %(left) %(right:*.c) version.o: version.c $(INCS) $(OINCS) $(CC) $(CFLAGS) -c -o %(left) %(right:*.c) window.o: window.c $(INCS) $(OINCS) $(CC) $(CFLAGS) -c -o %(left) %(right:*.c) word.o: word.c $(INCS) $(OINCS) undo.h $(CC) $(CFLAGS) -c -o %(left) %(right:*.c) buffer.o: buffer.c $(INCS) $(OINCS) kbd.h undo.h $(CC) $(CFLAGS) -c -o %(left) %(right:*.c) cmode.o: cmode.c $(INCS) $(OINCS) undo.h $(CC) $(CFLAGS) -c -o %(left) %(right:*.c) file.o: file.c $(INCS) $(OINCS) undo.h $(CC) $(CFLAGS) -c -o %(left) %(right:*.c) line.o: line.c $(INCS) $(OINCS) undo.h $(CC) $(CFLAGS) -c -o %(left) %(right:*.c) paragraph.o: paragraph.c $(INCS) $(OINCS) undo.h $(CC) $(CFLAGS) -c -o %(left) %(right:*.c) random.o: random.c $(INCS) $(OINCS) undo.h $(CC) $(CFLAGS) -c -o %(left) %(right:*.c) region.o: region.c $(INCS) $(OINCS) undo.h $(CC) $(CFLAGS) -c -o %(left) %(right:*.c) undo.o: undo.c $(INCS) $(OINCS) undo.h $(CC) $(CFLAGS) -c -o %(left) %(right:*.c) complt.o: complt.c $(INCS) $(OINCS) kbd.h complt.h $(CC) $(CFLAGS) -c -o %(left) %(right:*.c) display.o: display.c $(INCS) $(OINCS) kbd.h $(CC) $(CFLAGS) -c -o %(left) %(right:*.c) modes.o: modes.c $(INCS) $(OINCS) kbd.h $(CC) $(CFLAGS) -c -o %(left) %(right:*.c) echo.o: echo.c $(INCS) $(OINCS) key.h macro.h $(CC) $(CFLAGS) -c -o %(left) %(right:*.c) extend.o: extend.c $(INCS) $(OINCS) kbd.h macro.h key.h $(CC) $(CFLAGS) -c -o %(left) %(right:*.c) help.o: help.c $(INCS) $(OINCS) kbd.h macro.h key.h $(CC) $(CFLAGS) -c -o %(left) %(right:*.c) kanji.o: kanji.c $(INCS) $(OINCS) kinit.h $(CC) $(CFLAGS) -c -o %(left) %(right:*.c) kbd.o: kbd.c $(INCS) $(OINCS) macro.h kbd.h key.h undo.h $(CC) $(CFLAGS) -c -o %(left) %(right:*.c) macro.o: macro.c $(INCS) $(OINCS) macro.h key.h $(CC) $(CFLAGS) -c -o %(left) %(right:*.c) skg.o: skg.c $(INCS) $(OINCS) macro.h key.h undo.h $(CC) $(CFLAGS) -c -o %(left) %(right:*.c) main.o: main.c $(INCS) $(OINCS) macro.h $(CC) $(CFLAGS) -c -o %(left) %(right:*.c) search.o: search.c $(INCS) $(OINCS) macro.h $(CC) $(CFLAGS) -c -o %(left) %(right:*.c) match.o: match.c $(INCS) $(OINCS) key.h $(CC) $(CFLAGS) -c -o %(left) %(right:*.c) re_search.o: re_search.c $(INCS) $(OINCS) $(REINCS) $(CC) $(CFLAGS) -c -o %(left) re_search.c regex.o: regex.c $(INCS) $(OINCS) $(REINCS) $(CC) $(CFLAGS) -c -o %(left) regex.c keymap.o: keymap.c $(INCS) $(OINCS) $(S)/amiga_maps.c kbd.h $(CC) $(CFLAGS) -c -o keymap.o keymap.c fileio.o: $(S)/fileio.c $(INCS) $(OINCS) $(S)/zz_pointer.h kbd.h $(CC) $(CFLAGS) -c -o fileio.o $(S)/fileio.c spawn.o: $(S)/spawn.c $(INCS) $(OINCS) $(CC) $(CFLAGS) -c -o spawn.o $(S)/spawn.c sleep.o: $(S)/sleep.c $(INCS) $(OINCS) $(CC) $(CFLAGS) -c -o sleep.o $(S)/sleep.c sysinit.o: $(S)/sysinit.c $(INCS) $(OINCS) $(S)/zz_pointer.h $(CC) $(CFLAGS) -c -o sysinit.o $(S)/sysinit.c #malloc.o: $(S)/malloc.c $(INCS) $(OINCS) # $(CC) $(CFLAGS) -c -o malloc.o $(S)/malloc.c offset.o: $(S)/offset.c $(INCS) $(OINCS) $(CC) $(CFLAGS) -c -o offset.o $(S)/offset.c iconify.o: $(S)/iconify.c $(INCS) $(OINCS) $(S)/iconify.h $(CC) $(CFLAGS) -c -o iconify.o $(S)/iconify.c tty.o: $(S)/tty.c $(INCS) $(OINCS) $(CC) $(CFLAGS) -c -o tty.o $(S)/tty.c ttyicon.o: $(S)/ttyicon.c $(INCS) $(OINCS) $(S)/iconify.h $(CC) $(CFLAGS) -I$(S)/iconify -c -o ttyicon.o $(S)/ttyicon.c ttyio.o: $(S)/ttyio.c $(INCS) $(OINCS) $(CC) $(CFLAGS) -c -o ttyio.o $(S)/ttyio.c ttykbd.o: $(S)/ttykbd.c $(INCS) $(OINCS) kbd.h $(CC) $(CFLAGS) -c -o ttykbd.o $(S)/ttykbd.c ttymenu.o: $(S)/ttymenu.c $(INCS) $(OINCS) macro.h $(S)/KgMenus.c $(S)/KgMenus.h $(S)/menumap.h $(CC) $(CFLAGS) -c -o ttymenu.o $(S)/ttymenu.c ttymouse.o: $(S)/ttymouse.c $(INCS) $(OINCS) macro.h $(CC) $(CFLAGS) -c -o ttymouse.o $(S)/ttymouse.c #menustack.o: $(S)/menustack.c $(INCS) $(OINCS) # $(CC) $(CFLAGS) -c -o menustack.o $(S)/menustack.c console.o: $(S)/console.c $(INCS) $(OINCS) $(CC) $(CFLAGS) -c -o console.o $(S)/console.c dirio.o: $(S)/dirio.c $(INCS) $(OINCS) $(CC) $(CFLAGS) -c -o dirio.o $(S)/dirio.c #alloca.o: sys/default/alloca.c # cc $(CFLAGS) -o $@ sys/default/$*.c cinfo.o: sys/default/cinfo.c $(INCS) $(OINCS) cp sys/default/cinfo.c . $(CC) $(CFLAGS) -c -o cinfo.o cinfo.c rm cinfo.c #rexx.o: $(S)/rexx.c $(INCS) $(OINCS) # $(CC) $(CFLAGS) -c -o rexx.o $(S)/rexx.c zz_pointer.o: $(S)/zz_pointer.c $(INCS) $(OINCS) $(CC) $(CFLAGS) -c -o zz_pointer.o $(S)/zz_pointer.c clipboard.o: $(S)/clipboard.c $(INCS) $(OINCS) $(CC) $(CFLAGS) -c -o clipboard.o $(S)/clipboard.c ng-1.5beta1/sys/amiga/KgMenus.c100644 1750 1750 6553 7126003720 15070 0ustar amurausers/* $Id: KgMenus.c,v 1.1.1.1 2000/06/27 01:48:00 amura Exp $ */ /*********************************************/ /* */ /* Designer (C) Ian OConnor 1994 */ /* */ /* Designer Produced C include file */ /* */ /*********************************************/ /* * $Log: KgMenus.c,v $ * Revision 1.1.1.1 2000/06/27 01:48:00 amura * import to CVS * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "KgMenus.h" struct Window *Win0 = NULL; APTR Win0VisualInfo; struct Gadget *Win0GList; struct Gadget *Win0Gadgets[4]; UWORD Win0GadgetTypes[] = { BUTTON_KIND, BUTTON_KIND, BUTTON_KIND, BUTTON_KIND, }; struct NewGadget Win0NewGadgets[] = { 24, 21, 58, 12, (UBYTE *)"Top", &topaz800, Win0_Gad0, 16, NULL, NULL, 84, 21, 58, 12, (UBYTE *)"Up", &topaz800, Win0_Gad1, 16, NULL, NULL, 84, 35, 58, 12, (UBYTE *)"Redraw", &topaz800, Win0_Gad2, 16, NULL, NULL, 24, 35, 29, 12, (UBYTE *)"|<", &topaz800, Win0_Gad3, 16, NULL, NULL, }; UWORD Win0ZoomInfo[4] = { 200, 0, 200, 25 }; struct TextAttr topaz800 = { (STRPTR)"topaz.font", 8, 0, 0 }; int OpenWindowWin0( void ) { struct Screen *Scr; UWORD offx, offy; UWORD loop; struct NewGadget newgad; struct Gadget *Gad; if (Win0 == NULL) { if (NULL != (Scr = LockPubScreen(NULL))) { offx = Scr->WBorLeft; offy = Scr->WBorTop + Scr->Font->ta_YSize+1; if (NULL != ( Win0VisualInfo = GetVisualInfoA( Scr, NULL))) { Win0GList = NULL; Gad = CreateContext( &Win0GList); for ( loop=0 ; loop<4 ; loop++ ) { CopyMem((char * )&Win0NewGadgets[loop], ( char * )&newgad, (long)sizeof( struct NewGadget )); newgad.ng_VisualInfo = Win0VisualInfo; newgad.ng_LeftEdge += offx; newgad.ng_TopEdge += offy; Win0Gadgets[ newgad.ng_GadgetID - Win0FirstID ] = Gad = CreateGadgetA( Win0GadgetTypes[loop], Gad, &newgad, newgad.ng_UserData ); } if (Gad != NULL) { if (NULL != (Win0 = OpenWindowTags( NULL, WA_Left, 300, WA_Top, 21, WA_Width, 243+offx, WA_Height, 88+offy, WA_Title, "New Window 0", WA_MinWidth, 150, WA_MinHeight, 25, WA_MaxWidth, 1200, WA_MaxHeight, 1200, WA_DepthGadget, TRUE, WA_Activate, TRUE, WA_Dummy+0x30, TRUE, WA_SmartRefresh, TRUE, WA_AutoAdjust, TRUE, WA_Gadgets, Win0GList, WA_Zoom, Win0ZoomInfo, WA_IDCMP,580, TAG_END))) { GT_RefreshWindow( Win0, NULL); UnlockPubScreen( NULL, Scr); return( 0L ); } } FreeGadgets( Win0GList); FreeVisualInfo( Win0VisualInfo ); } UnlockPubScreen( NULL, Scr); } } else { WindowToFront(Win0); ActivateWindow(Win0); return( 0L ); } return( 1L ); } void CloseWindowWin0( void ) { if (Win0 != NULL) { CloseWindow( Win0); Win0 = NULL; FreeVisualInfo( Win0VisualInfo); FreeGadgets( Win0GList); } } ng-1.5beta1/sys/amiga/KgMenus.h100644 1750 1750 3220 7126003720 15061 0ustar amurausers/* $Id: KgMenus.h,v 1.1.1.1 2000/06/27 01:48:00 amura Exp $ */ /*********************************************/ /* */ /* Designer (C) Ian OConnor 1994 */ /* */ /* Designer Produced C header file */ /* */ /* For Kg 4.2 */ /* */ /*********************************************/ /* * $Log: KgMenus.h,v $ * Revision 1.1.1.1 2000/06/27 01:48:00 amura * import to CVS * */ #define Win0FirstID 0 #define Win0_Gad0 0 /* Top */ #define Win0_Gad1 1 /* Up */ #define Win0_Gad2 2 /* Redraw */ #define Win0_Gad3 3 /* |< */ #define Win0_Gad4 4 /* < */ #define Win0_Gad5 5 /* > */ #define Win0_Gad6 6 /* >| */ #define Win0_Gad7 7 /* Down */ #define Win0_Gad8 8 /* Bottom */ #define Win0_Gad9 9 /* PgUp */ #define Win0_Gad10 10 /* PgDown */ #define Win0_Gad11 11 /* >> */ #define Win0_Gad12 12 /* << */ #define Win0_Gad13 13 /* Show */ #define Win0_Gad14 14 /* Goto: */ #define Win0_Gad15 15 /* SetFont */ #define Win0_Gad16 16 /* SplitWindow */ #define Win0_Gad17 17 /* NextWindow */ #define Win0_Gad18 18 /* CloseWindow */ #define Win0_Gad19 19 /* ToggleBORDER */ #define Win0_Gad20 20 /* Done */ extern struct TextAttr topaz800; extern struct Gadget *Win0Gadgets[21]; extern struct Gadget *Win0GList; extern struct Window *Win0; extern APTR Win0VisualInfo; extern UWORD Win0GadgetTypes[]; extern struct NewGadget Win0NewGadgets[]; extern int OpenWindowWin0( void ); extern void CloseWindowWin0( void ); ng-1.5beta1/sys/amiga/Kgremotemenus.c100644 1750 1750 7574 7126003720 16350 0ustar amurausers/* $Id: Kgremotemenus.c,v 1.1.1.1 2000/06/27 01:48:00 amura Exp $ */ /*********************************************/ /* */ /* Designer (C) Ian OConnor 1994 */ /* */ /* Designer Produced C include file */ /* */ /*********************************************/ /* * $Log: Kgremotemenus.c,v $ * Revision 1.1.1.1 2000/06/27 01:48:00 amura * import to CVS * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "KgMenus.h" struct IntuiText Win0Texts[] = { 2, 3, JAM1, 46, 8, &topaz81281, (UBYTE *)"Goto:", NULL }; struct Window *Win0 = NULL; APTR Win0VisualInfo; struct Gadget *Win0GList; struct Gadget *Win0Gadgets[4]; UWORD Win0GadgetTypes[] = { BUTTON_KIND, BUTTON_KIND, BUTTON_KIND, BUTTON_KIND, }; struct NewGadget Win0NewGadgets[] = { 24, 21, 58, 12, (UBYTE *)"Top", &topaz800, Win0_Gad0, 16, NULL, NULL, 84, 21, 58, 12, (UBYTE *)"Up", &topaz800, Win0_Gad1, 16, NULL, NULL, 84, 35, 58, 12, (UBYTE *)"Redraw", &topaz800, Win0_Gad2, 16, NULL, NULL, 24, 35, 29, 12, (UBYTE *)"|<", &topaz800, Win0_Gad3, 16, NULL, NULL, }; UWORD Win0ZoomInfo[4] = { 200, 0, 200, 25 }; struct TextAttr topaz81281 = { (STRPTR)"topaz", 8, 128, 1 }; struct TextAttr topaz800 = { (STRPTR)"topaz.font", 8, 0, 0 }; void RendWindowWin0( struct Window *Win, void *vi ) { int loop; UWORD offx = Win->BorderLeft; UWORD offy = Win->BorderTop; if (Win != NULL) { for( loop=0; loop<1; loop++) if (Win0Texts[loop].ITextFont==NULL) Win0Texts[loop].ITextFont=Win->WScreen->Font; PrintIText( Win->RPort, Win0Texts, offx, offy); } } int OpenWindowWin0( void ) { struct Screen *Scr; UWORD offx, offy; UWORD loop; struct NewGadget newgad; struct Gadget *Gad; if (Win0 == NULL) { if (NULL != (Scr = LockPubScreen(NULL))) { offx = Scr->WBorLeft; offy = Scr->WBorTop + Scr->Font->ta_YSize+1; if (NULL != ( Win0VisualInfo = GetVisualInfoA( Scr, NULL))) { Win0GList = NULL; Gad = CreateContext( &Win0GList); for ( loop=0 ; loop<4 ; loop++ ) { CopyMem((char * )&Win0NewGadgets[loop], ( char * )&newgad, (long)sizeof( struct NewGadget )); newgad.ng_VisualInfo = Win0VisualInfo; newgad.ng_LeftEdge += offx; newgad.ng_TopEdge += offy; Win0Gadgets[ newgad.ng_GadgetID - Win0FirstID ] = Gad = CreateGadgetA( Win0GadgetTypes[loop], Gad, &newgad, newgad.ng_UserData ); } if (Gad != NULL) { if (NULL != (Win0 = OpenWindowTags( NULL, WA_Left, 300, WA_Top, 21, WA_Width, 243+offx, WA_Height, 88+offy, WA_Title, "New Window 0", WA_MinWidth, 150, WA_MinHeight, 25, WA_MaxWidth, 1200, WA_MaxHeight, 1200, WA_DepthGadget, TRUE, WA_Activate, TRUE, WA_Dummy+0x30, TRUE, WA_SmartRefresh, TRUE, WA_AutoAdjust, TRUE, WA_Gadgets, Win0GList, WA_Zoom, Win0ZoomInfo, WA_IDCMP,580, TAG_END))) { GT_RefreshWindow( Win0, NULL); UnlockPubScreen( NULL, Scr); RendWindowWin0(Win0, Win0VisualInfo ); return( 0L ); } } FreeGadgets( Win0GList); FreeVisualInfo( Win0VisualInfo ); } UnlockPubScreen( NULL, Scr); } } else { WindowToFront(Win0); ActivateWindow(Win0); return( 0L ); } return( 1L ); } void CloseWindowWin0( void ) { if (Win0 != NULL) { CloseWindow( Win0); Win0 = NULL; FreeVisualInfo( Win0VisualInfo); FreeGadgets( Win0GList); } } ng-1.5beta1/sys/amiga/Makefile100644 1750 1750 11651 7247657136 15052 0ustar amurausers# $Id: Makefile,v 1.3 2001/03/02 08:48:30 amura Exp $ # Makefile for MicroEMACS. using Aztec small model # # $Log: Makefile,v $ # Revision 1.3 2001/03/02 08:48:30 amura # now AUTOSAVE feature implemented almost all (except for WIN32 # # Revision 1.2 2000/10/02 13:59:28 amura # edit for new ttymenu.c # # Revision 1.1.1.1 2000/06/27 01:48:01 amura # import to CVS # # Modified for Ng 1.3 AmigaDOS version by H.Ohkubo Dec.20,1992 SYS = amiga S = sys/amiga # If defined USE_ARP, set LIBS -la -lc. #LIBS = -lc LIBS = -la -lc #LIBS = +l rexxglue.o rexxvars.o +l -lc # Aztec C 5.0 has no alloca(). ALLOCA = alloca.o # Now, compile-time options (PREFS) are defined in config.h. # XOBJ is used to denote any extra object files needed for these # options. MENUOBJ and MOUSEOBJ denote the extra object files # needed for the menu, mouse and Browser. MOUSEOBJ = ttymouse.o MENUOBJ = ttymenu.o OFFSETOBJ = offset.o ICONIFYOBJ = iconify.o ttyicon.o #REXXOBJ = rexx.o REXXOBJ = CLIPOBJ = clipboard.o #PREFS = XOBJ = $(MOUSEOBJ) $(MENUOBJ) $(ICONIFYOBJ) $(OFFSETOBJ) $(CLIPOBJ) $(REXXOBJ) CFLAGS = -I$(S) -Isys/default -DAMIGA -DMANX -wos -su # Objects which only depend on the "standard" includes OBJS = basic.o dir.o dired.o shell.o version.o window.o \ kinsoku.o jump.o autosave.o # Those with unique requirements IND = buffer.o complt.o display.o cmode.o echo.o extend.o file.o \ help.o kbd.o keymap.o line.o macro.o main.o match.o modes.o \ paragraph.o random.o region.o regex.o re_search.o search.o \ skg.o kanji.o undo.o word.o # System dependent objects OOBJS = cinfo.o spawn.o ttyio.o tty.o ttykbd.o fileio.o sleep.o \ sysinit.o console.o dirio.o OBJ = $(OBJS) $(IND) $(OOBJS) $(XOBJ) $(ALLOCA) zz_pointer.o OSRCS = cinfo.c fileio.c spawn.c ttyio.c tty.c ttykbd.c fileio.c sleep.c \ sysinit.c malloc.c console.c dirio.c SRCS = basic.c dir.c dired.c file.c line.c match.c paragraph.c \ random.c region.c search.c version.c window.c word.c \ buffer.c display.c echo.c extend.c help.c kbd.c keymap.c \ macro.c main.c modes.c regex.c re_search.c \ cmode.c shell.c kinsoku.c complt.c kanji.c skg.c jump.c undo.c autosave.c OINCS = $(S)/ttydef.h $(S)/sysdef.h sys/default/chrdef.h INCS = def.h config.h REINCS = regex_e.h regex_j.h regex_j.c regex_e.h kanji_.h kanji_.c #PROG = mg PROG = ng # # The editor # Building in Ram: saves a LOT of time in pass 2 of the linker. # $(PROG): $(OBJ) ln -o ram:$(PROG) -w $(OBJ) $(LIBS) copy ram:$(PROG) $(PROG) delete ram:$(PROG) $(OBJ): $(INCS) $(OINCS) buffer.o: $(INCS) $(OINCS) kbd.h undo.h cmode.o file.o line.o paragraph.o random.o region.o undo.o word.o: \ $(INCS) $(OINCS) undo.h complt.o: $(INCS) $(OINCS) kbd.h complt.h display.o modes.o: \ $(INCS) $(OINCS) kbd.h echo.o: $(INCS) $(OINCS) key.h macro.h complt.h extend.o help.o: \ $(INCS) $(OINCS) kbd.h macro.h key.h kanji.o: $(INCS) $(OINCS) kinit.h kbd.o: $(INCS) $(OINCS) kbd.h macro.h key.h undo.h macro.o: $(INCS) $(OINCS) macro.h key.h main.o search.o: \ $(INCS) $(OINCS) macro.h match.o: $(INCS) $(OINCS) key.h re_search.o: $(INCS) $(OINCS) $(REINCS) macro.h regex.o: $(INCS) $(OINCS) $(REINCS) skg.o: $(INCS) $(OINCS) macro.h key.h undo.h $(OOBJS): $(INCS) $(OINCS) clean: Delete $(OBJ) keymap.o: keymap.c $(S)/amiga_maps.c kbd.h cc $(CFLAGS) keymap.c fileio.o: $(S)/fileio.c $(S)/zz_pointer.h kbd.h cc $(CFLAGS) -o fileio.o $(S)/fileio.c spawn.o: $(S)/spawn.c cc $(CFLAGS) -o spawn.o $(S)/spawn.c sleep.o: $(S)/sleep.c cc $(CFLAGS) -o sleep.o $(S)/sleep.c sysinit.o: $(S)/sysinit.c $(S)/zz_pointer.h cc $(CFLAGS) -o sysinit.o $(S)/sysinit.c #malloc.o: $(S)/malloc.c # cc $(CFLAGS) -o malloc.o $(S)/malloc.c offset.o: $(S)/offset.c cc $(CFLAGS) -o offset.o $(S)/offset.c iconify.o: $(S)/iconify/iconify.c $(S)/iconify.h cc $(CFLAGS) -o iconify.o $(S)/iconify/iconify.c tty.o: $(S)/tty.c cc $(CFLAGS) -o tty.o $(S)/tty.c ttyicon.o: $(S)/ttyicon.c $(S)/iconify.h cc $(CFLAGS) -I$(S)/iconify -o ttyicon.o $(S)/ttyicon.c ttyio.o: $(S)/ttyio.c cc $(CFLAGS) -o ttyio.o $(S)/ttyio.c ttykbd.o: $(S)/ttykbd.c kbd.h cc $(CFLAGS) -o ttykbd.o $(S)/ttykbd.c ttymenu.o: $(S)/ttymenu.c macro.h $(S)/KgMenus.h $(S)/KgMenus.c $(S)/menumap.h cc $(CFLAGS) -o ttymenu.o $(S)/ttymenu.c ttymouse.o: $(S)/ttymouse.c macro.h cc $(CFLAGS) -o ttymouse.o $(S)/ttymouse.c #menustack.o: $(S)/menustack.c # cc $(CFLAGS) -o menustack.o $(S)/menustack.c console.o: $(S)/console.c cc $(CFLAGS) -o console.o $(S)/console.c dirio.o: $(S)/dirio.c cc $(CFLAGS) -o dirio.o $(S)/dirio.c #alloca.o: $(S)/alloca.asm # as -o alloca.o $(S)/alloca.asm alloca.o: sys/default/alloca.c cc $(CFLAGS) -o $@ sys/default/$*.c cinfo.o: sys/default/cinfo.c cc $(CFLAGS) -o cinfo.o sys/default/cinfo.c #rexx.o: $(S)/rexx.c # cc $(CFLAGS) -o rexx.o $(S)/rexx.c zz_pointer.o: $(S)/zz_pointer.c $(S)/zz_pointer.h cc $(CFLAGS) -o zz_pointer.o $(S)/zz_pointer.c clipboard.o: $(S)/clipboard.c cc $(CFLAGS) -o clipboard.o $(S)/clipboard.c ng-1.5beta1/sys/amiga/Makefile.SAS6100644 1750 1750 11720 7247657136 15562 0ustar amurausers# $Id: Makefile.SAS6,v 1.3 2001/03/02 08:48:30 amura Exp $ # Makefile for MicroEMACS. using SAS/C 6.0 # # $Log: Makefile.SAS6,v $ # Revision 1.3 2001/03/02 08:48:30 amura # now AUTOSAVE feature implemented almost all (except for WIN32 # # Revision 1.2 2000/10/02 13:59:28 amura # edit for new ttymenu.c # # Revision 1.1.1.1 2000/06/27 01:48:01 amura # import to CVS # # Modified for Ng 1.4 AmigaDOS version by amura Mar.17.2000 # Modified for Ng 1.3 AmigaDOS version by H.Konishi Sep.4,1993 # Modified for Ng 1.3 AmigaDOS version by H.Ohkubo Dec.20,1992 SYS = amiga S = sys/amiga # If defined USE_ARP, set LIBS -la -lc. #LIBS = -lc #LIBS = -la -lc LIBS = lib:sc.lib+lib:amiga.lib #LIBS = +l rexxglue.o rexxvars.o +l -lc # Now, compile-time options (PREFS) are defined in config.h. # XOBJ is used to denote any extra object files needed for these # options. MENUOBJ and MOUSEOBJ denote the extra object files # needed for the menu, mouse and Browser. MOUSEOBJ = ttymouse.o MENUOBJ = ttymenu.o OFFSETOBJ = offset.o ICONIFYOBJ = iconify.o ttyicon.o #REXXOBJ = rexx.o REXXOBJ = CLIPOBJ = clipboard.o #PREFS = XOBJ = $(MOUSEOBJ) $(MENUOBJ) $(ICONIFYOBJ) $(OFFSETOBJ) $(CLIPOBJ) $(REXXOBJ) CFLAGS = -I$(S) -Isys/default -DAMIGA -DMANX -wos -su # Objects which only depend on the "standard" includes OBJS = basic.o dir.o dired.o shell.o version.o window.o \ kinsoku.o jump.o autosave.o # Those with unique requirements IND = buffer.o complt.o display.o cmode.o echo.o extend.o file.o \ help.o kbd.o keymap.o line.o macro.o main.o match.o modes.o \ paragraph.o random.o region.o regex.o re_search.o search.o \ skg.o kanji.o undo.o word.o # System dependent objects OOBJS = cinfo.o spawn.o ttyio.o tty.o ttykbd.o fileio.o sleep.o \ sysinit.o console.o dirio.o OBJ = $(OBJS) $(IND) $(OOBJS) $(XOBJ) $(ALLOCA) zz_pointer.o OSRCS = cinfo.c fileio.c spawn.c ttyio.c tty.c ttykbd.c fileio.c sleep.c \ sysinit.c malloc.c console.c dirio.c SRCS = basic.c dir.c dired.c file.c line.c match.c paragraph.c \ random.c region.c search.c version.c window.c word.c \ buffer.c display.c echo.c extend.c help.c kbd.c keymap.c \ macro.c main.c modes.c regex.c re_search.c \ cmode.c shell.c kinsoku.c complt.c kanji.c skg.c jump.c undo.c autosave.c OINCS = $(S)/ttydef.h $(S)/sysdef.h sys/default/chrdef.h INCS = def.h config.h REINCS = regex_e.h regex_j.h regex_j.c regex_e.h kanji_.h kanji_.c #PROG = mg PROG = ng # # The editor # Building in Ram: saves a LOT of time in pass 2 of the linker. # $(PROG): $(OBJ) ln -o ram:$(PROG) -w $(OBJ) $(LIBS) copy ram:$(PROG) $(PROG) delete ram:$(PROG) $(OBJ): $(INCS) $(OINCS) buffer.o: $(INCS) $(OINCS) kbd.h undo.h cmode.o file.o line.o paragraph.o random.o region.o undo.o word.o: \ $(INCS) $(OINCS) undo.h complt.o: $(INCS) $(OINCS) kbd.h complt.h display.o modes.o: \ $(INCS) $(OINCS) kbd.h echo.o: $(INCS) $(OINCS) key.h macro.h complt.h extend.o help.o: \ $(INCS) $(OINCS) kbd.h macro.h key.h kanji.o: $(INCS) $(OINCS) kinit.h kbd.o: $(INCS) $(OINCS) kbd.h macro.h key.h undo.h macro.o: $(INCS) $(OINCS) macro.h key.h main.o search.o: \ $(INCS) $(OINCS) macro.h match.o: $(INCS) $(OINCS) key.h re_search.o: $(INCS) $(OINCS) $(REINCS) macro.h regex.o: $(INCS) $(OINCS) $(REINCS) skg.o: $(INCS) $(OINCS) macro.h key.h undo.h $(OOBJS): $(INCS) $(OINCS) clean: Delete $(OBJ) keymap.o: keymap.c $(S)/amiga_maps.c kbd.h sc $(CFLAGS) keymap.c fileio.o: $(S)/fileio.c $(S)/zz_pointer.h kbd.h sc $(CFLAGS) -o fileio.o $(S)/fileio.c spawn.o: $(S)/spawn.c sc $(CFLAGS) -o spawn.o $(S)/spawn.c sleep.o: $(S)/sleep.c sc $(CFLAGS) -o sleep.o $(S)/sleep.c sysinit.o: $(S)/sysinit.c $(S)/zz_pointer.h sc $(CFLAGS) -o sysinit.o $(S)/sysinit.c #malloc.o: $(S)/malloc.c # sc $(CFLAGS) -o malloc.o $(S)/malloc.c offset.o: $(S)/offset.c sc $(CFLAGS) -o offset.o $(S)/offset.c iconify.o: $(S)/iconify/iconify.c $(S)/iconify.h sc $(CFLAGS) -o iconify.o $(S)/iconify/iconify.c tty.o: $(S)/tty.c sc $(CFLAGS) -o tty.o $(S)/tty.c ttyicon.o: $(S)/ttyicon.c $(S)/iconify.h sc $(CFLAGS) -I$(S)/iconify -o ttyicon.o $(S)/ttyicon.c ttyio.o: $(S)/ttyio.c sc $(CFLAGS) -o ttyio.o $(S)/ttyio.c ttykbd.o: $(S)/ttykbd.c kbd.h sc $(CFLAGS) -o ttykbd.o $(S)/ttykbd.c ttymenu.o: $(S)/ttymenu.c macro.h $(S)/KgMenus.h $(S)/KgMenus.c $(S)/menumap.h sc $(CFLAGS) -o ttymenu.o $(S)/ttymenu.c ttymouse.o: $(S)/ttymouse.c macro.h sc $(CFLAGS) -o ttymouse.o $(S)/ttymouse.c #menustack.o: $(S)/menustack.c # sc $(CFLAGS) -o menustack.o $(S)/menustack.c console.o: $(S)/console.c sc $(CFLAGS) -o console.o $(S)/console.c dirio.o: $(S)/dirio.c sc $(CFLAGS) -o dirio.o $(S)/dirio.c alloca.o: $(S)/alloca.asm asm -oalloca.o $(S)/alloca.asm cinfo.o: sys/default/cinfo.c sc $(CFLAGS) -o cinfo.o sys/default/cinfo.c #rexx.o: $(S)/rexx.c # sc $(CFLAGS) -o rexx.o $(S)/rexx.c zz_pointer.o: $(S)/zz_pointer.c $(S)/zz_pointer.h sc $(CFLAGS) -o zz_pointer.o $(S)/zz_pointer.c clipboard.o: $(S)/clipboard.c sc $(CFLAGS) -o clipboard.o $(S)/clipboard.c ng-1.5beta1/sys/amiga/Makefile.gcc100644 1750 1750 12060 7247657136 15600 0ustar amurausers# $Id: Makefile.gcc,v 1.3 2001/03/02 08:48:30 amura Exp $ # Makefile for MicroEMACS. using Gnu CC # # $Log: Makefile.gcc,v $ # Revision 1.3 2001/03/02 08:48:30 amura # now AUTOSAVE feature implemented almost all (except for WIN32 # # Revision 1.2 2000/10/02 13:59:28 amura # edit for new ttymenu.c # # Revision 1.1.1.1 2000/06/27 01:48:01 amura # import to CVS # # Modified for Ng 1.4 AmigaDOS version by amura Mar.17.2000 # Modified for Ng 1.3 AmigaDOS version by H.Konishi Sep.4,1993 # Modified for Ng 1.3 AmigaDOS version by H.Ohkubo Dec.20,1992 SYS = amiga S = sys/$(SYS) # If defined USE_ARP, set LIBS ??. LIBS = # set compiler and compile option CC = gcc CFLAGS = -I. -I$(S) -Isys/default -DAMIGA -DGCC -noixemul -O2 -m68020-40 LFLAGS = -noixemul # Now, compile-time options (PREFS) are defined in config.h. # XOBJ is used to denote any extra object files needed for these # options. MENUOBJ and MOUSEOBJ denote the extra object files # needed for the menu, mouse and Browser. MOUSEOBJ = ttymouse.o MENUOBJ = ttymenu.o OFFSETOBJ = offset.o ICONIFYOBJ = iconify.o ttyicon.o CLIPOBJ = clipboard.o #REXXOBJ = rexx.o XOBJ = $(MOUSEOBJ) $(MENUOBJ) $(ICONIFYOBJ) $(OFFSETOBJ) $(CLIPOBJ) $(REXXOBJ) # Objects which only depend on the "standard" includes OBJS = basic.o dir.o dired.o shell.o version.o window.o \ kinsoku.o jump.o autosave.o # Those with unique requirements IND = buffer.o complt.o display.o cmode.o echo.o extend.o file.o \ help.o kbd.o keymap.o line.o macro.o main.o match.o modes.o \ paragraph.o random.o region.o regex.o re_search.o search.o \ skg.o kanji.o undo.o word.o # System dependent objects OOBJS = cinfo.o spawn.o ttyio.o tty.o ttykbd.o fileio.o sleep.o \ sysinit.o console.o dirio.o OBJ = $(OBJS) $(IND) $(OOBJS) $(XOBJ) zz_pointer.o OSRCS = cinfo.c fileio.c spawn.c ttyio.c tty.c ttykbd.c fileio.c sleep.c \ sysinit.c malloc.c console.c dirio.c SRCS = basic.c dir.c dired.c file.c line.c match.c paragraph.c \ random.c region.c search.c version.c window.c word.c \ buffer.c display.c echo.c extend.c help.c kbd.c keymap.c \ macro.c main.c modes.c regex.c re_search.c cmode.c \ shell.c kinsoku.c complt.c kanji.c skg.c jump.c undo.c autosave.c OINCS = $(S)/ttydef.h $(S)/sysdef.h sys/default/chrdef.h INCS = def.h config.h REINCS = regex_e.h regex_j.h regex_j.c regex_e.h kanji_.h kanji_.c #PROG = mg PROG = ng .c.o: $(CC) -o $@ -c $(CFLAGS) $< # # the editor # Building in Ram: saves a LOT of time in pass 2 of the linker. # $(PROG): $(OBJ) $(CC) -o ram:$(PROG) $(LFLAGS) $(OBJ) $(LIBS) copy ram:$(PROG) $(PROG) delete ram:$(PROG) clean: -delete $(OBJ) $(OBJ): $(INCS) $(OINCS) buffer.o: $(INCS) $(OINCS) kbd.h undo.h cmode.o file.o line.o paragraph.o random.o region.o undo.o word.o: \ $(INCS) $(OINCS) undo.h complt.o: $(INCS) $(OINCS) kbd.h complt.h display.o modes.o: \ $(INCS) $(OINCS) kbd.h echo.o: $(INCS) $(OINCS) key.h macro.h complt.h extend.o help.o: \ $(INCS) $(OINCS) kbd.h macro.h key.h kanji.o: $(INCS) $(OINCS) kinit.h kbd.o: $(INCS) $(OINCS) kbd.h macro.h key.h undo.h macro.o: $(INCS) $(OINCS) macro.h key.h main.o search.o: \ $(INCS) $(OINCS) macro.h match.o: $(INCS) $(OINCS) key.h re_search.o: $(INCS) $(OINCS) $(REINCS) macro.h regex.o: $(INCS) $(OINCS) $(REINCS) skg.o: $(INCS) $(OINCS) macro.h key.h undo.h $(OOBJS): $(INCS) $(OINCS) keymap.o: keymap.c $(S)/amiga_maps.c kbd.h $(CC) $(CFLAGS) -c -o keymap.o keymap.c fileio.o: $(S)/fileio.c $(S)/zz_pointer.h kbd.h $(CC) $(CFLAGS) -c -o fileio.o $(S)/fileio.c spawn.o: $(S)/spawn.c $(CC) $(CFLAGS) -c -o spawn.o $(S)/spawn.c sleep.o: $(S)/sleep.c $(CC) $(CFLAGS) -c -o sleep.o $(S)/sleep.c sysinit.o: $(S)/sysinit.c $(S)/zz_pointer.h $(CC) $(CFLAGS) -c -o sysinit.o $(S)/sysinit.c #malloc.o: $(S)/malloc.c # $(CC) $(CFLAGS) -c -o malloc.o $(S)/malloc.c offset.o: $(S)/offset.c $(CC) $(CFLAGS) -c -o offset.o $(S)/offset.c iconify.o: $(S)/iconify.c $(S)/iconify.h $(CC) $(CFLAGS) -c -o iconify.o $(S)/iconify.c tty.o: $(S)/tty.c $(CC) $(CFLAGS) -c -o tty.o $(S)/tty.c ttyicon.o: $(S)/ttyicon.c $(S)/iconify.h $(CC) $(CFLAGS) -I$(S)/iconify -c -o ttyicon.o $(S)/ttyicon.c ttyio.o: $(S)/ttyio.c $(CC) $(CFLAGS) -c -o ttyio.o $(S)/ttyio.c ttykbd.o: $(S)/ttykbd.c kbd.h $(CC) $(CFLAGS) -c -o ttykbd.o $(S)/ttykbd.c ttymenu.o: $(S)/ttymenu.c macro.h $(S)/KgMenus.h $(S)/KgMenus.c $(S)/menumap.h $(CC) $(CFLAGS) -c -o ttymenu.o $(S)/ttymenu.c ttymouse.o: $(S)/ttymouse.c macro.h $(CC) $(CFLAGS) -c -o ttymouse.o $(S)/ttymouse.c #menustack.o: $(S)/menustack.c # $(CC) $(CFLAGS) -c -o menustack.o $(S)/menustack.c console.o: $(S)/console.c $(CC) $(CFLAGS) -c -o console.o $(S)/console.c dirio.o: $(S)/dirio.c $(CC) $(CFLAGS) -c -o dirio.o $(S)/dirio.c #alloca.o: $(S)/alloca.asm # phxass $(S)/alloca.asm to alloca.o cinfo.o: sys/default/cinfo.c $(CC) $(CFLAGS) -c -o cinfo.o sys/default/cinfo.c #rexx.o: $(S)/rexx.c # $(CC) $(CFLAGS) -c -o rexx.o $(S)/rexx.c zz_pointer.o: $(S)/zz_pointer.c $(S)/zz_pointer.h $(CC) $(CFLAGS) -c -o zz_pointer.o $(S)/zz_pointer.c clipboard.o: $(S)/clipboard.c $(CC) $(CFLAGS) -c -o clipboard.o $(S)/clipboard.c ng-1.5beta1/sys/amiga/Ng-Startup100644 1750 1750 1602 7126003720 15270 0ustar amurausers; $Id: Ng-Startup,v 1.1.1.1 2000/06/27 01:48:00 amura Exp $ ; ; Ng startup file by amura ; ; selection Font ;(amiga-set-font 'Mincho '14 ) ; ; for No Backup files ;(make-backup-files nil) ; backspace <-> ^H (bsmap-mode) ; set-mark-command to ^\ (global-set-key "\^\\" 'set-mark-command) ; c-mode setting (set-c-argdecl-indent 0) (set-c-continued-statement-offset 8) (set-c-indent-level 8) (set-c-label-offset -8) (set-c-tab-always-indent nil) ; set regular-exp. re-search (global-set-key "\^[\^s" 're-search-forward) (global-set-key "\^[\^r" 're-search-backward) ; set kanji mode ;(set-kanji-expected-code 'shift-jis) (set-default-fileio-code 'shift-jis) (set-kanji-input-code 'euc) (set-kanji-display-code 'euc) ; set blink matching (global-set-key ")" 'blink-matching-paren-hack) (global-set-key "}" 'blink-matching-paren-hack) (global-set-key "]" 'blink-matching-paren-hack) ; ng-1.5beta1/sys/amiga/alloca.asm100644 1750 1750 2212 7126003720 15274 0ustar amurausers* $Id: alloca.asm,v 1.1.1.1 2000/06/27 01:48:00 amura Exp $ * * alloca() For SAS/C 6.0 By H.Konishi. * * This routine was written by Stephen Walton, swalton@solar.stanford.edu, * a rank asm amateur, to attempt to provide the alloca() function for Manx * Aztec C on the Amiga. It probably does horrible illegal things to the * stack but seems to mostly work. * * This subroutine expects a single int as argument, and returns a pointer * to a block of memory of that size allocated off the local stack. Thus, * this memory is automatically freed when the current subroutine exits. * * This version for the default Manx settings (int = 16 bits). To use * with int=32 bits, simply change both the ".w" to ".l" * * $Log: alloca.asm,v $ * Revision 1.1.1.1 2000/06/27 01:48:00 amura * import to CVS * * xdef _alloca section code _alloca: move.l a7,a1 ; Save current value of stack pointer move.w 4(a7),d0 ; Number of bytes needed suba.w d0,a7 ; Move stack up that many places move.l (a1),(a7) ; Place return address in proper place move.l a7,d0 ; Return value into d0 add.l #6,d0 ; plus amount by which stack is popped rts ; And back we go endng-1.5beta1/sys/amiga/amiga_maps.c100644 1750 1750 7321 7126003720 15607 0ustar amurausers/* $Id: amiga_maps.c,v 1.1.1.1 2000/06/27 01:48:00 amura Exp $ */ /* * Name: MG 2a * keymap.c setup for Amiga-specific function keys. * Created: 14-May-1988 Mic Kaczmarczik (mic@emx.utexas.edu) * Last edit: 14-May-1988 Mic Kaczmarczik * * One big table for coding convenience, because the number of different * compilation possibilities makes setting up data structures kind of * tricky. Once again for convenience, the file is #included into keymap.c * instead of being linked. I tried to minimize the changes to keymap.c, * while making it possible to have the Amiga function/arrow keys in dired * mode as well as fundamental mode. In the future, we might want to * rebind some of the function keys in dired mode, but for right now they * do the same thing as in fundamental mode. */ /* * $Log: amiga_maps.c,v $ * Revision 1.1.1.1 2000/06/27 01:48:00 amura * import to CVS * */ static PF amiga_keys[] = { #ifdef FKEYS backline, /* Up (0x100) */ forwline, /* Down */ backchar, /* Left */ forwchar, /* Right */ gotobop, /* Shift-Up */ gotoeop, /* Shift-Down */ backword, /* Shift-Left */ forwword, /* Shift-Right */ desckey, /* Help (0x108) */ #else /* 9 unbound keys */ rescan, rescan, rescan, rescan, rescan, rescan, rescan, rescan, rescan, #endif #ifdef DO_MENU amigamenu, /* Menu selction (0x109) */ #else rescan, /* Menu selection (0x109) */ #endif refresh, /* Resize window (0x10A) */ rescan, /* used to be Mouse */ #ifdef FKEYS filevisit, /* F1 (0x10C) */ filesave, /* F2 */ forwpage, /* F3 */ enlargewind, /* F4 */ fillpara, /* F5 */ splitwind, /* F6 */ twiddle, /* F7 */ definemacro, /* F8 */ executemacro, /* F9 */ listbuffers, /* F10 */ poptofile, /* Shift-F1 (0x116) */ filewrite, /* Shift-F2 */ backpage, /* Shift-F3 */ shrinkwind, /* Shift-F4 */ queryrepl, /* Shift-F5 */ onlywind, /* Shift-F6 */ justone, /* Shift-F7 */ finishmacro, /* Shift-F8 */ wallchart, /* Shift-F9 */ quit, /* Shift-F10 (0x11F) */ #else rescan, rescan, rescan, rescan, rescan, /* 20 unbound keys */ rescan, rescan, rescan, rescan, rescan, rescan, rescan, rescan, rescan, rescan, rescan, rescan, rescan, rescan, rescan, #endif #ifdef MOUSE amigamouse, /* Mouse (0x120) */ mforwdel, /* Ctrl-Mouse */ mreposition, /* Shift-Mouse */ mdelwhite, /* Shift-Ctrl-Mouse */ mdelfword, /* Meta-Mouse */ mkillregion, /* Meta-Ctrl-Mouse */ mkillline, /* Meta-Shift-Mouse */ myank, /* Meta-Shift-Ctrl-Mouse */ mforwpage, /* Mode-Mouse (0x128) */ mgotobob, /* Ctrl-Mode-Mouse */ mbackpage, /* Shift-Mode-Mouse */ mgotoeob, /* Shift-Ctrl-Mode-Mouse */ msplitwind, /* Meta-Mode-Mouse */ menlargewind, /* Meta-Ctrl-Mode-Mouse */ mdelwind, /* Meta-Shift-Mode-Mouse */ mshrinkwind, /* Meta-Shift-Ctrl-Mode-Mouse */ #ifdef DO_ICONIFY tticon, /* Echo-Mouse (0x130) */ #else usebuffer, /* Echo-Mouse (0x130) */ #endif spawncli, /* Ctrl-Echo-Mouse */ killbuffer, /* Shift-Echo-Mouse */ quit, /* Shift-Ctrl-Echo-Mouse */ desckey, /* Meta-Echo-Mouse */ listbuffers, /* Meta-Ctrl-Echo-Mouse */ wallchart, /* Meta-Shift-Echo-Mouse */ togglewindow, /* Meta-Shift-Ctrl-Echo-Mouse */ #endif MOUSE }; /* * Define extra maps for fundamental mode. Have to provide the number of * extra map segments because it's used by the KEYMAPE() macro that builds * keymaps. The keymap setup, while compact, is pretty complex... */ #define NFUND_XMAPS 1 #ifdef MOUSE #define FUND_XMAPS {KUP, KEASCMOUSE, amiga_keys, (KEYMAP*)NULL} #else #define FUND_XMAPS {KUP, KSF10, amiga_keys, (KEYMAP*)NULL} #endif /* * Extra map segments for dired mode -- just use fundamental mode segments */ #define NDIRED_XMAPS NFUND_XMAPS #define DIRED_XMAPS FUND_XMAPS ng-1.5beta1/sys/amiga/clipboard.c100644 1750 1750 24145 7165147710 15506 0ustar amurausers/* $Id: clipboard.c,v 1.2 2000/09/29 17:22:16 amura Exp $ */ /* * clipboard.c * Amiga clipboard support routine. * * Copyright (C) 2000, MURAMATSU Atsushi All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY "MURAMATSU Atsushi" AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ /* This source Based on: * * Clipdemo.c * Demonstrate use of clipboard I/O. Uses general functions * provided in cbio.c * * Cbio.c * Provide standard clipboard device interface routines * such as Open, Close, Post, Read, Write, etc. * * included in "AMIGA DEVELOPER CD 1.2" */ /* * $Log: clipboard.c,v $ * Revision 1.2 2000/09/29 17:22:16 amura * change license to BSD style * * Revision 1.2 2000/09/29 17:14:40 amura * change license to BSD style * * Revision 1.1.1.1 2000/06/27 01:48:00 amura * import to CVS * * Revision 1.1 2000/02/09 18:16:06 amura * Initial revision * */ #include "config.h" /* Dec.19,1992 Add by H.Ohkubo */ #include "def.h" #ifdef CLIPBOARD #include #include #include #include #include #include #include #include #include #include #define MAKE_ID(a,b,c,d) \ ((ULONG) (a)<<24 | (ULONG) (b)<<16 | (ULONG) (c)<<8 | (ULONG) (d)) #define ID_FORM MAKE_ID('F','O','R','M') #define ID_FTXT MAKE_ID('F','T','X','T') #define ID_CHRS MAKE_ID('C','H','R','S') static struct IOClipReq *CBOpen pro((ULONG)); static VOID CBClose pro((struct IOClipReq *)); static int CBWriteFTXT pro((struct IOClipReq *, char *, long)); static int WriteLong pro((struct IOClipReq *, long*)); static int CBQueryFTXT pro((struct IOClipReq *)); static int CBReadCHRS pro((struct IOClipReq *, char *)); static int ReadLong pro((struct IOClipReq *, ULONG *)); static int FillCBData pro((struct IOClipReq *, char *, ULONG)); static VOID CBReadDone pro((struct IOClipReq *)); struct IOClipReq *CBOpen(unit) ULONG unit; { struct MsgPort *mp; struct IOStdReq *ior; if (mp = CreatePort(0L,0L)) { if (ior=(struct IOStdReq *)CreateExtIO(mp,sizeof(struct IOClipReq))) { if (!(OpenDevice("clipboard.device",unit, (struct IORequest *)ior,0L))) return((struct IOClipReq *)ior); DeleteExtIO((struct IORequest *)ior); } DeletePort(mp); } return(NULL); } void CBClose(ior) struct IOClipReq *ior; { struct MsgPort *mp; mp = ior->io_Message.mn_ReplyPort; CloseDevice((struct IORequest *)ior); DeleteExtIO((struct IORequest *)ior); DeletePort(mp); } int CBWriteFTXT(ior, string, slen) struct IOClipReq *ior; char *string; long slen; { BOOL odd; int success; long length; odd = (slen & 1); /* pad byte flag */ length = (odd) ? slen+1 : slen; /* initial set-up for Offset, Error, and ClipID */ ior->io_Offset = 0; ior->io_Error = 0; ior->io_ClipID = 0; /* Create the IFF header information */ WriteLong(ior, (long *) "FORM"); /* "FORM" */ length+=12L; /* + "[size]FTXTCHRS" */ WriteLong(ior, &length); /* total length */ WriteLong(ior, (long *) "FTXT"); /* "FTXT" */ WriteLong(ior, (long *) "CHRS"); /* "CHRS" */ WriteLong(ior, &slen); /* string length */ /* Write string */ ior->io_Data = (STRPTR)string; ior->io_Length = slen; ior->io_Command = CMD_WRITE; DoIO( (struct IORequest *) ior); /* Pad if needed */ if (odd) { ior->io_Data = (STRPTR)""; ior->io_Length = 1L; DoIO( (struct IORequest *) ior); } /* Tell the clipboard we are done writing */ ior->io_Command=CMD_UPDATE; DoIO( (struct IORequest *) ior); /* Check if io_Error was set by any of the preceding IO requests */ success = ior->io_Error ? FALSE : TRUE; return(success); } int WriteLong(ior, ldata) struct IOClipReq *ior; long *ldata; { ior->io_Data = (STRPTR)ldata; ior->io_Length = 4L; ior->io_Command = CMD_WRITE; DoIO( (struct IORequest *) ior); if (ior->io_Actual == 4) return( ior->io_Error ? FALSE : TRUE); return(FALSE); } int CBQueryFTXT(ior) struct IOClipReq *ior; { ULONG cbuff[4]; /* initial set-up for Offset, Error, and ClipID */ ior->io_Offset = 0; ior->io_Error = 0; ior->io_ClipID = 0; /* Look for "FORM[size]FTXT" */ ior->io_Command = CMD_READ; ior->io_Data = (STRPTR)cbuff; ior->io_Length = 12; DoIO( (struct IORequest *) ior); /* Check to see if we have at least 16 bytes */ if (ior->io_Actual == 12L) { /* Check to see if it starts with "FORM" */ if (cbuff[0] == ID_FORM) { /* Check to see if its "FTXT" */ if (cbuff[2] == ID_FTXT) return TRUE; } /* It's not "FORM[size]FTXT", so tell clipboard we are done */ } CBReadDone(ior); return FALSE; } int CBReadCHRS(ior, buffer) struct IOClipReq *ior; char *buffer; { ULONG chunk,size; int looking, res = 0; /* Find next CHRS chunk */ looking = TRUE; while (looking) { looking = FALSE; if (ReadLong(ior,&chunk)) /* Is CHRS chunk */ { if (chunk == ID_CHRS) { /* Get size of chunk, and copy data */ if (ReadLong(ior,&size)) { if (size) { if (buffer) res = FillCBData(ior, buffer, size); else { res = size; ior->io_Offset += (size&1) ? size+1 : size; } } else if (!buffer) looking = TRUE; } } else /* If not, skip to next chunk */ { if (ReadLong(ior,&size)) { looking = TRUE; /* if odd size, add pad byte */ ior->io_Offset += (size&1) ? size+1 : size; } } } } CBReadDone(ior); /* tell clipboard we are done */ return res; } int ReadLong(ior, ldata) struct IOClipReq *ior; ULONG *ldata; { ior->io_Command = CMD_READ; ior->io_Data = (STRPTR)ldata; ior->io_Length = 4L; DoIO( (struct IORequest *) ior); if (ior->io_Actual == 4) return( ior->io_Error ? FALSE : TRUE); return(FALSE); } int FillCBData(ior,buffer,size) struct IOClipReq *ior; char *buffer; ULONG size; { ULONG length; /* if odd size, read 1 more */ length = (size & 1) ? size+1 : size; ior->io_Command = CMD_READ; ior->io_Data = (STRPTR)buffer; ior->io_Length = length; if (!DoIO((struct IORequest *)ior) && ior->io_Actual==length) return TRUE; return FALSE; } VOID CBReadDone(ior) struct IOClipReq *ior; { char buffer[256]; ior->io_Command = CMD_READ; ior->io_Data = (STRPTR)buffer; ior->io_Length = 254; /* falls through immediately if io_Actual == 0 */ while (ior->io_Actual) { if (DoIO( (struct IORequest *) ior)) break; } } /* * */ size_clipboard_(void) { struct IOClipReq *ior; int len, size=0; /* Open clipboard.device unit 0 */ if (ior=CBOpen(0L)) { /* Look for FTXT in clipboard */ if (CBQueryFTXT(ior)) { /* Obtain a copy of the contents of each CHRS chunk */ while (len = CBReadCHRS(ior, NULL)) size += len; /* The next call is not really needed if you are sure */ /* you read to the end of the clip. */ } CBReadDone(ior); CBClose(ior); return size; } else puts("Error opening clipboard unit 0"); return 0; } /* * Read, and output FTXT in the clipboard. * */ recieve_clipboard_(buf) char *buf; { struct IOClipReq *ior; int len; char *p1,*p2; /* Open clipboard.device unit 0 */ if (ior=CBOpen(0L)) { /* Look for FTXT in clipboard */ if (CBQueryFTXT(ior)) { /* Obtain a copy of the contents of each CHRS chunk */ while (len = CBReadCHRS(ior, buf)) { for (p1 = p2 = buf; p1 #include #include #include #include #include "config.h" /* Dec. 15, 1992 by H.Ohkubo */ #ifdef KANJI /* Dec.27,1992 Add by H.Ohkubo */ #define READBUF 64 static UBYTE getbuf[READBUF]; #endif extern LONG OpenDevice(); extern LONG DoIO(); extern LONG SendIO(); /* * Open a console device, given a read request * and a write request message. */ int OpenConsole(writerequest,readrequest,window) struct IOStdReq *writerequest; struct IOStdReq *readrequest; struct Window *window; { LONG error; writerequest->io_Data = (APTR) window; writerequest->io_Length = (ULONG) sizeof(*window); error = OpenDevice("console.device", 0L, writerequest, 0L); /* clone required parts of the request */ if (readrequest) { readrequest->io_Device = writerequest->io_Device; readrequest->io_Unit = writerequest->io_Unit; #ifdef KANJI /* Dec.19,1992 Add by H.Ohkubo */ QueueRead(readrequest, getbuf); #endif } return((int) error); } #ifndef BUGFIX /* Dec.26,1992 by H.Ohkubo */ /* * Output a single character * to a specified console */ int ConPutChar(request,character) struct IOStdReq *request; char character; { #ifdef V11 register int x; #endif request->io_Command = CMD_WRITE; request->io_Data = (APTR)&character; request->io_Length = (ULONG)1; DoIO(request); /* caution: read comments in manual! */ return(0); } /* * Output a NULL-terminated string of * characters to a console */ int ConPutStr(request,string) struct IOStdReq *request; char *string; { #ifdef V11 register int x; #endif request->io_Command = CMD_WRITE; request->io_Data = (APTR)string; request->io_Length = (LONG)-1; DoIO(request); return(0); } #endif /* BUGFIX */ /* * Write out a string of predetermined * length to the console */ int ConWrite(request,string,len) struct IOStdReq *request; char *string; int len; { #ifdef V11 register int x; #endif request->io_Command = CMD_WRITE; request->io_Data = (APTR)string; request->io_Length = (LONG)len; DoIO(request); return(0); } /* * Queue up a read request * to a console */ int QueueRead(request,whereto) struct IOStdReq *request; char *whereto; { #ifdef V11 register int x; #endif request->io_Command = CMD_READ; request->io_Data = (APTR)whereto; #ifdef KANJI /* Dec.27,1992 by H.Ohkubo */ request->io_Length = (LONG)READBUF; #else /* ORIGINAL Code */ request->io_Length = (LONG)1; #endif /* KANJI */ SendIO(request); return(0); } #ifdef KANJI /* Dec.27,1992 Add by H.Ohkubo */ UBYTE *ConRead(mport, n) struct MsgPort *mport; int *n; { static UBYTE readbuf[READBUF]; register UBYTE *p; register struct IOStdReq *readreq; p = readbuf; if (readreq = (struct IOStdReq *)GetMsg(mport)) { memcpy(p, getbuf, readreq->io_Actual); p += (*n = readreq->io_Actual); QueueRead(readreq, getbuf); } return readbuf; } #endif ng-1.5beta1/sys/amiga/dirio.c100644 1750 1750 3755 7244021177 14635 0ustar amurausers/* $Id: dirio.c,v 1.4 2001/02/18 19:29:03 amura Exp $ */ /* * Name: MG 2x * Directory I/O routines, by Stephen Walton * Version of 5-May-88 */ /* * $Log: dirio.c,v $ * Revision 1.4 2001/02/18 19:29:03 amura * split dir.c to port depend/independ * * Revision 1.3 2000/12/22 19:48:17 amura * change "sysdef.h" to "def.h" for get NFILEN * * Revision 1.2 2000/12/14 18:07:51 amura * filename length become flexible * * Revision 1.1.1.1 2000/06/27 01:48:01 amura * import to CVS * */ #include "config.h" /* Dec. 15, 1992 by H.Ohkubo */ #ifndef NO_DIR #include "def.h" #include #include extern char MyDirName[NFILEN]; extern char *wdir, *startdir; char *getcwd(path, len) char *path; { strncpy(path, MyDirName, len); path[len-1] = '\0'; return path; } chdir(path) char *path; { BPTR Lock(), AttemptLock, CurrentDir(); long PathName(), len; struct FileInfoBlock *fib; void *AllocMem(); int retval; AttemptLock = Lock(path, ACCESS_READ); if (!AttemptLock) return -1; fib = (struct FileInfoBlock *) AllocMem((long) sizeof(struct FileInfoBlock), #ifdef BUGFIX /* Dec.18,1992 by H.Ohkubo */ MEMF_CHIP | #endif MEMF_CLEAR); #ifdef BUGFIX /* Dec.20,1992 by H.Ohkubo */ if (fib == NULL) { UnLock(AttemptLock); return -1; } #endif Examine(AttemptLock, fib); if (fib->fib_DirEntryType < 0) { retval = -1; UnLock(AttemptLock); goto clean; } UnLock(CurrentDir(AttemptLock)); /* do the thing */ if (PathName(AttemptLock, MyDirName, NFILEN/31L) == 0) MyDirName[0] = '\0'; retval = 0; /* Success! */ clean: FreeMem((void *) fib, (long) sizeof(struct FileInfoBlock)); return retval; } /* * Initialize anything the directory management routines need */ VOID dirinit() { wdir = MyDirName; if (startdir == NULL) { int len = strlen(wdir); startdir = malloc(len + 2); if (startdir == NULL) { ewprintf("Cannot alloc %d bytes", len + 2); return; } strcpy(startdir, wdir); } } #endif ng-1.5beta1/sys/amiga/fileio.c100644 1750 1750 51046 7247657010 15016 0ustar amurausers/* $Id: fileio.c,v 1.7 2001/03/02 08:47:04 amura Exp $ */ /* * Name: MG 2a401 * Commodore Amiga file I/O. * Last edit: 05-May-88 swalton@solar.stanford.edu * Next-to-Last edit: 16-Dec-87 mic@emx.utexas.edu * Created: 23-Jul-86 mic@emx.utexas.edu * * Read and write ASCII files. All of the low level file I/O * knowledge is here. Uses AmigaDOS standard I/O and does its * own dynamic buffering; this seems to save about 2K worth * of space in the executable image. */ /* * $Log: fileio.c,v $ * Revision 1.7 2001/03/02 08:47:04 amura * fix some bogus bugs * * Revision 1.6 2001/02/18 19:29:03 amura * split dir.c to port depend/independ * * Revision 1.5 2000/12/28 07:26:50 amura * suffix o is not search in filename complition * * Revision 1.4 2000/12/27 16:55:41 amura * change d_makename() params for conservative reason, and bugfix in dires_() * * Revision 1.3 2000/12/21 16:54:20 amura * fix usage of strncat() * * Revision 1.2 2000/12/14 18:07:52 amura * filename length become flexible * * Revision 1.1.1.1 2000/06/27 01:48:01 amura * import to CVS * * Revision 1.1 1999/05/21 00:58:37 amura * Initial revision * */ #include "config.h" /* Dec.15,1992 Add by H.Ohkubo */ #undef TRUE #undef FALSE #include "def.h" #ifdef SUPPORT_ANSI # include # include # include #endif #ifdef AMIGA_STDIO # include #endif #include #include #include #ifdef USE_ARP # include "libraries/arpbase.h" #else # define FCHARS 32L #endif #define NIOBUF 4096 extern ULONG Rename(), UnLock(), Close(), FreeMem(); extern LONG Write(), Read(); extern UBYTE *AllocMem(); extern struct FileLock *Lock(); extern struct FileHandle *Open(); #ifdef BUGFIX /* Dec.17,1992 by H.Ohkubo */ extern LONG Examine(); #endif #ifdef AMIGA_STDIO static FILE *ffp; #else static struct FileHandle *ffh = 0; static UBYTE *iobuf; static int ibufo, niobuf; static LONG iostat, access_mode; #include "zz_pointer.h" /* Dec.20,1992 Add by H.Ohkubo */ extern struct Window *EmW; #endif #ifdef MANX extern char *strncpy(), *strncat(), *index(), *rindex(); #endif #ifdef LATTICE extern char *malloc() ; #endif #ifdef SUPPORT_ANSI # define index strchr # define rindex strrchr #endif #ifdef AMIGA_STDIO # define GETC(f) getc(f) # define PUTC(c,f) putc(c,f) # define FERROR(f) ferror(f) #else # define GETC(f) (ibufo == niobuf) ? FillBuf() : iobuf[ibufo++] # define PUTC(c,f) {if (niobuf == NIOBUF) FlushBuf(); iobuf[niobuf++] = c;} # define FERROR(f) (iostat < 0L) #endif /* * Open the Emacs internal file for reading. */ ffropen(fn) char *fn; #ifdef AMIGA_STDIO { if ((ffp=fopen(fn, "r")) == NULL) return (FIOFNF); return (FIOSUC); } #else { if ((iobuf = AllocMem((ULONG) NIOBUF, 0L)) == NULL) return (FIOERR); if ((ffh = Open(fn, access_mode = MODE_OLDFILE)) == 0L) { FreeMem(iobuf, (ULONG) NIOBUF); return (FIOFNF); } ZZ_POINTER(EmW); /* Dec.20,1992 Add by H.Ohkubo */ ibufo = niobuf = 0; return (FIOSUC); } #endif /* * Open a file for writing. Return TRUE if all * is well, and FALSE on error (cannot create). */ ffwopen(fn) char *fn; #ifdef AMIGA_STDIO { if ((ffp=fopen(fn, "w")) == NULL) { ewprintf("Cannot open file for writing"); return (FIOERR); } return (FIOSUC); } #else { if ((iobuf = AllocMem((ULONG) NIOBUF, 0L)) == NULL) return (FIOERR); if ((ffh = Open(fn, access_mode = MODE_NEWFILE)) == 0L) { ewprintf("Cannot open file for writing"); FreeMem(iobuf, (ULONG) NIOBUF); return (FIOERR); } niobuf = 0; iostat = NIOBUF; /* pretend we wrote out a full buffer last time */ ZZ_POINTER(EmW); /* Dec.20,1992 Add by H.Ohkubo */ return (FIOSUC); } #endif /* * Close a file, flushing the output buffer. Should look at * the status. */ ffclose() #ifdef AMIGA_STDIO { (VOID) fclose(ffp); return (FIOSUC); } #else { if (access_mode == MODE_NEWFILE) FlushBuf(); if (ffh) (void) Close(ffh); if (iobuf) FreeMem(iobuf, (ULONG) NIOBUF); CLEAR_POINTER(EmW); /* Dec.20,1992 add by H.Ohkubo */ return (FIOSUC); } #endif /* * Write a buffer to the already opened file. bp points to the * buffer. Return the status. Check only at the newline and * end of buffer. */ ffputbuf(bp) BUFFER *bp; { register char *cp; register char *cpend; register LINE *lp; register LINE *lpend; #ifdef KANJI /* Dec. 15, 1992 by H.Ohkubo */ register int kfio; # ifdef AMIGA_STDIO # define FFP (ffp) # else My_FILE ffp; # define FFP (&ffp) # endif #endif /* KANJI */ lpend = bp->b_linep; #ifdef KANJI /* Dec. 15, 1992 by H.Ohkubo */ if (bp->b_kfio == NIL) ksetbufcode(bp); /* Set buffer local KANJI code. */ kfio = bp->b_kfio; # ifndef AMIGA_STDIO ffp.niobuf = &niobuf; ffp.bufmax = NIOBUF; ffp.iobuf = iobuf; # endif #endif /* KANJI */ lp = lforw(lpend); do { cp = <ext(lp)[0]; /* begining of line */ cpend = &cp[llength(lp)]; /* end of line */ while(cp != cpend) { #ifdef KANJI /* Dec. 15, 1992 by H.Ohkubo / 19 May 1999 by amura*/ kputc(*cp, FFP, kfio); #else /* NOT KANJI */ PUTC(*cp, FFP); #endif /* KANJI */ cp++; } #ifdef KANJI /* Dec. 15, 1992 by H.Ohkubo */ if (kfio == JIS) { kfselectcode(FFP, FALSE); } #endif /* KANJI */ lp = lforw(lp); if(lp == lpend) break; /* no implied newline on last line */ PUTC('\n', ffp); } while(!FERROR(ffp)); if(FERROR(ffp)) { ewprintf("Write I/O error"); return FIOERR; } return FIOSUC; } /* * Read a line from a file, and store the bytes * in the supplied buffer. Stop on end of file or end of * line. When FIOEOF is returned, there is a valid line * of data without the normally implied \n. */ ffgetline(buf, nbuf, nbytes) register char *buf; register int nbuf; register int *nbytes; { register int c; register int i; i = 0; while((c = GETC(ffp))!=EOF && c!='\n') { buf[i++] = c; if (i >= nbuf) return FIOLONG; } if (c == EOF && FERROR(ffp) != FALSE) { ewprintf("File read error"); return FIOERR; } *nbytes = i; return c==EOF ? FIOEOF : FIOSUC; } #ifndef NO_BACKUP /* * Rename the current file into a backup copy, * possibly after deleting the original file. */ fbackupfile(fname) char *fname; { struct FileLock *twiddle, *lock; char buffer[NFILEN]; (void) strncpy(buffer,fname,NFILEN - 1); (void) strcat(buffer,"~"); lock = Lock(fname,(ULONG)EXCLUSIVE_LOCK);/* does file exist? */ if (!lock) return (FALSE); /* nope, return error */ twiddle = Lock(buffer,(ULONG)EXCLUSIVE_LOCK); if (twiddle) { /* delete old backup */ UnLock(twiddle); /* let it go */ if (!DeleteFile(buffer)) { UnLock(lock); return (FALSE); } twiddle = NULL; } /* rename file to backup name (after unlocking the file) */ UnLock(lock); return (int) Rename(fname,buffer); } #ifdef BUGFIX /* Dec.17,1992 Modified for AmigaDos by H.Ohkubo */ /* * Get file mode of a file fn. */ fgetfilemode(fn) char *fn; { struct FileLock *lock; struct FileInfoBlock *fib; int retval = -1; if ((lock = Lock(fn, SHARED_LOCK)) != NULL) { if ((fib = (struct FileInfoBlock *) AllocMem(sizeof(struct FileInfoBlock), MEMF_CHIP)) != NULL) { if (Examine(lock, fib) != NULL) retval = fib->fib_Protection; FreeMem(fib, sizeof(struct FileInfoBlock)); } UnLock(lock); } return retval; } /* * Set file mode of a file fn to the specified mode. */ VOID fsetfilemode(fn, mode) char *fn; int mode; { struct FileLock *lock; if ((lock = Lock(fn, EXCLUSIVE_LOCK)) != NULL) { SetProtection(fn, mode); UnLock(lock); } } #endif /* BUGFIX */ #endif /* NO_BACKUP */ /* Dec.18,1992 Add by H.Ohkubo */ #ifdef READONLY /* 91.01.05 by S.Yoshida */ /* * Check whether file is read-only of a file fn. */ fchkreadonly(fn) char *fn; { struct Lock *lock; struct FileInfoBlock *fib; int retval = FALSE; if ((lock = (struct Lock*)Lock(fn, SHARED_LOCK)) != NULL) { if ((fib = (struct FileInfoBlock *) AllocMem(sizeof(struct FileInfoBlock), MEMF_CHIP)) != NULL) { if (Examine(lock, fib) != NULL) retval = (fib->fib_Protection & FIBF_DELETE); FreeMem(fib, sizeof(struct FileInfoBlock)); } UnLock(lock); } return retval; } #endif /* READONLY */ #ifndef NO_STARTUP /* * Return name of user's startup file. On Amiga, make it * .mg in the current directory, then s:.mg */ #ifdef KANJI /* Dec. 15, 1992 by H.Ohkubo */ static char startname[] = ".ng"; static char altstartname[] = "s:ng-startup"; #else /* NOT KANJI */ static char startname[] = ".mg"; static char altstartname[] = "s:mg-startup"; /* .mg -> mg-startup by H.Ohkubo */ #endif /* KANJI */ char * #ifdef ADDOPT startupfile(ngrcfile, suffix) char* ngrcfile; #else startupfile(suffix) #endif char *suffix; { struct FileLock *lock; #ifdef ADDOPT if (ngrcfile) { if (lock = Lock(ngrcfile,(ULONG)SHARED_LOCK)) { UnLock(lock); return(ngrcfile); } } #endif if (lock = Lock(startname,(ULONG)SHARED_LOCK)) { UnLock(lock); return(startname); } if (lock = Lock(altstartname,(ULONG)SHARED_LOCK)) { /* alternate */ UnLock(lock); return (altstartname); } return (NULL); } #endif NO_STARTUP /* * The string "fn" is a file name. Perform any required name adjustments, * including conversion to a fully qualified path if NO_DIR isn't defined. */ #define MAX_ELEMS 8 /* Maximum number of elements */ extern char MyDirName[]; char *adjustname(fn) register char *fn; { #ifndef NO_DIR static char fnb[MAX_ELEMS*FCHARS + 1]; struct FileLock *lock; long PathName(); void TackOn(); char *dup, *p; if (!index(fn, ':')) { /* no device */ strcpy(fnb, MyDirName); TackOn(fnb, fn); if (!index(fn, '/')) /* completely bare name */ return fnb; } else strcpy(fnb, fn); /* * Else fn has some path components in it. We try to PathName * the whole thing first, but since the file specified by fn * may not exist, we PathName the leading part and TackOn the * trailing part if it doesn't. */ if (lock = Lock(fnb, SHARED_LOCK)) { if (PathName(lock, fnb, (long) MAX_ELEMS) !=0) { UnLock(lock); return fnb; } ewprintf("adjustname: PathName() failed!"); UnLock(lock); return fn; } if (!(p = rindex(fnb, '/'))) p = index(fnb, ':'); p++; dup = alloca(strlen(p) + 1); if (dup == NULL) { ewprintf("adjustname: PathName() failed!"); return fn; } strcpy(dup, p); *p = '\0'; if (lock = Lock(fnb, SHARED_LOCK)) { if (PathName(lock, fnb, (long) MAX_ELEMS) != 0) { UnLock(lock); TackOn(fnb, dup); return fnb; } ewprintf("adjustname: PathName() failed!"); UnLock(lock); } #endif return fn; /* if all else fails */ } #ifndef AMIGA_STDIO /* * Functions to read/write into the I/O buffer */ int FlushBuf() { if (niobuf > 0) { iostat = Write(ffh, iobuf, (ULONG) niobuf); niobuf = 0; } } /* * Fill up the input buffer and return the first character in it. */ int FillBuf() { if ((iostat = Read(ffh, iobuf, (ULONG) NIOBUF)) <= 0L) return (EOF); ibufo = 0; niobuf = (int) iostat; return (int) (iobuf[ibufo++]); } #endif /* not AMIGA_STDIO */ #ifndef NO_DIRED #include "kbd.h" copy(frname, toname) char *frname, *toname; { #ifdef MANX return fexecl("copy", "copy", frname, toname, (char *) 0); #else # ifdef LATTICE int error ; if (error = forkl("copy", "copy", frname, toname, (char *) 0, (char *) 0, 2)) return error ; return (int) wait(2) ; # else char buf[NFILEN*2]; sprintf(buf, "copy <>NIL: from %s to %s", frname, toname); return system(buf); # endif /* LATTICE */ #endif /* MANX */ } BUFFER *dired_(dirname) char *dirname; { register BUFFER *bp; char line[CMDLINELENGTH]; BUFFER *findbuffer(); char *tmpname, *mktemp(); int i; VOID lfree(); if((dirname = adjustname(dirname)) == NULL) { ewprintf("Bad directory name"); return NULL; } if(!ffisdir(dirname)) { ewprintf("Not a directory: %s", dirname); return NULL; } if((bp = findbuffer(dirname)) == NULL) { ewprintf("Could not create buffer"); return NULL; } bclear(bp); /* clear out leftover garbage */ (void) strcpy(line, "list >"); (void) strncat(line, tmpname = mktemp("ram:mgXXX.XXX"), sizeof(line)-strlen(line)-1); (void) strncat(line, " \"", sizeof(line)-strlen(line)-1); (void) strncat(line, dirname, sizeof(line)-strlen(line)-1); (void) strncat(line, "\"", sizeof(line)-strlen(line)-1); Execute(line, 0L, 0L); if (ffropen(tmpname) != FIOSUC) { ewprintf("Can't open temporary dir file"); return NULL; } if (ffgetline(line, sizeof(line), &i) != FIOSUC || strncmp(line, "Directory", 9) != 0) { ffclose(); DeleteFile(tmpname); ewprintf("No such directory: `%s'", dirname); return NULL; } line[0] = line[1] = ' '; while (ffgetline(&line[2], sizeof(line)-3, &i) == FIOSUC) { line[i+2] = '\0'; (VOID) addline(bp, line); } ffclose(); DeleteFile(tmpname); bp->b_dotp = lforw(bp->b_linep); /* go to first line */ if(bp->b_fname != NULL) free(bp->b_fname); if((bp->b_fname=malloc(strlen(dirname)+1)) != NULL) (VOID) strcpy(bp->b_fname, dirname); #ifdef EXTD_DIR if(bp->b_cwd != NULL) free(bp->b_cwd); bp->b_cwd = NULL; #endif if((bp->b_modes[0] = name_mode("dired")) == NULL) { bp->b_modes[0] = &map_table[0]; ewprintf("Could not find mode dired"); return NULL; } bp->b_nmodes = 0; return bp; } #if defined(LATTICE)||defined(_DCC) char * mktemp(pattern) char *pattern; { /* quick hack mktemp for this purpose only */ register char *name, *printo ; register unsigned short counter = 0 ; if ((name = malloc(strlen(pattern) + 5)) == NULL) panic("Manx sucks rocks!") ; (VOID) strcpy(name, pattern) ; printo = name + strlen(name) ; do (void) sprintf(printo, "%d", counter += 1) ; while (counter > 0 && access(name, 0) == 0) ; if (counter == 0) panic("Manx _really_ sucks!") ; return name ; } #endif #define LIST_LINE_LENGTH 58 /* Size of line from List */ d_makename(lp, fn, buflen) register LINE *lp; register char *fn; { register char *cp; int n = 2, len; if(llength(lp) < LIST_LINE_LENGTH) return ABORT; if(lgetc(lp, 2) == ':') return ABORT; /* FileNote line */ len = strlen(curbp->b_fname) + llength(lp) - 41; if (buflen <= len) return ABORT; cp = fn; (VOID) strcpy(cp, curbp->b_fname); cp += strlen(cp); if ((cp[-1] != ':') && (cp[-1] != '/')) /* append '/' if needed */ *cp++ = '/'; while (lgetc(lp, n) != ' ') { *cp++ = lgetc(lp, n); n++; } *cp = '\0'; for (n=34; nl_text[n], "Dir", 3) == 0; } ffisdir(name) char *name; { struct FileLock *lock; struct FileInfoBlock *fib; int result; if ((lock = Lock(name, ACCESS_READ)) == NULL) return FALSE; if ((fib = (struct FileInfoBlock *) #ifdef BUGFIX /* Dec.17,1992 by H.Ohkubo */ AllocMem((long)sizeof(struct FileInfoBlock),MEMF_CHIP))==NULL) { #else /* ORIGINAL Code */ AllocMem((long)sizeof(struct FileInfoBlock),MEMF_PUBLIC))==NULL) { #endif UnLock(lock); return FALSE; } #ifdef BUGFIX /* Dec.17, 1992 by H.Ohkubo */ result = FALSE; if (Examine(lock, fib) != NULL) #endif result = (fib->fib_DirEntryType > 0L) ? TRUE : FALSE; FreeMem(fib,(long)sizeof(struct FileInfoBlock)); UnLock(lock); return result; } #endif /* NO_DIRED */ /* Dec.17,1992 Add by H.Ohkubo */ #ifndef NO_FILECOMP /* 90.04.04 by K.Maeda */ /* 89.11.20 Original code is for X68K (Human68K). * 90.04.08 Modified for MS-DOS by S.Yoshida. * 90.05.30 Debuged by A.Shirahashi. * Dec.17,1992 Modified for AmigaDos by H.Ohkubo * Find file names starting with name. * Result is stored in *buf, got from malloc(); * Return the number of files found, or * -1 of error occured. */ #define MALLOC_STEP 256 fffiles(name, buf) char *name, **buf; { char pathbuf[NFILEN], tmpnam[NFILEN]; char *dirpart, *nampart; struct Lock *lock; struct FileInfoBlock *fib; int n, len, size, dirpartlen, nampartlen; char *buffer,*BaseName(); void TackOn(); if ((fib = (struct FileInfoBlock *) AllocMem(sizeof(struct FileInfoBlock), MEMF_CHIP)) == NULL) { return -1; } if (!index(name, ':')) { strcpy(pathbuf, MyDirName); TackOn(pathbuf, (*name) ? name : "dummy"); } else { strcpy(pathbuf, name); } dirpart = BaseName(pathbuf); *dirpart = '\0'; nampart = BaseName(name); nampartlen = strlen(nampart); dirpartlen = nampart - name; if ((lock = (struct Lock*)Lock(pathbuf, SHARED_LOCK)) == NULL) { FreeMem(fib, sizeof(struct FileInfoBlock)); return -1; } if (Examine(lock, fib) == NULL) { UnLock(lock); FreeMem(fib, sizeof(struct FileInfoBlock)); return -1; } if ((buffer = malloc(MALLOC_STEP)) == NULL) { UnLock(lock); FreeMem(fib, sizeof(struct FileInfoBlock)); return -1; } size = MALLOC_STEP; len = 0; n = 0; while (ExNext(lock, fib)) { register int l; if (Strncmp(nampart, fib->fib_FileName, nampartlen) != 0) continue; strncpy(tmpnam, name, dirpartlen); strcpy(tmpnam + dirpartlen, fib->fib_FileName); if (fib->fib_DirEntryType > 0) { strcat(tmpnam, "/"); } l = strlen(tmpnam) + 1; if (l > 3 && (stricmp(&tmpnam[l-3],".O") == 0)) continue; if (l + len >= size) { /* make room for double null */ if ((buffer = realloc(buffer, size += MALLOC_STEP)) == NULL) { UnLock(lock); FreeMem(fib, sizeof(struct FileInfoBlock)); return -1; } } strcpy(buffer + len, tmpnam); len += l; n++; } UnLock(lock); FreeMem(fib, sizeof(struct FileInfoBlock)); *buf = buffer; buffer[len] = '\0'; return(n); } #endif /* NO_FILECOMP */ #ifdef NEW_COMPLETE /* Dec.17,1992 Add by H.Ohkubo */ char * copy_dir_name (d, s) char *d; char *s; { int i; char *BaseName(); i = BaseName(s) - s; strncpy (d, s, i); d[i] = '\0'; return (d); } #endif /* NEW_COMPLETE */ #ifndef USE_ARP /* * Here are work-alikes for the few ARP commands now used by the * Amiga version of mg. These may go away if we require ARP in future. */ #define LOWER(c) (ISUPPER(c) ? TOLOWER(c) : (c)) /* By H.Ohkubo */ Strcmp(s1, s2) register char *s1, *s2; { while (LOWER(*s1) == LOWER(*s2)) { /* tolower -> LOWER */ if (*s1 == '\0') /* Modified by H.Ohkubo */ return 0; s1++; s2++; } return (LOWER(*s1) < LOWER(*s2) ? -1 : 1); } Strncmp(s1, s2, n) /* Dec.20,1992 By H.Ohkubo */ register char *s1, *s2; register int n; { int c1, c2; while (n > 0 && *s1 != '\0' && *s2 != '\0') { c1 = LOWER(*s1); c2 = LOWER(*s2); if (c1 != c2) return c1 < c2 ? -1 : 1; s1++; s2++; n--; } if (n == 0) return 0; else return c1 < c2 ? -1 : 1; } /* * This PathName function shamelessly stolen from the Matt Dillon Shell. * It is a slight mod of that program's get_pwd routine, from comm1.c. */ long PathName(flock, pwdstr, nentries) struct Lock *flock; long nentries; char *pwdstr; { char *ptr; char *name; int err=0; struct FileLock *lock, *newlock, *ParentDir(), *DupLock(); long Examine(); struct FileInfoBlock *fib; int i, len, n; lock = DupLock(flock); n = nentries * FCHARS + 1; fib = (struct FileInfoBlock *)AllocMem((long)sizeof(struct FileInfoBlock), #ifdef BUGFIX /* Dec. 17, 1992 by H.Ohkubo */ MEMF_CHIP); #else /* ORIGINAL Code */ MEMF_PUBLIC); #endif pwdstr[i = n-1] = '\0'; while (lock) { newlock = ParentDir(lock); if (!Examine(lock, fib)) ++err; name = fib->fib_FileName; if (*name == '\0') /* HACK TO FIX RAM: DISK BUG */ name = "RAM"; len = strlen(name); if (newlock) { if (i == n-1) { i -= len; bcopy(name, pwdstr + i, len); } else { i -= len + 1; bcopy(name, pwdstr + i, len); pwdstr[i+len] = '/'; } } else { i -= len + 1; bcopy(name, pwdstr + i, len); pwdstr[i+len] = ':'; } UnLock(lock); lock = newlock; } FreeMem(fib, (long)sizeof(struct FileInfoBlock)); bcopy(pwdstr + i, pwdstr, n - i); if (err) return(0L); return((long) n - i - 1); } void TackOn(path, file) char *path, *file; { if (*file != '\0') { if (path[strlen(path)-1] != ':') strcat(path, "/"); strcat(path, file); } } #ifdef NEW_COMPLETE /* Dec.20,1992 by H.Ohkubo */ char * BaseName(pathname) char *pathname; { char *cp, *dirpart; dirpart = NULL; for (cp = pathname; *cp; cp++) { if (*cp == '/' || (dirpart == NULL && *cp == ':')) { dirpart = cp; } } if (dirpart) ++dirpart; else dirpart = pathname; return dirpart; } #endif /* NEW_COMPLETE */ #endif /* USE_ARP */ #ifdef AUTOSAVE VOID autosave_name(buff, name, buflen) char* buff; char* name; { strcpy(buff, name); if (strlen(name)) { char *fn = rindex(name, '/'); if (fn == NULL) fn = rindex(name, ':'); if (fn == NULL){ fn = buff; } else { fn++; } strcpy(&buff[strlen(buff)-strlen(fn)], "#"); strcat(buff, fn); strcat(buff, "#"); } } #endif /* AUTOSAVE */ ng-1.5beta1/sys/amiga/iconify.c100644 1750 1750 12521 7165150071 15174 0ustar amurausers/* $Id: iconify.c,v 2.1 2000/09/29 17:24:09 amura Exp $ */ /* * iconify.c * Leo Schwab's iconify() compatible iconify routine. * * Copyright (C) 2000, MURAMATSU Atsushi All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY "MURAMATSU Atsushi" AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ /* * $Log: iconify.c,v $ * Revision 2.1 2000/09/29 17:24:09 amura * rewrite from scratch * */ #include "config.h" #ifdef DO_ICONIFY #include "def.h" #include #include #include "iconify.h" #ifdef V2 #include #include #include #include extern struct Library *WorkbenchBase; static struct DiskObject icondef = { WB_DISKMAGIC,WB_DISKVERSION, {NULL, 0, 0, 0/*width*/, 0/*height*/, GFLG_GADGIMAGE|GFLG_GADGHCOMP, GACT_IMMEDIATE, GTYP_BOOLGADGET, NULL/*image*/, NULL, NULL, 0, NULL, 0, NULL}, 0, NULL, NULL, NO_ICON_POSITION, NO_ICON_POSITION, NULL, NULL, 0 }; int iconify(x, y, width, height, etcptr, ptr, type) UWORD *x, *y, width, height; APTR ptr; APTR etcptr; { struct AppIcon *icon; struct MsgPort *myport; struct AppMessage *msg; int done; icondef.do_Gadget.Width = width; icondef.do_Gadget.Height = height; icondef.do_Gadget.GadgetRender = ptr; icondef.do_CurrentX = NO_ICON_POSITION; icondef.do_CurrentY = NO_ICON_POSITION; if ((myport=(struct MsgPort *)CreateMsgPort()) == NULL) return FALSE; if (type == ICON_WB) icon = AddAppIconA(0, 0, etcptr, myport, NULL, &icondef, NULL); else icon = AddAppIconA(0, 0, NULL, myport, NULL, &icondef, NULL); if (icon == NULL) { while (msg=(struct AppMessage *)GetMsg(myport)) ReplyMsg((struct Message *)msg); DeleteMsgPort(myport); return FALSE; } done = FALSE; while (!done) { WaitPort(myport); while (msg = (struct AppMessage *)GetMsg(myport)) { if (msg->am_NumArgs == 0L) done = TRUE; ReplyMsg((struct Message *)msg); } } RemoveAppIcon(icon); while (msg=(struct AppMessage *)GetMsg(myport)) ReplyMsg((struct Message *)msg); DeleteMsgPort(myport); return TRUE; } #else /* not V2 */ #include #include #include #include static struct Gadget gadget = { NULL, 0, 0, 0/*width*/, 0/*height*/, GFLG_GADGIMAGE|GFLG_GADGHCOMP, GACT_IMMEDIATE, WDRAGGING, NULL/*image*/, NULL, NULL, 0, NULL, 0, NULL}; static struct NewWindow icondef = { 0, 0, /* start position */ 0, 0, /* width, height */ 0, 1, /* detail pen, block pen */ GADGETDOWN, /* mouse is used */ BORDERLESS|SMART_REFRESH|NOCAREREFRESH, /* window flags */ &gadget, /* pointer to first user gadget */ NULL, /* pointer to user checkmark */ NULL, /* title (filled in later) */ NULL, /* pointer to screen (none) */ NULL, /* pointer to superbitmap */ 0, 0, /* minimum size (small!) */ 0, 0, /* maximum size (set by ttopen) */ WBENCHSCREEN /* screen in which to open */ }; int iconify(x, y, width, height, etcptr, ptr, type) UWORD *x, *y, width, height; APTR etcptr; APTR ptr; { int done; unsigned long secs,secs1,micros,micros1; struct IntuiMessage *msg; struct Window *icon; icondef.Width = width; icondef.Height = height; icondef.LeftEdge = *x; icondef.TopEdge = *y; if (type==ICON_WB || etcptr==NULL) icondef.Screen = (struct Screen *)WBENCHSCREEN; else icondef.Screen = (struct Screen *)etcptr; gadget.Width = width; gadget.Height = height; gadget.GadgetRender = ptr; if ((icon=OpenWindow(&icondef)) == NULL) return FALSE; micros1 = secs1 = 0; done = FALSE; while (!done) { Wait((long)(1L << icon->UserPort->mp_SigBit)); while (msg = (struct IntuiMessage *)GetMsg(icon->UserPort)) { if (msg->Class == IDCMP_GADGETDOWN) { CurrentTime(&secs, µs); if (DoubleClick(secs1, micros1, secs, micros)) done = TRUE; secs1 = secs; micros1 = micros; } ReplyMsg((struct Message *)msg); } } CloseWindow(icon); return TRUE; } #endif /* V2 */ #endif /* DO_ICONIFY */ ng-1.5beta1/sys/amiga/iconify.h100644 1750 1750 3374 7165150071 15167 0ustar amurausers/* $Id: iconify.h,v 2.1 2000/09/29 17:24:09 amura Exp $ */ /* * iconify.h * Leo Schwab's iconify() compatible iconify routine header. * * Copyright (C) 2000, MURAMATSU Atsushi All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY "MURAMATSU Atsushi" AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #define ICON_IMAGE 0 /* this version support only ICON_IMAGE and ICON_WB */ /* #define ICON_BOADER 1 #define ICON_FUNCTION 2 */ #define ICON_WB 3 /* extended from original */ int iconify(UWORD *x, UWORD *y, UWORD width, UWORD height, APTR etcptr, APTR ptr, int type); ng-1.5beta1/sys/amiga/menumap.h100644 1750 1750 31450 7632242734 15214 0ustar amurausers/* $Id: menumap.h,v 2.1.4.1 2003/03/08 01:22:36 amura Exp $ */ /* * menumap.h * Amiga intuition menu mapping header for Ng 1.x * * Copyright (C) 2000, MURAMATSU Atsushi All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY "MURAMATSU Atsushi" AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ /* * $Log: menumap.h,v $ * Revision 2.1.4.1 2003/03/08 01:22:36 amura * NOTAB is always enabled * * Revision 2.1 2000/10/02 14:05:46 amura * create for new ttymenu.c * */ /*--- Functions called from menu ---*/ #define _PF() pro((int, int)) /* * Defined by "buffer.c". */ extern int listbuffers _PF(); /* Display list of buffers */ extern int usebuffer _PF(); /* Switch a window to a buffer */ extern int killbuffer _PF(); /* Make a buffer go away. */ #ifndef NO_DIRED /* * defined by "dired.c" */ extern int dired _PF(); /* dired */ #endif /* * Defined by "file.c". */ extern int filevisit _PF(); /* Get a file, read write */ extern int filewrite _PF(); /* Write a file */ extern int filesave _PF(); /* Save current file */ extern int fileinsert _PF(); /* Insert file into buffer */ /* * defined by help.c */ #ifndef NO_HELP extern int desckey _PF(); /* describe key */ extern int wallchart _PF(); /* Make wall chart. */ extern int help_help _PF(); /* help help */ extern int apropos_command _PF(); /* apropos */ #endif /* * defined by "jump.c" Dec 1991. bsh */ #ifdef JUMPERR extern int compile _PF(); /* compile Y.Koyanagi */ #endif /* * defined by "kanji.c" */ #ifdef KANJI /* 90.01.29 by S.Yoshida */ extern int k_set_buffio _PF(); /* Set buffer file I/O code. */ extern int k_set_input _PF(); /* Set keyboard input code. */ extern int k_set_display _PF(); /* Set KANJI display code. */ #endif /* KANJI */ /* * defined by "line.c" */ #ifdef UNDO extern int do_undo _PF(); /* undo */ #endif /* * defined by "macro.c" */ #ifndef NO_MACRO extern int executemacro _PF(); /* Execute macro */ #endif /* * Defined by "main.c". */ extern int quit _PF(); /* Quit */ /* * defined by "modes.c" */ extern int indentmode _PF(); /* set auto-indent mode */ extern int fillmode _PF(); /* set word-wrap mode */ extern int notabmode _PF(); /* no tab mode */ extern int overwrite _PF(); /* overwrite mode */ #ifdef C_MODE /* 90.07.24 by K.Takano */ extern int cmode _PF(); /* set c-mode */ #endif /* C_MODE */ /* * defined by "paragraph.c" - the paragraph justification code. */ extern int fillpara _PF(); /* Justify a paragraph. */ /* * Defined by "random.c". */ extern int yank _PF(); /* Yank back from killbuffer. */ #ifdef REGEX /* * Defined by "re_search.c" */ extern int re_forwsearch _PF(); /* Regex search forward */ extern int re_backsearch _PF(); /* Regex search backwards */ extern int re_searchagain _PF(); /* Repeat regex search command */ extern int re_queryrepl _PF(); /* Regex query replace */ #endif /* * Defined by "region.c". */ extern int killregion _PF(); /* Kill region. */ extern int copyregion _PF(); /* Copy region to kill buffer. */ extern int lowerregion _PF(); /* Lower case region. */ extern int upperregion _PF(); /* Upper case region. */ /* * Defined by "search.c". */ extern int forwsearch _PF(); /* Search forward */ extern int backsearch _PF(); /* Search backwards */ extern int searchagain _PF(); /* Repeat last search command */ extern int queryrepl _PF(); /* Query replace */ /* * Defined by "spawn.c". */ extern int spawncli _PF(); /* Run CLI in a subjob. */ /* * Defined by "version.c" */ extern int showversion(); /* Show version numbers, etc. */ #ifdef ADDFUNC /* 90.12.28 by S.Yoshida */ extern int showngversion(); /* Show Ng version, etc. */ #endif /* ADDFUNC */ /* * Defined by "window.c". */ extern int refresh _PF(); /* Refresh the screen */ extern int onlywind _PF(); /* Make current window only one */ extern int splitwind _PF(); /* Split current window */ extern int delwind _PF(); /* Delete current window */ extern int enlargewind _PF(); /* Enlarge display window. */ extern int shrinkwind _PF(); /* Shrink window. */ /* * Defined by "skg.c". */ #ifdef INCLUDE_SKG extern int skginput _PF(); /* Get Kanji strings. */ #endif /* * Amiga Special */ #ifdef AMIGA #ifdef DO_ICONIFY extern int tticon _PF(); #endif extern int togglewindow _PF(); /* Defined by "ttyio.c" */ extern int togglezooms _PF(); /* "" "" */ #ifdef CHANGE_FONT extern int setfont _PF(); /* Defined by "ttyio.c" */ #endif #ifdef CHANGE_COLOR /* functions to mess with the mode line rendition, window colors*/ extern int ttmode _PF(); /* Defined by "tty.c" */ extern int tttext _PF(); /* "" */ extern int textforeground _PF(); /* "" */ extern int textbackground _PF(); /* "" */ extern int modeforeground _PF(); /* "" */ extern int modebackground _PF(); /* "" */ #endif #ifdef ASL extern int aslopen _PF(); extern int aslinsert _PF(); extern int aslwrite _PF(); #endif #endif /* AMIGA */ /*--- Menu definitions ---*/ #define MENU_END 0 #define MENU_FUNC 1 #define MENU_SUB 2 #define MENU_LINE 0x0F #define MENU_TYPE(t) (t&0x0F) typedef struct { char *face; int type; void *func; char *key; } MenuMap; #ifndef MENU_SUB_ICON #define MENU_SUB_ICON "" #endif MenuMap MgFileMenus[] = { {"Open File... (C-x C-f)", MENU_FUNC, filevisit , NULL}, #ifndef NO_DIRED {"Open Directory... (C-x d)" , MENU_FUNC, dired , NULL}, #endif {"Save Buffer (C-x C-s)", MENU_FUNC, filesave , NULL}, {"Save Buffer As... (C-x C-w)", MENU_FUNC, filewrite , NULL}, {"Insert File... (C-x i)" , MENU_FUNC, fileinsert , NULL}, {"Kill Buffer... (C-x k)" , MENU_FUNC, killbuffer , NULL}, {"---------------------------", MENU_LINE, NULL , NULL}, {"Show All Buffer (C-x C-b)", MENU_FUNC, listbuffers, NULL}, {"Switch Buffer (C-x b)" , MENU_FUNC, usebuffer , NULL}, {"---------------------------", MENU_LINE, NULL , NULL}, {"Split Window (C-x 2)" , MENU_FUNC, splitwind , NULL}, {"One Window (C-x 1)" , MENU_FUNC, onlywind , NULL}, {"One Window(Alt) (C-x 0)" , MENU_FUNC, delwind , NULL}, #if defined(AMIGA)||defined(DO_ICONIFY) {"---------------------------", MENU_LINE, NULL , NULL}, #endif #ifdef AMIGA {"Spawn CLI" , MENU_FUNC, spawncli , NULL}, #endif #ifdef DO_ICONIFY {"Iconify" , MENU_FUNC, tticon , NULL}, #endif {"---------------------------", MENU_LINE, NULL , NULL}, {"Exit Emacs (C-x C-c)", MENU_FUNC, quit , NULL}, {NULL , MENU_END , NULL , NULL} }; MenuMap MgEditMenus[] = { #ifdef UNDO {"Undo (C-x _)", MENU_FUNC, do_undo , NULL}, #endif {"Cut (C-w)" , MENU_FUNC, killregion , NULL}, {"Copy (M-w)" , MENU_FUNC, copyregion , NULL}, {"Paste (C-y)" , MENU_FUNC, yank , NULL}, {"------------------------", MENU_LINE, NULL , NULL}, {"Fill Paragraph (M-q)" , MENU_FUNC, fillpara , NULL}, {"Up-case Region (M-u)" , MENU_FUNC, upperregion, NULL}, {"Down-case Region (M-l)" , MENU_FUNC, lowerregion, NULL}, {NULL , MENU_END , NULL , NULL} }; MenuMap MgSearchMenus[] = { {"Search..." , MENU_FUNC, forwsearch , NULL}, #ifdef REGEX {"Regexp Search..." , MENU_FUNC, re_forwsearch , NULL}, #endif {"Search Backwards..." , MENU_FUNC, backsearch , NULL}, #ifdef REGEX {"Regexp Search Backwards..." , MENU_FUNC, re_backsearch , NULL}, #endif {"--------------------------------", MENU_LINE, NULL , NULL}, {"Repeat Search" , MENU_FUNC, searchagain , NULL}, #ifdef REGEX {"Repeat Regexp" , MENU_FUNC, re_searchagain, NULL}, #endif {"--------------------------------", MENU_LINE, NULL , NULL}, {"Quary Replace... (M-%)", MENU_FUNC, queryrepl , NULL}, #ifdef REGEX {"Quary Replace Regexp..." , MENU_FUNC, re_queryrepl , NULL}, #endif {NULL , MENU_END , NULL , NULL} }; #ifdef KANJI MenuMap MgKanjiMenus[] = { {"Kanji Buffer I/O Code (C-x C-k f)", MENU_FUNC, k_set_buffio , NULL}, {"Kanji Input Code (C-x C-k i)", MENU_FUNC, k_set_input , NULL}, {"Kanji Display Code (C-x C-k d)", MENU_FUNC, k_set_display, NULL}, {NULL , MENU_END , NULL , NULL} }; #endif /* KANJI */ #ifdef AMIGA MenuMap MgAmigaMenus[] = { {"Window Border Toggle" , MENU_FUNC, togglewindow , NULL}, {"Window Zooming" , MENU_FUNC, togglezooms , NULL}, #ifdef CHANGE_FONT {"Set Font" , MENU_FUNC, setfont , NULL}, #endif #ifdef CHANGE_COLOR {"Set Text Rendering Mode" , MENU_FUNC, tttext , NULL}, {"Set Text Foreground Color" , MENU_FUNC, textforeground, NULL}, {"Set Text Background Color" , MENU_FUNC, textbackground, NULL}, {"Set Modeline Rendering Mode" , MENU_FUNC, ttmode , NULL}, {"Set Modeline Foreground Color" , MENU_FUNC, modeforeground, NULL}, {"Set Modeline Background Color" , MENU_FUNC, modebackground, NULL}, #endif /* CHANGE_COLOR */ {NULL , MENU_END , NULL , NULL} }; #endif /* AMIGA */ MenuMap MgEtcMenus[] = { #ifndef NO_MACRO {"Execute Kbd Macro (C-x e)" , MENU_FUNC, executemacro, NULL}, {"----------------------------", MENU_LINE, NULL , NULL}, #endif {"Auto Fill Mode" , MENU_FUNC, fillmode , NULL}, {"Auto Indent Mode" , MENU_FUNC, indentmode , NULL}, {"Overwrite Mode" , MENU_FUNC, overwrite , NULL}, #ifdef CMODE {"C Mode" , MENU_FUNC, cmode , NULL}, #endif #ifdef JUMPERR {"Compile..." , MENU_FUNC, compile , NULL}, #endif #ifdef INCLUDE_SKG {"----------------------------", MENU_LINE, NULL , NULL}, {"Simple Kanji Generator..." , MENU_FUNC, skginput , NULL}, #endif #if defined(AMIGA)||defined(KANJI) {"----------------------------", MENU_LINE, NULL , NULL}, #endif #ifdef KANJI {"Set Default Kanji Code " MENU_SUB_ICON, MENU_SUB , MgKanjiMenus, NULL}, #endif #ifdef AMIGA {"Set Amiga " MENU_SUB_ICON, MENU_SUB , MgAmigaMenus, NULL}, #endif {NULL , MENU_END , NULL , NULL} }; #ifndef NO_HELP MenuMap MgHelpMenus[] = { {"Command Apropos... (C-h a)", MENU_FUNC, apropos_command, NULL}, {"Decscribe Bindings (C-h b)", MENU_FUNC, wallchart , NULL}, {"Decscribe Key (C-h c)", MENU_FUNC, desckey , NULL}, {"Show Compile Options" , MENU_FUNC, showngversion , NULL}, {"Show Version" , MENU_FUNC, showversion , NULL}, {NULL , MENU_END , NULL , NULL} }; #endif #ifdef AMIGA #ifdef ASL MenuMap MgAslMenus[] = { {"Open File" , MENU_FUNC, aslopen , NULL}, {"Insert File", MENU_FUNC, aslinsert, NULL}, {"Write File" , MENU_FUNC, aslwrite , NULL}, {NULL , MENU_END , NULL , NULL} }; #endif /* ASL */ #endif /* AMIGA */ MenuMap MgMenus[] = { {"File" , MENU_SUB, MgFileMenus , NULL}, {"Edit" , MENU_SUB, MgEditMenus , NULL}, {"Search" , MENU_SUB, MgSearchMenus, NULL}, {"Etc." , MENU_SUB, MgEtcMenus , NULL}, #ifndef NO_HELP {"Help" , MENU_SUB, MgHelpMenus , NULL}, #endif #ifdef AMIGA #ifdef ASL {"ASL req.", MENU_SUB, MgAslMenus , NULL}, #endif /* ASL */ #endif /* AMIGA */ {NULL , MENU_END, NULL , NULL} }; ng-1.5beta1/sys/amiga/offset.c100644 1750 1750 442 7126003721 14755 0ustar amurausers/* $Id: offset.c,v 1.1.1.1 2000/06/27 01:48:01 amura Exp $ */ /* * Used to return number of bytes member is from start of structure type. * This is used because Manx 3.20a can't handle Bob's OFFSET macro */ #include "config.h" /* Dec.19,1992 Add by H.Ohkubo */ char *offset_dummy = 0; ng-1.5beta1/sys/amiga/sleep.c100644 1750 1750 1136 7126003721 14620 0ustar amurausers/* $Id: sleep.c,v 1.1.1.1 2000/06/27 01:48:01 amura Exp $ */ /* * Name: MicroEmacs * AmigaDOS sleep function * Version: 31 * Last Edit: 18-Apr-86 * Created: 18-Apr-86 ...!ihnp4!seismo!ut-sally!ut-ngp!mic */ /* * $Log: sleep.c,v $ * Revision 1.1.1.1 2000/06/27 01:48:01 amura * import to CVS * */ #include "config.h" /* Dec. 15, 1992 by H.Ohkubo */ /* There are really 60 ticks/second, but I don't want to wait that */ /* long when matching parentheses... */ #define TICKS 45 extern long Delay(); #ifdef SUPPORT_ANSI void #endif sleep(n) int n; { if (n > 0) Delay((long) n * TICKS); } ng-1.5beta1/sys/amiga/spawn.c100644 1750 1750 4433 7175035122 14647 0ustar amurausers/* $Id: spawn.c,v 1.2 2000/10/23 13:17:06 amura Exp $ */ /* * Name: MG * Version: 2x * Spawn an AmigaDOS subprocess * Last edit: 05-Sep-1987 * By: ...!ihnp4!seismo!ut-sally!ut-ngp!mic */ /* * $Log: spawn.c,v $ * Revision 1.2 2000/10/23 13:17:06 amura * no spawncli() do change directory * * Revision 1.1.1.1 2000/06/27 01:48:00 amura * import to CVS * */ #include #include #undef TRUE #undef FALSE #include "config.h" /* Dec. 15, 1992 by H.Ohkubo */ #include "def.h" /* AFTER system files to avoid redef's */ /* * Create a subjob with a copy of the command intrepreter in it. * This is really a way to get a new copy of the CLI, because * we don't wait around for the new process to quit. Note the use * of a file handle to nil: to avoid the "endcli" message going out * to Emacs's standard output. */ spawncli(f, n) { struct FileHandle *nil, *Open(); ewprintf("[Starting new CLI]"); nil = Open("NIL:", MODE_NEWFILE); if (nil == (struct FileHandle *) 0) { /* highly unlikely */ ewprintf("Can't create nil file handle"); return (FALSE); } #ifdef EXTD_DIR ensurecwd(); #endif Execute("NEWCLI \"CON:0/0/640/200/MicroEmacs Subprocess\"",nil,nil); Close(nil); return (TRUE); } /* Dec.19,1992 Add by H.Ohkubo */ /* from spawn.c in SYSV. Modified for AmigaDos */ #ifndef NO_SHELL /* 91.01.10 by K.Maeda */ /* * Call process in subshell. * Execute COMMAND binding standard input to file INPUT. * NULL as INPUT means standard input should be bound to * /dev/null or whatever equivalent in your OS. * All output during the execution (including standard error output) * should go into a scratch file, whose name call_process() returns. * Return value NULL means error in some stage of the execution. * In that case, scratch file should be deleted. */ char * call_process(command, input) char *command; char *input; { char *tmp; struct FileHandle *in, *out, *Open(); extern char *mktemp(); if ((tmp = mktemp("RAM:ngXXX.XXX")) == NULL) return NULL; if ((in = Open(input ? input : "NIL:", MODE_NEWFILE)) == NULL) return NULL; if ((out = Open(tmp, MODE_NEWFILE)) == NULL) { Close(in); return NULL; } #ifdef EXTD_DIR ensurecwd(); #endif Execute(command, in, out); Close(in); Close(out); return tmp; } #endif /* NO_SHELL */ ng-1.5beta1/sys/amiga/sysdef.h100644 1750 1750 6631 7244021177 15025 0ustar amurausers/* $Id: sysdef.h,v 1.4 2001/02/18 19:29:03 amura Exp $ */ /* * Name: MicroEMACS * Version: MG 2a * Commodore Amiga system header file. */ /* * $Log: sysdef.h,v $ * Revision 1.4 2001/02/18 19:29:03 amura * split dir.c to port depend/independ * * Revision 1.3 2001/01/05 14:07:06 amura * first implementation of Hojo Kanji support * * Revision 1.2 2000/12/14 18:07:52 amura * filename length become flexible * * Revision 1.1.1.1 2000/06/27 01:48:01 amura * import to CVS * */ #include /* Dec. 16, 1992 by H.Ohkubo */ /* Neither can lattice 4 */ extern char *offset_dummy; /* Manx 3.2 can't handle 0-> */ #define OFFSET(type,member) \ ((char *)&(((type *)offset_dummy)->member)-(char *)((type *)offset_dummy)) #ifdef _DCC #include #endif #ifdef SAS6 # define LATTICE 1 #endif #ifndef SUPPORT_ANSI # ifdef LATTICE # define SUPPORT_ANSI 1 # endif # ifdef _DCC # define SUPPORT_ANSI 1 # endif # ifdef __GNUC__ # define SUPPORT_ANSI 1 # endif #endif #define HAVE_GETCWD #define VARARGS #define DPROMPT /* we always want delayed prompts */ #define KBLOCK 4096 /* Kill grow. */ #define GOOD 0 /* Good exit status. */ #define SYSINIT sysinit() /* System-specific initialization */ #define SYSCLEANUP syscleanup() /* System-specific cleanup */ #define MALLOCROUND(m) (m+=7,m&=~7) /* Round up to 8 byte boundary */ #ifndef NULL # ifdef BUGFIX /* Dec. 15, 1992 by H.Ohkubo */ # ifdef SAS6 # define NULL 0L # else # define NULL ((void *)0) # endif # else /* ORIGINAL Code */ # define NULL ((char *) 0) /* These are crass, but */ # endif /* BUGFIX */ #endif #ifndef EOF # define EOF -1 /* will work` */ #endif #ifndef NO_SHELL /* Dec. 15, 1992 by H.Ohkubo */ #define CMDLINELENGTH NFILEN /* Maximum length of shell command. */ #endif /* NO_SHELL */ #define BSMAP FALSE /* Dec.18,1992 Add by H.Ohkubo */ /* * Macros used by the buffer name making code. * Start at the end of the file name, scan to the left * until BDC1 (or BDC2, if defined) is reached. The buffer * name starts just to the right of that location, and * stops at end of string (or at the next BDC3 character, * if defined). BDC2 and BDC3 are mainly for VMS. */ #define BDC1 '/' /* Buffer names. */ #define BDC2 ':' /* * Typedefs for internal key type and how big a region can be. */ typedef short KCHAR; /* type used to represent Emacs characters */ typedef long RSIZE; /* size of a region */ #ifndef __GNUC__ #define bcopy(src,dest,len) movmem(src,dest,len) #define bzero(s,n) memset(s,0,n) /* Dec. 16, 1992 Add by H.Ohkubo */ #define bcmp(s,d,n) memcmp(s,d,n) /* Dec. 16, 1992 Add by H.Ohkubo */ #endif #define fncmp Strcmp #ifndef NO_DIRED #define rename(s1,s2) (Rename(s1,s2) == -1 ? 0 : -1) #define unlinkdir(s1) (DeleteFile(s1) == -1 ? 0 : -1) #endif #ifndef NO_DIR #define rchdir(dir) chdir(dir) #define dirend() (VOID)0 #endif #ifdef KANJI /* Dec.17,1992 by H.Ohkubo */ #ifndef AMIGA_STDIO extern int FlushBuf(); typedef struct { int *niobuf; int bufmax; unsigned char *iobuf; } My_FILE; #define FILE My_FILE #define AMIGA_FAST_FILE #define Putc(c,fp) {if (*(fp)->niobuf == (fp)->bufmax) FlushBuf();\ (fp)->iobuf[(*(fp)->niobuf)++] = (c);} #ifdef putc # undef putc #endif #define putc Putc /* #define kputc KPutc */ #endif /* AMIGA_STDIO */ #endif /* KANJI */ #define chdir Chdir /* Dec.18,1992 Add by H.Ohkubo */ #ifdef NEW_COMPLETE /* Jan.5,1992 Add by H.Ohkubo */ #define file_name_part BaseName #endif ng-1.5beta1/sys/amiga/sysinit.c100644 1750 1750 10404 7236307557 15250 0ustar amurausers/* $Id: sysinit.c,v 1.6 2001/02/01 16:31:43 amura Exp $ */ /* * Name: MG 2a * * Very early-on system-specific initialization for whatever's * necessary. * Last edit: 05-May-88, Stephen Walton, swalton@solar.stanford.edu * Created: Stephen Walton, 3-Dec-87. * */ /* * $Log: sysinit.c,v $ * Revision 1.6 2001/02/01 16:31:43 amura * fix small bug? in get current directory * * Revision 1.5 2000/12/22 19:48:17 amura * change "sysdef.h" to "def.h" for get NFILEN * * Revision 1.4 2000/12/14 18:08:35 amura * filename length become flexible * * Revision 1.3 2000/10/31 07:08:14 amura * fix bug around input.device * * Revision 1.2 2000/09/29 17:25:15 amura * small patch for new iconify() * * Revision 1.1.1.1 2000/06/27 01:48:01 amura * import to CVS * */ /* Dec.20,1992 Add by H.Ohkubo */ #include #include #include #include "zz_pointer.h" #include #include "config.h" /* Dec. 16, 1992 by H.Ohkubo */ #include "def.h" #undef FALSE #undef TRUE #define TRUE 1 #define FALSE 0 #ifdef USE_ARP #include "libraries/arpbase.h" struct ArpBase *ArpBase; #endif #ifdef DO_ICONIFY # ifdef V2 struct Library *WorkbenchBase; # endif #endif #ifdef KANJI # ifdef V2 struct Library *InputBase; static struct IOStdReq *InputIO; static struct MsgPort *InputMP; # endif #endif /* * Library bases (used by glue libraries) * These valiable from ttyio.c by.H.Ohkubo Dec.20,1992 */ struct IntuitionBase *IntuitionBase; struct GfxBase *GfxBase; struct Library *DiskfontBase; extern struct Library *OpenLibrary(); #ifndef NO_DIR extern struct Task *FindTask(); static BPTR StartLock; char MyDirName[NFILEN]; extern BPTR DupLock(), CurrentDir(); #endif /* NO_DIR */ sysinit() { long len; BPTR MyDirLock; #ifdef USE_ARP if (!(ArpBase = (struct ArpBase *) OpenLibrary("arp.library", 0L))) panic("Compiled with USE_ARP, but arp.library not found"); #endif #ifndef NO_DIR /* * The following attempt to be clever assigns the external StartLock * to the lock on the current directory, then switches our CurrentDir * to a duplicate of that lock so we can restore the original lock * on exit. */ StartLock = ((struct Process *)FindTask(0L))->pr_CurrentDir; (void) CurrentDir(MyDirLock = DupLock(StartLock)); len = PathName(MyDirLock, MyDirName, (NFILEN+31L)/32L - 1); #endif /* NO_DIR */ /* These from ttyio.c by H.Ohkubo Dec.20,1992 */ #ifdef USE_ARP /* Add by H.Ohkubo */ #define OpenLibrary ArpOpenLibrary #endif GfxBase = (struct GfxBase *) OpenLibrary("graphics.library", 0L); if (GfxBase == NULL) /* Graphics lib */ syscleanup(); IntuitionBase = (struct IntuitionBase *) /* Intuition */ OpenLibrary("intuition.library", 0L); if (IntuitionBase == NULL) syscleanup(); DiskfontBase = (struct Library *) OpenLibrary("diskfont.library", 0L); if (DiskfontBase == NULL) syscleanup(); #ifdef DO_ICONIFY # ifdef V2 WorkbenchBase = OpenLibrary("workbench.library",0L); if (WorkbenchBase == NULL) syscleanup(); # endif #endif #ifdef KANJI # ifdef V2 InputBase = NULL; if (InputMP=CreatePort(0L,0L)) { if (InputIO = (struct IOStdReq*) CreateExtIO(InputMP, sizeof(struct IOStdReq))) { if (!OpenDevice("input.device", NULL, (struct IORequest *)InputIO, NULL)) InputBase = (struct Library *)InputIO->io_Device; } } if (InputBase == NULL) panic("cannot open input device"); # endif /* V2 */ #endif #ifdef REXX /* Dec.20,1992 by H.Ohkubo */ openrexx(); #endif zz_pointer_open(); /* Dec.20,1992 Add by H.Ohkubo */ } /* * System dependent cleanup for the Amiga. */ syscleanup() { zz_pointer_close(); /* Dec.20,1992 Add by H.Ohkubo */ UnLock(CurrentDir(StartLock)); /* restore startup directory */ #ifdef REXX closerexx(); #endif #ifdef KANJI # ifdef V2 if (InputIO) { CloseDevice(InputIO); DeleteExtIO(InputIO); } if (InputMP) DeletePort(InputMP); # endif #endif /* from ttyio.c by H.Ohkubo Dec.20,1992 */ #ifndef USE_ARP /* Add by H.Ohkubo */ # ifdef DO_ICONIFY # ifdef V2 if (WorkbenchBase) CloseLibrary(WorkbenchBase); # endif # endif if (DiskfontBase) CloseLibrary(DiskfontBase); if (IntuitionBase) CloseLibrary(IntuitionBase); if (GfxBase) CloseLibrary(GfxBase); #endif #ifdef USE_ARP if (ArpBase) CloseLibrary(ArpBase); #endif } ng-1.5beta1/sys/amiga/tty.c100644 1750 1750 24651 7232331536 14365 0ustar amurausers/* $Id: tty.c,v 1.2 2001/01/20 15:48:46 amura Exp $ */ /* * Name: MG 2a * Amiga console device virtual terminal display * Last Edit: 29-Nov-87 mic@emx.cc.utexas.edu * Created: 19-Apr-86 mic@emx.cc.utexas.edu * * Drives the Amiga console device display. The code is basically * like the termcap driver in that it uses the console device * scrolling region. It also has some hacks to manage the console * device colors. The latest hack is to inform the terminal I/O * driver when we intend to do an escape sequence; this allows the * terminal I/O driver to turn off the cursor without breaking up * the sequences, leading to a garbled screen. */ /* * $Log: tty.c,v $ * Revision 1.2 2001/01/20 15:48:46 amura * very big terminal supported * * Revision 1.1.1.1 2000/06/27 01:48:01 amura * import to CVS * */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifndef MANX #include #endif #include #undef TRUE #undef FALSE #include "config.h" /* Dec. 15, 1992 by H.Ohkubo */ #include "def.h" #define BEL 0x07 /* BEL character. */ #define ESC 0x1B /* ESC character. */ #define LF 0x0A /* Linefeed character */ #define CSI 0x9B /* Command Sequence Introducer */ extern int ttrow; extern int ttcol; extern int tttop; extern int ttbot; extern int tthue; int tceeol = 3; /* Costs, ANSI display. */ int tcinsl = 17; int tcdell = 16; #ifdef CHANGE_COLOR short mode_rendition = MODE_RENDITION, /* set standard colors */ text_rendition = TEXT_RENDITION, text_fg = TEXT_FG + 30, text_bg = TEXT_BG + 40, mode_fg = MODE_FG + 30, mode_bg = MODE_BG + 40; #else /* colors are hard-coded */ #define mode_rendition MODE_RENDITION #define text_rendition TEXT_RENDITION #define text_fg (TEXT_FG + 30) #define text_bg (TEXT_BG + 40) #define mode_fg (MODE_FG + 30) #define mode_bg (MODE_BG + 40) #endif #ifdef SUPPORT_ANSI VOID asciiparm(int) ; #else VOID asciiparm() ; #endif /* VOID ttnowindow() ; */ VOID ttwindow() ; extern struct Screen WBInfo; /* For Font Sensitive by H.Konishi */ /* * Initialize the terminal when the editor * Initialize the virtual terminal. * Set the console device's top edge below * the front-to-back gadgets, to avoid * garbage when scrolling. */ /* VOID */ ttinit() { ttputc(CSI); asciiparm(TOP_OFFSET); ttputc('y'); } /* * Clean up the terminal, in anticipation of * a return to the command interpreter. This * is a no-op on the Amiga, since the window * is deleted anyway. */ /* VOID */ tttidy() { } /* * Move the cursor to the specified origin 0 row and column position. Try to * optimize out extra moves; redisplay may have left the cursor in the right * location last time! */ /* VOID */ ttmove(row, col) { if (ttrow!=row || ttcol!=col) { ttnflush(8); /* flush if buffer too full */ ttputc(CSI); asciiparm(row+1); ttputc(';'); asciiparm(col+1); ttputc('H'); ttrow = row; ttcol = col; } } /* * Erase to end of line. */ /* VOID */ tteeol() { ttnflush(2); /* flush if not enough room to fit in buffer */ ttputc(CSI); ttputc('K'); } /* * Erase to end of page. */ /* VOID */ tteeop() { ttnflush(12); /* flush (but only if not enough room for seq */ ttputc(CSI); asciiparm((tthue == CTEXT) ? text_rendition : mode_rendition); ttputc(';'); asciiparm(text_fg); ttputc(';'); asciiparm(text_bg); ttputc('m'); ttputc(CSI); /* clear to end of display */ ttputc('J'); } /* * Make a noise. */ /* VOID */ ttbeep() { ttputc(BEL); ttflush(); } /* * Convert a number to decimal * ascii, and write it out. Used to * deal with numeric arguments. */ VOID asciiparm(n) register int n; { if (n > 9) asciiparm(n/10); #ifdef BUGFIX /* Jan.4,1993 by H.Ohkubo */ ttputc((unsigned char)((n%10) + '0')); #else /* Original code */ ttputc((n%10) + '0'); #endif } /* * Insert a block of blank lines onto the * screen, using a scrolling region that starts at row * "row" and extends down to row "bot". Deal with the one * line case, which is a little bit special, with special * case code. */ /* VOID */ ttinsl(row, bot, nchunk) { if (row == bot) { /* Funny case. */ if (nchunk != 1) panic("ttinsl: nchunk != 1"); ttmove(row, 0); tteeol(); return; } ttmove(1+bot-nchunk, 0); if (nchunk > 0) { ttwindow(row, bot); ttnflush(4); /* don't break the sequence */ ttputc(CSI); asciiparm(nchunk); ttputc('T'); /* Scroll scrolling region down */ ttnowindow(); } } /* * Delete a block of lines, with the uppermost * line at row "row", in a screen slice that extends to * row "bot". The "nchunk" is the number of lines that have * to be deleted. It's really easy with the console * device scrolling region. */ /* VOID */ ttdell(row, bot, nchunk) { if (row == bot) { /* One line special case */ ttmove(row, 0); tteeol(); return; } if (nchunk > 0) { ttwindow(row, bot); ttnflush(4); /* don't break esc. sequence */ ttputc(CSI); asciiparm(nchunk); ttputc('S'); /* Scroll scrolling region up */ ttnowindow(); } ttrow = HUGE; ttcol = HUGE; ttmove(bot-nchunk,0); } /* * This routine sets the scrolling window on the display to go from line * "top" to line "bot" (origin 0, inclusive). The caller checks for the * pathalogical 1 line scroll window that doesn't work right on all * systems, and avoids it. The "ttrow" and "ttcol" variables are set * to a crazy value to ensure that ttmove() actually does something. */ extern struct Window *EmW; /* The window MG uses */ VOID ttwindow(top,bot) { if (tttop != top || ttbot != bot) { ttnflush(10); /* Flush if necessary */ ttputc(CSI); /* Home cursor */ ttputc('H'); ttputc(CSI); /* Set top offset */ asciiparm(TOP_OFFSET + top * FontHeight(EmW)); ttputc('y'); ttputc(CSI); asciiparm(bot - top + 1); /* Set page length */ ttputc('t'); ttrow = HUGE; /* Force cursor reset */ ttcol = HUGE; tttop = top; /* Save region state */ ttbot = bot; } } /* * Switch to full screen scrolling */ /* VOID */ ttnowindow() { ttnflush(10); /* Flush if necessary */ ttputc(CSI); /* Home cursor */ ttputc('H'); ttputc(CSI); /* Set top offset to normal */ asciiparm(TOP_OFFSET); ttputc('y'); ttputc(CSI); /* Set page length to nrow */ asciiparm(nrow); ttputc('t'); ttrow = HUGE; /* Make cursor unknown. */ ttcol = HUGE; tttop = HUGE; ttbot = HUGE; } #ifdef CHANGE_COLOR /* * Set the rendition of the mode line by * selecting colors from the following: * 0 -- plain text * 1 -- bold-face * 3 -- italic * 4 -- underscore * 7 -- inverse video * Certain of these selections may be less than * appealing :-) */ ttmode(f, n) { register int s; char buf[2]; if (!(f & FFARG)) { if ((s = ereply("Set mode line rendition (0-7): ", buf, sizeof(buf))) != TRUE) return (s); n = atoi(buf); } if (n < 0 || n > 7) return (FALSE); mode_rendition = n; /* store the color */ sgarbf = TRUE; return (TRUE); } /* * Set the rendition of the text area. * Most of these selections will be * less than appealing :-] */ tttext(f, n) { register int s; char buf[2]; if (!(f & FFARG)) { if ((s = ereply("Set text rendition (0-7): ", buf, sizeof(buf))) != TRUE) return (s); n = atoi(buf); } if (n < 0 || n > 7) return (FALSE); text_rendition = n; /* store the color */ sgarbf = TRUE; return (TRUE); } /* * Set foreground color for entire window * to a value between 30 and 37, which * corresponds to the arguments 0-7. * This requires a total refresh, which * sets up the screen. */ textforeground(f, n) { register int s; char buf[2]; if (!(f & FFARG)) { if ((s = ereply("Text foreground color (0-7): ", buf, sizeof(buf))) != TRUE) return (s); n = atoi(buf); } if (n < 0 || n > 7) return (FALSE); text_fg = n + 30; sgarbf = TRUE; return (TRUE); } /* * Set background color for entire window * to a value between 40 and 47 inclusive. */ textbackground(f, n) { register int s; char buf[2]; if (!(f & FFARG)) { if ((s = ereply("Text background color (0-7): ", buf, sizeof(buf))) != TRUE) return (s); n = atoi(buf); } if (n < 0 || n > 7) return (FALSE); text_bg = n + 40; sgarbf = TRUE; return (TRUE); } /* * Set foreground color for entire the mode line */ modeforeground(f, n) { register int s; char buf[2]; if (!(f & FFARG)) { if ((s = ereply("Mode line foreground color (0-7): ", buf, sizeof(buf))) != TRUE) return (s); n = atoi(buf); } if (n < 0 || n > 7) return (FALSE); mode_fg = n + 30; sgarbf = TRUE; return (TRUE); } /* * Set background color for the mode line */ modebackground(f, n) { register int s; char buf[2]; if (!(f & FFARG)) { if ((s = ereply("Mode line background color (0-7): ", buf, sizeof(buf))) != TRUE) return (s); n = atoi(buf); } if (n < 0 || n > 7) return (FALSE); mode_bg = n + 40; sgarbf = TRUE; return (TRUE); } #endif /* * Set the current writing color to the * specified color. Watch for color changes that are * not going to do anything (the color is already right) * and don't send anything to the display. */ /* VOID */ ttcolor(color) register int color; { if (color != tthue) { ttnflush(12); /* Flush if necessary */ if (color == CTEXT) { /* Normal video. */ ttputc(CSI); /* Reset to 0 */ ttputc('m'); ttputc(CSI); /* Set text style */ asciiparm(text_rendition); ttputc(';'); asciiparm(text_fg); ttputc(';'); asciiparm(text_bg); ttputc('m'); } else if (color == CMODE) { /* Standout mode */ ttputc(CSI); /* Reset to 0 */ ttputc('m'); ttputc(CSI); /* Set standout mode */ asciiparm(mode_rendition); ttputc(';'); asciiparm(mode_fg); /* Use mode line colors */ ttputc(';'); asciiparm(mode_bg); ttputc('m'); } tthue = color; /* Save the color. */ } } /* * This routine is called by the "refresh the screen" command to try and resize * the display. The new size, which must be deadstopped to not exceed the NROW * and NCOL limits, is stored back into "nrow" and "ncol". Display can always * deal with a screen NROW by NCOL. Look in "window.c" to see how the caller * deals with a change. On the Amiga, we make the Intuition terminal driver * do all the work. */ /* VOID */ ttresize() { setttysize(); vtsetsize(ncol, nrow); } ng-1.5beta1/sys/amiga/ttydef.h100644 1750 1750 12064 7225352412 15042 0ustar amurausers/* $Id: ttydef.h,v 1.2 2001/01/05 14:07:06 amura Exp $ */ /* * Name: MicroEMACS * Amiga console device virtual terminal header file * Version: MG 2a * Last edit: 28-Nov-87 ...!seismo!ut-sally!ut-ngp!mic (mic@emx.cc.utexas.edu) * Created: 20-Apr-86 ...!seismo!ut-sally!ut-ngp!mic */ /* * $Log: ttydef.h,v $ * Revision 1.2 2001/01/05 14:07:06 amura * first implementation of Hojo Kanji support * * Revision 1.1.1.1 2000/06/27 01:48:01 amura * import to CVS * */ #define GOSLING /* Compile in fancy display. */ /* #define TOP_OFFSET 11 */ /* # raster lines from top of window */ /* For Font Sensitive By H.Konishi */ #define TOP_OFFSET ((WBInfo. Font->ta_YSize)+3) #ifndef NROW #define NROW 51 /* Max rows (interlaced screen) */ #endif #ifndef NCOL #define NCOL 85 /* Max cols (MoreRows, borderless) */ #endif #ifndef LR_BORDER #define LR_BORDER (3 + 20) /* Vertical border size (pixels) */ #endif #ifndef TB_BORDER #define TB_BORDER (TOP_OFFSET + 2) /* Horizontal border size (pixels)*/ #endif #ifndef INIT_ROWS #define INIT_ROWS 24 /* Desired initial window height */ #endif #ifndef INIT_COLS #define INIT_COLS 80 /* Desired initial window width */ #endif #ifdef DO_METAKEY #define METABIT 0x200 #endif /* * Function key codes (using 16-bit KEY values) */ #define KFIRST 0x100 #define KUP 0x100 #define KDOWN 0x101 #define KLEFT 0x102 #define KRIGHT 0x103 #define KSUP 0x104 #define KSDOWN 0x105 #define KSLEFT 0x106 #define KSRIGHT 0x107 #define KHELP 0x108 #define KMENU 0x109 #define KRESIZE 0x10A #define KF1 0x10C #define KF2 0x10D #define KF3 0x10E #define KF4 0x10F #define KF5 0x110 #define KF6 0x111 #define KF7 0x112 #define KF8 0x113 #define KF9 0x114 #define KF10 0x115 #define KSF1 0x116 #define KSF2 0x117 #define KSF3 0x118 #define KSF4 0x119 #define KSF5 0x11A #define KSF6 0x11B #define KSF7 0x11C #define KSF8 0x11D #define KSF9 0x11E #define KSF10 0x11F #define KW___MOUSE 0x120 #define KW__CMOUSE 0x121 #define KW_S_MOUSE 0x122 #define KW_SCMOUSE 0x123 #define KWA__MOUSE 0x124 #define KWA_CMOUSE 0x125 #define KWAS_MOUSE 0x126 #define KWASCMOUSE 0x127 #define KM___MOUSE 0x128 #define KM__CMOUSE 0x129 #define KM_S_MOUSE 0x12A #define KM_SCMOUSE 0x12B #define KMA__MOUSE 0x12C #define KMA_CMOUSE 0x12D #define KMAS_MOUSE 0x12E #define KMASCMOUSE 0x12F #define KE___MOUSE 0x130 #define KE__CMOUSE 0x131 #define KE_S_MOUSE 0x132 #define KE_SCMOUSE 0x133 #define KEA__MOUSE 0x134 #define KEA_CMOUSE 0x135 #define KEAS_MOUSE 0x136 #define KEASCMOUSE 0x137 #define KLAST KEASCMOUSE /* * Mouse key encoding stuff... The bit fields are: * * 4 3 2 1 0 * | where | ALT | SHIFT | CTRL * * Where ALT, SHIFT, and CTRL indicate qualifiers, and the 2-bit * where field indicates whether the click was (initially) in a window, * a mode line, or the echo line. The mouse functions are smart enough * to remap themselves if necessary; we implement these as keys so * users can rebind things to their taste. */ #define M_X_ZERO ' ' #define M_Y_ZERO ' ' #define MQ_OFFSET 0x40 #define MQ_NOQUAL 0x00 #define MQ_CTRL 0x01 #define MQ_SHIFT 0x02 #define MQ_ALT 0x04 #define MQ_WINDOW 0x00 #define MQ_MODE 0x08 #define MQ_ECHO 0x10 #define MQ_WHERE(m) (m & 0x18) /* get where field */ #define MQ_QUALS(m) (m & 0x07) /* get qualifier field */ /* * Intuition menu interface. Each set of menu items kept in a table of * MenuBinding structures, which is in turn kept in a table of MenuInfo * structures. These tables are indexed via the menu and item numbers to * find the internal extended name of the function associated with a * certain item. */ #define MN_OFFSET ' ' /* menu char - ' ' = real code */ struct MenuBinding { char *Command; #ifdef SUPPORT_ANSI int (*Function)(int,int); #else int (*Function)(); #endif }; struct MenuInfo { char *Name; /* name of menu */ short NumItems; /* # of items */ struct MenuBinding *Items; /* item name, internal binding */ }; #define NITEMS(arr) (sizeof(arr) / (sizeof(arr[0]))) /* * If either MENU, or BROWSER is defined, we need to define * DO_MENU to get the code for dealing with menu selections * compiled in. */ #ifdef MENU #define DO_MENU #else #ifdef BROWSER #define DO_MENU #endif BROWSER #endif MENU /* * MODE_RENDITION and TEXT_RENDITION determine the way the mode line and * text area are rendered (using the SGR sequence). TEXT_* and MODE_* set * the foreground (FG) and background (BG) color to the specified number. * If you* #define CHANGE_COLOR, you can redefine these dynamically. */ #ifndef MODE_RENDITION #define MODE_RENDITION 7 #endif #ifndef TEXT_RENDITION #define TEXT_RENDITION 0 #endif #ifndef TEXT_FG #define TEXT_FG 1 #endif #ifndef TEXT_BG #define TEXT_BG 0 #endif #ifndef MODE_FG #define MODE_FG 1 #endif #ifndef MODE_BG #define MODE_BG 0 #endif /* * Return the width and height of * the default font for a window. */ #define FontWidth(w) (w)->RPort->TxWidth #define FontHeight(w) (w)->RPort->TxHeight /* Dec.17,1992 Add by H.Ohkubo */ #ifdef KANJI /* 90.02.05 by S.Yoshida */ #define ungetkbd(c) (ttungetc(c)) #endif /* KANJI */ ng-1.5beta1/sys/amiga/ttyicon.c100644 1750 1750 12134 7165150173 15230 0ustar amurausers/* $Id: ttyicon.c,v 1.3 2000/09/29 17:25:15 amura Exp $ */ /* * Name: MG 2a * Iconify the MG window using Leo Schwab's iconify() routine. * Last Edit: 07-Jan-88 mic@emx.utexas.edu * Created: 04-Jan-88 mic@emx.utexas.edu */ /* * $Log: ttyicon.c,v $ * Revision 1.3 2000/09/29 17:25:15 amura * small patch for new iconify() * * Revision 1.2 2000/07/28 11:26:37 amura * edit icon to Ng 1.4 * * Revision 1.1.1.1 2000/06/27 01:48:01 amura * import to CVS * */ #include "config.h" /* Dec.19,1992 Add by H.Ohkubo */ #ifdef DO_ICONIFY #include #include #include #include "iconify.h" #undef TRUE #undef FALSE #include "def.h" /* * Simple Mg 2a icon image. We need a more imaginative one. */ #ifdef KANJI /* Dec.19,1992 by H.Ohkubo */ /* 27 Jul 2000 rewrite for Ng 1.4 by amura */ UWORD mg2a[] = { /* Bit Plane #0 */ 0x3fff, 0xffff, 0xffff, 0xfffe, 0x3fff, 0xffff, 0xffff, 0xfffe, 0x3ffd, 0xefff, 0xffff, 0xfffe, 0x3ff2, 0x97ff, 0xfeff, 0xffbe, 0x3fe3, 0x2fff, 0xf17f, 0xf85e, 0x3fe1, 0x3fbf, 0xc2ff, 0xf0be, 0x3fc2, 0x605f, 0xc2ff, 0xe0be, 0x3fc0, 0x445f, 0xc5ff, 0xc97e, 0x3f80, 0x88bf, 0xc5ff, 0x917e, 0x3f80, 0x88bf, 0x8bff, 0x13be, 0x3f21, 0x117f, 0x8bfe, 0x00be, 0x3f21, 0x117f, 0x17fc, 0x017e, 0x3e62, 0x22ff, 0x17df, 0xc77e, 0x3e53, 0x02fe, 0x2e2f, 0x8bfe, 0x398f, 0xc402, 0x2227, 0x881e, 0x3ffc, 0x0bff, 0xdfdf, 0xf7fe, 0x3fff, 0xf7ff, 0xffff, 0xfffe, 0x3fff, 0xffff, 0xffff, 0xfffe, 0x3fff, 0xffff, 0xffff, 0xfffe, /* Bit Plane #1 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x1fff, 0xffff, 0xffff, 0xfffc, 0x1ff3, 0x9fff, 0xffff, 0xfffc, 0x1fed, 0x6fff, 0xf1ff, 0xf87c, 0x1fdc, 0xdfff, 0xceff, 0xf7bc, 0x1fde, 0xc07f, 0xbdff, 0xef7c, 0x1fbd, 0x9fbf, 0xbdff, 0xdf7c, 0x1fbf, 0xbbbf, 0xbbff, 0xb6fc, 0x1f7f, 0x777f, 0xbbff, 0x6efc, 0x1f7f, 0x777f, 0x77fe, 0xec7c, 0x1ede, 0xeeff, 0x77fd, 0xff7c, 0x1ede, 0xeefe, 0xeffb, 0xfefc, 0x1d9d, 0xddfe, 0xee38, 0x38fc, 0x1dac, 0xfdfd, 0xdddf, 0x77fc, 0x1800, 0x3801, 0xc1c7, 0x701c, 0x1ffb, 0xf7fe, 0x3e3f, 0x8ffc, 0x1ffc, 0x0fff, 0xffff, 0xfffc, 0x1fff, 0xffff, 0xffff, 0xfffc, 0x0000, 0x0000, 0x0000, 0x0000, }; #else /* Original Code */ UWORD mg2a[160] = { /* Bit Plane #0 */ 0x0000,0x0000,0x0000,0x0000, 0x3fff,0xffff,0xffff,0xf000, 0x3fff,0xffff,0xffff,0xf000, 0x3c00,0x0000,0x0000,0xf000, 0x3cc1,0x8f80,0x0000,0xf000, 0x3ce3,0x9ce0,0x0000,0xf000, 0x3cf7,0xb800,0x0000,0xf000, 0x3cff,0xb9e0,0x0000,0xf000, 0x3cfb,0xb8e0,0x0000,0xf000, 0x3ce3,0x9ce3,0xf000,0xf000, 0x3ce3,0x8fe7,0x3800,0xf000, 0x3c00,0x0000,0x39f8,0xf000, 0x3c00,0x0000,0xf01c,0xf000, 0x3c00,0x0003,0x80fc,0xf000, 0x3c00,0x0007,0x3b1c,0xf000, 0x3c00,0x0007,0xf9ee,0xf000, 0x3c00,0x0000,0x0000,0xf000, 0x3fff,0xffff,0xffff,0xf000, 0x3fff,0xffff,0xffff,0xf000, 0x0000,0x0000,0x0000,0x0000, /* Bit Plane #1 */ 0xffff,0xffff,0xffff,0xfc00, 0xffff,0xffff,0xffff,0xfc00, 0xf000,0x0000,0x0000,0x3c00, 0xf000,0x0000,0x0000,0x3c00, 0xf040,0x8000,0x0000,0x3c00, 0xf020,0x8420,0x0000,0x3c00, 0xf010,0x8800,0x0000,0x3c00, 0xf000,0x8820,0x0000,0x3c00, 0xf020,0x8820,0x0000,0x3c00, 0xf020,0x8420,0x1000,0x3c00, 0xf020,0x8021,0x0800,0x3c00, 0xf000,0x0000,0x0808,0x3c00, 0xf000,0x0000,0x1004,0x3c00, 0xf000,0x0000,0x8004,0x3c00, 0xf000,0x0001,0x0804,0x3c00, 0xf000,0x0000,0x0802,0x3c00, 0xf000,0x0000,0x0000,0x3c00, 0xf000,0x0000,0x0000,0x3c00, 0xffff,0xffff,0xffff,0xfc00, 0xffff,0xffff,0xffff,0xfc00 }; #endif /* KANJI */ static struct Image iconimg = { /* Icon Image */ 0, 0, #ifdef KANJI /* Dec.19,1992 by H.Ohkubo */ 64, 19, 2, #else /* Original */ 54, 20, 2, #endif NULL, /* filled in later */ 0x3, 0, NULL }; /* * Iconify MG's window using tthide(), iconify(), and ttshow(). */ int tticon(f, n) { static UWORD iconX = 0, iconY = 0; UWORD *chipbitmap; struct Image *chipimg; extern short toggling; extern APTR AllocMem(); /* copy the bitmap into chip memory */ if (NULL == (chipbitmap = (UWORD * ) AllocMem((ULONG) sizeof(mg2a), MEMF_CHIP | MEMF_PUBLIC))) { ewprintf("Can't allocate image bitmap"); return FALSE; } bcopy((char *)mg2a, (char *)chipbitmap, (int) sizeof(mg2a)); /* copy the image structure too */ if (NULL == (chipimg = (struct Image *) AllocMem((ULONG) sizeof(iconimg), MEMF_CHIP | MEMF_PUBLIC))) { FreeMem(chipbitmap, (ULONG) sizeof(iconimg)); ewprintf("Can't allocate image structure"); return FALSE; } bcopy((char *)&iconimg, (char *)chipimg, (int) sizeof(iconimg)); chipimg->ImageData = chipbitmap; /* hide the window, display the icon, then redisplay the window */ tthide(FALSE); /* not resizing */ #ifdef ICON_WB iconify(&iconX, &iconY, chipimg->Width, chipimg->Height, "Ng iconified", (APTR) chipimg, (int) ICON_WB); /* iconify */ #else iconify(&iconX, &iconY, chipimg->Width, chipimg->Height, NULL, (APTR) chipimg, (int) ICON_IMAGE); /* iconify */ #endif FreeMem(chipimg, (ULONG) sizeof(iconimg)); FreeMem(chipbitmap, (ULONG) sizeof(mg2a)); ttshow(FALSE); /* no resize */ return TRUE; } #endif DO_ICONIFY ng-1.5beta1/sys/amiga/ttyio.c100644 1750 1750 72626 7247657136 14737 0ustar amurausers/* $Id: ttyio.c,v 1.6 2001/03/02 08:48:30 amura Exp $ */ /* * Name: MG 2a * Amiga terminal window I/O, with all kinds o' trimmings. * This module is 'way too big. * Last Edit: 01-Dec-87 mic@emx.cc.utexas.edu * Created: 21-Apr-86 mic@emx.cc.utexas.edu */ /* * $Log: ttyio.c,v $ * Revision 1.6 2001/03/02 08:48:30 amura * now AUTOSAVE feature implemented almost all (except for WIN32 * * Revision 1.5 2001/01/20 15:48:46 amura * very big terminal supported * * Revision 1.4 2000/12/21 16:54:20 amura * fix usage of strncat() * * Revision 1.3 2000/10/02 16:13:06 amura * ignore mouse event in minibuffer editing * * Revision 1.2 2000/09/29 17:26:17 amura * small patch for new ttymenu.c * * Revision 1.1.1.1 2000/06/27 01:48:01 amura * import to CVS * */ /* * Lots of includes. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef KANJI # ifdef V2 #include # endif #endif #undef TRUE /* avoid redefinition messages */ #undef FALSE #include "config.h" /* Dec. 15, 1992 by H.Ohkubo */ #include "def.h" /* includes sysdef.h and ttydef.h */ #ifdef DO_METAKEY #define IEQUALIFIER_ALT (IEQUALIFIER_RALT | IEQUALIFIER_LALT) #endif /* DO_METAKEY */ /* ARexx support. this is mg3b's feature! */ #ifdef REXX /* Dec.20,1992 Add by H.Ohkubo */ #include "key.h" #endif /* * External Amiga functions. */ extern LONG AbortIO(); extern LONG CloseDevice(); extern LONG CloseLibrary(); extern LONG CloseWindow(); extern struct MsgPort *CreatePort(); extern struct IOStdReq *CreateStdIO(); extern LONG DeletePort(); extern LONG DeleteStdIO(); extern struct IntuiMessage *GetMsg(); #ifndef V11 extern LONG GetScreenData(); #endif extern int OpenConsole(); extern char *OpenLibrary(); extern struct Window *OpenWindow(); extern struct TextFont *OpenDiskFont(); extern LONG RectFill(); extern LONG ReplyMsg(); extern LONG RawKeyConvert(); extern LONG SetAPen(); extern LONG SetDrMd(); extern LONG Wait(); #ifdef DO_MENU extern LONG ClearMenuStrip(); /* menu functions */ extern struct Menu *InitEmacsMenu(); extern VOID DisposeMenus(); extern struct MenuItem *ItemAddress(); extern LONG SetMenuStrip(); #endif #ifdef MANX extern int Enable_Abort; /* Do NOT allow abort! */ #endif /* * External MG functions and variables */ extern int quit(); /* Defined by "main.c" */ extern char version[]; /* Version information */ extern int ttrow; /* Current cursor row */ extern int use_metakey; /* Do meta characters? */ /* * Non-int internal functions. P?() is used to conditionally indicate * ANSI-style prototype arguments for compilers (i.e. Lattice) that * support them. */ #ifdef SUPPORT_ANSI #define P1(a) a #define P2(a,b) a,b #define P3(a,b,c) a,b,c #else #define P1(a) #define P2(a,b) #define P3(a,b,c) #endif /* VOID panic(P1(char *)); */ VOID setttysize(); /* VOID ttclose(); */ /* VOID ttflush(); */ VOID ttnflush(P1(int)); /* VOID ttputc(P1(unsigned char)); */ static VOID cleanup(); static VOID firstwin(); #ifndef KANJI /* Dec.19,1992 by H.Ohkubo */ static VOID qkey(P1(KCHAR)); #endif #ifdef DO_MENU static VOID qmenu(P1(USHORT)); #endif #ifdef MOUSE static VOID qmouse(P3(SHORT, SHORT, USHORT)); extern int allow_mouse_event; #endif static VOID ttreopen(P1(int)) ; static VOID setmaxima() ; static struct Screen *wbscreen(); /* * Intuition window and menu variables. MG gets used a lot, because it * gets reconfigured on the fly for the amiga-set-font and toggle-border * operations. */ #define WINDOWGADGETS (WINDOWDRAG | WINDOWDEPTH | WINDOWCLOSE) #define WINDOWFLAGS (WINDOWGADGETS | ACTIVATE) struct NewWindow MG = { 0, 0, /* start position */ 0, 0, /* width, height (set by ttopen)*/ 0, 1, /* detail pen, block pen */ #ifdef DO_MENU MENUPICK | /* If menu is used */ #endif #ifdef MOUSE MOUSEBUTTONS | /* If mouse is used */ #endif INTUITICKS | #ifndef KANJI /* Dec.19,1992 by H.Ohkubo */ RAWKEY | #endif CLOSEWINDOW | NEWSIZE, /* IDCMP flags */ 0, /* window flags (set by ttopen) */ NULL, /* pointer to first user gadget */ NULL, /* pointer to user checkmark */ NULL, /* title (filled in later) */ NULL, /* pointer to screen (none) */ NULL, /* pointer to superbitmap */ 220,40, /* minimum size (small!) */ 0, 0, /* maximum size (set by ttopen) */ WBENCHSCREEN /* screen in which to open */ }; static short borderless = FALSE; /* Flag for borderless window */ static short toggle_zooms = TRUE; /* Does toggling border zoom? */ static int last_top, last_left, last_height, last_width; struct Window *EmW = NULL; /* Our window */ struct Screen *EmS = NULL; /* Our screen (usually WB) */ short toggling = FALSE; /* Prevent menu wiping */ #ifndef V11 struct Screen WBInfo; /* Info about the WB screen */ #endif struct TextFont *EmFont = NULL; /* Our font (usually TOPAZ_xx) */ #ifdef DO_MENU static struct Menu *EmacsMenu = NULL; /* Our menu */ #endif static ULONG class; /* Intuition event */ static USHORT code, /* information */ qualifier; static APTR address; static SHORT x, y; static LONG intuitionMsgBit; /* Signal bit */ #define INTUITION_MESSAGE ((LONG) (1L << intuitionMsgBit)) /* * * * * * * * * * * * * console I/O * * * * * * * * * * * * * * * * */ #define CSI 0x9b /* Command Sequence Introducer */ #define NOBUF 512 /* About 1/4 screen */ #define NIBUF 256 /* Input buffer */ static KCHAR ibuf[NIBUF]; /* keyboard input buffer */ static int ibufo, nibuf; /* head, # of bytes in ibuf */ #ifndef PROMPTWAIT #define PROMPTWAIT 20 /* ticks to wait before timeout */ #endif static LONG tickcount; /* # intuiticks since last char */ #ifdef REXX /* Dec.20,1992 Add by H.Ohkubo */ extern struct MsgPort *rexxport; #define REXXPORT_MESSAGE (1L<mp_SigBit) #endif #ifdef KANJI /* Dec.19,1992 by H.Ohkubo */ static struct MsgPort *conReadPort = NULL; /* I/O ports */ static struct IOStdReq *conReadMsg = NULL; /* I/O messages */ #define CONREAD_MESSAGE (1L<mp_SigBit) #endif static struct MsgPort *conWritePort = NULL; /* I/O ports */ static struct IOStdReq *conWriteMsg = NULL; /* I/O messages */ #ifndef KANJI /* Dec.19,1992 by H.Ohkubo / fixed by amura */ struct Device *ConsoleDevice; /* used by RawKeyConvert*/ #endif static unsigned char outbuf[NOBUF+7]; /* output buffer */ static unsigned char *obuf; /* first output char */ int nobuf; /* # of bytes in above */ int nrow; /* Terminal size, rows. */ int ncol; /* Terminal size, cols. */ #ifdef KANJI /* Dec.19,1992 by H.Ohkubo */ #define qkey(k) {if (nibuf < NIBUF) ibuf[(ibufo + nibuf++)%NIBUF] = (KCHAR)(k);} #endif /* * * * * * * * * functions to open/reopen the window * * * * * * * * * */ /* * Open up the virtual terminal MG communicates with. Set up the window, * console, and menu strip. */ ttopen() { #ifdef MANX Enable_Abort = 0; /* Disable ^C */ #endif /* firstwin() is only called the very first time we open the window */ if (toggling == FALSE) firstwin(); /* Set the window size, set the flags and title, and open it */ setmaxima(); MG.Flags = WINDOWFLAGS; MG.Flags |= borderless ? BORDERLESS : WINDOWSIZING; MG.Title = (UBYTE *) &version[0]; if ((EmW = OpenWindow(&MG)) == NULL) cleanup(); SetFont(EmW->RPort, EmFont); /* Once the window is created, get the Intuition signal bit, set up * the menu, and tell the virtual terminal how big it is. */ setttysize(); intuitionMsgBit = EmW->UserPort->mp_SigBit; #ifdef DO_MENU if (toggling == FALSE) EmacsMenu = InitEmacsMenu(EmW); if (EmacsMenu == NULL) cleanup(); SetMenuStrip(EmW, EmacsMenu); #endif /* Attach a console device (purely for output now) to our window */ if ((conWritePort = CreatePort("Emacs.con.write", 0L)) == NULL) cleanup(); if ((conWriteMsg = CreateStdIO(conWritePort)) == NULL) cleanup(); #ifdef KANJI /* Dec.19,1992 by H.Ohkubo */ if ((conReadPort = CreatePort("Emacs.con.read", 0L)) == NULL) cleanup(); if ((conReadMsg = CreateStdIO(conReadPort)) == NULL) cleanup(); #endif #ifdef KANJI /* Dec.19,1992 by H.Ohkubo */ if (OpenConsole(conWriteMsg,conReadMsg,EmW) != 0) #else /* Original */ if (OpenConsole(conWriteMsg,NULL,EmW) != 0) #endif cleanup(); #ifndef KANJI /* Dec.19,1992 by H.Ohkubo */ ConsoleDevice = conWriteMsg->io_Device; #endif nibuf = ibufo = 0; return (0); } /* * Set up the initial state of the window. Opens up libraries, decides how * big the initial window should be, and whether it should be borderless. */ static VOID firstwin() { /* Get our screen and font, then figure out if we can go borderless */ if ((EmS = wbscreen()) == NULL) cleanup(); EmFont = OpenDiskFont(EmS->Font); if ((EmS->Width >= ((INIT_COLS * EmFont->tf_XSize) + LR_BORDER)) && (EmS->Height >= ((INIT_ROWS * EmFont->tf_YSize) + TB_BORDER))) borderless = FALSE; /* Set the size of the initial window and fake the last one */ last_width = MG.Width = EmS->Width; last_height = MG.Height = EmS->Height; last_left = MG.LeftEdge = 0; last_top = MG.TopEdge = 0; bcopy(outbuf,"\2330 p", 4); /* preload cursor off sequence */ obuf = outbuf + 4; } /* * Make sure the window isn't bigger than NROW * NCOL, while accounting * for borders & such. Since the window might not be at its largest right * now, deadstop both the current width and the maxwidth. */ static VOID setmaxima() { register int maxw, maxh; MG.MaxWidth = EmS->Width; MG.MaxHeight = EmS->Height; maxw = NCOL * EmFont->tf_XSize + (borderless ? 0 : LR_BORDER); maxh = NROW * EmFont->tf_YSize + (borderless ? TOP_OFFSET : TB_BORDER); if (MG.MaxWidth > maxw) MG.MaxWidth = maxw; if (MG.Width > maxw) MG.Width = maxw; if (MG.MaxHeight > maxh) MG.MaxHeight = maxh; if (MG.Height > maxh) MG.Height = maxh; } /* Return a pointer the workbench screen, using GetScreenData() to do * things like a good citizen. Left the V11 code in as a reminder * that what works is not always the _best_ way to do things. * Thanks to Tom Rokicki for reminding me (mpk) this had to be done. */ static struct Screen *wbscreen() { #ifndef V11 return GetScreenData(&WBInfo, (ULONG) sizeof(WBInfo), WBENCHSCREEN, NULL) ? &WBInfo : ((struct Screen *)NULL); #else register struct Screen *s; extern struct IntuitionBase *IntuitionBase;/* Dec.20,1992 by H.Ohkubo */ Forbid(); for (s = IntuitionBase->FirstScreen; s ; s = s->NextScreen) if ((s->Flags & SCREENTYPE) == WBENCHSCREEN) break; Permit(); return (s); #endif } /* * Hide the window and open it up again. If resize is TRUE, they're * being called as part of a resize operation, so assume that the * NewWindow structure is set correctly. Otherwise, store the current * window size and position in the NewWindow structure. * * These two functions are split so we can do things like ttreopen() and * tticon() cleanly. */ VOID tthide(resize) int resize; { toggling = TRUE; if (resize == FALSE) { /* if we're resizing, */ MG.LeftEdge = EmW->LeftEdge; /* use current window size */ MG.TopEdge = EmW->TopEdge; MG.Width = EmW->Width; MG.Height = EmW->Height; } ttclose(); /* reset to zero */ } VOID ttshow(resize) int resize; { ttopen(); /* re-open tty window */ ttinit(); /* re-initalize tty */ sgarbf = TRUE; /* screen was trashed */ if (resize == TRUE) nrow = ncol = -1; /* trash screen size */ refresh(); /* and redraw it */ toggling = FALSE; /* Ok, done */ } /* * ttreopen() was split into the two functions above when tticon() * was introduced. */ static VOID ttreopen(resize) int resize; { tthide(resize); ttshow(resize); } /* * * * * * * * * * * * functions to close the window * * * * * * * * */ /* * Close the virtual terminal. If toggling, don't release all * the other resources we've allocated. */ /* VOID */ ttclose() { ttflush(); CloseDevice(conWriteMsg); DeleteStdIO(conWriteMsg); conWriteMsg = NULL; DeletePort(conWritePort); conWritePort = NULL; #ifdef KANJI /* Dec.19,1992 by H.Ohkubo */ if (CheckIO(conReadMsg)) { AbortIO(conReadMsg); WaitIO(conReadMsg); } DeleteStdIO(conReadMsg); conReadMsg = NULL; DeletePort(conReadPort); conReadPort = NULL; #endif #ifdef DO_MENU ClearMenuStrip(EmW); #endif CloseWindow(EmW); if (toggling == FALSE) cleanup(); /* clean up everything */ #ifdef MANX Enable_Abort = 1; #endif } /* * Clean up. Done only when we're really closing up shop */ static VOID cleanup() { if (conWriteMsg) DeleteStdIO(conWriteMsg); if (conWritePort) DeletePort(conWritePort); #ifdef KANJI /* Dec.19,1992 by H.Ohkubo */ if (conReadMsg) { if (CheckIO(conReadMsg)) { AbortIO(conReadMsg); WaitIO(conReadMsg); } DeleteStdIO(conReadMsg); } if (conReadPort) DeletePort(conReadPort); #endif #ifdef DO_MENU if (EmacsMenu) DisposeMenus(EmacsMenu); #endif if (EmFont) CloseFont(EmFont); } /* * * * * * * * functions that diddle the window and reopen it * * * * * */ /* * Toggle between a borderless window and a sizeable window. This lets you * use the whole screen if you want. Bound to "amiga-toggle-border". */ togglewindow(f, n) { if ((borderless = !borderless) == TRUE) {/* *always* save last */ last_top = EmW->TopEdge; /* bordered window size */ last_left = EmW->LeftEdge; last_width = EmW->Width; last_height = EmW->Height; } if (toggle_zooms == FALSE) { /* just use current size */ ttreopen(FALSE); return (TRUE); } /* zooming -- if borderless, go as big as possible. If * bordered, set to last saved value of bordered window */ if (borderless) { MG.LeftEdge = 0; MG.TopEdge = 0; MG.Width = MG.MaxWidth; MG.Height = MG.MaxHeight; } else { MG.LeftEdge = last_left; MG.TopEdge = last_top; MG.Width = last_width; MG.Height = last_height; } ttreopen(TRUE); /* open with new size */ return (TRUE); } /* * Modify the action of "amiga-toggle-border", reporting outcome to user. * Bound to "amiga-zoom-mode". */ togglezooms(f, n) { toggle_zooms = !toggle_zooms; ewprintf("Toggling border %s", toggle_zooms ? "expands window to screen size" : "retains current window size"); return (TRUE); } #ifdef CHANGE_FONT /* * Select a different font for the MG window. This does not work very well with * proportional fonts, so we ask the user to confirm before he uses one. It's * available if you want to be able to use your own disk font (or Topaz 11 * under 1.2) to edit with. */ setfont(f, n) { register int s, size; register struct TextFont *newfont; char fontname[NFILEN], fontpath[NFILEN], fontsize[3]; struct TextAttr ta; /* If negative size, reset to default font */ if ((f & FFARG) && (n <= 0)) { CloseFont(EmFont); /* return old font */ EmFont = OpenDiskFont(EmS->Font); /* screen's default */ ttreopen(FALSE); /* no resize */ ewprintf("Now using default font"); return (TRUE); } if ((s = ereply("Font name: ",fontname, sizeof(fontname))) != TRUE) return (s); /* make name */ strncpy(fontpath,fontname,sizeof(fontpath)); fontpath[sizeof(fontpath)-1] = '\0'; strncat(fontpath,".font",sizeof(fontpath)-strlen(fontpath)-1); /* Get font size */ if (f & FFARG) size = n; else { if ((s = ereply("Font size: ", fontsize, sizeof(fontsize))) != TRUE) return (s); size = atoi(fontsize); } /* Set up text attributes */ ta.ta_Name = (UBYTE *)fontpath; ta.ta_YSize = size; ta.ta_Style = FS_NORMAL; ta.ta_Flags = 0; /* Look for the font */ ewprintf("Looking for %s %d...",fontname,size); if ((newfont = OpenDiskFont(&ta)) == NULL) { ewprintf("Can't find %s %d!",fontname,size); return (FALSE); } /* Found it! Check before using it */ if ((newfont->tf_YSize != size) && ((s = eyesno("Size unavailable - use closest")) != TRUE)) { CloseFont(newfont); return (FALSE); } if ((newfont->tf_Flags & FPF_PROPORTIONAL) && (((s = eyesno("Use proportional font")))!= TRUE)) { CloseFont(newfont); return (FALSE); } /* Get rid of old font and reopen with the new one */ CloseFont(EmFont); EmFont = newfont; ttreopen(FALSE); ewprintf("Now using font %s %d",fontname,EmFont->tf_YSize); return (TRUE); } #endif /* * * * * * * * * * * * * console output functions * * * * * * * * * * * * */ /* * Write a single character to the screen. Buffered for speed, so ttflush() * does all the work. */ /* VOID */ ttputc(c) int c; { obuf[nobuf++] = (unsigned char)c; if (nobuf >= NOBUF) ttflush(); } /* * Flush characters from the output buffer. If the # of characters is * greater than a certain ad-hoc value, turn the cursor off while doing * the write. To avoid extra writes, the output buffer has been preloaded * with the cursor-off sequence. Outbuf is large enough to hold the extra * 7 characters. */ #define MIN_OFF 8 /* VOID */ ttflush() { if (nobuf > 0) { if (nobuf <= MIN_OFF) /* don't turn off for short writes */ ConWrite(conWriteMsg, obuf, nobuf); else { obuf[nobuf++] = '\x9b'; obuf[nobuf++] = ' '; obuf[nobuf++] = 'p'; ConWrite(conWriteMsg, outbuf, nobuf + 4); } nobuf = 0; } } /* * The caller intends to output an escape sequence, but only flush * the buffer if there's not enough room to hold the complete sequence. * This avoids breaking up escape sequences when we turn the cursor * off in ttflush(), at the expense of some extra function calls. */ VOID ttnflush(n) int n; { if ((nobuf + n) > NOBUF) ttflush(); } /* * * * * * * * * * * * * console input functions * * * * * * * * * * * * */ /* Dec.17,1992 Add by H.Ohkubo */ #ifdef KANJI /* 90.02.05 by S.Yoshida */ static int nkey = 0; /* The number of ungetc charactor. */ static int keybuf[4]; /* Ungetc charactors. */ #endif /* KANJI */ /* * Read a character (really a KCHAR, > 8 bits), blocking till a character * is put in the input buffer and can be returned. */ ttgetc() { static handle_kbd(); /* Dec.17,1992 Add by H.Ohkubo */ #ifdef KANJI /* 90.02.05 by S.Yoshida */ if (nkey > 0) { return(keybuf[--nkey]); } /* 91.01.14 by K.Maeda ---remove else */ #endif /* KANJI */ #ifdef AUTOSAVE while (handle_kbd(TRUE)) autosave_handler(); #endif /* AUTOSAVE */ return handle_kbd(FALSE); } /* Dec.17,1992 Add by H.Ohkubo */ #ifdef KANJI /* 90.02.05 by S.Yoshida */ /* * Save pre-readed char to read again. */ ttungetc(c) int c; { keybuf[nkey++] = c; } #endif /* KANJI */ /* * Return TRUE if we've waited for 2 seconds and nothing has happened, * else return false. */ ttwait() { static handle_kbd(); /* Dec.17,1992 Add by H.Ohkubo */ #ifdef KANJI /* 90.02.05 by S.Yoshida */ if (nkey > 0) { return(FALSE); } #endif /* KANJI */ return handle_kbd(TRUE); /* time out after 2 sec */ } /* * Common routine for handling character input, with and without timeout. * Handle events until: * * 1) a character is put in the input buffer * 2) if timeout == TRUE, PROMPTWAIT IntuiTicks have gone by * * If timeout == FALSE, the input character is returned and removed from * the input buffer. * * If timeout == TRUE, returns TRUE if the read timed out, else FALSE. * Leaves any character typed in the input buffer. */ static handle_kbd(timeout) register int timeout; { register struct IntuiMessage *message; /* IDCMP message */ register LONG wakeupmask; /* which signals? */ register int charfound; /* got a character yet? */ static dispatch(),nextkey(); tickcount = 0; /* *always* zero the count */ if (nibuf) /* any chars? return if so */ return timeout ? FALSE : nextkey(); charfound = FALSE; /* nope -- have to wait */ while (!charfound) { #ifdef KANJI /* Dec.19,1992 by H.Ohkubo */ #ifdef REXX /* Dec.20,1992 by H.Ohkubo */ wakeupmask = Wait(INTUITION_MESSAGE | CONREAD_MESSAGE | REXXPORT_MESSAGE); #else /* NO REXX */ wakeupmask = Wait(INTUITION_MESSAGE | CONREAD_MESSAGE); #endif if (wakeupmask & CONREAD_MESSAGE) { register UBYTE *ch; int n; UBYTE *ConRead(); ch = ConRead(conReadPort, &n); if (n > 0) { #ifdef V2 unsigned short q = PeekQualifier(); #endif charfound = TRUE; while (n-- > 0) { #ifdef V2 if (*ch==' ' && (q & IEQUALIFIER_CONTROL)) {qkey((KCHAR)0x00);} #ifdef LAMIGA_META else if (use_metakey&&(q&IEQUALIFIER_LCOMMAND)) { qkey((KCHAR)((*ch&0x7f)|METABIT));} #endif else {qkey((KCHAR)(*ch & 0xff));} ch++; #else /* !V2 */ qkey((KCHAR)(*ch & 0xff)); ch++; #endif /* V2 */ } } } if (wakeupmask & INTUITION_MESSAGE) #else /* Original */ #ifdef REXX /* Dec.20,1992 by H.Ohkubo */ wakeupmask = Wait(INTUITION_MESSAGE|REXXPORT_MESSAGE); #else wakeupmask = Wait(INTUITION_MESSAGE); #endif #endif /* KANJI */ /* Handle Intuiticks specially for speed */ while(message = GetMsg(EmW->UserPort)) if (message->Class == INTUITICKS) { tickcount++; ReplyMsg(message); } else if (dispatch(message) == TRUE) charfound = TRUE; #ifdef REXX /* Dec.20,1992 by H.Ohkubo */ /* Now handle any rexx messages if we need them */ if (wakeupmask & REXXPORT_MESSAGE) { struct key savekey;/* save current keystrokes */ savekey = key; disprexx(rexxport); update(); key = savekey; } #endif /* time out if enough ticks have gone by without * any keyboard input. We do this *after* all the * events in the current list have been dispatched. */ if (timeout && (tickcount > PROMPTWAIT)) break; } /* If called by ttwait(), return FALSE if a character was found. * Else return the next character in the input buffer */ return timeout ? (!charfound) : nextkey(); } /* * Handle the events we handle... The result returned indicates if we've put * a character in the input buffer. */ static dispatch(msg) register struct IntuiMessage *msg; { #ifdef DO_MENU register struct MenuItem *item; #endif register int txheight, txwidth; register struct RastPort *rp; int dx, dy, fgpen, drmode; #ifndef KANJI /* Jan.7,1992 by H.Ohkubo */ static struct InputEvent FakedEvent = { NULL, IECLASS_RAWKEY, 0, 0, 0 }; unsigned char keybuf[64], altbuf[64]; int keylen, altlen, i; #ifndef V11 APTR deadcodes; #endif #endif /* KANJI */ class = msg->Class; /* grab the info before we */ code = msg->Code; /* reply to the message */ qualifier = msg->Qualifier; address = msg->IAddress; x = msg->MouseX; y = msg->MouseY; #ifndef KANJI /* Jan.7,1993 by H.Ohkubo */ #ifndef V11 if (class == RAWKEY) /* get dead key info */ deadcodes = (APTR)address; #endif #endif /* KANJI */ ReplyMsg(msg); /* return it to Intuition */ switch(class) { /* see what the fuss is about */ #ifndef KANJI /* Dec.19,1992 by H.Ohkubo */ case RAWKEY: FakedEvent.ie_Code = code; FakedEvent.ie_Qualifier = qualifier; #ifndef V11 FakedEvent.ie_EventAddress = deadcodes; #endif keylen = (int) RawKeyConvert(&FakedEvent, keybuf, (LONG)sizeof(keybuf), NULL); #ifdef DO_METAKEY /* Special mapping for ALT-ed keys. The intent is to get * around keymaps where the ALT'ed characters map to * things other than (0x80 | (c)). This may not work * for all possible keymaps, but it seems to be ok * for the keymaps distributed with 1.2. */ #ifdef LAMIGA_META if (use_metakey && (qualifier & (IEQUALIFIER_ALT|IEQUALIFIER_LCOMMAND))) { FakedEvent.ie_Qualifier &= ~(IEQUALIFIER_ALT | IEQUALIFIER_LCOMMAND); if (qualifier & IEQUALIFIER_ALT) altlen = (int) RawKeyConvert(&FakedEvent, altbuf, (LONG)sizeof(altbuf), NULL); else { altlen = 1; altbuf[0] = keybuf[0]; } if (altlen >= 1) qkey((KCHAR)(altbuf[0]|METABIT)); for (i = 1; i < altlen ; i++) qkey((KCHAR) altbuf[i]); return (altlen > 0) ? TRUE : FALSE; } #else if (use_metakey && (qualifier & IEQUALIFIER_ALT) { FakedEvent.ie_Qualifier &= ~IEQUALIFIER_ALT; altlen = (int) RawKeyConvert(&FakedEvent, altbuf, (LONG)sizeof(altbuf), NULL); if (altlen == 1) altbuf[0] |= METABIT; for (i = 0; i < altlen ; i++) qkey((KCHAR) altbuf[i]); return (altlen > 0) ? TRUE : FALSE; } #endif /* LAMIGA_META */ #endif /* DO_METAKEY */ if (keybuf[0]==' ' && (qualifier&IEQUALIFIER_CONTROL)) keybuf[0] = '\0'; for (i = 0; i < keylen ; i++) qkey((KCHAR) keybuf[i]); return (keylen > 0) ? TRUE : FALSE; break; #endif /* KANJI */ #ifdef DO_MENU case MENUPICK: if (code == MENUNULL) return (FALSE); while (code != MENUNULL) {/* handle multiple selection */ qmenu(code); item = ItemAddress(EmacsMenu,(LONG) code); code = item->NextSelect; } return (TRUE); /* puts KMENU in event queue */ break; #endif #ifdef MOUSE case MOUSEBUTTONS: /* fake the mouse key */ if (code != SELECTDOWN) /* ignore SELECTUP */ return (FALSE); qmouse(x, y, qualifier); return (TRUE); break; #endif case NEWSIZE: /* Sometimes when you resize the window to make it smaller, * garbage is left at the right and bottom sides of the * window. This code is devoted to (somehow) getting rid * of this garbage. Any suggestions? */ rp = EmW->RPort; fgpen = rp->FgPen; /* save params */ drmode = rp->DrawMode; SetDrMd(rp, (LONG) JAM1); SetAPen(rp, (LONG) EmW->RPort->BgPen); /* Check the bottom of the window */ txheight = EmW->Height - EmW->BorderTop - EmW->BorderBottom; if (dy = (txheight % FontHeight(EmW))) RectFill(rp, (LONG) EmW->BorderLeft, (LONG) EmW->BorderTop + txheight - dy - 1, (LONG) (EmW->Width - 1) - EmW->BorderRight, (LONG) (EmW->Height - 1) - EmW->BorderBottom); /* Check the right side */ txwidth = EmW->Width - EmW->BorderLeft - EmW->BorderRight; if (dx = txwidth % FontWidth(EmW)) RectFill(rp, (LONG) EmW->BorderLeft + txwidth - dx - 1, (LONG) EmW->BorderTop, (LONG) (EmW->Width - 1) - EmW->BorderRight, (LONG) (EmW->Height - 1) - EmW->BorderBottom); SetDrMd(rp, (LONG) drmode); SetAPen(rp, (LONG) fgpen); /* restore colors */ /* Tell the console device to resize itself */ ttputc(CSI); ttputc('t'); ttputc(CSI); ttputc('u'); ttflush(); /* Signal the editor that a new size has occurred. * I may break down and do this asynchronously... */ qkey(KRESIZE); return (TRUE); /* we done (finally) */ break; case CLOSEWINDOW: /* Calling quit() directly is not a guaranteed win. */ quit(FFRAND, 1); return (FALSE); break; default: panic("HandleMsg: unknown event!!!"); break; } return(FALSE); } /* * Return the current size of the virtual terminal in nrow and ncol, * making sure we don't go beyond the size of the internal video array. * Assumes the current font is monospaced. */ VOID setttysize() { nrow = (EmW->Height - TOP_OFFSET - EmW->BorderBottom) / FontHeight(EmW); ncol = (EmW->Width - EmW->BorderLeft - EmW->BorderRight) / FontWidth(EmW); if (nrow < 1) nrow = 1; if (ncol < 1) ncol = 1; } /* * Exit as soon as possible, after displaying the message. */ /* VOID */ panic(s) char *s; { ewprintf(s); /* put message at bottom */ Delay((ULONG) 90); /* wait 1.5 seconds */ ttclose(); /* get rid of window &resources */ exit(10000); /* go 'way */ } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Event buffer management * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* * Return next key in the input buffer, if any available. Returns -1 if not. */ static int nextkey() { register KCHAR k; if (nibuf <= 0) { /* shouldn't happen, but could... */ nibuf = 0; return -1; } else { k = ibuf[ibufo++]; nibuf--; ibufo %= NIBUF; return (int) k; } } /* * Return true if there are some characters available in the input buffer. */ typeahead() { /* Dec.17,1992 by H.Ohkubo */ #ifdef KANJI /* 90.02.05 by S.Yoshida */ if (nkey > 0) { return(TRUE); } #endif /* KANJI */ return (nibuf > 0); } #ifndef KANJI /* Dec.19,1992 by H.Ohkubo */ /* * Add a key to the input queue */ static VOID qkey(k) KCHAR k; { if (nibuf < NIBUF) ibuf[(ibufo + nibuf++) % NIBUF] = k; } #endif #ifdef MOUSE /* * Add a mouse event to the input queue, calculating the row and column * value from the current height and width of the window's font. */ static VOID qmouse(x, y, qual) SHORT x, y; USHORT qual; { register int myqual = MQ_NOQUAL; register int row, col; register WINDOW *wp; if (!allow_mouse_event) return; /* get row, column */ col = (x - EmW->BorderLeft) / FontWidth(EmW); row = (y - TOP_OFFSET) / FontHeight(EmW); /* find out which kind of window was clicked in */ for (wp = wheadp; wp != NULL; wp = wp->w_wndp) if ((row >= wp->w_toprow) && (row <= (wp->w_toprow + wp->w_ntrows))) break; if (wp == NULL) myqual |= MQ_ECHO; else if (row == (wp->w_toprow + wp->w_ntrows)) myqual |= MQ_MODE; else myqual |= MQ_WINDOW; /* figure out qualifiers */ if (qual & IEQUALIFIER_CONTROL) myqual |= MQ_CTRL; if (qual & (IEQUALIFIER_LSHIFT | IEQUALIFIER_RSHIFT)) myqual |= MQ_SHIFT; if (qual & (IEQUALIFIER_LALT | IEQUALIFIER_RALT)) myqual |= MQ_ALT; #ifdef META_LAMIGA if (qual & IEQUALIFIER_LCOMMAND) myqual |= MQ_ALT; #endif /* * Queue up the whole mess. If user didn't click in the echo * line, transmit the x, y values to the mouse function */ qkey(KW___MOUSE + myqual); if (MQ_WHERE(myqual) != MQ_ECHO) { qkey(M_X_ZERO + col); qkey(M_Y_ZERO + row); } } #endif #ifdef DO_MENU /* * Add a menu event to the queue. */ static VOID qmenu(code) USHORT code; { qkey(KMENU); /* menu key sequence */ qkey(((KCHAR) MENUNUM(code)) + MN_OFFSET); qkey(((KCHAR) ITEMNUM(code)) + MN_OFFSET); qkey(((KCHAR) SUBNUM(code)) + MN_OFFSET); } #endif ng-1.5beta1/sys/amiga/ttykbd.c100644 1750 1750 6723 7126003721 15020 0ustar amurausers/* $Id: ttykbd.c,v 1.1.1.1 2000/06/27 01:48:01 amura Exp $ */ /* * Name: MG 2a * Amiga virtual terminal keyboard, default console keymap. * Created: Mic Kaczmarczik (mic@emx.cc.utexas.edu) * Last edit: May 14, 1988 */ /* * $Log: ttykbd.c,v $ * Revision 1.1.1.1 2000/06/27 01:48:01 amura * import to CVS * */ #undef TRUE #undef FALSE #include "config.h" /* Dec. 15, 1992 by H.Ohkubo */ #include "def.h" #include "kbd.h" /* * List of function key names, from KFIRST to KLAST */ #ifdef FKEYS char *keystrings[] = { "Up", "Down", "Left", "Right", "Shift-Up", "Shift-Down", "Shift-Left", "Shift-Right", "Help", "The menu", "The resize gadget", "The mouse", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "Shift-F1", "Shift-F2", "Shift-F3", "Shift-F4", "Shift-F5", "Shift-F6", "Shift-F7", "Shift-F8", "Shift-F9", "Shift-F10", "Mouse", "Ctrl-Mouse", "Shift-Mouse", "Shift-Ctrl-Mouse", "Meta-Mouse", "Meta-Ctrl-Mouse", "Meta-Shift-Mouse", "Meta-Shift-Ctrl-Mouse", "Mode-Mouse", "Ctrl-Mode-Mouse", "Shift-Mode-Mouse", "Shift-Ctrl-Mode-Mouse", "Meta-Mode-Mouse", "Meta-Ctrl-Mode-Mouse", "Meta-Shift-Mode-Mouse", "Meta-Shift-Ctrl-Mode-Mouse", "Echo-Mouse", "Ctrl-Echo-Mouse", "Shift-Echo-Mouse", "Shift-Ctrl-Echo-Mouse", "Meta-Echo-Mouse", "Meta-Ctrl-Echo-Mouse", "Meta-Shift-Echo-Mouse", "Meta-Shift-Ctrl-Echo-Mouse" }; #endif /* * Read in a key, doing whatever low-level mapping of ASCII code to * 11 bit code. This has become a bit easier since keymaps. */ #define CSI 0x9b getkbd() { register int c; #ifdef FKEYS register int n; #endif loop: if ((c = ttgetc()) == CSI) { c = ttgetc(); #ifdef FKEYS if (c == '?') { /* HELP key */ ttgetc(); /* discard '~' */ return (KHELP); } /* Arrow keys */ if (c == 'A') return (KUP); if (c == 'B') return (KDOWN); if (c == 'C') return (KRIGHT); if (c == 'D') return (KLEFT); if (c == 'T') return (KSUP); if (c == 'S') return (KSDOWN); /* Shifted left, right arrow */ if (c == ' ') { c = ttgetc(); if (c == 'A' || c == '@') return ((c == 'A') ? (KSLEFT) : (KSRIGHT)); goto loop; /* try again, sucker */ } /* Function keys */ if (c >= '0' && c <= '9') { n = 0; do { n = 10*n + c - '0'; c = ttgetc(); } while (c>='0' && c<='9'); if (c == '~' && n < 20) return (n < 9) ? (KF1 + n) : (KSF1 + (n - 10)); else goto loop; /* Try again */ } #endif goto loop; /* Try again */ } return (c); } /* * Terminal specific keymap initialization, calling bind() to get * things done. All the keys bound here are done globally. */ /*ARGSUSED*/ VOID #ifdef ADDOPT ttykeymapinit(ngrcfile) char *ngrcfile; #else ttykeymapinit() #endif { #ifndef BUGFIX /* Dec.19,1992 by H.Ohkubo */ #ifdef FKEYS KCHAR c; register KEYMAP **mapp = &map_table[0].p_map; #endif static KCHAR esc_bs[] = { CCHR('['), CCHR('H') }; static KCHAR esc_del[] = { CCHR('['), CCHR('?') }; #define BINDC(k,s) (c = k, bindkey(mapp, s, &c, 1)) #define BINDM(m,s) bindkey(mapp, s, m, (sizeof(m)/sizeof(KCHAR))) /* Swap the backspace and del keys, at least in normal usage. * This loses the help feature of CTRL-H, but we rebind * CTRL-_ to do the same thing. Under FKEYS, the Help key * calls describe-key-briefly. */ BINDC(CCHR('_'), "help-help"); /* CTRL-Backspace */ BINDM(esc_bs, "backward-kill-word"); BINDC(CCHR('H'), "delete-backward-char"); BINDC(CCHR('?'), "delete-char"); BINDM(esc_del, "kill-word"); #endif /* BUGFIX */ } ng-1.5beta1/sys/amiga/ttymenu.c100644 1750 1750 31273 7216206243 15246 0ustar amurausers/* $Id: ttymenu.c,v 2.3 2000/12/14 18:08:35 amura Exp $ */ /* * ttymenu.c * Amiga intuition menu handling routine for Ng 1.x * * Copyright (C) 2000, MURAMATSU Atsushi All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY "MURAMATSU Atsushi" AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ /* * $Log: ttymenu.c,v $ * Revision 2.3 2000/12/14 18:08:35 amura * filename length become flexible * * Revision 2.2 2000/10/11 13:38:59 amura * change wildcard in ASL requester * * Revision 2.1 2000/10/02 14:03:14 amura * rewrite from scratch * */ #include "config.h" #ifdef DO_MENU #include "def.h" #include #include #include #include #include #include #include #define MENU_SUB_ICON " \273" #include "menumap.h" struct Menu * InitEmacsMenu(struct Window *); VOID DisposeMenus(struct Menu *); struct MenuItem *MakeMenuItems(MenuMap *, struct TextAttr *); VOID DisposeMenuItems(struct MenuItem *); int amigamenu pro((int, int)); /* * internal function prototypes * these functions based on menulayout.c included * in "AMIGA DEVELOPER CD 1.2" */ static USHORT MaxLength(struct RastPort *textRPort, struct MenuItem *first_item, USHORT char_size); static VOID adjustItems(struct RastPort *textRPort, struct MenuItem *first_item, USHORT char_size, USHORT height, USHORT level, USHORT left_edge); static VOID adjustMenus(struct Menu *first_menu, struct Window *win); struct Menu * InitEmacsMenu(win) struct Window *win; { int i, num; struct Menu *menu; num = sizeof(MgMenus)/sizeof(MenuMap) - 1; menu = (struct Menu *)AllocMem(num*sizeof(struct Menu), MEMF_PUBLIC|MEMF_CLEAR); if (menu == NULL) return NULL; for (i=0; iWScreen->Font): (struct MenuItem*)MENUNULL; } /* Menu Last mark */ menu[num-1].NextMenu = NULL; adjustMenus(menu, win); return menu; } VOID DisposeMenus(menu) struct Menu *menu; { long num; struct Menu *p; if (menu == NULL) return; for (p=menu,num=0; p!=NULL; p=p->NextMenu,num++) DisposeMenuItems(p->FirstItem); FreeMem(menu, num*sizeof(struct Menu)); } struct MenuItem * MakeMenuItems(em, font) MenuMap *em; struct TextAttr *font; { int i, num; struct IntuiText *texts; struct MenuItem *items; MenuMap *p; /* counting menu items */ for (p=em,num=0; p->type!=MENU_END; p++,num++); texts = (struct IntuiText *)AllocMem(num*sizeof(struct IntuiText), MEMF_PUBLIC|MEMF_CLEAR); if (texts == NULL) return NULL; items = (struct MenuItem *)AllocMem(num*sizeof(struct MenuItem), MEMF_PUBLIC|MEMF_CLEAR); if (items == NULL) { FreeMem(texts, num*sizeof(struct IntuiText)); return NULL; } for (i=0; i=0; i--) DisposeMenuItems(items[i].SubItem); /* Dispose now making Items */ FreeMem(texts, num*sizeof(struct IntuiText)); FreeMem(items, num*sizeof(struct MenuItem)); return NULL; } } else items[i].SubItem = (struct MenuItem*)NULL; items[i].NextItem = &items[i+1]; if (MENU_TYPE(em[i].type) == MENU_LINE) items[i].Flags = ITEMTEXT|ITEMENABLED|HIGHNONE; else items[i].Flags = ITEMTEXT|ITEMENABLED|HIGHCOMP; items[i].ItemFill = &texts[i]; /* Make IntuiText for menu face */ texts[i].FrontPen = 0; texts[i].BackPen = 1; texts[i].DrawMode = JAM2; texts[i].LeftEdge = 0; texts[i].TopEdge = 1; texts[i].IText = (UBYTE*)em[i].face; texts[i].ITextFont = font; } items[num-1].NextItem = NULL; /* Menu Last mark */ return items; } VOID DisposeMenuItems(items) struct MenuItem *items; { long num; struct MenuItem *p; if (items==NULL || items==(struct MenuItem *)MENUNULL) return; /* count menu items */ for (p=items,num=0; p!=NULL; p=p->NextItem,num++) DisposeMenuItems(p->SubItem); FreeMem(items->ItemFill, num*sizeof(struct IntuiText)); FreeMem(items, num*sizeof(struct MenuItem) ); } /* Steps thru each item to determine the maximum width of the strip */ static USHORT MaxLength(struct RastPort *textRPort, struct MenuItem *first_item, USHORT char_size) { USHORT maxLength; USHORT total_textlen; struct MenuItem *cur_item; struct IntuiText *itext; USHORT extra_width; USHORT maxCommCharWidth; USHORT commCharWidth; #ifdef notdef extra_width = char_size; /* used as padding for each item. */ #endif /* * Find the maximum length of a command character, if any. * If found, it will be added to the extra_width field. */ maxCommCharWidth = 0; for (cur_item=first_item; cur_item!=NULL; cur_item=cur_item->NextItem) { if (cur_item->Flags & COMMSEQ) { commCharWidth = TextLength(textRPort,&(cur_item->Command),1); if (commCharWidth > maxCommCharWidth) maxCommCharWidth = commCharWidth; } } /* * if we found a command sequence, add it to the extra required space. * Add space for the Amiga key glyph plus space for the command * character. * * Note this only works for HIRES screens, for LORES, use LOWCOMMWIDTH. */ if (maxCommCharWidth > 0) extra_width += maxCommCharWidth + COMMWIDTH; /* * Find the maximum length of the menu items, given the extra width * calculated above. */ maxLength = 0; for (cur_item=first_item; cur_item!=NULL; cur_item=cur_item->NextItem) { itext = (struct IntuiText *)cur_item->ItemFill; total_textlen = extra_width + itext->LeftEdge + TextLength(textRPort, itext->IText, strlen(itext->IText)); /* returns the greater of the two */ if (total_textlen > maxLength) maxLength = total_textlen; } return maxLength; } /* Adjust the MenuItems and SubItems */ static VOID adjustItems(struct RastPort *textRPort, struct MenuItem *first_item, USHORT char_size, USHORT height, USHORT level, USHORT left_edge) { register USHORT item_num; struct MenuItem *cur_item; USHORT strip_width, subitem_edge; if (first_item==NULL || first_item==(struct MenuItem *)MENUNULL) return; /* The width of this strip is the maximum length of its members. */ strip_width = MaxLength(textRPort, first_item, char_size); /* Position the items. */ for (cur_item=first_item,item_num=0; cur_item!=NULL; cur_item=cur_item->NextItem,item_num++) { cur_item->TopEdge = (item_num * height) - level; cur_item->LeftEdge = left_edge; cur_item->Width = strip_width - left_edge; cur_item->Height = height; /* place the sub_item 3/4 of the way over on the item. */ subitem_edge = strip_width - (strip_width >> 2); /* subitem_edge = strip_width >> 2; */ adjustItems(textRPort, cur_item->SubItem, char_size, height, 1, subitem_edge); } } /* * The following routines adjust an entire menu system to conform to * the specified fonts' width and height. Allows for Proportional Fonts. * This is necessary for a clean look regardless of what the users * preference in Fonts may be. Using these routines, you don't need to * specify TopEdge, LeftEdge, Width or Height in the MenuItem structures. * * NOTE that this routine does not work for menus with images, but assumes * that all menu items are rendered with IntuiText. * * This set of routines does NOT check/correct if the menu runs off * the screen due to large fonts, too many items, lo-res screen. */ VOID adjustMenus(struct Menu *first_menu, struct Window *win) { struct Menu *cur_menu; USHORT start, char_size, height; /* Get the Width of the Font */ char_size = TextLength(win->RPort, "n", 1); /* * To prevent crowding of the Amiga key when using COMMSEQ, * don't allow the items to be less than 8 pixels high. * Also, add an extra pixel for inter-line spacing. */ if (FontHeight(win) > 8) height = 1 + FontHeight(win); else height = 1 + 8; start = 2; /* Set Starting Pixel */ /* Step thru the menu structure and adjust it */ for (cur_menu=first_menu; cur_menu!=NULL; cur_menu=cur_menu->NextMenu) { cur_menu->LeftEdge = start; cur_menu->Width = char_size + TextLength(win->RPort, cur_menu->MenuName, strlen(cur_menu->MenuName)); cur_menu->Height = height; cur_menu->TopEdge = 0; adjustItems(win->RPort, cur_menu->FirstItem, char_size, height, 0, 0); start += cur_menu->Width + char_size; } } #ifdef ASL #include #include #define ASL_OPEN 1 #define ASL_INSERT 2 #define ASL_WRITE 3 struct Library *AslBase; static int alsmenu(dir, mode, buff) char *dir; char *buff; { struct FileRequester *fr; char *text_OK, *title; ULONG asl_flag; if (AslBase = OpenLibrary("asl.library", 0L)) { asl_flag = FILF_PATGAD; buff[0] = '\0'; switch (mode) { case ASL_OPEN: text_OK = "Open"; title = "Select File to Open"; break; case ASL_INSERT: text_OK = "Insert"; title = "Select File to Insert"; break; case ASL_WRITE: text_OK = "Save"; title = "Select File to Save to"; asl_flag |= FILF_SAVE; break; default: text_OK = "OK"; title = "Select File"; } if (dir == NULL) dir = ""; if (fr = AllocAslRequestTags(ASL_FileRequest, ASL_Hail, (ULONG)title, ASL_Dir, (ULONG)dir, ASL_Pattern, "~(#?'~)", ASL_OKText, (ULONG)text_OK, ASL_CancelText, (ULONG)"Cancel", ASL_FuncFlags, asl_flag, TAG_DONE )) { if (AslRequest(fr, NULL)) { strncpy(buff, fr->rf_Dir, NFILEN); buff[NFILEN-1] = '\0'; if (!AddPart(buff, fr->rf_File, NFILEN)) buff[0] = '\0'; } FreeAslRequest(fr); } CloseLibrary(AslBase); return TRUE; } return FALSE; } int aslopen(f, c) { char fname[NFILEN]; alsmenu(curbp->b_cwd, ASL_OPEN, fname); eargset(fname); return filevisit(f, c); } int aslinsert(f, c) { char fname[NFILEN]; alsmenu(curbp->b_cwd, ASL_INSERT, fname); eargset(fname); return fileinsert(f, c); } int aslwrite(f, c) { char fname[NFILEN]; alsmenu(curbp->b_cwd, ASL_WRITE, fname); eargset(fname); return filewrite(f, c); } #endif /* ASL */ int amigamenu(f, c) int f, c; { MenuMap *em; int menuNum,itemNum,subNum; menuNum = getkbd() - MN_OFFSET; itemNum = getkbd() - MN_OFFSET; subNum = getkbd() - MN_OFFSET; if (menuNum == NOITEM) return TRUE; em = MgMenus; switch (MENU_TYPE(em[menuNum].type)) { case MENU_LINE: return TRUE; case MENU_FUNC: return ((int (*)())em[menuNum].func)(f, c); case MENU_SUB: if (itemNum == NOITEM) return TRUE; em = (MenuMap*)(em[menuNum].func); switch (MENU_TYPE(em[itemNum].type)) { case MENU_LINE: return TRUE; case MENU_FUNC: return ((int (*)())em[itemNum].func)(f, c); case MENU_SUB: if (subNum == NOITEM) return TRUE; em = (MenuMap*)(em[itemNum].func); switch (MENU_TYPE(em[subNum].type)) { case MENU_LINE: return TRUE; case MENU_FUNC: return ((int (*)())em[subNum].func)(f, c); } } } ewprintf("BUGS in amiga menu execute"); return FALSE; } #endif /* DO_MENU */ ng-1.5beta1/sys/amiga/ttymouse.c100644 1750 1750 13433 7630447766 15451 0ustar amurausers/* $Id: ttymouse.c,v 1.1.1.1.4.1 2003/03/02 18:39:50 amura Exp $ */ /* * Name: MG 2a * Commodore Amiga mouse handling * Created: Distant past * Last edit: 28-Nov-87 mic@emx.cc.utexas.edu */ /* * $Log: ttymouse.c,v $ * Revision 1.1.1.1.4.1 2003/03/02 18:39:50 amura * change curwp to curbp * * Revision 1.1.1.1 2000/06/27 01:48:01 amura * import to CVS * */ #include #include #undef TRUE #undef FALSE #include "config.h" /* Dec.19,1992 Add by H.Ohkubo */ #include "def.h" #ifndef NO_MACRO #include "macro.h" #endif extern int forwline pro((int,int)); extern int forwchar pro((int,int)); extern int setmark pro((int,int)); extern int isetmark pro((void)); /* stuff for go-to-window-and-do-it functions */ extern int reposition pro((int,int)); extern int delfword pro((int,int)); extern int killline pro((int,int)); extern int forwdel pro((int,int)); extern int justone pro((int,int)); extern int killregion pro((int,int)); extern int yank pro((int,int)); extern int forwpage pro((int,int)); extern int backpage pro((int,int)); extern int splitwind pro((int,int)); extern int delwind pro((int,int)); extern int gotobob pro((int,int)); extern int gotoeob pro((int,int)); extern int enlargewind pro((int,int)); extern int shrinkwind pro((int,int)); /* * Handle the mouse click that's been passed by ttgetc() and position * dot where the user pointed at. If this is the same position * where the user pointed the last time, set the mark, whether or * not this is a true double-click. This isn't a true double-click, * but it does most of what we want. */ static USHORT oldrow = HUGE, oldcol = HUGE; /* last mouse click */ static USHORT newrow, newcol; /* next mouse click */ static dottomouse(); amigamouse(f, n) { if (!dottomouse()) /* sets newrow, newcol */ return (FALSE); if ((newrow == oldrow) && (newcol == oldcol)) setmark(FFRAND, 1); /* double-click */ oldrow = newrow; /* save state */ oldcol = newcol; return (TRUE); } /* * Recenter on selected line */ mreposition(f, n) { if (!dottomouse()) return (FALSE); return (reposition(f, n)); } /* * Delete word after selected char */ mdelfword(f, n) { if (!dottomouse()) return (FALSE); return (delfword(f, n)); } /* * Move to selection, kill line */ mkillline(f, n) { if (!dottomouse()) return (FALSE); return (killline(f, n)); } /* * Move to selection, kill word */ mforwdel(f, n) { if (!dottomouse()) return (FALSE); return (forwdel(f, n)); } /* * Move to selection, kill line */ mdelwhite(f, n) { if (!dottomouse()) return (FALSE); return (justone(f, n)); } /* * Set mark, move to selection, kill region. */ mkillregion(f, n) { register struct LINE *p_old; register short o_old; p_old = curbp->b_markp; /* Save old mark */ o_old = curbp->b_marko; isetmark(); /* and set current one */ if (!dottomouse()) { curbp->b_markp = p_old; /* Oops - put mark back */ curbp->b_marko = o_old; return (FALSE); } return (killregion(f, n)); } /* * Move to selection, yank kill buffer */ myank(f, n) { if (!dottomouse()) return (FALSE); return (yank(f, n)); } /* * Select window pointed to by mouse, then scroll down */ mforwpage(f, n) { if (!dottomouse()) return (FALSE); return (forwpage(f, n)); } /* * Select buffer, scroll page down */ mbackpage(f, n) { if (!dottomouse()) return (FALSE); return (backpage(f, n)); } /* * Select the window, split it. */ msplitwind(f, n) { if (!dottomouse()) return (FALSE); return (splitwind(f, n)); } /* * Select the buffer, delete it. */ mdelwind(f, n) { if (!dottomouse()) return (FALSE); return (delwind(f, n)); } /* * Select window, goto beginning of buffer */ mgotobob(f, n) { if (!dottomouse()) return (FALSE); return (gotobob(f, n)); } /* * Select window, go to end of buffer */ mgotoeob(f, n) { if (!dottomouse()) return (FALSE); return (gotoeob(f, n)); } /* * Select window, enlarge it. */ menlargewind(f, n) { if (!dottomouse()) return (FALSE); return (enlargewind(f, n)); } /* * Select window, shrink it. */ mshrinkwind(f, n) { if (!dottomouse()) return (FALSE); return (shrinkwind(f, n)); } /* * Utility routine to move dot to where the user clicked. If in * mode line, chooses that buffer as the one to work on. */ static dottomouse() { register WINDOW *wp; register int dot; register int col; register int c; int getkey pro((int)); #ifndef NO_MACRO if (inmacro) return FALSE; /* can't record mouse clicks */ #endif /* read the next 2 characters to get the col, row info, using * getkey() to record them (or re-read them if in a macro). */ newcol = getkey(FALSE) - M_X_ZERO; newrow = getkey(FALSE) - M_Y_ZERO; #ifndef NO_MACRO if (macrodef) { /* menu picks can't be practically recorded */ ewprintf("Can't record mouse clicks"); return (FALSE); } #endif /* find out which window was clicked in */ for (wp = wheadp; wp != NULL; wp = wp->w_wndp) if ((newrow >= wp->w_toprow) && (newrow <= (wp->w_toprow + wp->w_ntrows))) break; if (wp == NULL) /* echo line */ return (ABORT); else if (newrow == wp->w_toprow + wp->w_ntrows) {/* mode line */ curwp = wp; /* just change buffer */ curbp = wp->w_bufp; } else { /* move to selected window, move dot to top left */ curwp = wp; curbp = wp->w_bufp; curwp->w_dotp = wp->w_linep; curwp->w_doto = 0; /* go forward the correct # of lines */ forwline(FFRAND, newrow - curwp->w_toprow); /* go forward the correct # of characters */ /* need to count them out because of tabs */ col = dot = 0; while ((col < newcol) && (dot < llength(curwp->w_dotp))) { c = lgetc(curwp->w_dotp, dot++); if (c == CCHR('I')) col |= 0x07; else if (ISCTRL(c) != FALSE) ++col; ++col; } if (col > newcol) dot--; /* back up to tab/ctrl char */ forwchar(FFRAND, dot); } return (TRUE); } ng-1.5beta1/sys/amiga/varargs.h100644 1750 1750 1166 7126003721 15165 0ustar amurausers/* $Id: varargs.h,v 1.1.1.1 2000/06/27 01:48:01 amura Exp $ */ /* * Varargs, for use on AmigaDOS with the Lattice C compiler, * or (maybe?) the Manx compiler with 32-bit ints. * Blatantly lifted from 4.2BSD. */ /* * $Log: varargs.h,v $ * Revision 1.1.1.1 2000/06/27 01:48:01 amura * import to CVS * */ #ifdef __STDARG_H /* Dec. 15, 1992 H.Ohkubo */ #undef va_start #undef va_end #undef va_arg #else typedef char *va_list; #endif /* __STDARG_H */ #define va_dcl int va_alist; #define va_start(pv) pv = (char *) &va_alist #define va_end(pv) /* Naught to do... */ #define va_arg(pv, t) ((t *) (pv += sizeof(t)))[-1] ng-1.5beta1/sys/amiga/zz_pointer.c100644 1750 1750 3700 7126003721 15712 0ustar amurausers/* $Id: zz_pointer.c,v 1.1.1.1 2000/06/27 01:48:01 amura Exp $ */ /************************************** * ZZ_POINTER.C 08/05/90 * Written by Timm Martin * This source code is public domain. ***************************************/ /* * $Log: zz_pointer.c,v $ * Revision 1.1.1.1 2000/06/27 01:48:01 amura * import to CVS * */ #ifndef AMIGA_STDIO #include #include #ifndef SAS6 # ifndef __GNUC__ # ifndef _DCC # include # endif # endif #endif #include "zz_pointer.h" /********************** * POINTER IMAGE DATA ***********************/ #define POINTER_DATA 54 #define POINTER_SIZE (long)(POINTER_DATA*2) USHORT zz_pointer_data[POINTER_DATA] = { 0x0000, 0x0000, 0x0000, 0x0FE0, 0x0F60, 0x1090, 0x1FF0, 0x6008, 0x3FF0, 0x4008, 0x7FF8, 0x8F04, 0x7FFC, 0x8202, 0x7FFC, 0x8402, 0x3FFE, 0x4F01, 0x7FFE, 0x8001, 0x7FFE, 0x80F1, 0x3FFC, 0x4022, 0x7FFE, 0x8041, 0x7FFE, 0x80F1, 0x3FFE, 0x4001, 0x1FFC, 0x2002, 0x07F8, 0x1804, 0x00F0, 0x0708, 0x0780, 0x0870, 0x0FE0, 0x1010, 0x07C0, 0x0820, 0x0000, 0x0FE0, 0x01C0, 0x0220, 0x03E0, 0x0410, 0x00E0, 0x0310, 0x0000, 0x00E0, 0x0000, 0x0000 }; USHORT *zz_pointer = NULL; /* GLOBAL */ /******************** * ZZ POINTER CLOSE *********************/ /* This procedure frees the CHIP RAM memory used by the ZZ pointer. */ void zz_pointer_close( void ) { if (zz_pointer) { FreeMem( zz_pointer, POINTER_SIZE ); zz_pointer = NULL; } } /******************* * ZZ POINTER OPEN ********************/ /* This function attempts to copy the ZZ pointer image data into CHIP RAM. It returns TRUE or FALSE whether memory was allocated. */ BOOL zz_pointer_open( void ) { /* if could allocate CHIP RAM to hold pointer data */ if (zz_pointer = (USHORT *)AllocMem( POINTER_SIZE, MEMF_CHIP )) CopyMemQuick( zz_pointer_data, zz_pointer, POINTER_SIZE ); return (zz_pointer != NULL ); } #endif /* AMIGA_STDIO */ ng-1.5beta1/sys/amiga/zz_pointer.h100644 1750 1750 1130 7126003721 15712 0ustar amurausers/* $Id: zz_pointer.h,v 1.1.1.1 2000/06/27 01:48:01 amura Exp $ */ /************************************** * ZZ_POINTER.H 08/05/90 * Written by Timm Martin * This source code is public domain. ***************************************/ /* * $Log: zz_pointer.h,v $ * Revision 1.1.1.1 2000/06/27 01:48:01 amura * import to CVS * */ #ifndef ZZ_POINTER_H #define ZZ_POINTER_H extern USHORT *zz_pointer; extern void zz_pointer_close( void ); extern BOOL zz_pointer_open( void ); #define ZZ_POINTER(w) SetPointer(w,zz_pointer,25L,16L,-7L,-11L) #define CLEAR_POINTER(w) ClearPointer(w) #endif ng-1.5beta1/sys/bsd/ 40755 1750 1750 0 7642273645 12761 5ustar amurausersng-1.5beta1/sys/bsd/Makefile100644 1750 1750 7461 7626153752 14524 0ustar amurausers# $Id: Makefile,v 1.2.4.1 2003/02/23 14:17:14 amura Exp $ # Makefile for Mg 2a # # $Log: Makefile,v $ # Revision 1.2.4.1 2003/02/23 14:17:14 amura # move canna.c from sys/default to sys/unix # # Revision 1.2 2000/09/30 15:59:42 amura # add Canna configuration form config.h # # Revision 1.1.1.1 2000/06/27 01:48:02 amura # import to CVS # # Modified for Ng 1.0 by Shigeki Yoshida (shige@csk.CO.JP) 1990.01.29 SYS = bsd # Canna configurations (ex. for NetBSD) #CANNADEF = -DCANNA #CANNALIB = -L/usr/pkg/lib -lcanna #CANNAINC = -I/usr/pkg/include CANNADEF = CANNALIB = CANNAINC = # CDEFS gets defines, and gets passed to lint. CFLAGS gets flags, and doesn't # get passed to lint. # # Now, compile time options are defined in a "config.h". # CDEFS = $(CANNADEF) CFLAGS = -O2 $(CDEFS) $(CANNAINC) LIBS = $(CANNALIB) -ltermcap # If your machine don't have an alloca(), please define ALLOCA. #ALLOCA = alloca.o ALLOCA = CC = cc # Objects which only depend on the "standard" includes OBJS = basic.o dir.o dired.o shell.o version.o window.o \ kinsoku.o jump.o # Those with unique requirements IND = buffer.o complt.o display.o cmode.o echo.o extend.o file.o \ help.o kbd.o keymap.o line.o macro.o main.o match.o modes.o \ paragraph.o random.o region.o regex.o re_search.o search.o \ skg.o kanji.o undo.o word.o # System dependent objects OOBJS = cinfo.o spawn.o ttyio.o tty.o ttykbd.o OBJ = $(OBJS) $(IND) $(OOBJS) fileio.o canna.o $(ALLOCA) OSRCS = cinfo.c fileio.c spawn.c ttyio.c tty.c ttykbd.c canna.c alloca.c SRCS = basic.c cmode.c dir.c dired.c file.c line.c match.c paragraph.c \ random.c region.c search.c shell.c version.c window.c word.c \ buffer.c complt.c display.c echo.c extend.c help.c kbd.c \ keymap.c macro.c main.c modes.c regex.c re_search.c kanji.c \ kinsoku.c skg.c jump.c undo.c OINCS = ttydef.h sysdef.h chrdef.h INCS = config.h def.h REINCS = regex_e.h regex_j.h regex_j.c regex_e.h kanji_.h kanji_.c #PROG = mg PROG = ng $(PROG): $(OBJ) $(CC) $(CFLAGS) -o $(PROG) $(OBJ) $(LIBS) # strip mg once you're satisfied it'll run -- makes it much smaller strip: strip $(PROG) lint: $(SRCS) $(OSRCS) $(INCS) $(OINCS) lint -ahbz $(CDEFS) $(SRCS) $(OSRCS) $(OBJ): $(INCS) $(OINCS) $(OOBJS): $(INCS) $(OINCS) buffer.o: $(INCS) $(OINCS) kbd.h undo.h cmode.o file.o line.o paragraph.o random.o region.o undo.o word.o: \ $(INCS) $(OINCS) undo.h complt.o: $(INCS) $(OINCS) kbd.h complt.h display.o keymap.o modes.o fileio.o: \ $(INCS) $(OINCS) kbd.h echo.o: $(INCS) $(OINCS) key.h macro.h complt.h extend.o help.o: \ $(INCS) $(OINCS) kbd.h macro.h key.h kanji.o: $(INCS) $(OINCS) kinit.h kbd.o: $(INCS) $(OINCS) kbd.h macro.h key.h undo.h macro.o canna.o: \ $(INCS) $(OINCS) macro.h key.h main.o search.o: \ $(INCS) $(OINCS) macro.h match.o: $(INCS) $(OINCS) key.h re_search.o: $(INCS) $(OINCS) $(REINCS) macro.h regex.o: $(INCS) $(OINCS) $(REINCS) skg.o: $(INCS) $(OINCS) macro.h key.h undo.h sysdef.h: sys/$(SYS)/sysdef.h # Update links, if needed. rm -f sysdef.h ln sys/$(SYS)/sysdef.h . ttydef.h: sys/default/ttydef.h rm -f ttydef.h ln sys/default/ttydef.h . chrdef.h: sys/default/chrdef.h rm -f chrdef.h ln sys/default/chrdef.h . fileio.c: sys/$(SYS)/fileio.c rm -f fileio.c ln sys/$(SYS)/fileio.c . spawn.c: sys/$(SYS)/spawn.c rm -f spawn.c ln sys/$(SYS)/spawn.c . tty.c: sys/default/tty.c rm -f tty.c ln sys/default/tty.c . ttyio.c: sys/$(SYS)/ttyio.c rm -f ttyio.c ln sys/$(SYS)/ttyio.c . ttykbd.c: sys/default/ttykbd.c rm -f ttykbd.c ln sys/default/ttykbd.c . cinfo.c: sys/default/cinfo.c rm -f cinfo.c ln sys/default/cinfo.c . canna.c: sys/unix/canna.c rm -f canna.c ln sys/unix/canna.c . alloca.c: sys/default/alloca.c rm -f alloca.c ln sys/default/alloca.c . port: $(SRCS) $(INCS) rm -f port tar cfb port 1 $? clean:; rm -f $(OBJ) $(OSRCS) $(OINCS) $(PROG) ng-1.5beta1/sys/bsd/fileio.c100644 1750 1750 35505 7222417415 14506 0ustar amurausers/* $Id: fileio.c,v 1.4 2000/12/27 16:55:41 amura Exp $ */ /* * bsd (4.2, others?), Sun (3.2, ?) and Ultrix-32 (?) file I/O. */ /* * $Log: fileio.c,v $ * Revision 1.4 2000/12/27 16:55:41 amura * change d_makename() params for conservative reason, and bugfix in dires_() * * Revision 1.3 2000/12/14 18:17:37 amura * filename length become flexible and small bugfix * * Revision 1.2 2000/12/01 09:50:23 amura * fix problems open "/" and sybolic link directory * * Revision 1.1.1.1 2000/06/27 01:48:02 amura * import to CVS * */ /* 90.01.29 Modified for Ng 1.0 by S.Yoshida */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include "def.h" static FILE *ffp; #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__BSDI__) #include #include #else extern char *getenv(), *strncpy(); #endif char *adjustname(); /* * Open a file for reading. */ ffropen(fn) char *fn; { if ((ffp=fopen(fn, "r")) == NULL) return (FIOFNF); return (FIOSUC); } /* * Open a file for writing. * Return TRUE if all is well, and * FALSE on error (cannot create). */ ffwopen(fn) char *fn; { if ((ffp=fopen(fn, "w")) == NULL) { ewprintf("Cannot open file for writing"); return (FIOERR); } return (FIOSUC); } /* * Close a file. * Should look at the status. */ ffclose() { (VOID) fclose(ffp); return (FIOSUC); } /* * Write a buffer to the already * opened file. bp points to the * buffer. Return the status. * Check only at the newline and * end of buffer. */ ffputbuf(bp) BUFFER *bp; { register char *cp; register char *cpend; register LINE *lp; register LINE *lpend; #ifdef KANJI /* 90.01.29 by S.Yoshida */ register int kfio; #endif /* KANJI */ lpend = bp->b_linep; #ifdef KANJI /* 90.01.29 by S.Yoshida */ if (bp->b_kfio == NIL) ksetbufcode(bp); /* Set buffer local KANJI code. */ kfio = bp->b_kfio; #endif /* KANJI */ lp = lforw(lpend); do { cp = <ext(lp)[0]; /* begining of line */ cpend = &cp[llength(lp)]; /* end of line */ while(cp != cpend) { #ifdef KANJI /* 90.01.29 by S.Yoshida */ kputc(*cp, ffp, kfio); #else /* NOT KANJI */ putc(*cp, ffp); #endif /* KANJI */ cp++; /* putc may evalualte arguments more than once */ } #ifdef KANJI /* 90.01.29 by S.Yoshida */ if (kfio == JIS) { kfselectcode(ffp, FALSE); } #endif /* KANJI */ lp = lforw(lp); if(lp == lpend) break; /* no implied newline on last line */ putc('\n', ffp); } while(!ferror(ffp)); if(ferror(ffp)) { ewprintf("Write I/O error"); return FIOERR; } return FIOSUC; } /* * Read a line from a file, and store the bytes * in the supplied buffer. Stop on end of file or end of * line. When FIOEOF is returned, there is a valid line * of data without the normally implied \n. */ ffgetline(buf, nbuf, nbytes) register char *buf; register int nbuf; register int *nbytes; { register int c; register int i; i = 0; while((c = getc(ffp))!=EOF && c!='\n') { buf[i++] = c; if (i >= nbuf) return FIOLONG; } if (c == EOF && ferror(ffp) != FALSE) { ewprintf("File read error"); return FIOERR; } *nbytes = i; return c==EOF ? FIOEOF : FIOSUC; } #ifndef NO_BACKUP /* * Rename the file "fname" into a backup * copy. On Unix the backup has the same name as the * original file, with a "~" on the end; this seems to * be newest of the new-speak. The error handling is * all in "file.c". The "unlink" is perhaps not the * right thing here; I don't care that much as * I don't enable backups myself. */ fbackupfile(fn) char *fn; { register char *nname; if ((nname=alloca((unsigned)(strlen(fn)+1+1))) == NULL) { ewprintf("Can't get %d bytes", strlen(fn) + 1); return (ABORT); } (void) strcpy(nname, fn); (void) strcat(nname, "~"); (void) unlink(nname); /* Ignore errors. */ if (rename(fn, nname) < 0) { free(nname); return (FALSE); } return (TRUE); } #ifdef BUGFIX /* 90.02.14 by S.Yoshida */ #ifndef _SYS_STAT_H_ #include #include #define _SYS_STAT_H_ #endif /* _SYS_STAT_H_ */ /* * Get file mode of a file fn. */ fgetfilemode(fn) char *fn; { struct stat filestat; stat(fn, &filestat); return(filestat.st_mode & 0x0fff); } /* * Set file mode of a file fn to the specified mode. */ fsetfilemode(fn, mode) char *fn; int mode; { chmod(fn, mode); } #endif /* BUGFIX */ #endif #ifdef READONLY /* 91.01.05 by S.Yoshida */ #ifndef _SYS_STAT_H_ #include #include #define _SYS_STAT_H_ #endif /* _SYS_STAT_H_ */ /* * Check whether file is read-only of a file fn. */ fchkreadonly(fn) char *fn; { struct stat filestat; if (stat(fn, &filestat) == 0) { return(!(filestat.st_mode & S_IWRITE)); } else { return FALSE; } } #endif /* READONLY */ /* * The string "fn" is a file name. * Perform any required appending of directory name or case adjustments. * If NO_DIR is not defined, the same file should be refered to even if the * working directory changes. */ #ifdef SYMBLINK #ifndef _SYS_STAT_H_ /* 90.02.15 by S.Yoshida */ #include #include #define _SYS_STAT_H_ #endif /* _SYS_STAT_H_ */ #ifndef MAXSYMLINKS #define MAXSYMLINKS 8 /* maximum symbolic links to follow */ #endif #endif #include #ifndef NO_DIR extern char *wdir; #endif char *adjustname(fn) register char *fn; { register char *cp; static char fnb[NFILEN]; struct passwd *pwent; #ifdef SYMBLINK struct stat statbuf; int i, j; char linkbuf[NFILEN]; #endif switch(*fn) { case '/': cp = fnb; *cp++ = *fn++; break; case '~': fn++; if(*fn == '/' || *fn == '\0') { (VOID) strcpy(fnb, getenv("HOME")); cp = fnb + strlen(fnb); if(*fn) fn++; break; } else { cp = fnb; while(*fn && *fn != '/') *cp++ = *fn++; *cp = '\0'; if((pwent = getpwnam(fnb)) != NULL) { (VOID) strcpy(fnb, pwent->pw_dir); cp = fnb + strlen(fnb); break; } else { fn -= strlen(fnb) + 1; /* can't find ~user, continue to default case */ } } default: #ifndef NO_DIR strcpy(fnb, wdir); cp = fnb + strlen(fnb); break; #else return fn; /* punt */ #endif } if(cp != fnb && cp[-1] != '/') *cp++ = '/'; while(*fn) { switch(*fn) { case '.': switch(fn[1]) { case '\0': *--cp = '\0'; return fnb; case '/': fn += 2; continue; case '.': if(fn[2]=='/' || fn[2] == '\0') { #ifdef SYMBLINK cp[-1] = '\0'; for(j = MAXSYMLINKS; j-- && lstat(fnb, &statbuf) != -1 && (statbuf.st_mode&S_IFMT) == S_IFLNK && (i = readlink(fnb, linkbuf, sizeof linkbuf)) != -1 ;) { if(linkbuf[0] != '/') { --cp; while(cp > fnb && *--cp != '/') {} ++cp; (VOID) strncpy(cp, linkbuf, i); cp += i; } else { (VOID) strncpy(fnb, linkbuf, i); cp = fnb + i; } if(cp[-1]!='/') *cp++ = '\0'; else cp[-1] = '\0'; } cp[-1] = '/'; #endif --cp; while(cp > fnb && *--cp != '/') {} ++cp; if(fn[2]=='\0') { *--cp = '\0'; return fnb; } fn += 3; continue; } break; default: break; } break; case '/': fn++; continue; default: break; } while(*fn && (*cp++ = *fn++) != '/') {} } if((cp-1)!=fnb && cp[-1]=='/') --cp; *cp = '\0'; return fnb; } #ifndef NO_STARTUP #include /* * Find a startup file for the user and return its name. As a service * to other pieces of code that may want to find a startup file (like * the terminal driver in particular), accepts a suffix to be appended * to the startup file name. */ char * #ifdef ADDOPT startupfile(ngrcfile, suffix) char* ngrcfile; #else startupfile(suffix) #endif char *suffix; { register char *file; static char home[NFILEN]; char *getenv(); #ifdef ADDOPT if (ngrcfile == NULL) ngrcfile = getenv("NGRC"); if (ngrcfile != NULL) if (access(ngrcfile, F_OK) == 0) return ngrcfile; #endif if ((file = getenv("HOME")) == NULL) goto notfound; if (strlen(file)+7 >= NFILEN - 1) goto notfound; (VOID) strcpy(home, file); #ifdef KANJI /* 90.02.10 by S.Yoshida */ (VOID) strcat(home, "/.ng"); #else /* NOT KANJI */ (VOID) strcat(home, "/.mg"); #endif /* KANJI */ if (suffix != NULL) { (VOID) strcat(home, "-"); (VOID) strcat(home, suffix); } if (access(home, F_OK ) == 0) return home; notfound: #ifdef STARTUPFILE file = STARTUPFILE; if (suffix != NULL) { (VOID) strcpy(home, file); (VOID) strcat(home, "-"); (VOID) strcat(home, suffix); file = home; } if (access(file, F_OK ) == 0) return file; #endif return NULL; } #endif #ifndef NO_DIRED #include #include "kbd.h" copy(frname, toname) char *frname, *toname; { int pid; char *eargv[3]; int status; /* change for Digital UNIX */ #ifdef BUGFIX /* 91.01.11 by Y.Kaneko */ if((pid = vfork()) == 0) { execl("/bin/cp", "cp", frname, toname, (char *)NULL); #else /* ORIGINAL */ if(pid = vfork()) { if(pid == -1) return -1; eargv[0] = frname; eargv[1] = toname; eargv[2] = NULL; execve("cp", eargv, (char **)NULL); #endif /* BUGFIX */ _exit(1); /* shouldn't happen */ } #ifdef BUGFIX /* 91.01.11 by Y.Kaneko */ if(pid == -1) return -1; #endif /* BUGFIX */ while(wait((int*)&status) != pid) {} return status == 0; } BUFFER *dired_(dirname) char *dirname; { register BUFFER *bp; char line[256]; BUFFER *findbuffer(); FILE *dirpipe; FILE *popen(); if((dirname = adjustname(dirname)) == NULL) { ewprintf("Bad directory name"); return NULL; } if(dirname[strlen(dirname)-1] != '/') (VOID) strcat(dirname, "/"); if((bp = findbuffer(dirname)) == NULL) { ewprintf("Could not create buffer"); return NULL; } if(bclear(bp) != TRUE) return FALSE; #ifdef EXTD_DIR if (bp->b_cwd) free(bp->b_cwd); if ((bp->b_cwd=malloc(strlen(dirname)+1)) != NULL) strcpy(bp->b_cwd, dirname); ensurecwd(); #endif #ifdef BUGFIX /* 91.02.04 by M.Oki */ (VOID) strcpy(line, "/bin/ls -al "); (VOID) strcpy(&line[12], dirname); #else /* ORIGINAL */ (VOID) strcpy(line, "ls -al "); (VOID) strcpy(&line[7], dirname); #endif /* BUGFIX */ if((dirpipe = popen(line, "r")) == NULL) { ewprintf("Problem opening pipe to ls"); return NULL; } line[0] = line[1] = ' '; while(fgets(&line[2], 254, dirpipe) != NULL) { line[strlen(line) - 1] = '\0'; /* remove ^J */ (VOID) addline(bp, line); } if(pclose(dirpipe) == -1) { ewprintf("Problem closing pipe to ls"); return NULL; } bp->b_dotp = lforw(bp->b_linep); /* go to first line */ if (bp->b_fname) free(bp->b_fname); if ((bp->b_fname=malloc(strlen(dirname)+1)) != NULL) (VOID) strcpy(bp->b_fname, dirname); if((bp->b_modes[0] = name_mode("dired")) == NULL) { bp->b_modes[0] = &map_table[0]; ewprintf("Could not find mode dired"); return NULL; } bp->b_nmodes = 0; return bp; } d_makename(lp, fn, buflen) register LINE *lp; register char *fn; { char* cp; int l,l1,len; char c; /* '47' is a magic number and is not correct always */ if ( llength( lp ) <= 47 ) { return ABORT ; } l = llength(lp); if (lgetc(lp, 2) == 'l') { do { while (l > 2 && lgetc(lp, l) != ' ') l--; if (bcmp(lp->l_text + l - 3, " -> ", 4) == 0) break; l--; } while (l > 2); } else { do { while (l > 2 && lgetc(lp, l)!=' ') l--; l1 = l; while (l > 2 && lgetc(lp, l)==' ') l--; while (l > 2 && (c=lgetc(lp, l))!=' ') { if (c!=':' && (c<'0'||c>'9')) { break; } l--; } } while (l > 2 && c != ' '); l = l1; } if (l <= 2) return ABORT; l++; len = llength(lp) - l + 1; if (buflen <= len+strlen(curbp->b_fname)) return ABORT; cp = fn; strcpy(cp, curbp->b_fname); cp += strlen(cp); bcopy(lp->l_text + l, cp, len); cp[len-1] = '\0'; #ifdef SYMBLINK if (lgetc(lp, 2) == 'l') return ffisdir(curbp->b_fname); #endif return lgetc(lp, 2) == 'd'; } #endif #ifndef NO_DIRED /* 91.01.15 by K.Maeda */ #ifndef _SYS_STAT_H_ #include #include #define _SYS_STAT_H_ #endif /* _SYS_STAT_H_ */ /* * Check whether file "dn" is directory. */ ffisdir(dn) char *dn; { struct stat filestat; if (stat(dn, &filestat) == 0) { return ((filestat.st_mode & S_IFMT) == S_IFDIR); } else { return FALSE; } } #endif /* NO_DIRED */ #ifndef NO_FILECOMP /* 90.04.04 by K.Maeda */ #include /* 89.11.20 Original code is for X68K (Human68K). * 90.04.04 Modified for BSD UNIX by S.Yoshida * Find file names starting with name. * Result is stored in *buf, got from malloc(); * Return the number of files found, or * -1 of error occured. */ #define MALLOC_STEP 256 fffiles(name, buf) char *name, **buf; { char pathbuf[128], tmpnam[128]; char *cp, *dirpart, *nampart; DIR *dp; #ifdef BSD4_3 register struct dirent *dirent; #else register struct direct *dirent; #endif int n, len, size, dirpartlen, nampartlen; char *buffer; struct stat st; strcpy(pathbuf, name); dirpart = NULL; for (cp = pathbuf; *cp; cp++) { if (*cp == '/') dirpart = cp; } if (dirpart) { *++dirpart = '\0'; dirpartlen = dirpart-pathbuf; } else { strcpy(pathbuf, "./"); dirpartlen = 0; } nampart = name + dirpartlen; nampartlen = strlen(nampart); #ifndef NEW_COMPLETE /* 90.12.10 Sawayanagi Yosirou */ if ((dp = opendir(pathbuf)) == NULL) return -1; #endif /* NOT NEW_COMPLETE */ buffer = malloc(MALLOC_STEP); if (buffer == NULL) return -1; size = MALLOC_STEP; len = 0; n = 0; #ifdef NEW_COMPLETE /* 90.12.10 Sawayanagi Yosirou */ if ((dp = opendir(pathbuf)) == NULL) { *buf = buffer; buffer[0] = '\0'; return 0; } #endif /* NEW_COMPLETE */ while ((dirent = readdir(dp)) != NULL) { register int l; if (strncmp(nampart, dirent->d_name, nampartlen) != 0) goto nomatch; /* case-sensitive comparison */ strncpy(tmpnam, pathbuf, dirpartlen); strcpy(tmpnam+dirpartlen, dirent->d_name); if (stat(tmpnam, &st) < -1) goto nomatch; if ((st.st_mode & S_IFMT)==S_IFDIR) strcat(tmpnam, "/"); l = strlen(tmpnam)+1; if (l > 3 && tmpnam[l-3] == '.' && tmpnam[l-2] == 'o') goto nomatch; if (l+len >= size) { /* make room for double null */ if ((buffer = realloc(buffer, size += MALLOC_STEP)) == NULL) return -1; } strcpy(buffer+len, tmpnam); len += l; n++; nomatch:; } closedir(dp); *buf = buffer; buffer[len] = '\0'; return n; } #endif #ifdef NEW_COMPLETE /* 90.12.10 Sawayanagi Yosirou */ char * file_name_part (s) char *s; { int i; for (i = strlen (s); i > 0; i--) { if (s[i - 1] == '/') break; } return (s + i); } char * copy_dir_name (d, s) char *d; char *s; { int i; i = file_name_part (s) - s; strncpy (d, s, i); d[i] = '\0'; return (d); } #endif /* NEW_COMPLETE */ ng-1.5beta1/sys/bsd/spawn.c100644 1750 1750 13107 7126003722 14354 0ustar amurausers/* $Id: spawn.c,v 1.1.1.1 2000/06/27 01:48:02 amura Exp $ */ /* * Spawn. New version, which * interracts with the job control stuff * in the 4.X BSD C shell. * Last edit: Wed Aug 27 11:16:07 PDT 1986 * By: rtech!daveb, to use stop for ksh. */ /* * $Log: spawn.c,v $ * Revision 1.1.1.1 2000/06/27 01:48:02 amura * import to CVS * */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include "def.h" #include #include #include char *shellp = NULL; /* Saved "SHELL" name. */ extern struct sgttyb oldtty; /* There really should be a */ extern struct sgttyb newtty; /* nicer way of doing this, so */ extern struct sgttyb oldtchars; /* spawn does not need to know */ extern struct sgttyb newtchars; /* about the insides of the */ extern struct sgttyb oldltchars; /* terminal I/O code. */ extern struct sgttyb newltchars; extern char *getenv(); #ifdef HAVE_GETSID extern int job_control; #endif /* * This code does a one of 2 different * things, depending on what version of the shell * you are using. If you are using the C shell, which * implies that you are using job control, then MicroEMACS * moves the cursor to a nice place and sends itself a * stop signal. If you are using the Bourne shell it runs * a subshell using fork/exec. Bound to "C-C", and used * as a subcommand by "C-Z". * * Daveb -- changed sense of test so that we only spawn if you * are explicitly using /bin/sh. This makes it stop * work with the ksh. */ /*ARGSUSED*/ spawncli(f, n) { register PID_T pid, wpid; register int omask; register VOID (*oqsig)(),(*oisig)(); #ifdef ADDFUNC /* 90.02.14 by S.Yoshida */ #ifdef SIGWINCH /* 90.02.14 by S.Yoshida */ register VOID (*owsig)(); #endif /* SIGWINCH */ #endif /* ADDFUNC */ /* union wait status; */ /* change for Digital UNIX */ int status; #ifdef XKEYS /* 92.03.16 by Gen KUROKI */ ttykeymaptidy(); #endif /* XKEYS */ if (shellp == NULL) { shellp = getenv("SHELL"); if (shellp == NULL) shellp = getenv("shell"); if (shellp == NULL) shellp = "/bin/sh"; /* Safer. */ } ttcolor(CTEXT); ttnowindow(); if (strcmp(shellp, "/bin/csh") == 0) { if (epresf != FALSE) { ttmove(nrow-1, 0); tteeol(); epresf = FALSE; } /* Csh types a "\n" */ ttmove(nrow-2, 0); /* before "Stopped". */ } else { ttmove(nrow-1, 0); if (epresf != FALSE) { tteeol(); epresf = FALSE; } } if (ttcooked() == FALSE) return (FALSE); #ifdef HAVE_GETSID if (job_control) { #else if (strcmp(shellp, "/bin/sh")!=0 || getenv("BASH_VERSION") || getenv("BASH")) { /* C shell, ksh or bash */ #endif omask = sigsetmask(0); (void) kill(0, SIGTSTP); (void) sigsetmask(omask); #ifdef ADDFUNC /* 90.02.14 by S.Yoshida */ #ifdef SIGWINCH /* 90.02.14 by S.Yoshida */ refresh(FFRAND, 0); /* May be resized. */ #endif /* SIGWINCH */ #endif /* ADDFUNC */ } else { /* Bourne shell. */ oqsig = signal(SIGQUIT, SIG_IGN); oisig = signal(SIGINT, SIG_IGN); #ifdef ADDFUNC /* 90.02.14 by S.Yoshida */ #ifdef SIGWINCH /* 90.02.14 by S.Yoshida */ owsig = signal(SIGWINCH, SIG_IGN); #endif /* SIGWINCH */ #endif /* ADDFUNC */ if ((pid=fork()) < 0) { (void) signal(SIGQUIT, oqsig); (void) signal(SIGINT, oisig); #ifdef ADDFUNC /* 90.02.14 by S.Yoshida */ #ifdef SIGWINCH /* 90.02.14 by S.Yoshida */ (void) signal(SIGWINCH, owsig); #endif /* SIGWINCH */ #endif /* ADDFUNC */ ewprintf("Failed to create process"); return (FALSE); } if (pid == 0) { #ifdef EXTD_DIR dirend(); #endif execl(shellp, "sh", "-i", NULL); _exit(0); /* Should do better! */ } while ((wpid=wait((int*)&status))>=0 && wpid!=pid) ; (void) signal(SIGQUIT, oqsig); (void) signal(SIGINT, oisig); #ifdef ADDFUNC /* 90.02.14 by S.Yoshida */ #ifdef SIGWINCH /* 90.02.14 by S.Yoshida */ (void) signal(SIGWINCH, owsig); refresh(FFRAND, 0); /* May be resized. */ #endif /* SIGWINCH */ #endif /* ADDFUNC */ } sgarbf = TRUE; /* Force repaint. */ #ifdef XKEYS /* 92.03.16 by Gen KUROKI */ ttykeypadstart(); #endif /* XKEYS */ return ttraw(); } #ifndef NO_SHELL /* 91.01.10 by K.Maeda */ #include #include /* * Call process in subshell. * Execute COMMAND binding standard input to file INPUT. * NULL as INPUT means standard input should be bound to * /dev/null or whatever equivalent in your OS. * All output during the execution (including standard error output) * should go into a scratch file, whose name call_process() returns. * Return value NULL means error in some stage of the execution. * In that case, scratch file should be deleted. */ char * call_process(command, input) char *command; char *input; { char buf[256]; static char tmpbuf[20]; char *tmp; int ostdin, ostdout, ostderr, in, out, s; #ifndef HAVE_MKSTEMP extern char *mktemp(); #endif strcpy(tmpbuf, "/tmp/ngXXXXXX"); if ((in = open(input ? input : "/dev/null", 0)) < 0) return NULL; #ifndef HAVE_MKSTEMP if ((tmp = mktemp(tmpbuf)) == NULL) { close(in); return NULL; } if ((out = creat(tmp, S_IREAD | S_IWRITE)) < 0) { close(in); return NULL; } #else if ((out = mkstemp(tmpbuf)) < 0) { close(in); return NULL; } tmp = tmpbuf; #endif ostdin = dup(0); ostdout = dup(1); ostderr = dup(2); if (ostdin < 0 || ostdout < 0 || ostderr < 0) { s = -1; goto skip; } dup2(in, 0); dup2(out, 1); dup2(out, 2); strcpy(buf, command); #ifdef EXTD_DIR ensurecwd(); #endif s = system(buf); close(in); close(out); dup2(ostdin, 0); dup2(ostdout, 1); dup2(ostderr, 2); skip: close(ostdin); close(ostdout); close(ostderr); if (s == -1) { unlink(tmp); return NULL; } return tmp; } #endif /* NO_SHELL */ ng-1.5beta1/sys/bsd/sysdef.h100644 1750 1750 5204 7216206446 14515 0ustar amurausers/* $Id: sysdef.h,v 1.3 2000/12/14 18:10:46 amura Exp $ */ /* * BSD unix based systems (sunos, ultrix) */ /* * $Log: sysdef.h,v $ * Revision 1.3 2000/12/14 18:10:46 amura * filename length become flexible * * Revision 1.2 2000/06/27 01:59:42 amura * small bugfix * * Revision 1.1.1.1 2000/06/27 01:48:02 amura * import to CVS * */ #include #include /* 00.04.15 by amura */ #include #define KBLOCK 8192 /* Kill grow. */ #define GOOD 0 /* Good exit status. */ #define SYMBLINK 1 /* Handle symbolic links */ #ifndef NO_SHELL /* 91.01.10 by K.Maeda */ #define CMDLINELENGTH NFILEN /* Maximum length of shell command. */ #endif /* NO_SHELL */ #define BSMAP FALSE /* Bs map feature can use. */ /* (default mode is bsmap off) */ #define MAKEBACKUP TRUE /* Making backup file is on. */ typedef int RSIZE; /* Type for file/region sizes */ typedef short KCHAR; /* Type for internal keystrokes */ #ifdef BSD4_4 #define HAVE_MKSTEMP #define HAVE_GETCWD #define HAVE_FDSET #define HAVE_DIRENT #else #define NO_PID_TYPE #define NO_SIG_TYPE #endif #if 0 #ifdef __FreeBSD__ #if __FreeBSD__ >= 3 # define HAVE_GETSID #endif #else /* NOT __FreeBSD__ */ #ifdef _POSIX_JOB_CONTROL /* This is trick */ # if (0 - _POSIX_JOB_CONTROL - 1) != -1 # define HAVE_GETSID # endif #endif /* _POSIX_JOB_CONTROL */ #endif /* __FreeBSD__ */ #endif #ifdef NO_PID_TYPE # undef PID_T # define PID_T int #else #ifndef PID_T # define PID_T pid_t #endif #endif #ifdef NO_SIG_TYPE # undef SIG_T typedef void (*SIG_T)(); /* If your compiler doesn't have void, rewrite this "int (*SIG_T)()" Cannot use VOID because it's defined later... */ #else #ifndef SIG_T # define SIG_T sig_t #endif #endif #ifdef NO_FDSET # undef FDSET # define FDSET int # define FD_SET(fd,fdsp) ((*fdsp) |= (1<<(fd))) # define FD_ZERO(fdsp) ((*fdsp) = 0) #else #ifndef FDSET # define FDSET fd_set #else #include #endif #endif /* * Macros used by the buffer name making code. * Start at the end of the file name, scan to the left * until BDC1 (or BDC2, if defined) is reached. The buffer * name starts just to the right of that location, and * stops at end of string (or at the next BDC3 character, * if defined). BDC2 and BDC3 are mainly for VMS. */ #define BDC1 '/' /* Buffer names. */ #ifdef CANNA #define SYSINIT canna_init() #define SYSCLEANUP canna_end() #endif #define MALLOCROUND(m) (m+=7,m&=~7) /* round up to 8 byte boundry */ #define fncmp strcmp /* file name comparison */ #define unlinkdir(fn) rmdir(fn) /* unlink directory */ char *getenv(); #define gettermtype() getenv("TERM") /* determine terminal type */ ng-1.5beta1/sys/bsd/ttyio.c100644 1750 1750 20236 7232331536 14402 0ustar amurausers/* $Id: ttyio.c,v 1.2 2001/01/20 15:48:46 amura Exp $ */ /* * Ultrix-32 and Unix terminal I/O. * The functions in this file * negotiate with the operating system for * keyboard characters, and write characters to * the display in a barely buffered fashion. */ /* * $Log: ttyio.c,v $ * Revision 1.2 2001/01/20 15:48:46 amura * very big terminal supported * * Revision 1.1.1.1 2000/06/27 01:48:02 amura * import to CVS * */ /* 90.02.05 Modified for Ng 1.0 by S.Yoshida */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include "def.h" #include #ifdef ADDFUNC /* 90.02.14 by S.Yoshida */ #include /* 90.02.13: For SIGWINCH. */ #endif /* ADDFUNC */ #include /* 00.04.03: amura */ #define NOBUF 512 /* Output buffer size. */ char obuf[NOBUF]; /* Output buffer. */ int nobuf; struct sgttyb oldtty; /* V6/V7 stty data. */ struct sgttyb newtty; struct tchars oldtchars; /* V7 editing. */ struct tchars newtchars; struct ltchars oldltchars; /* 4.2 BSD editing. */ struct ltchars newltchars; #ifdef TIOCGWINSZ struct winsize winsize; /* 4.3 BSD window sizing */ #endif int nrow; /* Terminal size, rows. */ int ncol; /* Terminal size, columns. */ #ifdef ADDFUNC /* 90.02.14 by S.Yoshida */ #ifdef SIGWINCH /* 90.02.13 by S.Yoshida */ VOID ttwinch(); #endif /* SIGWINCH */ #endif /* ADDFUNC */ #ifdef HAVE_GETSID static int ttysavedp = FALSE; /* terminal state saved? */ int job_control; #endif /* * This function gets called once, to set up * the terminal channel. On Ultrix is's tricky, since * we want flow control, but we don't want any characters * stolen to send signals. Use CBREAK mode, and set all * characters but start and stop to 0xFF. */ ttopen() { register char *tv_stype; char *getenv(), *tgetstr(), tcbuf[1024], err_str[72]; #ifndef SUPPORT_ANSI int sprintf(); #endif #ifdef HAVE_GETSID if( !ttysavedp ) { pid_t pid,pgid,sid; pid = getpid(); pgid = getpgrp(); sid = getsid(0); if (pid == pgid && pgid != sid) job_control = TRUE; else job_control = FALSE; ttysavedp = TRUE; } #endif /* HAVE_GETSID */ /* do this the REAL way */ if ((tv_stype = getenv("TERM")) == NULL) { puts("Environment variable TERM not defined!"); exit(1); } if((tgetent(tcbuf, tv_stype)) != 1) { (void) sprintf(err_str, "Unknown terminal type %s!", tv_stype); puts(err_str); exit(1); } if (ttraw() == FALSE) panic("aborting due to terminal initialize failure"); #ifdef ADDFUNC /* 90.02.14 by S.Yoshida */ #ifdef SIGWINCH /* 90.02.13 by S.Yoshida */ (void) signal(SIGWINCH, ttwinch); #endif /* SIGWINCH */ #endif /* ADDFUNC */ } /* * This function sets the terminal to RAW mode, as defined for the current * shell. This is called both by ttopen() above and by spawncli() to * get the current terminal settings and then change them to what * mg expects. Thus, stty changes done while spawncli() is in effect * will be reflected in mg. */ ttraw() { extern short ospeed; if (ioctl(0, TIOCGETP, (char *) &oldtty) < 0) { ewprintf("ttopen can't get sgtty"); return(FALSE); } newtty.sg_ospeed = ospeed = oldtty.sg_ospeed; newtty.sg_ispeed = oldtty.sg_ispeed; newtty.sg_erase = oldtty.sg_erase; newtty.sg_kill = oldtty.sg_kill; newtty.sg_flags = oldtty.sg_flags; newtty.sg_flags &= ~(ECHO|CRMOD); /* Kill echo, CR=>NL. */ #ifdef FLOWCONTROL newtty.sg_flags |= CBREAK; /* Half-cooked mode. */ #else newtty.sg_flags |= RAW|ANYP; /* raw mode for 8 bit path.*/ #endif if (ioctl(0, TIOCSETP, (char *) &newtty) < 0) { ewprintf("ttopen can't set sgtty"); return(FALSE); } if (ioctl(0, TIOCGETC, (char *) &oldtchars) < 0) { ewprintf("ttopen can't get chars"); return(FALSE); } newtchars.t_intrc = 0xFF; /* Interrupt. */ newtchars.t_quitc = 0xFF; /* Quit. */ #if FLOWCONTROL newtchars.t_startc = 0x11; /* ^Q, for terminal. */ newtchars.t_stopc = 0x13; /* ^S, for terminal. */ #else newtchars.t_startc = 0xFF; /* ^Q, for terminal. */ newtchars.t_stopc = 0xFF; /* ^S, for terminal. */ #endif newtchars.t_eofc = 0xFF; newtchars.t_brkc = 0xFF; if (ioctl(0, TIOCSETC, (char *) &newtchars) < 0) { ewprintf("ttraw can't set chars"); return(FALSE); } if (ioctl(0, TIOCGLTC, (char *) &oldltchars) < 0) { panic("ttraw can't get ltchars"); return(FALSE); } newltchars.t_suspc = 0xFF; /* Suspend #1. */ newltchars.t_dsuspc = 0xFF; /* Suspend #2. */ newltchars.t_rprntc = 0xFF; newltchars.t_flushc = 0xFF; /* Output flush. */ newltchars.t_werasc = 0xFF; newltchars.t_lnextc = 0xFF; /* Literal next. */ if (ioctl(0, TIOCSLTC, (char *) &newltchars) < 0) { ewprintf("ttraw can't set ltchars"); return(FALSE); } setttysize() ; return(TRUE); } /* * This function gets called just * before we go back home to the shell. Put all of * the terminal parameters back. * Under UN*X this just calls ttcooked(), but the ttclose() hook is in * because vttidy() in display.c expects it for portability reasons. */ ttclose() { if (ttcooked() == FALSE) panic(""); /* ttcooked() already printf'd */ } /* * This function restores all terminal settings to their default values, * in anticipation of exiting or suspending the editor. */ ttcooked() { ttflush(); if (ioctl(0, TIOCSLTC, (char *) &oldltchars) < 0) { ewprintf("ttclose can't set ltchars"); return(FALSE); } if (ioctl(0, TIOCSETC, (char *) &oldtchars) < 0) { ewprintf("ttclose can't set chars"); return(FALSE); } if (ioctl(0, TIOCSETP, (char *) &oldtty) < 0) { ewprintf("ttclose can't set sgtty"); return(FALSE); } return(TRUE); } /* * Write character to the display. * Characters are buffered up, to make things * a little bit more efficient. */ ttputc(c) int c; { if (nobuf >= NOBUF) ttflush(); obuf[nobuf++] = c; } /* * Flush output. */ ttflush() { if (nobuf != 0) { if (write(1, obuf, nobuf) != nobuf) panic("ttflush write failed"); nobuf = 0; } } #ifdef KANJI /* 90.02.05 by S.Yoshida */ static int nkey = 0; /* The number of ungetc charactor. */ static int keybuf[4]; /* Ungetc charactors. */ #endif /* KANJI */ /* * Read character from terminal. * All 8 bits are returned, so that you can use * a multi-national terminal. */ ttgetc() { char buf[1]; #ifdef KANJI /* 90.02.05 by S.Yoshida */ if (nkey > 0) { return (keybuf[--nkey]); } #endif /* KANJI */ while (read(0, &buf[0], 1) != 1) ; return (buf[0] & 0xFF); } #ifdef KANJI /* 90.02.05 by S.Yoshida */ /* * Save pre-readed char to read again. */ ttungetc(c) int c; { keybuf[nkey++] = c; } #endif /* KANJI */ /* * set the tty size. Functionized for 43BSD. */ setttysize() { #ifdef TIOCGWINSZ if (ioctl(0, TIOCGWINSZ, (char *) &winsize) != -1) { nrow = winsize . ws_row; ncol = winsize . ws_col; } else nrow = 0; if(nrow<=0 || ncol<=0) #endif if ((nrow=tgetnum ("li")) <= 0 || (ncol=tgetnum ("co")) <= 0) { nrow = 24; ncol = 80; } } #ifdef ADDFUNC /* 90.02.14 by S.Yoshida */ #ifdef SIGWINCH /* 90.02.13 by S.Yoshida */ /* * Signal handler when window size has changed. */ VOID ttwinch() { refresh(FFRAND, 0); /* Very easy way... */ #ifdef CANNA canna_width(); #endif /* CANNA */ } #endif /* SIGWINCH */ #endif /* ADDFUNC */ /* * typeahead returns TRUE if there are characters available to be read * in. */ typeahead() { int x; #ifdef KANJI /* 90.02.05 by S.Yoshida */ if (nkey > 0) { return (TRUE); } #endif /* KANJI */ return((ioctl(0, FIONREAD, (char *) &x) < 0) ? 0 : x); } /* * panic - just exit, as quickly as we can. */ panic(s) char *s; { (void) fputs("panic: ", stderr); (void) fputs(s, stderr); (void) fputc('\n', stderr); (void) fflush(stderr); abort(); /* To leave a core image. */ } #ifndef NO_DPROMPT #include /* * A program to return TRUE if we wait for 2 seconds without anything * happening, else return FALSE. Cribbed from mod.sources xmodem. */ int ttwait() { FDSET readfd; struct timeval tmout; #ifdef KANJI /* 90.02.05 by S.Yoshida */ if (nkey > 0) { return (FALSE); } #endif /* KANJI */ #ifdef BUGFIX /* 90.02.07 by S.Yoshida */ tmout.tv_sec = 1; #else /* NOT BUGFIX */ tmout.tv_sec = 2; #endif /* BUGFIX */ tmout.tv_usec = 0; FD_ZERO(&readfd); FD_SET(0, &readfd); if ((select(1, &readfd, (FDSET *)0, (FDSET *)0, &tmout)) == 0) return(TRUE); return(FALSE); } #endif ng-1.5beta1/sys/default/ 40755 1750 1750 0 7642273645 13635 5ustar amurausersng-1.5beta1/sys/default/alloca.c100644 1750 1750 11361 7126003722 15333 0ustar amurausers/* $Id: alloca.c,v 1.1.1.1 2000/06/27 01:48:02 amura Exp $ */ /* alloca -- (mostly) portable public-domain implementation last edit: 86/01/26 D A Gwyn This implementation of the PWB library alloca() function, which is used to allocate space off the run-time stack so that it is automatically reclaimed upon procedure exit, was inspired by discussions with J. Q. Johnson of Cornell. It should work under any C implementation that uses an actual procedure stack (as opposed to a linked list of frames). There are some preprocessor constants that can be defined when compiling for your specific system, for improved efficiency; however, the defaults should be okay. The general concept of this implementation is to keep track of all alloca()-allocated blocks, and reclaim any that are found to be deeper in the stack than the current invocation. This heuristic does not reclaim storage as soon as it becomes invalid, but it will do so eventually. As a special case, alloca(0) reclaims storage without allocating any. It is a good idea to use alloca(0) in your main control loop, etc. to force garbage collection. */ /* * $Log: alloca.c,v $ * Revision 1.1.1.1 2000/06/27 01:48:02 amura * import to CVS * */ #ifndef lint static char SCCSid[] = "@(#)alloca.c 1.1"; /* for the "what" utility */ #endif #ifdef X3J11 typedef void *pointer; /* generic pointer type */ #else typedef char *pointer; /* generic pointer type */ #endif #define NULL 0 /* null pointer constant */ extern void free(); extern pointer malloc(); /* Define STACK_DIRECTION if you know the direction of stack growth for your system; otherwise it will be automatically deduced at run-time. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ #ifndef STACK_DIRECTION #define STACK_DIRECTION 0 /* direction unknown */ #endif #if STACK_DIRECTION != 0 #define STACK_DIR STACK_DIRECTION /* known at compile-time */ #else /* STACK_DIRECTION == 0; need run-time code */ static int stack_dir = 0; /* 1 or -1 once known */ #define STACK_DIR stack_dir static void find_stack_direction( /* void */ ) { static char *addr = NULL; /* address of first `dummy', once known */ auto char dummy; /* to get stack address */ if ( addr == NULL ) { /* initial entry */ addr = &dummy; find_stack_direction(); /* recurse once */ } else /* second entry */ if ( &dummy > addr ) stack_dir = 1; /* stack grew upward */ else stack_dir = -1; /* stack grew downward */ } #endif /* STACK_DIRECTION == 0 */ /* An "alloca header" is used to: (a) chain together all alloca()ed blocks; (b) keep track of stack depth. It is very important that sizeof(header) agree with malloc() alignment chunk size. The following default should work okay. */ #ifndef ALIGN_SIZE #define ALIGN_SIZE sizeof(double) #endif typedef union hdr { char align[ALIGN_SIZE]; /* to force sizeof(header) */ struct { union hdr *next; /* for chaining headers */ char *deep; /* for stack depth measure */ } h; } header; /* alloca( size ) returns a pointer to at least `size' bytes of storage which will be automatically reclaimed upon exit from the procedure that called alloca(). Originally, this space was supposed to be taken from the current stack frame of the caller, but that method cannot be made to work for some implementations of C, for example under Gould's UTX/32. */ pointer alloca( size ) /* returns pointer to storage */ unsigned size; /* # bytes to allocate */ { static header *last = NULL; /* -> last alloca header */ auto char probe; /* probes stack depth: */ register char *depth = &probe; #if STACK_DIRECTION == 0 if ( STACK_DIR == 0 ) /* unknown growth direction */ find_stack_direction(); #endif /* Reclaim garbage, defined as all alloca()ed storage that was allocated from deeper in the stack than currently. */ { register header *hp; /* traverses linked list */ for ( hp = last; hp != NULL; ) if ( STACK_DIR > 0 && hp->h.deep > depth || STACK_DIR < 0 && hp->h.deep < depth ) { register header *np = hp->h.next; free( (pointer)hp ); /* collect garbage */ hp = np; /* -> next header */ } else break; /* rest are not deeper */ last = hp; /* -> last valid storage */ } if ( size == 0 ) return NULL; /* no allocation required */ /* Allocate combined header + user data storage. */ { register pointer new = malloc( sizeof(header) + size ); /* address of header */ if ( new == NULL ) return NULL; /* abort() is traditional */ ((header *)new)->h.next = last; ((header *)new)->h.deep = depth; last = (header *)new; /* User storage begins just after header. */ return (pointer)((char *)new + sizeof(header)); } } ng-1.5beta1/sys/default/README100644 1750 1750 11720 7126003722 14613 0ustar amurausers MG Termcap Terminal Driver The termcap library needs to know where to get the terminal type and termcap capibilities file from. UNIX and Os9/68k users should setenv TERM term-type to their terminal type, and setenv TERMCAP termcap-file if they are using a non-standard termcap file. VMS users should see [.SYS.VMS]AAAREADME.1ST for information on how to define the logical names TERM and ETC to point to the termcap definition file. Users of other operating systems should do the aproprate thing. For an example of a termcap file, UNIX users may look in /etc/termcap, Os9/68k users may look at /dd/sys/termcap (if present), and VMS users should see the file [.SYS.VMS.TERMCAP]TERMCAP. MG requires that certain terminal capabilities exist in the specified termcap entry. The "cm" (cursor motion) capability *must* be available to use MG. (Yes, it is possible to fake cm with some other capibilities, but MG doesn't try.) If your terminal is one that uses control characters in the paramater portion of the "cm" string, the "up" and "bc" capabilites may also be needed. (See your termlib documentation for when this is so.) If the following capabilities are available, they are used. The AL and DL sequences are not totally standard, but having them improves the performance of the editor, since it doesn't have to redraw the screen to delete a line. They should not be used if they need control characters as paramaters. cd -- clear display ce -- clear to end of line al -- insert 1 line dl -- delete 1 line AL -- insert multiple lines (note capitalization) DL -- delete multiple lines (note capitalization) ti -- cursor movement initialization string te -- cursor movement end string The cs capability is not as standard as some of the other capibilities, but is used by MG when available. It is used to define a "scrolling region", which defines a window within the screen where all the action takes place. A newline character at the bottom of this area scrolls the rest of the text in the area up one line, just like the normal screen; a reverse linefeed (sr) at the top of the window moves all the text in the area down a line. MG does not properly handle "cs" if your terminal needs control characters as paramaters, and in this case "cs" should not be defined. If the cs and sr capabilities are available, the termcap driver uses these to make the insert/delete line functions work more smoothly. If only the cs capability is present, it is still used for the delete line function, but not for inserting lines. Use of the cs capability is often desirable, but is not a win on bit-mapped screens such as Sun workstation console windows. This is because it takes longer to scroll the window than to redraw it. If you are using a workstation window, you might consider using a termcap entry that doesn't have the cs capability. The definition of the cs capability is: the first parameter in the sequence defines the first row (origin 0) that is in the scrolling region, and the second argument defines the last row to include in the scrolling region. cs -- set scrolling region (arg1 = top, arg2 = bottom) sr -- reverse index The following capabilities provide for an enhanced (reverse-video or otherwise rendered) mode line. The sg entry should not be present on terminals that do this to characters as they are placed on the screen. Terminals that put a region of the screen in the standout mode should have sg defined as numeric: :sg#0: for terminals that do this on regions but don't take any character positions to do this, (this may be a non-standard interprition of the meaning of sg) and the number of character positions taken by any other terminal. so -- enter standout mode se -- leave standout mode sg -- number of character positions used by standout Terminal-specific initialization file If the MG termcap terminal driver is compiled with XKEYS defined, and the startup file option is enabled as well, MG will look for a terminal-specific initialization file. The name of the terminal initialization file varies between operating systems, but will usually look like .mg-TERM, where TERM represents your terminal type. For example, a terminal initialization file under Unix and VMS for the DEC VT100 terminal (termcap type vt100) would have the name ".mg-vt100". The terminal-specific startup file has the same format as the mg startup file, and is executed immediately after the startup file during mg's startup phase. An example vt100 initialization file follows, which globally binds the key sequences sent by the VT100 terminal (in keypad mode) to the appropriate functions. ----------------------------------CUT HERE----------------------------------- ; ; Small key definition file for VT100 terminals using the termcap ; driver. This only works if XKEYS is defined during compilation. ; (global-set-key "\eOA" 'previous-line) ; up arrow (global-set-key "\eOB" 'next-line) ; down arrow (global-set-key "\eOC" 'forward-char) ; right arrow (global-set-key "\eOD" 'backward-char) ; left arrow ng-1.5beta1/sys/default/chrdef.h100644 1750 1750 4700 7225352413 15323 0ustar amurausers/* $Id: chrdef.h,v 1.2 2001/01/05 14:07:07 amura Exp $ */ /* * sys/default/chardef.h: character set specific #defines for mg 2a * Warning: System specific ones exist */ /* * $Log: chrdef.h,v $ * Revision 1.2 2001/01/05 14:07:07 amura * first implementation of Hojo Kanji support * * Revision 1.1.1.1 2000/06/27 01:48:02 amura * import to CVS * */ /* 90.01.29 Modified for Ng 1.0 by S.Yoshida */ #ifndef CHARMASK /* * casting should be at least as efficent as anding with 0xff, * and won't have the size problems. Override in sysdef.h if no * unsigned char type. */ #define CHARMASK(c) ((unsigned char) (c)) #endif /* * These flags, and the macros below them, * make up a do-it-yourself set of "ctype" macros that * understand the DEC multinational set, and let me ask * a slightly different set of questions. */ #define _W 0x01 /* Word. */ #define _U 0x02 /* Upper case letter. */ #define _L 0x04 /* Lower case letter. */ #define _C 0x08 /* Control. */ #define _P 0x10 /* end of sentence punctuation */ #define _D 0x20 /* is decimal digit */ #ifdef KANJI /* 90.01.29 by S.Yoshida */ #define _K 0x40 /* Kanji 1st/2nd byte. (EUC) */ #endif /* KANJI */ #define ISWORD(c) ((cinfo[CHARMASK(c)]&_W)!=0) #define ISCTRL(c) ((cinfo[CHARMASK(c)]&_C)!=0) #define ISUPPER(c) ((cinfo[CHARMASK(c)]&_U)!=0) #define ISLOWER(c) ((cinfo[CHARMASK(c)]&_L)!=0) #define ISEOSP(c) ((cinfo[CHARMASK(c)]&_P)!=0) #define ISDIGIT(c) ((cinfo[CHARMASK(c)]&_D)!=0) #ifdef KANJI /* 90.01.29 by S.Yoshida */ #define ISKANJI(c) ((cinfo[CHARMASK(c)]&_K)!=0) #endif /* KANJI */ #define TOUPPER(c) ((c)-0x20) #define TOLOWER(c) ((c)+0x20) #define SS2 0x8e #define SS3 0x8f #ifdef HANKANA #define ISHANKANA(c) (CHARMASK(c) == SS2) #endif #ifdef HOJO_KANJI #define ISHOJO(c) (CHARMASK(c) == SS3) #endif /* * generally useful thing for chars */ #define CCHR(x) ((x) ^ 0x40) /* CCHR('?') == DEL */ #ifndef METACH #define METACH CCHR('[') #endif #ifdef XKEYS #define K00 256 #define K01 257 #define K02 258 #define K03 259 #define K04 260 #define K05 261 #define K06 262 #define K07 263 #define K08 264 #define K09 265 #define K0A 266 #define K0B 267 #define K0C 268 #define K0D 269 #define K0E 270 #define K0F 271 #define K10 272 #define K11 273 #define K12 274 #define K13 275 #define K14 276 #define K15 277 #define K16 278 #define K17 279 #define K18 280 #define K19 281 #define K1A 282 #define K1B 283 #define K1C 284 #define K1D 285 #define K1E 286 #define K1F 287 #endif ng-1.5beta1/sys/default/cinfo.c100644 1750 1750 11022 7126003722 15170 0ustar amurausers/* $Id: cinfo.c,v 1.1 2000/06/27 01:48:02 amura Exp $ */ /* * Character class tables. * Do it yourself character classification * macros, that understand the multinational character set, * and let me ask some questions the standard macros (in * ctype.h) don't let you ask. */ /* * $Log: cinfo.c,v $ * Revision 1.1 2000/06/27 01:48:02 amura * Initial revision * */ /* 90.01.29 Modified for Ng 1.0 by S.Yoshida */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include "def.h" /* * This table, indexed by a character drawn * from the 256 member character set, is used by my * own character type macros to answer questions about the * type of a character. It handles the full multinational * character set, and lets me ask some questions that the * standard "ctype" macros cannot ask. */ char cinfo[256] = { _C, _C, _C, _C, /* 0x0X */ _C, _C, _C, _C, _C, _C, _C, _C, _C, _C, _C, _C, _C, _C, _C, _C, /* 0x1X */ _C, _C, _C, _C, _C, _C, _C, _C, _C, _C, _C, _C, 0, _P, 0, 0, /* 0x2X */ _W, _W, 0, _W, 0, 0, 0, 0, 0, 0, _P, 0, _D|_W, _D|_W, _D|_W, _D|_W, /* 0x3X */ _D|_W, _D|_W, _D|_W, _D|_W, _D|_W, _D|_W, 0, 0, 0, 0, 0, _P, 0, _U|_W, _U|_W, _U|_W, /* 0x4X */ _U|_W, _U|_W, _U|_W, _U|_W, _U|_W, _U|_W, _U|_W, _U|_W, _U|_W, _U|_W, _U|_W, _U|_W, _U|_W, _U|_W, _U|_W, _U|_W, /* 0x5X */ _U|_W, _U|_W, _U|_W, _U|_W, _U|_W, _U|_W, _U|_W, 0, 0, 0, 0, 0, 0, _L|_W, _L|_W, _L|_W, /* 0x6X */ _L|_W, _L|_W, _L|_W, _L|_W, _L|_W, _L|_W, _L|_W, _L|_W, _L|_W, _L|_W, _L|_W, _L|_W, _L|_W, _L|_W, _L|_W, _L|_W, /* 0x7X */ _L|_W, _L|_W, _L|_W, _L|_W, _L|_W, _L|_W, _L|_W, 0, 0, 0, 0, _C, #ifdef KANJI /* 90.01.29 by S.Yoshida */ 0, 0, 0, 0, /* 0x8X */ 0, 0, 0, 0, 0, 0, 0, 0, #ifdef HANKANA /* 92.11.21 by S.Sasaki */ 0, 0, _K, 0, #else /* not HANKANA */ 0, 0, 0, 0, #endif /* HANKANA */ 0, 0, 0, 0, /* 0x9X */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _K, _K, _K, /* 0xAX */ _K, _K, _K, _K, _K, _K, _K, _K, _K, _K, _K, _K, _K, _K, _K, _K, /* 0xBX */ _K, _K, _K, _K, _K, _K, _K, _K, _K, _K, _K, _K, _K, _K, _K, _K, /* 0xCX */ _K, _K, _K, _K, _K, _K, _K, _K, _K, _K, _K, _K, _K, _K, _K, _K, /* 0xDX */ _K, _K, _K, _K, _K, _K, _K, _K, _K, _K, _K, _K, _K, _K, _K, _K, /* 0xEX */ _K, _K, _K, _K, _K, _K, _K, _K, _K, _K, _K, _K, _K, _K, _K, _K, /* 0xFX */ _K, _K, _K, _K, _K, _K, _K, _K, _K, _K, _K, 0 #else /* NOT KANJI (ORIGINAL) */ 0, 0, 0, 0, /* 0x8X */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x9X */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xAX */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xBX */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, _U|_W, _U|_W, _U|_W, _U|_W, /* 0xCX */ _U|_W, _U|_W, _U|_W, _U|_W, _U|_W, _U|_W, _U|_W, _U|_W, _U|_W, _U|_W, _U|_W, _U|_W, 0, _U|_W, _U|_W, _U|_W, /* 0xDX */ _U|_W, _U|_W, _U|_W, _U|_W, _U|_W, _U|_W, _U|_W, _U|_W, _U|_W, _U|_W, 0, _W, _L|_W, _L|_W, _L|_W, _L|_W, /* 0xEX */ _L|_W, _L|_W, _L|_W, _L|_W, _L|_W, _L|_W, _L|_W, _L|_W, _L|_W, _L|_W, _L|_W, _L|_W, 0, _L|_W, _L|_W, _L|_W, /* 0xFX */ _L|_W, _L|_W, _L|_W, _L|_W, _L|_W, _L|_W, _L|_W, _L|_W, _L|_W, _L|_W, 0, 0 #endif /* KANJI */ }; /* * Find the name of a keystroke. Needs to be changed to handle 8-bit printing * characters and function keys better. Returns a pointer to the terminating * '\0'. */ char *keyname(cp, k) register char *cp; register int k; { register char *np; #ifdef FKEYS extern char *keystrings[]; #endif if(k < 0) k = CHARMASK(k); /* sign extended char */ switch(k) { case CCHR('@'): np = "NUL"; break; case CCHR('I'): np = "TAB"; break; case CCHR('J'): np = "LFD"; break; /* yuck, but that's what GNU calls it */ case CCHR('M'): np = "RET"; break; case CCHR('['): np = "ESC"; break; case ' ': np = "SPC"; break; /* yuck again */ case CCHR('?'): np = "DEL"; break; default: #ifdef FKEYS if(k >= KFIRST && k <= KLAST && (np = keystrings[k - KFIRST]) != NULL) break; #endif if(k > CCHR('?')) { *cp++ = '0'; *cp++ = ((k>>6)&7) + '0'; *cp++ = ((k>>3)&7) + '0'; *cp++ = (k&7) + '0'; *cp = '\0'; return cp; } if(k < ' ') { *cp++ = 'C'; *cp++ = '-'; k = CCHR(k); if(ISUPPER(k)) k = TOLOWER(k); } *cp++ = k; *cp = '\0'; return cp; } (VOID) strcpy(cp, np); return cp + strlen(cp); } ng-1.5beta1/sys/default/termcap.c100644 1750 1750 13124 7126003722 15532 0ustar amurausers/* $Id: termcap.c,v 1.1.1.1 2000/06/27 01:48:02 amura Exp $ */ /* * termcap.c - termcap library routines for MS-DOS and OS/2 * * This is nearly public domain termcap library routines, * completely rewritten from the code of Norman Azadian's * termcap routines, which is also not copyrighted. * You may freely copy and distribute this program. * * Junn Ohta, September 1989 */ /* * $Log: termcap.c,v $ * Revision 1.1.1.1 2000/06/27 01:48:02 amura * import to CVS * */ /* 90.07.24 by S.Yoshida: Ng don't need this file. #include "env.h" */ /* 90.07.24 by S.Yoshida: Ng always need termcap library. #ifdef TERMCAP */ /* 97.09.12 by amura: Ng don't need termcap when using TurboC conio */ #ifndef TCCONIO #include #define TBSIZE 1024 /* size of termcap buffer (termcap dependent) */ /* * termcap tcbuf; retained for later use of termcap routines */ static char *tcbuf; /* * dummy variables; for compatibility with UNIX termcap */ extern char PC; extern short ospeed; extern char *getenv(), *strcpy(), *strchr(); /* * error exit */ static void error(s) char *s; { fprintf(stderr, "termcap: %s\n", s); exit(1); } /* * get an entry */ static int getentry(fp, buf, room, name) FILE *fp; char *buf; int room; char *name; { register char *p, *q; int cont, len, c; char line[TBSIZE]; next: for (;;) { if ((p = fgets(line, TBSIZE, fp)) == NULL) { *buf = 0; return 0; } line[TBSIZE-1] = 0; if (*p >= 'A' && *p <= 'Z' || *p >= 'a' && *p <= 'z') break; } for (p = line; *p && *p != '\r' && *p != '\n'; p++) ; if (cont = (p > line && p[-1] == '\\')) p--; *p = 0; p = line; for (;;) { for (q = p; *q && *q != '|' && *q != ':'; q++) ; if (*q == 0) goto next; c = *q; *q = 0; if (!strcmp(name, p)) { *q = c; break; } *q = c; p = q + 1; } while (*p != ':') p++; len = strlen(p); if (room <= len) error("tcbuf too long"); strcpy(buf, p); buf += len; room -= len; while (cont) { if ((p = fgets(line, TBSIZE, fp)) == NULL) error("unexpected eof"); line[TBSIZE-1] = 0; for (p = line; *p && *p != '\r' && *p != '\n'; p++) ; if (cont = (p > line && p[-1] == '\\')) p--; *p = 0; for (p = line; *p == ' ' || *p == '\t'; p++) ; if (!*p || *p == '#') continue; len = strlen(p); if (room <= len) error("tcbuf too long"); strcpy(buf, p); buf += len; room -= len; } return 1; } /* * get one capability value */ static char * getcap(name) register char *name; { register char *p; if (tcbuf == NULL) return NULL; p = tcbuf; while (*p) { if (*p++ != ':') continue; if (*p == *name && p[1] == name[1]) return p + 2; } return NULL; } /* * tgetent */ int tgetent(buf, name) char *buf; char *name; { register char *p, *q; char *file; FILE *fp; int ret; if ((file = getenv("TERMCAP")) == NULL) file = "/etc/termcap"; if ((fp = fopen(file, "r")) == NULL) return -1; p = buf; if ((ret = getentry(fp, p, TBSIZE, name)) == 1) tcbuf = buf; fclose(fp); while (p = getcap("tc")) { for (q = p; *q && *q != ':'; q++) ; *q = 0; p -= 2; if ((fp = fopen(file, "r")) == NULL) return -1; ret = getentry(fp, p, TBSIZE-(int)(p-tcbuf), p+3); fclose(fp); } return ret; } /* * tgetflag */ int tgetflag(name) char *name; { register char *p; return ((p = getcap(name)) != NULL && *p == ':'); } /* * tgetnum */ int tgetnum(name) char *name; { register char *p; int num; if ((p = getcap(name)) == NULL || *p++ != '#') return -1; num = 0; while (*p && *p != ':') num = num * 10 + (*p++ - '0'); return num; } /* * tgetstr */ char * tgetstr(name, bufp) char *name; char **bufp; { register char *p, *q; char *ret; int c; if ((p = getcap(name)) == NULL || *p++ != '=') return NULL; ret = q = *bufp; while (*p && *p != ':') { if (*p == '^') { p++; *q++ = *p++ & 0x1f; continue; } if (*p != '\\') { *q++ = *p++; continue; } p++; if (*p >= '0' && *p <= '7') { c = *p++ - '0'; if (*p >= '0' && *p <= '7') c = (c << 3) + *p++ - '0'; if (*p >= '0' && *p <= '7') c = (c << 3) + *p++ - '0'; *q++ = c; continue; } switch (c = *p++) { case 'E': c = '\033'; break; case 'n': c = '\n'; break; case 'r': c = '\r'; break; case 'f': c = '\f'; break; case 't': c = '\t'; break; case 'b': c = '\b'; break; } *q++ = c; } *q++ = 0; *bufp = q; return ret; } /* * tgoto */ char * tgoto(cm, col, row) char *cm; int col, row; { register char *p, *q; char *fmt; int *val, tmp; static char buf[20]; val = &row; for (p = cm, q = buf; *p; p++) { if (*p != '%') { *q++ = *p; continue; } switch (*++p) { case 'd': fmt = "%dX"; goto num; case '2': fmt = "%02dX"; goto num; case '3': fmt = "%03dX"; num: sprintf(q, fmt, *val); while (*q != 'X') q++; val = &col; break; case '.': *q++ = *val; val = &col; break; case '+': *q++ = *val + *++p; val = &col; break; case '>': p++; if (*val > *p++) *val += *p; break; case 'r': tmp = row; row = col; col = tmp; break; case 'i': row++; col++; break; case 'n': row ^= 0140; col ^= 0140; break; case 'B': *val += 6 * (*val / 10); break; case 'D': *val -= 2 * (*val % 16); break; case '%': *q++ = '%'; break; default: return "OOPS"; } } *q = 0; return buf; } /* * tputs */ void tputs(p, lines, outc) register char *p; int lines; int (*outc)(); { while (*p == '.' || *p == '*' || *p >= '0' && *p <= '9') p++; while (*p) (*outc)(*p++); } #endif /* TCCONIO */ /* 90.07.24 by S.Yoshida: Ng always need termcap library. #endif /*TERMCAP*/ ng-1.5beta1/sys/default/tty.c100644 1750 1750 26440 7232352216 14727 0ustar amurausers/* $Id: tty.c,v 1.2 2001/01/20 18:10:22 amura Exp $ */ /* * Termcap/terminfo display driver * * Termcap is a terminal information database and routines to describe * terminals on most UNIX systems. Many other systems have adopted * this as a reasonable way to allow for widly varying and ever changing * varieties of terminal types. This should be used where practical. */ /* Known problems: * If you have a terminal with no clear to end of screen and * memory of lines below the ones visible on the screen, display * will be wrong in some cases. I doubt that any such terminal * was ever made, but I thought everyone with delete line would * have clear to end of screen too... * * Code for terminals without clear to end of screen and/or clear * to end of line has not been extensivly tested. * * Cost calculations are very rough. Costs of insert/delete line * may be far from the truth. This is accentuated by display.c * not knowing about multi-line insert/delete. * * Using scrolling region vs insert/delete line should probably * be based on cost rather than the assuption that scrolling * region operations look better. */ /* * $Log: tty.c,v $ * Revision 1.2 2001/01/20 18:10:22 amura * very big terminal supported * * Revision 1.1.1.1 2000/06/27 01:48:02 amura * import to CVS * */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include "def.h" #define BEL 0x07 /* BEL character. */ extern int ttrow; extern int ttcol; extern int tttop; extern int ttbot; extern int tthue; int tceeol; /* Costs are set later */ int tcinsl; int tcdell; #ifdef NO_RESIZE static setttysize(); #endif int ttputc(); char *tgetstr(); char *tgoto(); static int insdel; /* Do we have both insert & delete line? */ #define TCAPSLEN 1024 char tcapbuf[TCAPSLEN]; /* PC, UP, and BC are used by termlib, so must be extern and have these * names unless you have a non-standard termlib. */ int LI; /* standard # lines */ char PC, *CM, *CE, *UP, *BC, *IM, /* insert mode */ *IC, /* insert a single space */ *EI, /* end insert mode */ *DC, *AL, /* add line */ *DL, /* del line */ *pAL, /* parameterized add line */ *pDL, /* parameterized delete line */ *TI, /* term init -- start using cursor motion */ *TE, /* term end --- end using cursor motion */ *SO, *SE, *CD, *CS, /* set scroll region */ *SF, /* forw index (used with scroll region) */ *SR; /* back index (used with scroll region) */ # ifdef XKEYS char *KS, *KE; /* enter keypad mode, exit keypad mode */ # endif int SG; /* number of glitches, 0 for invisible, -1 for none */ /* (yes virginia, there are terminals with invisible glitches) */ /* * Initialize the terminal when the editor * gets started up. */ static char tcbuf[1024]; ttinit() { char *tv_stype; char *t, *p, *tgetstr(); #ifndef gettermtype /* (avoid declaration if #define) */ char *gettermtype(); /* system dependent function to determin terminal type */ #endif if((tv_stype = gettermtype()) == NULL) panic("Could not determine terminal type"); if((tgetent(tcbuf, tv_stype)) != 1) { (VOID) strcpy(tcbuf, "Unknown terminal type "); (VOID) strcat(tcbuf, tv_stype); panic(tcbuf); } p = tcapbuf; t = tgetstr("pc", &p); if(t) PC = *t; LI = tgetnum("li"); CD = tgetstr("cd", &p); CM = tgetstr("cm", &p); CE = tgetstr("ce", &p); UP = tgetstr("up", &p); BC = tgetstr("bc", &p); IM = tgetstr("im", &p); IC = tgetstr("ic", &p); EI = tgetstr("ei", &p); DC = tgetstr("dc", &p); AL = tgetstr("al", &p); DL = tgetstr("dl", &p); pAL= tgetstr("AL", &p); /* parameterized insert and del. line */ pDL= tgetstr("DL", &p); TI = tgetstr("ti", &p); TE = tgetstr("te", &p); SO = tgetstr("so", &p); SE = tgetstr("se", &p); CS = tgetstr("cs", &p); /* set scrolling region */ SF = tgetstr("sf", &p); if(!SF || !*SF) { /* this is what GNU Emacs does */ SF = tgetstr("do", &p); if(!SF || !*SF) { SF = tgetstr("nl", &p); if(!SF || !*SF) SF = "\n"; } } SR = tgetstr("sr", &p); SG = tgetnum("sg"); /* standout glitch */ # ifdef XKEYS KS = tgetstr("ks", &p); /* keypad start, keypad end */ KE = tgetstr("ke", &p); # endif if(CM == NULL || UP == NULL) panic("This terminal is to stupid to run MicroGnuEmacs\n"); ttresize(); /* set nrow & ncol */ /* watch out for empty capabilities (sure to be wrong) */ if (CE && !*CE) CE = NULL; if (CS && !*CS) CS = NULL; if (SR && !*SR) SR = NULL; if (AL && !*AL) AL = NULL; if (DL && !*DL) DL = NULL; if (pAL && !*pAL) pAL = NULL; if (pDL && !*pDL) pDL = NULL; if (CD && !*CD) CD = NULL; if(!CE) tceeol = ncol; else tceeol = charcost(CE); /* Estimate cost of inserting a line */ if (CS && SR) tcinsl = charcost(CS)*2 + charcost(SR); else if (pAL) tcinsl = charcost(pAL); else if (AL) tcinsl = charcost(AL); else tcinsl = NROW * NCOL; /* make this cost high enough */ /* Estimate cost of deleting a line */ if (CS) tcdell = charcost(CS)*2 + charcost(SF); else if (pDL) tcdell = charcost(pDL); else if (DL) tcdell = charcost(DL); else tcdell = NROW * NCOL; /* make this cost high enough */ /* Flag to indicate that we can both insert and delete lines */ insdel = (AL || pAL) && (DL || pDL); if (p >= &tcapbuf[TCAPSLEN]) panic("Terminal description too big!\n"); if (TI && *TI) putpad(TI, 1); /* init the term */ } /* * Clean up the terminal, in anticipation of * a return to the command interpreter. This is a no-op * on the ANSI display. On the SCALD display, it sets the * window back to half screen scrolling. Perhaps it should * query the display for the increment, and put it * back to what it was. */ tttidy() { if (TE && *TE) putpad(TE, 1); /* set the term back to normal mode */ putpad(tgoto(CM, 0, ttrow), 1); /* not nrow */ if (CE && *CE) putpad(CE, 1); /* erase one line */ #ifdef XKEYS ttykeymaptidy(); #endif } /* * Move the cursor to the specified * origin 0 row and column position. Try to * optimize out extra moves; redisplay may * have left the cursor in the right * location last time! */ ttmove(row, col) { if (ttrow!=row || ttcol!=col) { putpad(tgoto(CM, col, row), 1); ttrow = row; ttcol = col; } } /* * Erase to end of line. */ tteeol() { if(CE) putpad(CE, 1); else { register int i=ncol-ttcol; while(i--) ttputc(' '); ttrow = ttcol = HUGE; } } /* * Erase to end of page. */ tteeop() { if(CD) putpad(CD, nrow - ttrow); else { tteeol(); if (insdel) ttdell(ttrow + 1, LI, LI - ttrow - 1); else /* do it by hand */ { register int line; for (line = ttrow + 1; line <= LI; ++line) { ttmove(line, 0); tteeol(); } } ttrow = ttcol = HUGE; } } /* * Make a noise. */ ttbeep() { ttputc(BEL); ttflush(); } /* * Insert nchunk blank line(s) onto the * screen, scrolling the last line on the * screen off the bottom. Use the scrolling * region if possible for a smoother display. * If no scrolling region, use a set * of insert and delete line sequences */ ttinsl(row, bot, nchunk) { register int i, nl; if (row == bot) { /* Case of one line insert is */ ttmove(row, 0); /* special */ tteeol(); return; } if (CS && SR) { /* Use scroll region and back index */ nl = bot - row; ttwindow(row,bot); ttmove(row, 0); while (nchunk--) putpad(SR, nl); ttnowindow(); return; } else if (insdel) { ttmove(1+bot-nchunk, 0); nl = nrow - ttrow; if (pDL) putpad(tgoto(pDL, 0, nchunk), nl); else for (i=0; i LI ? nrow : LI) - 1, 0), nrow - ttrow); ttrow = HUGE; /* Unknown. */ ttcol = HUGE; tttop = HUGE; /* No scroll region. */ ttbot = HUGE; } } /* * Set the current writing color to the * specified color. Watch for color changes that are * not going to do anything (the color is already right) * and don't send anything to the display. * The rainbow version does this in putline.s on a * line by line basis, so don't bother sending * out the color shift. */ ttcolor(color) register int color; { if (color != tthue) { if (color == CTEXT) { /* Normal video. */ putpad(SE, 1); } else if (color == CMODE) { /* Reverse video. */ putpad(SO, 1); } tthue = color; /* Save the color. */ } } /* * This routine is called by the * "refresh the screen" command to try and resize * the display. The new size, which must be deadstopped * to not exceed the NROW and NCOL limits, it stored * back into "nrow" and "ncol". Display can always deal * with a screen NROW by NCOL. Look in "window.c" to * see how the caller deals with a change. */ ttresize() { setttysize(); /* found in "ttyio.c", */ /* ask OS for tty size */ if (nrow < 1) /* Check limits. */ nrow = 1; if (ncol < 1) ncol = 1; vtsetsize(ncol, nrow); } #ifdef NO_RESIZE static setttysize() { nrow = tgetnum("li"); ncol = tgetnum("co"); } #endif static int cci; /*ARGSUSED*/ static int /* fake char output for charcost() */ fakec(c) char c; { cci++; } /* calculate the cost of doing string s */ charcost (s) char *s; { cci = 0; tputs(s, nrow, fakec); return cci; } ng-1.5beta1/sys/default/ttydef.h100644 1750 1750 3676 7242446661 15412 0ustar amurausers/* $Id: ttydef.h,v 1.3 2001/02/14 09:19:45 amura Exp $ */ /* * Termcap terminal file, nothing special, just make it big * enough for windowing systems. */ /* * $Log: ttydef.h,v $ * Revision 1.3 2001/02/14 09:19:45 amura * code cleanup around putline() and NCOL/NROW * * Revision 1.2 2001/01/05 14:07:07 amura * first implementation of Hojo Kanji support * * Revision 1.1.1.1 2000/06/27 01:48:02 amura * import to CVS * */ /* 90.11.09 Modified for Ng 1.2.1 Human68k by Sawayanagi Yosirou */ /* 90.02.05 Modified for Ng 1.0 by S.Yoshida */ #if defined(PC9801)||defined(WIN32) /* 90.03.24 by A.Shirahashi */ #define MEMMAP /* Not memory mapped video. */ #else /* not !PC9801 && !WIN32 */ #define GOSLING /* Compile in fancy display. */ #endif /* PC9801 */ #if !(defined(NROW)&&defined(NCOL)) #if defined(MSDOS) /* 90.04.02 by S.Yoshida */ #define NROW 50 /* (default) Rows. */ #define NCOL 80 /* (default) Columns. */ #elif defined(HUMAN68K) /* by Sawayanagi Yosirou */ #define NROW 32 /* (default) Rows. */ #define NCOL 96 /* (default) Columns. */ #else /* not MSDOS or HUMAN68K */ #define NROW 66 /* (default) Rows. */ #define NCOL 132 /* (default) Columns. */ #endif /* MSDOS or HUMAN68K */ #endif /* NROW && NCOL */ /* #define MOVE_STANDOUT /* don't move in standout mode */ #define STANDOUT_GLITCH /* possible standout glitch */ #define TERMCAP /* for possible use in ttyio.c */ #ifdef DO_METAKEY #ifndef METABIT #ifdef KANJI /* 90.01.29 by S.Yoshida */ #define METABIT 0x100 #else /* NOT KANJI */ #define METABIT 0x80 #endif /* KANJI */ #endif /* METABIT */ #endif /* DO_METAKEY */ #define getkbd() (ttgetc()) #ifdef KANJI /* 90.02.05 by S.Yoshida */ #define ungetkbd(c) (ttungetc(c)) #endif /* KANJI */ #ifndef XKEYS # ifdef ADDOPT #define ttykeymapinit(ngrc) {} # else #define ttykeymapinit() {} # endif #endif extern int tputs(); #define putpad(str, num) tputs(str, num, ttputc) #define KFIRST K00 #define KLAST K00 ng-1.5beta1/sys/default/ttykbd.c100644 1750 1750 3200 7126003722 15352 0ustar amurausers/* $Id: ttykbd.c,v 1.1 2000/06/27 01:48:02 amura Exp $ */ /* * Name: MG 2a * Termcap keyboard driver using key files * Created: 22-Nov-1987 Mic Kaczmarczik (mic@emx.cc.utexas.edu) */ /* * $Log: ttykbd.c,v $ * Revision 1.1 2000/06/27 01:48:02 amura * Initial revision * */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include "def.h" #ifdef XKEYS /* * Get keyboard character. Very simple if you use keymaps and keys files. * Bob was right -- the old XKEYS code is not the right solution. * FKEYS code is not usefull other than to help debug FKEYS code in * extend.c. */ #ifdef FKEYS char *keystrings[] = { NULL } ; #endif /* * Turn on function keys using KS, then load a keys file, if available. * The keys file is located in the same manner as the startup file is, * depending on what startupfile() does on your system. */ extern int ttputc(); #ifdef ADDOPT ttykeymapinit(ngrcfile) char *ngrcfile; #else ttykeymapinit() #endif { #ifndef TCCONIO extern char *KS; #endif #ifndef NO_STARTUP char *cp, *startupfile(); if (cp = gettermtype()) { #ifdef ADDOPT if (((cp = startupfile(ngrcfile, cp)) != NULL) #else if (((cp = startupfile(cp)) != NULL) #endif && (load(cp) != TRUE)) ewprintf("Error reading key initialization file"); } #endif } /* * Start keypad mode -- called by update() and spawncli() */ ttykeypadstart() { #ifndef TCCONIO extern char *KS; if (KS && *KS) /* turn on keypad */ putpad(KS, 1); #endif } /* * Clean up the keyboard -- called by tttidy() and spawncli() */ ttykeymaptidy() { #ifndef TCCONIO extern char *KE; if (KE && *KE) putpad(KE, 1); /* turn off keypad */ #endif } #endif ng-1.5beta1/sys/default/varargs.h100644 1750 1750 3053 7126003722 15531 0ustar amurausers/* $Id: varargs.h,v 1.1.1.1 2000/06/27 01:48:02 amura Exp $ */ /* varargs.h for MicroGnuEmacs 2a. This one will work on systems that */ /* the non-varargs version of mg 1 did. */ /* based on the one I wrote for os9/68k . I did not look at the bsd code. */ /* by Robert A. Larson */ /* assumptions made about how arguments are passed: */ /* arguments are stored in a block of memory with no padding between. */ /* The first argument will have the lowest address */ /* varargs is a "portable" way to write a routine that takes a variable */ /* number of arguements. This implemination agrees with both the 4.2bsd*/ /* and Sys V documentation of varargs. Note that just because varargs.h*/ /* is used does not mean that it is used properly. */ /* * $Log: varargs.h,v $ * Revision 1.1.1.1 2000/06/27 01:48:02 amura * import to CVS * */ #ifndef __STDARG_H # ifndef __TURBOC__ typedef char *va_list; # endif #endif #define va_dcl unsigned va_alist; #ifndef __TURBOC__ /* 90.03.23 by A.Shirahashi */ #undef va_start #undef va_arg #undef va_end #endif /* __TURBOC__ */ #if defined(__TURBOC__) && __TURBOC__ > 0x0200 /* 90.12.27 For Turbo C++ 1.0 by Junn Ohta */ typedef void *va_list; #endif #define va_start(pvar) ((pvar) = (char *)&va_alist) #ifdef __TURBOC__ /* 90.03.23 by A.Shirahashi */ #define va_arg(pvar,type) ((((char *)(pvar))+=sizeof(type)),*(((type *)(pvar)) - 1)) #else /* NOT __TURBOC__ */ #define va_arg(pvar,type) (((pvar)+=sizeof(type)),*(((type *)(pvar)) - 1)) #endif /* __TURBOC__ */ #define va_end(pvar) /* va_end is simple */ ng-1.5beta1/sys/human68k/ 40755 1750 1750 0 7642273645 13652 5ustar amurausersng-1.5beta1/sys/human68k/GNUmakefile100644 1750 1750 11212 7247657137 16041 0ustar amurausers# $Id: GNUmakefile,v 1.2 2001/03/02 08:48:31 amura Exp $ # GNUmakefile for Ng on Human68k (SHARP X68000) # This makefile requires GNU make 91.01.20 by K.Maeda. # # $Log: GNUmakefile,v $ # Revision 1.2 2001/03/02 08:48:31 amura # now AUTOSAVE feature implemented almost all (except for WIN32 # # Revision 1.1.1.1 2000/06/27 01:47:58 amura # import to CVS # SYS = human68k LIBS = cshwild.a gmalloc.a h68unix.a doslib.a iocslib.a #LIBS = a:\xc\lib\doslib.l a:\xc\lib\iocslib.l a:\xc\lib\floatfnc.l \ # a:\gcc\lib\gnulib.l a:\xc\lib\clib.l #LIBS = a:\jshwild3\jshwild.l a:\xc\lib\doslib.l a:\xc\lib\iocslib.l \ # a:\xc\lib\floatfnc.l a:\gcc\lib\gnulib.l a:\gmalloc\gmalloc.l \ # a:\xc\lib\clib.l ifeq ($(SHELL),minsh) CP = cp PATHDELIM = / else CP = copy PATHDELIM = \\ # or \ if your GNU make recognise \ as a path delimiter. endif SYSDIR = sys$(PATHDELIM)$(SYS)$(PATHDELIM) SYSDEF = sys$(PATHDELIM)default$(PATHDELIM) # CDEFS gets defines, and gets passed to lint. CFLAGS gets flags, and doesn't # get passed to lint. # # Now, compile time options are defined in a "config.h". # CDEFS = -DHUMAN68K ifneq (,$(findstring gmalloc,$(LIBS))) override CDEFS := $(CDEFS) -DFLEX_MALLOC endif CFLAGS = -O -fcombine-regs -fomit-frame-pointer -fstrength-reduce $(CDEFS) CC = gcc # Objects which only depend on the "standard" includes OBJS = basic.o dir.o dired.o shell.o version.o window.o \ kinsoku.o jump.o autosave.o # Those with unique requirements IND = buffer.o complt.o display.o cmode.o echo.o extend.o file.o \ help.o kbd.o keymap.o line.o macro.o main.o match.o modes.o \ paragraph.o random.o region.o regex.o re_search.o search.o \ skg.o kanji.o undo.o word.o # System dependent objects OOBJS = cinfo.o spawn.o ttyio.o tty.o ttykbd.o fileio.o # Human68k additional objects HOBJS = sysinit.o dosutil.o h68kfncmp.o termcap.o fepctrl.o hentrap.o OBJ = $(OBJS) $(IND) $(OOBJS) $(HOBJS) OSRCS = cinfo.c fileio.c spawn.c ttyio.c tty.c ttykbd.c HSRCS = sysinit.c dosutil.c h68kfncmp.c termcap.c fepctrl.c hentrap.s SRCS = basic.c cmode.c dir.c dired.c file.c line.c match.c paragraph.c \ random.c region.c search.c shell.c version.c window.c word.c \ buffer.c complt.c display.c echo.c extend.c help.c kbd.c \ keymap.c macro.c main.c modes.c regex.c re_search.c kanji.c \ kinsoku.c skg.c jump.c undo.c autosave.c OINCS = ttydef.h sysdef.h chrdef.h INCS = config.h def.h REINCS = regex_e.h regex_j.h regex_j.c regex_e.h kanji_.h kanji_.c PROG = ng.x $(PROG): $(OBJ) gcc -o $@ -x $^ $(LIBS) #lint: $(SRCS) $(OSRCS) $(INCS) $(OINCS) # lint -ahbz $(CDEFS) $(SRCS) $(OSRCS) $(OBJS): $(INCS) $(OINCS) $(OOBJS): $(INCS) $(OINCS) %.o:%.c $(CC) $(CFLAGS) -c $< %.o:%.s $(CC) $(CFLAGS) -c $< buffer.o: $(INCS) $(OINCS) kbd.h undo.h cmode.o file.o line.o paragraph.o random.o region.o undo.o word.o: \ $(INCS) $(OINCS) undo.h complt.o: $(INCS) $(OINCS) kbd.h complt.h display.o keymap.o modes.o fileio.o: \ $(INCS) $(OINCS) kbd.h echo.o: $(INCS) $(OINCS) key.h macro.h varargs.h complt.h extend.o help.o: \ $(INCS) $(OINCS) kbd.h macro.h key.h kanji.o: $(INCS) $(OINCS) kinit.h kbd.o: $(INCS) $(OINCS) kbd.h macro.h key.h undo.h macro.o: $(INCS) $(OINCS) macro.h key.h main.o search.o: \ $(INCS) $(OINCS) macro.h match.o: $(INCS) $(OINCS) key.h re_search.o: $(INCS) $(OINCS) $(REINCS) macro.h regex.o: $(INCS) $(OINCS) $(REINCS) skg.o: $(INCS) $(OINCS) macro.h key.h undo.h sysdef.h: $(SYSDIR)sysdef.h # Update, if needed. $(CP) $(SYSDIR)sysdef.h . ttydef.h: $(SYSDEF)ttydef.h $(CP) $(SYSDEF)ttydef.h . chrdef.h: $(SYSDEF)chrdef.h $(CP) $(SYSDEF)chrdef.h . varargs.h: $(SYSDEF)varargs.h $(CP) $(SYSDEF)varargs.h . cinfo.c: $(SYSDEF)cinfo.c $(CP) $(SYSDEF)cinfo.c . spawn.c: $(SYSDIR)spawn.c $(CP) $(SYSDIR)spawn.c . ttyio.c: $(SYSDIR)ttyio.c $(CP) $(SYSDIR)ttyio.c . tty.c: $(SYSDEF)tty.c $(CP) $(SYSDEF)tty.c . ttykbd.c: $(SYSDEF)ttykbd.c $(CP) $(SYSDEF)ttykbd.c . fileio.c: $(SYSDIR)fileio.c $(CP) $(SYSDIR)fileio.c . sysinit.c: $(SYSDIR)sysinit.c $(CP) $(SYSDIR)sysinit.c . dosutil.c: $(SYSDIR)dosutil.c $(CP) $(SYSDIR)dosutil.c . h68kfncmp.c: $(SYSDIR)h68kfncmp.c $(CP) $(SYSDIR)h68kfncmp.c . termcap.c: $(SYSDEF)termcap.c $(CP) $(SYSDEF)termcap.c . fepctrl.h: $(SYSDIR)fepctrl.h $(CP) $(SYSDIR)fepctrl.h . fepctrl.c: $(SYSDIR)fepctrl.c $(CP) $(SYSDIR)fepctrl.c . fepctrl.o: fepctrl.c fepctrl.h hentrap.s: $(SYSDIR)hentrap.s $(CP) $(SYSDIR)hentrap.s . clean: ifeq ($(SHELL),minsh) -rm *.o $(OINCS) varargs.h fepctrl.h $(OSRCS) $(HSRCS) ng.x else del *.o FOR %%F IN ($(OINCS)) DO del %%F FOR %%F IN (varargs.h fepctrl.h) DO del %%F FOR %%F IN ($(OSRCS)) DO del %%F FOR %%F IN ($(HSRCS)) DO del %%F del indirect.lk del ng.x endif ng-1.5beta1/sys/human68k/Makefile100644 1750 1750 10520 7247657137 15430 0ustar amurausers# $Id: Makefile,v 1.2 2001/03/02 08:48:31 amura Exp $ # Makefile for Ng on Human68k (SHARP X68000) # # $Log: Makefile,v $ # Revision 1.2 2001/03/02 08:48:31 amura # now AUTOSAVE feature implemented almost all (except for WIN32 # # Revision 1.1.1.1 2000/06/27 01:47:58 amura # import to CVS # SYS = human68k LIBS = a:\xc\lib\doslib.l a:\xc\lib\iocslib.l a:\xc\lib\floatfnc.l \ a:\gcc\lib\gnulib.l a:\xc\lib\clib.l #LIBS = a:\jshwild3\jshwild.l a:\xc\lib\doslib.l a:\xc\lib\iocslib.l \ # a:\xc\lib\floatfnc.l a:\gcc\lib\gnulib.l a:\gmalloc\gmalloc.l \ # a:\xc\lib\clib.l # CDEFS gets defines, and gets passed to lint. CFLAGS gets flags, and doesn't # get passed to lint. # # Now, compile time options are defined in a "config.h". # CDEFS = -DHUMAN68K CFLAGS = -O -fcombine-regs -fomit-frame-pointer -fstrength-reduce $(CDEFS) CC = gcc LK = lk # Objects which only depend on the "standard" includes OBJS = basic.o dir.o dired.o shell.o version.o window.o \ kinsoku.o jump.o autosave.o # Those with unique requirements IND = buffer.o complt.o display.o cmode.o echo.o extend.o file.o \ help.o kbd.o keymap.o line.o macro.o main.o match.o modes.o \ paragraph.o random.o region.o regex.o re_search.o search.o \ skg.o kanji.o undo.o word.o # System dependent objects OOBJS = cinfo.o spawn.o ttyio.o tty.o ttykbd.o fileio.o # Human68k additional objects HOBJS = sysinit.o dosutil.o h68kfncmp.o termcap.o fepctrl.o hentrap.o OBJ = $(OBJS) $(IND) $(OOBJS) $(HOBJS) OSRCS = cinfo.c fileio.c spawn.c ttyio.c tty.c ttykbd.c HSRCS = sysinit.c dosutil.c h68kfncmp.c termcap.c fepctrl.c hentrap.s SRCS = basic.c cmode.c dir.c dired.c file.c line.c match.c paragraph.c \ random.c region.c search.c shell.c version.c window.c word.c \ buffer.c complt.c display.c echo.c extend.c help.c kbd.c \ keymap.c macro.c main.c modes.c regex.c re_search.c kanji.c \ kinsoku.c skg.c jump.c undo.c autosave.c OINCS = ttydef.h sysdef.h chrdef.h INCS = config.h def.h REINCS = regex_e.h regex_j.h regex_j.c regex_e.h kanji_.h kanji_.c PROG = ng.x $(PROG): $(OBJ) indirect.lk @echo "indirect.lk" @type indirect.lk $(LK) /i indirect.lk #lint: $(SRCS) $(OSRCS) $(INCS) $(OINCS) # lint -ahbz $(CDEFS) $(SRCS) $(OSRCS) $(OBJS): $(INCS) $(OINCS) $(OOBJS): $(INCS) $(OINCS) %.o::%.c $(CC) $(CFLAGS) -c $< %.o::%.s $(CC) $(CFLAGS) -c $< buffer.o: $(INCS) $(OINCS) kbd.h undo.h cmode.o file.o line.o paragraph.o random.o region.o undo.o word.o: \ $(INCS) $(OINCS) undo.h complt.o: $(INCS) $(OINCS) kbd.h complt.h display.o keymap.o modes.o fileio.o: \ $(INCS) $(OINCS) kbd.h echo.o: $(INCS) $(OINCS) key.h macro.h varargs.h complt.h extend.o help.o: \ $(INCS) $(OINCS) kbd.h macro.h key.h kanji.o: $(INCS) $(OINCS) kinit.h kbd.o: $(INCS) $(OINCS) kbd.h macro.h key.h undo.h macro.o: $(INCS) $(OINCS) macro.h key.h undo.h main.o search.o: \ $(INCS) $(OINCS) macro.h match.o: $(INCS) $(OINCS) key.h re_search.o: $(INCS) $(OINCS) $(REINCS) macro.h regex.o: $(INCS) $(OINCS) $(REINCS) skg.o: $(INCS) $(OINCS) macro.h key.h undo.h sysdef.h: sys\$(SYS)\sysdef.h # Update, if needed. copy sys\$(SYS)\sysdef.h ttydef.h: sys\default\ttydef.h copy sys\default\ttydef.h chrdef.h: sys\default\chrdef.h copy sys\default\chrdef.h varargs.h: sys\default\varargs.h copy sys\default\varargs.h cinfo.c: sys\default\cinfo.c copy sys\default\cinfo.c spawn.c: sys\$(SYS)\spawn.c copy sys\$(SYS)\spawn.c ttyio.c: sys\$(SYS)\ttyio.c copy sys\$(SYS)\ttyio.c tty.c: sys\default\tty.c copy sys\default\tty.c ttykbd.c: sys\default\ttykbd.c copy sys\default\ttykbd.c fileio.c: sys\$(SYS)\fileio.c copy sys\$(SYS)\fileio.c sysinit.c: sys\$(SYS)\sysinit.c copy sys\$(SYS)\sysinit.c dosutil.c: sys\$(SYS)\dosutil.c copy sys\$(SYS)\dosutil.c h68kfncmp.c: sys\$(SYS)\h68kfncmp.c copy sys\$(SYS)\h68kfncmp.c termcap.c: sys\default\termcap.c copy sys\default\termcap.c fepctrl.h: sys\$(SYS)\fepctrl.h copy sys\$(SYS)\fepctrl.h fepctrl.c: sys\$(SYS)\fepctrl.c copy sys\$(SYS)\fepctrl.c fepctrl.o: fepctrl.c fepctrl.h $(INCS) hentrap.s: sys\$(SYS)\hentrap.s copy sys\$(SYS)\hentrap.s indirect.lk: Makefile sys\$(SYS)\objlist echo /x /o $(PROG) > $@ type sys\$(SYS)\objlist >> $@ echo $(LIBS) >> $@ clean: del *.o FOR %%F IN ($(OINCS)) DO del %%F FOR %%F IN (varargs.h fepctrl.h) DO del %%F FOR %%F IN ($(OSRCS)) DO del %%F FOR %%F IN ($(HSRCS)) DO del %%F del indirect.lk del ng.x ng-1.5beta1/sys/human68k/dosutil.c100644 1750 1750 1633 7630440452 15566 0ustar amurausers/* $Id: dosutil.c,v 1.1.1.1.4.1 2003/03/02 17:36:42 amura Exp $ */ /* * UNIX like functions for Human68k. * * Coded by Shigeki Yoshida (shige@csk.CO.JP) */ /* * $Log: dosutil.c,v $ * Revision 1.1.1.1.4.1 2003/03/02 17:36:42 amura * add #include * * Revision 1.1.1.1 2000/06/27 01:47:58 amura * import to CVS * */ /* 90.11.9 Modified for Ng 1.2.1 Human68k by Sawayanagi Yosirou */ /* 90.02.11 Created for Ng 1.0 MS-DOS ver. by S.Yoshida */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include #include /* Sleep (busily) for n seconds */ /* But return on key input (kaoru) */ /* 91.01.15 by K.Maeda */ int sleep (n) int n; { register start, laps, s; for(; n > 43200; n -= 43200) if(sleep(43200)) return 1; for(s = n*100, start = ONTIME(); n;) { if ((laps = ONTIME() - start) < 0) laps += 8640000; if (laps >= s) return 0; } } ng-1.5beta1/sys/human68k/fepctrl.c100644 1750 1750 7254 7126003716 15545 0ustar amurausers/* $Id: fepctrl.c,v 1.1.1.1 2000/06/27 01:47:58 amura Exp $ */ /* * fepctrl.c 1.2 1990/11/25 Public Domain. * * General purpose Japanese FEP control routines for Human68k. * Written for MS-DOS by Junn Ohta * Adjusted to Human68k by Sawayanagi Yosirou * * int fep_init() * checks FEP and turn it off, returns FEP type. * void fep_term() * restore the status of FEP saved by fep_init(). * void fep_on() * restore the status of FEP saved by fep_off(). * void fep_off() * save the status of FEP and turn it off. * void fep_force_on() * turn FEP on by its default "on" status. * void fep_force_off() * don't save the status of FEP and turn it off. */ /* * $Log: fepctrl.c,v $ * Revision 1.1.1.1 2000/06/27 01:47:58 amura * import to CVS * */ #define NG #ifdef NG #include "config.h" #endif #ifdef FEPCTRL #include "fepctrl.h" /* * default "on" status of FEP (used only in fep_force_on()) */ static int fepon[NFEPS] = { /* FEP_NONE */ 0, /* FEP_ASK68K */ 1 /* 0=off, 1=on */ }; static int fep = FEP_NONE; static int oldmode = 0; static int keepmode = 0; static void fep_open(), fep_close(); static int fep_find(); static int fep_mode(); static int ask68k_get_mode(); static int ask68k_set_mode(); int fep_init() { if (fep == FEP_NONE) fep = fep_find(); fep_open(); oldmode = keepmode = fep_mode(0); return fep; } void fep_term() { fep_mode(oldmode); fep_close(); } void fep_on() { fep_mode(keepmode); } void fep_off() { keepmode = fep_mode(0); } void fep_force_on() { fep_mode(fepon[fep]); } void fep_force_off() { fep_mode(0); } int fep_get_mode() { return ask68k_get_mode(); } /*--------------------------------------------------------------------*/ #ifdef TEST static char *fepname[NFEPS] = { /* FEP_NONE */ "(none)", /* FEP_ASK68K */ "ASK68K" }; static void putstr(s) char *s; { while (*s) putch(*s++); } static void echoline(s) char *s; { int c; putstr(s); while ((c = getch()) != '\r' && c != '\n') putch(c); putstr("\r\n"); } main() { putstr("fep = "); putstr(fepname[fep_init()]); putstr("\r\n"); putstr("enter 4 lines of text\r\n"); fep_force_on(); echoline(" on: "); fep_off(); echoline("off: "); fep_on(); echoline(" on: "); fep_force_off(); echoline("off: "); fep_term(); exit(0); } #endif /* TEST */ /*--------------------------------------------------------------------*/ #ifdef __GNUC__ #define _asm asm #endif static int fep_find() { /* it should be done in more exact way */ int d0; _asm(" move.l #2,-(sp)"); _asm(" dc.w $ff22"); _asm(" addq.l #4,sp"); _asm(" move.l d0,-4(a6)"); if (d0 == -1) return FEP_NONE; else return FEP_ASK68K; } static void fep_open() { extern int hentrap(); if (fep == FEP_ASK68K) hentrap(-1); } static void fep_close() { extern int hentrap(); if (fep == FEP_ASK68K) hentrap(0); } static int fep_mode(newmode) int newmode; { int curmode; switch (fep) { case FEP_ASK68K: /* mode: 0 = off, 1 = on */ curmode = ask68k_get_mode(); if (newmode != curmode) ask68k_set_mode(newmode); return curmode; default: return 0; } } static int ask68k_get_mode() { extern int iskmode(); if (iskmode() == 0) return 0; else return 1; } static int ask68k_set_mode(flag) { if (flag) { /* mode = KNJCTRL(2) */ _asm(" move.l #2,-(sp)"); _asm(" dc.w $ff22"); _asm(" addq.l #4,sp"); /* KNJCTRL(1, mode) */ _asm(" move.l d0,-(sp)"); _asm(" move.l #1,-(sp)"); _asm(" dc.w $ff22"); _asm(" addq.l #8,sp"); return; /* return d0 */ } else { /* KNJCTRL(1, 0) */ _asm(" clr.l -(sp)"); _asm(" move.l #1,-(sp)"); _asm(" dc.w $ff22"); _asm(" addq.l #8,sp" ); return; /* return d0 */ } } #endif /* FEPCTRL */ ng-1.5beta1/sys/human68k/fepctrl.h100644 1750 1750 1337 7126003716 15546 0ustar amurausers/* $Id: fepctrl.h,v 1.1.1.1 2000/06/27 01:47:58 amura Exp $ */ /* * fepctrl.h 1.2 1990/11/25 Public Domain. * * General purpose Japanese FEP control routines for Human68k. * Written for MS-DOS by Junn Ohta * Adjusted to Human68k by Sawayanagi Yosirou */ /* * $Log: fepctrl.h,v $ * Revision 1.1.1.1 2000/06/27 01:47:58 amura * import to CVS * */ /* * Japanese FEP type (returned by fep_init()) */ #define FEP_NONE 0 #define FEP_ASK68K 1 /* Nihongo FEP ASK68K on Human68k (SHARP X68000) */ #define NFEPS 2 /* Number of FEPs defined */ int fep_init(); void fep_term(); void fep_on(), fep_off(); void fep_force_on(), fep_force_off(); int fep_getmode(); ng-1.5beta1/sys/human68k/fileio.c100644 1750 1750 63235 7247657137 15416 0ustar amurausers/* $Id: fileio.c,v 1.9 2001/03/02 08:48:31 amura Exp $ */ /* * Human68k file I/O */ /* * $Log: fileio.c,v $ * Revision 1.9 2001/03/02 08:48:31 amura * now AUTOSAVE feature implemented almost all (except for WIN32 * * Revision 1.8 2001/02/18 19:29:03 amura * split dir.c to port depend/independ * * Revision 1.7 2001/01/05 13:55:27 amura * filename completion fixed * * Revision 1.6 2000/12/28 07:27:15 amura * homedirctory support with filename complition * * Revision 1.5 2000/12/27 16:55:42 amura * change d_makename() params for conservative reason, and bugfix in dires_() * * Revision 1.4 2000/12/14 18:10:47 amura * filename length become flexible * * Revision 1.3 2000/07/25 15:06:52 amura * handle Kanji filename of initfile * * Revision 1.2 2000/07/18 12:44:03 amura * fix to emacs style backup * * Revision 1.1.1.1 2000/06/27 01:47:57 amura * import to CVS * */ /* 90.11.09 Modified for Ng 1.2.1 Human68k by Sawayanagi Yosirou */ /* File I/O for MS-DOS */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include "def.h" #include #define A_RDONLY 0x01 #define A_HIDEN 0x02 #define A_SYSTEM 0x04 #define A_VOLNAME 0x08 #define A_DIR 0x10 #define A_NORMAL 0x20 static FILE *ffp; extern char *getenv(), *strncpy(); char *adjustname(); char *tounixfn(); char *toh68kfn(); /* * Open a file for reading. */ ffropen(fn) char *fn; { char fns[NFILEN]; strcpy(fns, fn); #ifdef KANJI bufetos(fns, strlen(fns)+1); #endif if ((ffp=fopen(fns, "r")) == NULL) return (FIOFNF); return (FIOSUC); } /* * Open a file for writing. * Return TRUE if all is well, and * FALSE on error (cannot create). */ ffwopen(fn) char *fn; { char fns[NFILEN]; strcpy(fns, fn); #ifdef KANJI bufetos(fns, strlen(fns)+1); #endif KANJI if ((ffp=fopen(fns, "w")) == NULL) { ewprintf("Cannot open file for writing"); return (FIOERR); } return (FIOSUC); } /* * Close a file. * Should look at the status. */ ffclose() { (VOID) fclose(ffp); return (FIOSUC); } /* * Write a buffer to the already * opened file. bp points to the * buffer. Return the status. * Check only at the newline and * end of buffer. */ ffputbuf(bp) BUFFER *bp; { register char *cp; register char *cpend; register LINE *lp; register LINE *lpend; #ifdef KANJI /* 90.01.29 by S.Yoshida */ register int kfio; #endif /* KANJI */ lpend = bp->b_linep; #ifdef KANJI /* 90.01.29 by S.Yoshida */ if (bp->b_kfio == NIL) ksetbufcode(bp); /* Set buffer local KANJI code. */ kfio = bp->b_kfio; #endif /* KANJI */ lp = lforw(lpend); do { cp = <ext(lp)[0]; /* begining of line */ cpend = &cp[llength(lp)]; /* end of line */ while(cp != cpend) { #ifdef KANJI /* 90.01.29 by S.Yoshida */ kputc(*cp, ffp, kfio); #else /* NOT KANJI */ putc(*cp, ffp); #endif /* KANJI */ cp++; /* putc may evalualte arguments more than once */ } #ifdef KANJI /* 90.01.29 by S.Yoshida */ if (kfio == JIS) { kfselectcode(ffp, FALSE); } #endif /* KANJI */ lp = lforw(lp); if(lp == lpend) break; /* no implied newline on last line */ putc('\n', ffp); } while(!ferror(ffp)); if(ferror(ffp)) { ewprintf("Write I/O error"); return FIOERR; } return FIOSUC; } /* * Read a line from a file, and store the bytes * in the supplied buffer. Stop on end of file or end of * line. When FIOEOF is returned, there is a valid line * of data without the normally implied \n. */ ffgetline(buf, nbuf, nbytes) register char *buf; register int nbuf; register int *nbytes; { register int c; register int i; i = 0; while((c = getc(ffp))!=EOF && c!='\n') { buf[i++] = c; if (i >= nbuf) return FIOLONG; } if (c == EOF && ferror(ffp) != FALSE) { ewprintf("File read error"); return FIOERR; } *nbytes = i; return c==EOF ? FIOEOF : FIOSUC; } #ifndef NO_BACKUP /* * Rename the file "fname" into a backup * copy. On Unix the backup has the same name as the * original file, with a "~" on the end; this seems to * be newest of the new-speak. The error handling is * all in "file.c". The "unlink" is perhaps not the * right thing here; I don't care that much as * I don't enable backups myself. */ fbackupfile(fn) char *fn; { #ifndef EMACS_BACKUP_STYLE /* 91.01.29 Sawayanagi Yosirou */ /* 90.07.26 by N.Kamei */ char oname[NFILEN]; char *nname; VOID strmfe(); (VOID) strcpy(oname, fn); toh68kfn(oname); #ifdef KANJI bufetos(oname, strlen(oname)+1); #endif if ((nname=alloca((unsigned)(strlen(fn)+4+1))) == NULL) { ewprintf("Can't get %d bytes", strlen(fn) + 5); return (ABORT); } strmfe(nname, oname, "bak"); (VOID) unlink(nname); /* Ignore errors. */ if (rename(oname, nname) < 0) return (FALSE); return (TRUE); #else char oname[NFILEN]; register char *nname; strcpy(oname,fn); toh68kfn(oname); #ifdef KANJI bufetos(oname, strlen(oname)+1); #endif /* KANJI */ if ((nname=alloca((unsigned)(strlen(oname)+1+1))) == NULL) { ewprintf("Can't get %d bytes", strlen(oname) + 1); return (ABORT); } (VOID) strcpy(nname, oname); (VOID) strcat(nname, "~"); (VOID) unlink(nname); /* Ignore errors. */ if (rename(oname, nname) < 0) return (FALSE); return (TRUE); #endif } #ifdef BUGFIX /* 90.02.16 by S.Yoshida */ #ifndef _STAT_H_ #include #define _STAT_H_ #endif /* _STAT_H_ */ /* * Get file mode of a file fn. */ fgetfilemode(fn) char *fn; { char fns[NFILEN]; #ifdef BUG_FIXED_CLIB struct stat filestat; #else struct FILBUF fi; #endif strcpy(fns, fn); #ifdef KANJI bufetos(fns, strlen(fns)+1); #endif KANJI #ifdef BUG_FIXED_CLIB if (stat(fns, &filestat) == 0) { return(filestat.st_mode & (S_IREAD | S_IWRITE)); } else { return(-1); } #else if (FILES(&fi, fns, A_NORMAL | A_DIR) < 0) return(-1); return ((fi.atr & A_RDONLY) ? S_IREAD : (S_IREAD | S_IWRITE)); #endif } /* * Set file mode of a file fn to the specified mode. */ VOID fsetfilemode(fn, mode) char *fn; int mode; { char fns[NFILEN]; strcpy(fns, fn); #ifdef KANJI bufetos(fns, strlen(fns)+1); #endif KANJI (VOID) chmod(fns, mode); } #endif /* BUGFIX */ #endif #ifdef READONLY /* 91.01.05 by S.Yoshida */ #ifndef _STAT_H_ #include #define _STAT_H_ #endif /* _STAT_H_ */ /* * Check whether file is read-only of a file fn. */ fchkreadonly(fn) char *fn; { #ifdef BUG_FIXED_CLIB struct stat filestat; #else struct FILBUF fi; #endif char fns[NFILEN]; strcpy(fns, fn); #ifdef KANJI bufetos(fns, strlen(fns)+1); #endif KANJI #ifdef BUG_FIXED_CLIB if (stat(fn, &filestat) == 0) { return(!(filestat.st_mode & S_IWRITE)); } else { return FALSE; } #else if (FILES(&fi, fn, A_NORMAL | A_DIR) < 0) return FALSE; return (fi.atr & A_RDONLY); #endif } #endif /* READONLY */ /* * getcwd() in XC version 1.0 doesn't work. * I suggest not to rely on version 2.0, to avoid confusion. * * getcwd() here is copied (and little modified) * from minsh's get_cwd(), original code by K.Maeda. * This works fine with either version of XC. * * 91.1.15 by K.Maeda */ /* * Getcwd gets the current drive together with the current * directory. Human68k's path delimiter character '\' is * converted to minsh's '/'. */ char *getcwd(cwd, len) char *cwd; int len; { register int drive; register char *s; char buf[NFILEN]; drive = CURDRV(); buf[0] = drive + 'a'; buf[1] = ':'; buf[2] = '/'; CURDIR(drive+1, &buf[3]); /* CURDIR() is a doscall of XC */ if (strlen(buf) > len-1) return NULL; strcpy(cwd, buf); return (cwd); } /* * The string "fn" is a file name. * Perform any required appending of directory name or case adjustments. * If NO_DIR is not defined, the same file should be refered to even if the * working directory changes. */ #ifndef NO_DIR #include extern char *wdir; extern char *startdir; static char cwd[NFILEN]; /* * Initialize anything the directory management routines need */ VOID dirinit() { if (!(wdir = tounixfn(getcwd(cwd, NFILEN - 1)))) panic("Can't get current directory!"); #ifdef KANJI bufstoe(wdir, strlen(wdir)+1); #endif if (startdir == NULL) { int len = strlen(cwd); startdir = malloc(len + 2); if (startdir == NULL) { ewprintf("Cannot alloc %d bytes", len + 2); return; } strcpy(startdir, cwd); } } /* * dirend routine */ VOID dirend() { rchdir(startdir); } /* rchdir() makes some effects to change directory. It will affect system to set the actual current directory to the specified one. This routine is extracted from changedir(), which is currently do some virtual chdir but previously do the actual one. Both bufc and wdir should have enough space to store file path, that is, as long as NFILEN. *** This function has not been completed *** By Tillanosoft, Mar 22, 1999 */ int rchdir(newdir) char *newdir; { char dir[NFILEN]; int i; strcpy(dir, newdir); #ifdef KANJI bufetos(dir, strlen(dir)+1); #endif i = strlen(dir) - 1; if (dir[i] == '\\' || dir[i] == '/') dir[i] = '\0'; if (dir[1] == ':' && dir[0] != wdir[0]) { int drive; drive = newdir[0]; /* 90.07.01 Change from TOUPPER() to TOLOWER() */ /* by S.Yoshida */ if (ISUPPER(drive)) drive = TOLOWER(drive); /* 90.07.01 Change from 'A' to 'a' by S.Yoshida */ drive = drive - 'a' + 1; if (CHGDRV(drive) <= drive) { drive = drive - 'a'; return(FALSE); } } if (dir[1] == ':') { if (dir[2] == '\0') { dirinit(); return 0; } else if (chdir(dir+2) == -1) return -1; } else if (chdir(dir) == -1) return -1; dirinit(); return 0; } #endif /* !NO_DIR */ char *adjustname(fn) register char *fn; { register char *cp; static char fnb[NFILEN]; char *p; char *endp; if (fn[0] == '\0') { strcpy (fnb, wdir); if (fnb[strlen (fnb) - 1] != '/' && fnb[strlen (fnb) - 1] != '\\') strcat (fnb, "/"); return (fnb); } #ifdef HOMEDIR else if (fn[0]=='~' && (fn[1]=='/' || fn[1]=='\\')) { strcpy(fnb, getenv("HOME")); while (*cp) { if (*cp == '\\') *cp = '/'; cp++; } fn++; } #endif endp = fn + strlen (fn) - 1; cp = fnb; for (p = endp; p > fn; p--) { if (*p == ':') { *cp++ = *(p - 1); *cp++ = *p; fn = p + 1; break; } } if (p == fn) #ifndef NO_DIR /* 91.01.22 NODIR -> NO_DIR. by S.Yoshida */ { *cp++ = wdir[0]; *cp++ = wdir[1]; } #else return (fn); /* punt */ #endif for (p = endp; p > fn; p--) { if ((*p == '/' || *p == '\\') && (*(p - 1) == '/' || *(p - 1) == '\\')) { fn = p; break; } } switch (*fn) { case '/': case '\\': *cp++ = *fn++; break; default: #ifndef NO_DIR /* 91.01.22 NODIR -> NO_DIR. by S.Yoshida */ if (fnb[0] == wdir[0]) /* in current drive */ { (VOID) strcpy(fnb, wdir); cp = fnb + strlen(fnb); } else /* change drives to get default directory */ { int drive; int ndrive; char *getcwd(); drive = fnb[0]; if (ISUPPER(drive)) { drive = TOLOWER(drive); } drive = drive - 'a'; if (CHGDRV(drive) <= drive || tounixfn(getcwd(fnb, NFILEN - 1)) == NULL) { cp = fnb; /* 90.07.01 Change from 'A' to 'a' by S.Yoshida */ *cp++ = drive + 'a'; *cp++ = ':'; } else { cp = fnb + strlen(fnb); } drive = wdir[0]; /* Reset to current drive. */ /* 90.07.01 Change from TOUPPER() to TOLOWER() */ /* by S.Yoshida */ if (ISUPPER(drive)) { drive = TOLOWER(drive); } /* 90.07.01 Change from 'A' to 'a' by S.Yoshida */ drive = drive - 'a'; if (CHGDRV(drive) <= drive) dirinit(); } break; #else return (fn); /* punt */ #endif } if(cp[-1] != '/' && cp[-1] != '\\') *cp++ = '/'; while (*fn) { switch (*fn) { case '.': switch (fn[1]) { case '\0': fn++; continue; case '/': case '\\': fn += 2; continue; case '.': if (fn[2] == '\\' || fn[2] == '/' || fn[2] == '\0') { if (cp[-2] != ':') { --cp; while (cp[-1] != '\\' && cp[-1] != '/') --cp; } if (fn[2] == '\0') fn += 2; else fn += 3; continue; } break; default: break; } break; case '/': case '\\': fn++; continue; default: break; } while (*fn) { *cp = *fn; if (*cp == '/' || *cp == '\\') { fn++; cp++; break; } fn++; cp++; } } if ((cp[-1] == '\\' || cp[-1] == '/') && cp[-2] != ':' && (*endp != '\\' && *endp != '/' && *endp != ':')) --cp; *cp = '\0'; return (fnb); } #ifndef NO_STARTUP #include /* * Find a startup file for the user and return its name. As a service * to other pieces of code that may want to find a startup file (like * the terminal driver in particular), accepts a suffix to be appended * to the startup file name. */ char * #ifdef ADDOPT startupfile(ngrcfile, suffix) char* ngrcfile; #else startupfile(suffix) #endif char *suffix; { register char *file; static char home[NFILEN]; char *getenv(); if ((file = getenv("NG")) == NULL) { if ((file = getenv("HOME")) == NULL) goto notfound; } if (strlen(file)+7 >= NFILEN - 1) goto notfound; (VOID) strcpy(home, file); #ifdef ADDOPT if (!ngrcfile) ngrcfile = getenv("NGRC"); if (ngrcfile) { if (access(ngrcfile, 0) == 0) { strncpy(home, ngrcfile, NFILEN); home[NFILEN-1] = '\0'; #ifdef KANJI bufstoe(home, strlen(home)+1); #endif return home; } /* strcat(home, "\\"); strcat(home, ngrcfile); if (access(home, 0) == 0) { #ifdef KANJI bufstoe(home, strlen(home)+1); #endif return home; (VOID)strcpy(home, file); */ } #endif #ifdef KANJI /* 90.02.10 by S.Yoshida */ (VOID) strcat(home, "\\ng.ini"); #else /* NOT KANJI */ (VOID) strcat(home, "\\mg.ini"); #endif /* KANJI */ if (suffix != NULL) { (VOID) strcat(home, "-"); (VOID) strcat(home, suffix); } if (access(home, 0) == 0) { #ifdef KANJI bufstoe(home, strlen(home)+1); #endif return home; } notfound: #ifdef STARTUPFILE (VOID) strcpy(home, STARTUPFILE); if (suffix != NULL) { (VOID) strcat(home, "-"); (VOID) strcat(home, suffix); } if (access(home, 0) == 0) { #ifdef KANJI bufstoe(home, strlen(home)+1); #endif return file; } #endif return NULL; } #endif #ifndef NO_DIRED #include #include "kbd.h" copy(frname, toname) char *frname, *toname; { char cmd[256]; char *ptr; char frnames[NFILEN]; char tonames[NFILEN]; strcpy(frnames, frname); strcpy(tonames, toname); #ifdef KANJI bufetos(frnames, strlen(frnames)+1); bufetos(tonames, strlen(tonames)+1); #endif sprintf(cmd, "copy %s %s > NUL", frnames, tonames); toh68kfn (cmd); return (system(cmd) == 0); } BUFFER *dired_(dirname) char *dirname; { register BUFFER *bp; BUFFER *findbuffer(); char **filelist, **getfilelist(); int numfiles; int i; if((dirname = adjustname(dirname)) == NULL) { ewprintf("Bad directory name"); return NULL; } if(dirname[strlen(dirname)-1] != '/' && dirname[strlen(dirname)-1] != '\\') (VOID) strcat(dirname, "/"); if((bp = findbuffer(dirname)) == NULL) { ewprintf("Could not create buffer"); return NULL; } if(bclear(bp) != TRUE) return FALSE; if ((filelist = getfilelist(&numfiles, dirname)) == NULL) { ewprintf("Could not get directory info"); return NULL; } for (i = 0; i < numfiles; i++) { (VOID) addline(bp, filelist[i]); free(filelist[i]); } free(filelist); bp->b_dotp = lforw(bp->b_linep); /* go to first line */ if(bp->b_fname != NULL) free(bp->b_fname); if((bp->b_fname=malloc(strlen(dirname+1))) != NULL) (VOID) strcpy(bp->b_fname, dirname); #ifdef EXTD_DIR if(bp->b_cwd != NULL) free(bp->b_cwd); bp->b_cwd = NULL; #endif if((bp->b_modes[0] = name_mode("dired")) == NULL) { bp->b_modes[0] = &map_table[0]; ewprintf("Could not find mode dired"); return NULL; } bp->b_nmodes = 0; return bp; } d_makename(lp, fn, buflen) register LINE *lp; register char *fn; { register char *cp; int len; if(llength(lp) <= 41) return ABORT; len = strlen(curbp->b_fname) + llength(lp) - 41; cp = malloc(len + 1); if (buflen <= len) return ABORT; cp = fn; strcpy(cp, curbp->b_fname); cp += strlen(cp); bcopy(&lp->l_text[41], cp, llength(lp) - 41); cp[llength(lp) - 41] = '\0'; return lgetc(lp, 2) == 'd'; } char ** getfilelist(numfiles, dirname) int *numfiles; char *dirname; { char **filelist; int maxfiles; struct FILBUF fileinfo; int i; char filename[NFILEN]; #ifdef KANJI char filenames[NFILEN]; #endif int filelinecmp(); void *calloc(), *realloc(); VOID mkfileline(); if (strlen(dirname) + 4 > NFILEN) return(NULL); (VOID) strcpy(filename, dirname); (VOID) strcat(filename, "*.*"); maxfiles = 50; filelist = (char **)calloc(maxfiles, sizeof(char *)); if (filelist == NULL) return(NULL); #ifdef KANJI strcpy(filenames, filename); bufetos(filenames, strlen(filenames) +1); if (FILES(&fileinfo, filenames, A_NORMAL | A_DIR) >= 0) #else if (FILES(&fileinfo, filename, A_NORMAL | A_DIR) >= 0) #endif { filelist[0] = (char *)calloc(80, 1); if (filelist[0] == NULL) { free(filelist); return(NULL); } mkfileline(filelist[0], &fileinfo); *numfiles = 1; while (NFILES(&fileinfo) >= 0) { if (*numfiles >= maxfiles) { filelist = (char **) realloc(filelist, sizeof(char *) * (maxfiles + 20)); if (filelist == NULL) return(NULL); maxfiles += 20; } filelist[*numfiles] = (char *)calloc(80, 1); if (filelist[*numfiles] == NULL) { for (i = 0; i < *numfiles; i++) { free(filelist[i]); } free(filelist); return(NULL); } mkfileline(filelist[*numfiles], &fileinfo); (*numfiles)++; } qsort(filelist, *numfiles, sizeof (char *), filelinecmp); return(filelist); } return(NULL); } VOID mkfileline(line, info) char *line; struct FILBUF *info; { int y; line[0] = line[1] = ' '; line[2] = (info->atr & A_DIR) ? 'd' : '-'; line[3] = 'r'; line[4] = (info->atr & A_RDONLY) ? '-' : 'w'; line[5] = '-'; line[6] = (info->atr & A_SYSTEM) ? 's' : '-'; (VOID) sprintf(&line[7], "%15ld", info->filelen); y = 1980 + ((info->date >> 9) & 0x7f); y -= (y > 1999) ? 2000 : 1900; (VOID) sprintf(&line[22], " %02d-%02d-%02d %02d:%02d ", y, (info->date >> 5) & 0x0f, info->date & 0x1f, (info->time >> 11) & 0x1f, (info->time >> 5) & 0x3f); (VOID) strcpy(&line[41], info->name); #ifdef KANJI (VOID) bufstoe(&line[41], strlen(&line[41])+1); #endif /* KANJI */ } filelinecmp(x, y) char **x, **y; { register char *xx, *yy; for (xx = &(*x)[41], yy = &(*y)[41]; *xx && *xx == *yy; xx++, yy++) {} return(*xx - *yy); } #endif #ifndef NO_DIRED /* 91.01.15 by K.Maeda */ #ifndef _STAT_H_ #include #define _STAT_H_ #endif /* _STAT_H_ */ /* * Check whether file "dn" is directory. */ ffisdir(dn) char *dn; { #ifdef BUG_FIXED_CLIB /* 91.01.26 by Masaru Oki */ struct stat filestat; #else struct FILBUF di; char pathbuf[NFILEN], *tmpnam; int len; #endif char dns[NFILEN]; strcpy(dns, dn); #ifdef KANJI bufetos(dns, strlen(dns)+1); #endif #ifdef BUG_FIXED_CLIB /* 91.01.26 by Masaru Oki */ if (stat(dns, &filestat) == 0) { return ((filestat.st_mode & S_IFDIR) == S_IFDIR); } else { return FALSE; } #else len = strlen(dns); if (!(len--)) return FALSE; if (dns[len] == '\\' || dns[len] == '/') { if (!len || (len == 2 && dns[1] == ':')) return TRUE; bcopy(dns, pathbuf, len); tmpnam = pathbuf; } else { tmpnam = dn; } if (FILES(&di, tmpnam, A_DIR) < 0) return FALSE; return (di.atr & A_DIR); #endif } #endif /* NO_DIRED */ #ifndef NO_FILECOMP /* 90.04.04 by K.Maeda */ /* 89.11.20 Original code is for X68K (Human68K). * 90.04.08 Modified for MS-DOS by S.Yoshida. * 90.05.30 Debuged by A.Shirahashi. * Find file names starting with name. * Result is stored in *buf, got from malloc(); * Return the number of files found, or * -1 of error occured. */ #define MALLOC_STEP 256 fffiles(name, buf) char *name, **buf; { char pathbuf[NFILEN], tmpnam[NFILEN]; #ifdef KANJI char pathbufs[NFILEN]; #endif char *cp, *dirpart, *nampart; struct FILBUF fileinfo; int n, len, size, dirpartlen, nampartlen; char *buffer; void *malloc(), *realloc(); #ifdef HOMEDIR char *home; int homelen; if(name[0] == '~' && (name[1]=='/' || name[1]=='\\') && (home = getenv("HOME"))) { homelen = strlen(home) - 1; strncpy(pathbuf, home, sizeof(pathbuf)); pathbuf[NFILEN-1] = '\0'; strncat(pathbuf, &name[1], sizeof(pathbuf)-strlen(pathbuf)-1); } else { home = NULL; homelen = 0; strncpy(pathbuf, name, sizeof(pathbuf)); pathbuf[NFILEN-1] = '\0'; } #else strncpy(pathbuf, name, sizeof(pathbuf)); pathbuf[NFILEN-1] = '\0'; #endif dirpart = NULL; for (cp = pathbuf; *cp; cp++) { if (*cp == '/' || *cp == '\\' || *cp == ':') { dirpart = cp; } } if (dirpart) { *++dirpart = '\0'; dirpartlen = dirpart - pathbuf; } else { *pathbuf = '\0'; dirpartlen = 0; } #ifdef HOMEDIR nampart = name + dirpartlen - homelen + 1; #else nampart = name + dirpartlen; #endif nampartlen = strlen(nampart); buffer = malloc(MALLOC_STEP); if (buffer == NULL) return (-1); size = MALLOC_STEP; len = 0; n = 0; (VOID) strcat(pathbuf, "*.*"); #ifdef KANJI strcpy(pathbufs, pathbuf); bufetos(pathbufs, strlen(pathbufs)+1); if (FILES(&fileinfo, pathbufs, A_NORMAL | A_DIR) < 0) #else if (FILES(&fileinfo, pathbuf, A_NORMAL | A_DIR) < 0) #endif { *buf = buffer; buffer[0] = '\0'; return (0); } do { register int l; if (strncmp(nampart, fileinfo.name, nampartlen) != 0) continue; /* case-sensitive comparison */ strncpy(tmpnam, pathbuf, dirpartlen); strcpy(tmpnam + dirpartlen, fileinfo.name); #ifdef KANJI bufstoe(tmpnam + dirpartlen, strlen(tmpnam+dirpartlen)+1); #endif if (fileinfo.atr & A_DIR) strcat(tmpnam, "/"); l = strlen(tmpnam) + 1; if (l > 3 && (stricmp(&tmpnam[l - 3], ".o") == 0 || stricmp(&tmpnam[l - 3], ".x") == 0 || stricmp(&tmpnam[l - 3], ".r") == 0 || stricmp(&tmpnam[l - 3], ".z") == 0)) continue; if (l + len >= size) { /* make room for double null */ if ((buffer = realloc(buffer, size += MALLOC_STEP)) == NULL) return(-1); } #ifdef HOMEDIR if(home) { strcpy(buffer+len, "~"); strcat(buffer+len, tmpnam+homelen+1); l -= homelen; } else #endif strcpy(buffer + len, tmpnam); len += l; n++; } while (NFILES(&fileinfo) >= 0); *buf = buffer; buffer[len] = '\0'; return(n); } #endif /* NO_FILECOMP */ /* This function changes file name into unix style's */ char * tounixfn(name) char *name; { register char *p; if ((p = name) == NULL) return (NULL); while(*p != '\0') { if (*p == '\\') { *p = '/'; } else if (*(p + 1) == ':') { if (ISUPPER(*p)) { *p = TOLOWER(*p); } } p++; } return(name); } char * toh68kfn (name) char *name; { register char *p; if ((p = name) == NULL) return (NULL); while(*p != '\0') { if (*p == '/') { *p = '\\'; } else if (*(p + 1) == ':') { if (ISLOWER(*p)) { *p = TOUPPER(*p); } } p++; } return(name); } #ifdef NEW_COMPLETE /* 90.12.10 Sawayanagi Yosirou */ char * file_name_part (s) char *s; { int i; for (i = strlen (s); i > 0; i--) { if (s[i - 1] == '/' || s[i - 1] == '\\' || s[i - 1] == ':') break; } return (s + i); } char * copy_dir_name (d, s) char *d; char *s; { int i; i = file_name_part (s) - s; strncpy (d, s, i); d[i] = '\0'; return (d); } #endif /* NEW_COMPLETE */ #ifdef AUTOSAVE VOID autosave_name(buff, name, buflen) char* buff; char* name; { strcpy(buff, name); if (strlen(name)) { char *fn = rindex(name, '/'); if (fn == NULL) fn = rindex(name, '\\'); if (fn == NULL) fn = rindex(name, ':'); if (fn == NULL){ fn = buff; } else { fn++; } strcpy(&buff[strlen(buff)-strlen(fn)], "#"); strcat(buff, fn); strcat(buff, "#"); } } #endif /* AUTOSAVE */ ng-1.5beta1/sys/human68k/h68kfncmp.c100644 1750 1750 1356 7126003715 15706 0ustar amurausers/* $Id: h68kfncmp.c,v 1.1.1.1 2000/06/27 01:47:57 amura Exp $ */ /* * Human68k file name comparison */ /* * $Log: h68kfncmp.c,v $ * Revision 1.1.1.1 2000/06/27 01:47:57 amura * import to CVS * */ /* 90.11.14 Created for Ng 1.2.1 Human68k by Sawayanagi Yosirou */ #include "def.h" int h68kfncmp (s1, s2) char *s1; char *s2; { int c1; int c2; while (*s1 != '\0' && *s2 != '\0') { c1 = *s1++; c2 = *s2++; if (ISUPPER (c1)) c1 = TOLOWER (c1); else if (c1 == '\\') c1 = '/'; if (ISUPPER (c2)) c2 = TOLOWER (c2); else if (c2 == '\\') c2 = '/'; if (c1 != c2) return (c1 - c2); } if (*s1 == '\0' && *s2 == '\0') return (0); return (*s1 - *s2); } ng-1.5beta1/sys/human68k/hentrap.s100644 1750 1750 2424 7126003715 15560 0ustar amurausers* $Id: hentrap.s,v 1.1.1.1 2000/06/27 01:47:57 amura Exp $ * * Public Domain Software * * * Written by Masatoshi Yoshizawa (Yoz.) for GAPO jstevie Human68k * Added abort trap by Sawayanagi Yosirou * * $Log: hentrap.s,v $ * Revision 1.1.1.1 2000/06/27 01:47:57 amura * import to CVS * .globl _hentrap,_iskmode .text _hentrap: tst.l 4(SP) beq hentrap0 clr.l -(sp) move.l #1,-(sp) dc.w $ff22 * KNJCTRL(1,0) addq.l #8,sp clr.l henflag pea hentrapmain(pc) move.w #$ff18,-(sp) dc.w $ff25 * intvcs addq.l #6,sp move.l d0,oldvect pea aborthentrap move.w #$fff2,-(sp) dc.w $ff25 * intvcs addq.l #6,sp move.l d0,abortvect rts hentrap0: move.l abortvect,-(sp) move.w #$fff2,-(sp) dc.w $ff25 * intvcs addq.l #6,sp move.l oldvect,-(sp) move.w #$ff18,-(sp) dc.w $ff25 * intvcs addq.l #6,sp rts _iskmode: move.l henflag,d0 rts hentrapmain: move.w (A6),D0 beq henopen * mode window open cmp.w #3,D0 beq henclose * mode window close hencont: move.l oldvect,A0 jmp (A0) henopen: move.l #-1,henflag bra hencont henclose: clr.l henflag bra hencont aborthentrap: bsr hentrap0 move.l abortvect,A0 jmp (A0) .bss henflag: ds.l 1 oldvect: ds.l 1 abortvect: ds.l 1 .end ng-1.5beta1/sys/human68k/objlist100644 1750 1750 576 7126003715 15312 0ustar amurausersbasic.o cmode.o dir.o dired.o file.o line.o match.o paragraph.o random.o region.o search.o shell.o version.o window.o word.o buffer.o complt.o display.o echo.o extend.o help.o kbd.o keymap.o macro.o main.o modes.o regex.o re_search.o kanji.o kinsoku.o cinfo.o spawn.o ttyio.o tty.o ttykbd.o fileio.o sysinit.o dosutil.o h68kfncmp.o termcap.o fepctrl.o hentrap.o skg.o jump.o undo.o ng-1.5beta1/sys/human68k/spawn.c100644 1750 1750 6666 7126003715 15243 0ustar amurausers/* $Id: spawn.c,v 1.1.1.1 2000/06/27 01:47:57 amura Exp $ */ /* * Spawn CLI for Human68k */ /* * $Log: spawn.c,v $ * Revision 1.1.1.1 2000/06/27 01:47:57 amura * import to CVS * */ /* 90.11.10 Modified for Ng 1.2.1 Human68k by Sawayanagi Yosirou */ /* 90.02.11 Modified for Ng 1.0 MS-DOS ver. by S.Yoshida */ /* Spawn CLI for UNIX System V */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include "def.h" #include #include char *shellp = NULL; /* Saved "SHELL" name. */ extern char *getenv(); /* * On Human68k, we no gots job control, so always run * a subshell using spawn. Bound to "C-C", and used * as a subcommand by "C-Z". * * Returns 0 if the shell executed OK, something else if * we couldn't start shell or it exited badly. */ /*ARGSUSED*/ spawncli(f, n) { register void (*oisig)(); int status; #ifdef EXTD_DIR ensurecwd(); #endif if (shellp == NULL) { shellp = getenv("SHELL"); if (shellp == NULL) shellp = getenv("shell"); if (shellp == NULL) shellp = "command.x"; /* Safer. */ } ttcolor(CTEXT); ttnowindow(); ttmove(nrow-1, 0); if (epresf != FALSE) { tteeol(); epresf = FALSE; } ttclose(); sgarbf = TRUE; /* Force repaint. */ oisig = signal(SIGINT, SIG_IGN); #ifdef EXTD_DIR dirend(); #endif if (spawnlp(P_WAIT, shellp, shellp, NULL) == -1) { status = FALSE; } else { status = TRUE; } (VOID) signal(SIGINT, oisig); ttopen(); if(status == FALSE) { ewprintf("Failed to run %s", shellp); sleep(2); /* Show this message for 2 sec */ /* before refresh screen. */ } dirinit(); return (status); } #ifndef NO_SHELL /* 91.01.10 by K.Maeda */ char temp_file[128]; /* * Call process in subshell. * Execute COMMAND binding standard input to file INPUT. * NULL as INPUT means standard input should be bound to * /dev/null or whatever equivalent in your OS. * All output during the execution (including standard error output) * should go into a scratch file, whose name call_process() returns. * Return value NULL means error in some stage of the execution. * In that case, scratch file should be deleted. */ char * call_process(command, input) char *command; char *input; { char buf[256]; char *tmp; int ostdin, ostdout, ostderr, in, out, s; extern char *mktemp(); char *temp_path; temp_path = getenv("TMP"); if (temp_path == NULL) temp_path = getenv("tmp"); if (temp_path == NULL) temp_path = getenv("TEMP"); if (temp_path == NULL) temp_path = getenv("temp"); tmp = temp_file; if (temp_path && *temp_path) { while (*tmp = *temp_path++) { tmp++; } if (tmp[-1] != '/' && tmp[-1] != '\\') { *tmp++ = '/'; } } strcpy(tmp, "ngXXXXXX"); if ((tmp = mktemp(temp_file)) == NULL) { return NULL; } if ((in = open(input ? input : "nul", 1)) < 0) { return NULL; } if ((out = creat(tmp, 0x20)) < 0) { close(in); return NULL; } ostdin = dup(0); ostdout = dup(1); ostderr = dup(2); if (ostdin < 0 || ostdout < 0 || ostderr < 0) { s = -1; goto skip; } dup2(in, 0); dup2(out, 1); dup2(out, 2); strcpy(buf, command); #ifdef EXTD_DIR ensurecwd(); #endif s = system(buf); close(in); close(out); dup2(ostdin, 0); dup2(ostdout, 1); dup2(ostderr, 2); skip: close(ostdin); close(ostdout); close(ostderr); if (s == -1) { unlink(tmp); return NULL; } return tmp; } #endif /* NO_SHELL */ ng-1.5beta1/sys/human68k/sysdef.h100644 1750 1750 4165 7244021200 15373 0ustar amurausers/* $Id: sysdef.h,v 1.3 2001/02/18 19:29:04 amura Exp $ */ /* * Human68k system definitions */ /* * $Log: sysdef.h,v $ * Revision 1.3 2001/02/18 19:29:04 amura * split dir.c to port depend/independ * * Revision 1.2 2000/12/14 18:10:46 amura * filename length become flexible * * Revision 1.1.1.1 2000/06/27 01:47:57 amura * import to CVS * */ /* 90.11.10 Modified for Ng 1.2.1 Human68k by Sawayanagi Yosirou */ /* MS-DOS system definitions */ #include /* #include need to use memcpy(). but defined in def.h */ #define KBLOCK 1024 /* Kill grow. */ #define GOOD 0 /* Good exit status. */ #ifndef NO_SHELL /* 91.01.10 by K.Maeda */ #define CMDLINELENGTH NFILEN /* Maximum length of shell command. */ #endif /* NO_SHELL */ #define NO_RESIZE /* Screen size is constant. */ #define BSMAP TRUE /* Bs map feature can use. */ /* (default mode is bsmap on) */ #define MAKEBACKUP FALSE /* Making backup file is off. */ #define LOCAL_VARARGS typedef long RSIZE; /* Type for file/region sizes */ typedef short KCHAR; /* Type for internal keystrokes */ /* * Macros used by the buffer name making code. * Start at the end of the file name, scan to the left * until BDC1 (or BDC2, if defined) is reached. The buffer * name starts just to the right of that location, and * stops at end of string (or at the next BDC3 character, * if defined). BDC2 and BDC3 are mainly for VMS. */ #define BDC1 '/' /* Buffer names. */ #define BDC2 '\\' /* Buffer names. */ /* Grab memory as much as possible */ #define SYSINIT sysinit() #define MALLOCROUND(m) (m+=7,m&=~7) /* round up to 8 byte boundry */ #define bcopy(s,d,n) memcpy(d,s,n) /* copy memory area. */ #define bzero(s,n) memset(s,0,n) /* 91.01.21 Add by H.Kaneko. */ #define bcmp(s,d,n) memcmp(s,d,n) /* 91.02.04 Add by Y.Nimura. */ /* 91.02.04 strncmp -> memcmp */ /* by S.Yoshida */ #define fncmp h68kfncmp /* file name comparison */ #define unlinkdir(fn) rmdir(fn) /* unlink directory */ char *getenv(); #define gettermtype() getenv("TERM") /* determine terminal type */ #ifdef __GNUC__ #define alloca __builtin_alloca #endif ng-1.5beta1/sys/human68k/sysinit.c100644 1750 1750 740 7126003715 15560 0ustar amurausers/* $Id: sysinit.c,v 1.1.1.1 2000/06/27 01:47:57 amura Exp $ */ /* * Human68k systems initialization */ /* * $Log: sysinit.c,v $ * Revision 1.1.1.1 2000/06/27 01:47:57 amura * import to CVS * */ /* 90.11.09 Created for Ng 1.2.1 Human68k by Sawayanagi Yosirou */ #include sysinit() { #ifndef FLEX_MALLOC /* 91.01.20 by K.Maeda */ size_t max_size; if ((max_size = chkml ()) == 0) return (-1); return (sbrk (max_size / 2) == (char *)-1); #endif } ng-1.5beta1/sys/human68k/termcap100644 1750 1750 1207 7126003716 15310 0ustar amurausers#------------------------------------------------------------------------ # X68000: SHARP X68000 #------------------------------------------------------------------------ x68000|x68k|tsterm|Sharp X68000:\ :co#96:li#31:cl=\E[;H\E[2J:am:bs:cm=\E[%i%d;%dH:\ :nd=\E[C:up=\E[A:ce=\E[0K:cd=\E[0J:\ :so=\E[7m:se=\E[m:us=\E[4m:ue=\E[m:\ :cr=^M:do=^J:nl=^J:bl=^G:it=8\ :le=\E[D:md=\E[1m:mr=\E[7m:mb=\E[5m:me=\E[m:\ :is=\E[1;30r\E[30;1H:\ :kb=^H:\ :al=\E[1L:dl=\E[1M:AL=\E[%dL:DL=\E[%dM\ :PU=\ES:PD=\ET:PL=\EU:PR=\EV:\ :kh=\E[H:pt:sr=\EM:\ :CO=\E[>5l:CF=\E[>5h:GS=\E)3:GE=\E)0:\ :GV=\226:GH=\225:GU=\220:GD=\221:G1=\231:G2=\230:G3=\232:G4=\233: ng-1.5beta1/sys/human68k/ttyio.c100644 1750 1750 23365 7630440452 15301 0ustar amurausers/* $Id: ttyio.c,v 1.6.2.1 2003/03/02 17:36:42 amura Exp $ */ /* * Human68k terminal I/O */ /* * $Log: ttyio.c,v $ * Revision 1.6.2.1 2003/03/02 17:36:42 amura * add #include * * Revision 1.6 2001/03/09 15:53:14 amura * enable to really work autosave feature * * Revision 1.5 2001/03/02 08:48:31 amura * now AUTOSAVE feature implemented almost all (except for WIN32 * * Revision 1.4 2001/01/20 15:48:46 amura * very big terminal supported * * Revision 1.3 2001/01/05 14:07:07 amura * first implementation of Hojo Kanji support * * Revision 1.2 2000/07/20 12:41:56 amura * enable to use XF1/2 key as META * * Revision 1.1.1.1 2000/06/27 01:47:57 amura * import to CVS * */ /* 90.11.09 Modified for Ng 1.2.1 Human68k by Sawayanagi Yosirou */ /* 90.02.11 Modified for Ng 1.0 MS-DOS ver. by S.Yoshida */ /* Terminal I/O for BSD UNIX */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include "def.h" #include #include #include #define RAW_MODE 0x20 #define COOKED_MODE 0x00 #define NOBUF 512 #define FNCKEY_DEL 24 #define FNCKEY_LEFT 26 #define FNCKEY_RIGHT 27 #define FNCKEY_UP 25 #define FNCKEY_DOWN 28 #define FNCKEY_ROLLUP 21 #define FNCKEY_ROLLDN 22 #define FNCKEY_HOME 31 #define FNCKEY_UNDO 32 short ospeed = 13; /* We think 9600 bps is used. */ int nrow; /* Terminal size, rows. */ int ncol; /* Terminal size, columns. */ static char obuf[NOBUF]; /* Output buffer. */ static int nobuf = 0; static int stdinstat; /* stdin IOCTRL status. */ static unsigned char fnckeybuf[9][6]; /* buffer for function keys */ #ifdef FEPCTRL /* 90.11.26 by K.Takano */ static int fepctrl = FALSE; /* FEP control enable flag */ static int fepmode = TRUE; /* now FEP mode */ static int fepforce = 0; /* force FEP to mode */ #endif /* * This function gets called once, to set up * the terminal channel. */ ttopen() { register char *tv_stype; char *getenv(), tcbuf[1024], err_str[72]; /* do this the REAL way */ if ((tv_stype = getenv("TERM")) == NULL) { puts("Environment variable TERM not defined!"); exit(1); } if((tgetent(tcbuf, tv_stype)) != 1) { (void) sprintf(err_str, "Unknown terminal type %s!", tv_stype); puts(err_str); exit(1); } if (ttraw() == FALSE) panic("aborting due to terminal initialize failure"); #ifdef ADDFUNC /* 90.02.14 by S.Yoshida */ #ifdef SIGWINCH /* 90.02.13 by S.Yoshida */ (void) signal(SIGWINCH, ttwinch); #endif /* SIGWINCH */ #endif /* ADDFUNC */ #ifdef FEPCTRL /* 90.11.26 by K.Takano */ fepmode_init(); #endif } /* * This function sets the terminal to RAW mode, as defined for the current * shell. This is called both by ttopen() above and by spawncli() to * get the current terminal settings and then change them to what * Ng expects. Thus, stty changes done while spawncli() is in effect * will be reflected in Ng. */ ttraw() { if ((stdinstat = IOCTRLGT(0)) < 0) { ewprintf("ttopen can't get IOCTRL status"); return(FALSE); } if (IOCTRLST(0, RAW_MODE) < 0) return(FALSE); setttysize(); assignkey(); return(TRUE); } /* * This function gets called just * before we go back home to the shell. Put all of * the terminal parameters back. * Under Human68k this just calls ttcooked(), but the ttclose() hook is in * because vttidy() in display.c expects it for portability reasons. */ ttclose() { if (ttcooked() == FALSE) panic(""); /* ttcooked() already printf'd */ #ifdef FEPCTRL /* 90.11.26 by K.Takano */ fepmode_term(); #endif } /* * This function restores all terminal settings to their default values, * in anticipation of exiting or suspending the editor. */ ttcooked() { ttflush(); if (IOCTRLST(0, stdinstat) < 0) { ewprintf("ttclose can't set IOCTRL status"); return(FALSE); } cancelkey(); return(TRUE); } /* * Assign Human68k special keys to use Ng. */ assignkey() { unsigned char buf[6]; /* Assign Del key to DEL. */ FNCKEYGT (FNCKEY_DEL, fnckeybuf[0]); buf[0] = '\177'; buf[1] = '\0'; FNCKEYST (FNCKEY_DEL, buf); /* Assign <- key to C-b. */ FNCKEYGT (FNCKEY_LEFT, fnckeybuf[1]); buf[0] = '\002'; buf[1] = '\0'; FNCKEYST (FNCKEY_LEFT, buf); /* Assign -> key to C-f. */ FNCKEYGT (FNCKEY_RIGHT, fnckeybuf[2]); buf[0] = '\006'; buf[1] = '\0'; FNCKEYST (FNCKEY_RIGHT, buf); /* Assign up-arrow key to C-p. */ FNCKEYGT (FNCKEY_UP, fnckeybuf[3]); buf[0] = '\020'; buf[1] = '\0'; FNCKEYST (FNCKEY_UP, buf); /* Assign down-arrow key to C-n. */ FNCKEYGT (FNCKEY_DOWN, fnckeybuf[4]); buf[0] = '\016'; buf[1] = '\0'; FNCKEYST (FNCKEY_DOWN, buf); /* Assign Roll-Up key to M-v. */ FNCKEYGT (FNCKEY_ROLLUP, fnckeybuf[5]); buf[0] = '\033'; buf[1] = '\166'; buf[2] = '\0'; FNCKEYST (FNCKEY_ROLLUP, buf); /* Assign Roll-Dn key to C-v. */ FNCKEYGT (FNCKEY_ROLLDN, fnckeybuf[6]); buf[0] = '\026'; buf[1] = '\0'; FNCKEYST (FNCKEY_ROLLDN, buf); /* Assign Home key to M-<. */ FNCKEYGT (FNCKEY_HOME, fnckeybuf[7]); buf[0] = '\033'; buf[1] = '\074'; buf[2] = '\0'; FNCKEYST (FNCKEY_HOME, buf); /* Assign Ins key to M->. */ FNCKEYGT (FNCKEY_UNDO, fnckeybuf[8]); buf[0] = '\033'; buf[1] = '\076'; buf[2] = '\0'; FNCKEYST (FNCKEY_UNDO, buf); } /* * Cancel Human68k special key assign. */ cancelkey() { FNCKEYST (FNCKEY_DEL, fnckeybuf[0]); FNCKEYST (FNCKEY_LEFT, fnckeybuf[1]); FNCKEYST (FNCKEY_RIGHT, fnckeybuf[2]); FNCKEYST (FNCKEY_UP, fnckeybuf[3]); FNCKEYST (FNCKEY_DOWN, fnckeybuf[4]); FNCKEYST (FNCKEY_ROLLUP, fnckeybuf[5]); FNCKEYST (FNCKEY_ROLLDN, fnckeybuf[6]); FNCKEYST (FNCKEY_HOME, fnckeybuf[7]); FNCKEYST (FNCKEY_UNDO, fnckeybuf[8]); } /* * Write character to the display. * Characters are buffered up, to make things * a little bit more efficient. */ ttputc(c) int c; { if (nobuf >= NOBUF) ttflush(); obuf[nobuf++] = c; } /* * Now ttflush() isn't needed. But some function call this, * so here is dummy. */ ttflush() { int i; for (i = 0; i < nobuf; i++) { if (obuf[i] == 0x0a) B_PUTC (0x0d); B_PUTC (obuf[i] & 0xff); } nobuf = 0; } #ifdef KANJI /* 90.02.05 by S.Yoshida */ static int nkey = 0; /* The number of ungetc charactor. */ static int keybuf[4]; /* Ungetc charactors. */ #endif /* KANJI */ /* * Read character from terminal. * All 8 bits are returned, so that you can use * a multi-national terminal. */ ttgetc() { int c; /* Process OPT.1/OPT.2 as a META key. * 89.??.?? by M.Kondo * 91.01.14 by K.Maeda */ register int shifts; #ifdef DO_METAKEY extern int use_metakey; /* set in the generic kbd.c */ #endif #ifndef CTRL # define SHIFT (0x01) # define CTRL (0x02) # define OPT1 (0x04) # define OPT2 (0x08) # define CAPSLOCK (0x80) #endif /* CTRL */ #ifndef XF1_3GROUP # define XF1_3GROUP (0x0A) # define XF1 (0x20 << 16) # define XF2 (0x40 << 16) # define XF3 (0x80 << 16) #endif /* XF1_3GROUP */ #ifdef KANJI /* 90.02.05 by S.Yoshida */ if (nkey > 0) { return(keybuf[--nkey]); } /* 91.01.14 by K.Maeda ---remove else */ #endif /* KANJI */ #ifdef AUTOSAVE while (!kbhit()) autosave_handler(); /* this is polling */ #endif c = FGETC (1); shifts = K_SFTSNS() & 0xFFFF; shifts |= K_KEYBIT(XF1_3GROUP)<<16; if (c == ' ' && (shifts & CTRL)) c = 0; #ifdef DO_METAKEY else if (use_metakey == TRUE && (shifts & (OPT1|OPT2|XF1|XF2))) return ((KCHAR)(c | METABIT)); #endif /* DO_METAKEY */ return ((KCHAR)c); } #ifdef KANJI /* 90.02.05 by S.Yoshida */ /* * Save pre-readed char to read again. */ ttungetc(c) int c; { keybuf[nkey++] = c; } #endif /* KANJI */ /* * set the tty size. */ setttysize() { if ((nrow=tgetnum ("li")) <= 0 || (ncol=tgetnum ("co")) <= 0) { nrow = 32; ncol = 96; } } /* * typeahead returns TRUE if there are characters available to be read * in. */ typeahead() { #ifdef KANJI /* 90.02.05 by S.Yoshida */ if (nkey > 0) { return(TRUE); } #endif /* KANJI */ #ifdef FEPCTRL if (fep_get_mode()) /* This hack for ASK68k */ return(FALSE); #endif return (kbhit ()); } /* * panic - just exit, as quickly as we can. */ panic(s) char *s; { (void) fputs("panic: ", stderr); (void) fputs(s, stderr); (void) fputc('\n', stderr); (void) fflush(stderr); abort(); /* To leave a core image. */ } #ifndef NO_DPROMPT /* * A program to return TRUE if we wait for 1 seconds without anything * happening, else return FALSE. */ int ttwait() { int start; int lap; #ifdef KANJI /* 90.02.05 by S.Yoshida */ if (nkey > 0) { return(FALSE); } #endif /* KANJI */ start = ONTIME(); lap = 0; while (lap < 100) { if (kbhit()) { return(FALSE); } lap = ONTIME() - start; if (lap < 0) lap += 8640000; } return(TRUE); } #endif #ifdef FEPCTRL /* 90.11.26 by K.Takano */ fepmode_init() { if (fepctrl) fep_init(); } fepmode_term() { if (fepctrl) fep_term(); } fepmode_on() { if (fepctrl) { if (fepforce) { if (fepforce == 1) fep_force_on(); else fep_force_off(); fepforce = 0; fepmode = TRUE; } else if (!fepmode) { fep_on(); fepmode = TRUE; } } } fepmode_off() { if (fepctrl && fepmode) { fep_off(); fepmode = FALSE; } } fepmode_toggle() { if (fepctrl) { if (fep_get_mode()) fepforce = -1; else fepforce = 1; return (TRUE); } return (FALSE); } fepmode_set(f, n) { register int s; char buf[NFILEN]; if (f & FFARG) { n = (n > 0); } else { if ((s = ereply("FEP Control: ", buf, NFILEN)) != TRUE) return (s); if (ISDIGIT(buf[0]) || buf[0] == '-') n = (atoi(buf) > 0); else if (buf[0] == 't' || buf[0] == 'T') n = TRUE; else /* if (buf[0] == 'n' || buf[0] == 'N') */ n = FALSE; } if (!fepctrl && n) { fep_init(); fepmode = TRUE; } else if (fepctrl && !n) fep_term(); fepctrl = n; return (TRUE); } fepmode_chg(f, n) { if (fepctrl = !fepctrl) { fep_init(); fepmode = TRUE; } else fep_term(); return (TRUE); } #endif /* FEPCTRL */ #ifdef AUTOSAVE VOID itimer(func, sec) { /* VDISPST */ } #endif /* AUTOSAVE */ ng-1.5beta1/sys/msdos/ 40755 1750 1750 0 7642273645 13336 5ustar amurausersng-1.5beta1/sys/msdos/alloca.asm100644 1750 1750 3715 7126003716 15361 0ustar amurausers; $Id: alloca.asm,v 1.1.1.1 2000/06/27 01:47:58 amura Exp $ ;------------------------------------------------------------- ; alloca.asm: void * alloca(int) for Turbo-C 2.0 ; ; CAUTION: ; * Standard stack frame is required in caller function ; You had better use -k (Standard stack frame) option. ; ; $Header: /var/cvsroot/ng/sys/msdos/alloca.asm,v 1.1.1.1 2000/06/27 01:47:58 amura Exp $ ;------------------------------------------------------------- ; $Log: alloca.asm,v $ ; Revision 1.1.1.1 2000/06/27 01:47:58 amura ; import to CVS ; include rules.asi Header@ CSeg@ PubProc@ alloca, __CDECL__ pop cx ;retrun address if LPROG pop dx ;;return segment endif pop ax ;argument or ax, ax ;test if 0 jz eret ;no allocation required inc ax ; and al, 0FEh ;force Even mov bx, sp ;caller function stack position sub bx, ax ;get space jc eret ;under flow! if LDATA ExtSym@ _stklen, word, __CDECL__ cmp bx, 12 ;;12 bytes use later jc eret ;; ; ifdef __HUGE__ ;; old! ; mov ax, seg _stklen@ ; mov es, ax ;; ; mov ax, word ptr es:_stklen@ ; else ;; mov ax, word ptr DGROUP:_stklen@ cmp ax, bx ;; jb eret ;; else ;; ExtSym@ __brklvl, word, __CDECL__ mov ax, word ptr DGROUP:__brklvl@ add ax, 10 ;; 12 bytes usr later cmp ax, bx ;; jnc eret ;; endif ;; mov ax, bx ; <- pointer to allocated memory xchg sp, bx ; sp <- new pos / bx <- old pos push ss:[bx+4] ; for safe.. push ss:[bx+2] ; for DI (may be) push ss:[bx+0] ; for SI (may be) if LPROG mov bx, dx ;;save return segment endif if LDATA mov dx, ss ;;allocated mem segment address endif ;; goback: push ax ; restore argument space if LPROG ;; push bx ;;restor return segment endif ;; push cx ; restore return address ret ; bye-be eret: xor ax, ax ; NULL if LPROG ;; mov bx, dx ;;save return segment endif ;; if LDATA ;; mov dx, ax ;;NULL endif ;; jmp short goback ; EndProc@ alloca, __CDECL__ CSegEnd@ end ng-1.5beta1/sys/msdos/dosutil.c100644 1750 1750 2644 7126003716 15253 0ustar amurausers/* $Id: dosutil.c,v 1.1.1.1 2000/06/27 01:47:58 amura Exp $ */ /* * UNIX like functions for MS-DOS. * * Coded by Shigeki Yoshida (shige@csk.CO.JP) */ /* * $Log: dosutil.c,v $ * Revision 1.1.1.1 2000/06/27 01:47:58 amura * import to CVS * */ /* 90.02.11 Created for Ng 1.0 MS-DOS ver. by S.Yoshida */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include #ifndef __TURBOC__ /* 90.03.23 by A.Shirahashi */ /* 90.03.24 Modified by S.Yoshida * In old version (Ng 1.1), I used difftime() function to check * sleeping time. But, it returns double floating point value type, * and execute file was too big. So I change this function to not * use difftime(). This new sleep() use syssec() that was in a * ttyio.c. And move syssec() from ttyio.c to this dosutil.c file. */ sleep(sec) int sec; { register int s, ss, se; se = (ss = syssec()) + sec * 100; do { s = syssec(); if (se >= 6000 && s < ss) { se -= 6000; } } while (s < se); } #endif /* __TURBOC__ */ /* * Get system time, and return (second * 100) value. */ syssec() { union REGS regs; regs.h.ah = 0x2c; intdos(®s, ®s); return(regs.h.dh * 100 + regs.h.dl); } #ifdef REGEX bcmp(s1, s2, len) register char *s1; register char *s2; register int len; { while (len--) { if (*s1++ != *s2++) { return(1); } } return(0); } bzero(s, len) register char *s; register int len; { while (len--) { *s++ = 0; } } #endif /* REGEX */ ng-1.5beta1/sys/msdos/fepctrl.c100644 1750 1750 106521 7126003716 15266 0ustar amurausers/* $Id: fepctrl.c,v 1.1.1.1 2000/06/27 01:47:58 amura Exp $ */ /* * fepctrl.c 1.5 1992/04/08. Public Domain. * * General purpose Japanese FEP control routines for MS-DOS. * Written by Junn Ohta (ohta@src.ricoh.co.jp, msa02563) * * int fep_init(void) * checks FEP and turn it off, returns FEP type. * void fep_term(void) * restore the status of FEP saved by fep_init(). * void fep_on(void) * restore the status of FEP saved by fep_off(). * void fep_off(void) * save the status of FEP and turn it off. * void fep_force_on(void) * turn FEP on by its default "on" status. * void fep_force_off(void) * don't save the status of FEP and turn it off. * int fep_raw_init(void) * same as fep_init(), but doesn't turn the FEP off. * void fep_raw_term(void) * same as fep_term(), but doesn't restore the FEP status. * int fep_get_mode(void) * return the current status of FEP (0 = off). * * Compiles under: * Turbo C 1.5/2.0, Turbo C++ 1.0, Borland C++ 2.0/3.0, * Microsoft C 5.1, Microsoft C 6.0, Quick C 2.0, * Lattice C 4.1 (need negative stack frame, except huge model), * LSI C-86 3.2/3.3 Sampler (small model only). */ /* * $Log: fepctrl.c,v $ * Revision 1.1.1.1 2000/06/27 01:47:58 amura * import to CVS * */ #define NG #ifdef NG #include "config.h" #endif #ifdef FEPCTRL static char fepctrl_version[] = "FEPCTRL V1.5 04/08/1992"; /* * define appropriate directives shown below */ #define DO_MSKANJI /* support MS-KANJI application interface */ #ifndef PC9801 /* 91.05.21 by Junn Ohta */ #define DO_GENERIC /* support platforms other than PC-9801 */ #endif /* #define DO_USERDEV /* recognize user supplied device names */ #include #include "fepctrl.h" /* * default "on" status of FEP (used only in fep_force_on()) */ static unsigned char fepon[NFEPS] = { /* FEP_NONE */ 0, /* FEP_PC98A */ 1, /* 0=off, 1=on */ /* FEP_PC98B */ 1, /* 0=off, 1=on */ /* FEP_PC98C */ 1, /* 0=off, 1=on */ /* FEP_MSKANJI */ 2, /* 0=off, 1=system, 2=echo */ /* FEP_VJE */ 2, /* 0=off, 1=system, 2=echo */ /* FEP_ATOK6 */ 1, /* 0=off, 1=roma, 2=kana, 3=alpha, 4=sym, 5=code */ /* FEP_ATOK7 */ 1, /* 0=off, 1=on */ /* FEP_MTTK86 */ 1, /* 0=off, 1=on */ /* FEP_MTTK2 */ 1, /* 0=off, 1=on */ /* FEP_KATANA */ 1, /* 0=off, 1=echo, 2=system */ /* FEP_FIXER */ 1, /* 0=off, 1=echo, 2=system */ /* FEP_EGB2 */ 2, /* 0=off, 1=system, 2=echo */ /* FEP_EGB3 */ 2, /* 0=off, 1=system, 2=echo */ /* FEP_WXP */ 1, /* 0=off, 1=echo, 2=system */ /* FEP_WX2 */ 1, /* 0=off, 1=echo, 2=system */ /* FEP_MGR2 */ 1, /* 0=off, 1=on */ /* FEP_JJ */ 1, /* 0=off, 1=on */ /* FEP_NEC */ 1, /* 0=off, 1=on */ /* FEP_DFJ */ 1, /* 0=off, 1=on */ /* FEP_DANGO */ 1, /* 0=off, 1=kana, 3=alpha */ /* FEP_OTEMOTO */ 2, /* 0=off, 1=system, 2=echo */ /* FEP_OMAC */ 1, /* 0=off, 1=on */ /* FEP_AJIP1 */ 1, /* 0=off, 1=on */ /* FEP_JOKER3 */ 1, /* 0=off, 1=on */ /* FEP_KAZE */ 1, /* 0=off, 1=on */ /* FEP_OAK */ 0xd1, /* 0r010100=off, 1r010001=on (r=romaji) */ /* FEP_MKK */ 2, /* 0=off, 1=system, 2=echo */ /* FEP_B16 */ 0x80, /* 00000000=off, 10000000=on */ /* FEP_RICOH */ 0x80, /* 00000000=off, 10000000=on */ /* FEP_WXPJ */ 1, /* 0=off, 1=echo, 2=system */ /* FEP_MIJ */ 1, /* 0=off, 1=on */ /* FEP_FEPEX */ 1, /* 0=off, 1=on */ /* FEP_AT6AX */ 1, /* 0=off, 1=roma, 2=kana, 3=alpha, 4=sym, 5=code */ /* FEP_AT6IBM */ 1, /* 0=off, 1=roma, 2=kana, 3=alpha, 4=sym, 5=code */ /* FEP_AT7IBM */ 1, /* 0=off, 1=on */ /* FEP_AT7DOSV*/ 0x80, /* 00000000=off, 10000000=on */ /* FEP_IAS */ 0xc5 /* 0rxxx000=off, 1rxxx101=on */ }; static int fep = FEP_NONE; static int oldmode = 0; static int keepmode = 0; static void near __PASCAL fep_open(void); static void near __PASCAL fep_close(void); static int near __PASCAL fep_find(void); static int near __PASCAL fep_mode(int); static int near __PASCAL check_dev(char *); static int near __PASCAL check_vec(int, unsigned, unsigned, char *); static int near __PASCAL check_atok7(int); static int near __PASCAL msknj_find(char *); static int near __PASCAL msknj_get_mode(void); static int near __PASCAL msknj_set_mode(int); int __CDECL fep_init(void) { if (fep == FEP_NONE) fep = fep_find(); fep_open(); oldmode = keepmode = fep_mode(0); return fep; } void __CDECL fep_term(void) { fep_mode(oldmode); fep_close(); } void __CDECL fep_on(void) { fep_mode(keepmode); } void __CDECL fep_off(void) { keepmode = fep_mode(0); } void __CDECL fep_force_on(void) { fep_mode(fepon[fep]); } void __CDECL fep_force_off(void) { fep_mode(0); } int __CDECL fep_raw_init(void) { if (fep == FEP_NONE) fep = fep_find(); fep_open(); return fep; } void __CDECL fep_raw_term(void) { fep_close(); } int __CDECL fep_get_mode(void) { return fep_mode(-1); } /*--------------------------------------------------------------------*/ #ifdef TEST /* * mail routines for the batch utility * * Usage: fepctrl [command] * command: * help - print this message * test - ordinary FEP testing * name - print installed FEP name * on - turn FEP on * off - turn FEP off * flip - flip FEP status * status - return FEP status * check [fepname ...] * - check existence of specified FEP * fepname: * as follows... */ static char *fepname[NFEPS] = { /* FEP_NONE */ "(none)", /* FEP_PC98A */ "PC9801A", /* FEP_PC98B */ "PC9801B", /* FEP_PC98C */ "PC9801C", /* FEP_MSKANJI */ "MSKANJI", /* FEP_VJE */ "VJE", /* FEP_ATOK6 */ "ATOK6", /* FEP_ATOK7 */ "ATOK7", /* FEP_MTTK86 */ "MTTK86", /* FEP_MTTK2 */ "MTTK2", /* FEP_KATANA */ "KATANA", /* FEP_FIXER */ "FIXER", /* FEP_EGB2 */ "EGB2", /* FEP_EGB3 */ "EGB3", /* FEP_WXP */ "WXP", /* FEP_WX2 */ "WX2", /* FEP_MGR2 */ "MGR2", /* FEP_JJ */ "JJ", /* FEP_NEC */ "NEC", /* FEP_DFJ */ "DFJ", /* FEP_DANGO */ "DANGO", /* FEP_OTEMOTO */ "OTEMOTO", /* FEP_OMAC */ "OMAC", /* FEP_AJIP1 */ "AJIP1", /* FEP_JOKER3 */ "JOKER3", /* FEP_KAZE */ "KAZE", /* FEP_OAK */ "OAK", /* FEP_MKK */ "MKK", /* FEP_B16 */ "B16", /* FEP_RICOH */ "RICOH", /* FEP_WXPJ */ "WXPJ", /* FEP_MIJ */ "MIJ", /* FEP_FEPEX */ "FEPEX", /* FEP_AT6AX */ "AT6AX", /* FEP_AT6IBM */ "AT6IBM", /* FEP_AT7IBM */ "AT7IBM", /* FEP_AT7DOSV */ "AT7DOSV", /* FEP_IAS */ "IBMIAS" }; #define getch() (bdos(8, 0, 0) & 0xff) #define putch(c) bdos(2, (int)(c), 0) static void near __PASCAL putstr(char *s) { while (*s) putch(*s++); } static void near __PASCAL echoline(void) { int c; putstr(fep_get_mode()? " on: ": "off: "); while ((c = getch()) != '\r' && c != '\n') putch(c); putstr("\r\n"); } void __CDECL main(int ac, char **av) { int fep, ret; ac--, av++; if (ac == 0) *av = "help"; if (!strcmp(*av, "test")) { putstr("fep = "); putstr(fepname[fep_init()]); putstr("\r\n"); putstr("enter 4 lines of text\r\n"); fep_force_on(); echoline(); fep_off(); echoline(); fep_on(); echoline(); fep_force_off(); echoline(); fep_term(); exit(0); } ret = 0; fep = fep_raw_init(); if (!strcmp(*av, "name")) { putstr(fepname[fep]); putstr("\r\n"); } else if (!strcmp(*av, "on")) { if (!fep_get_mode()) fep_force_on(); } else if (!strcmp(*av, "off")) { if (fep_get_mode()) fep_force_off(); } else if (!strcmp(*av, "flip")) { if (fep_get_mode()) fep_force_off(); else fep_force_on(); } else if (!strcmp(*av, "status")) { ret = fep_get_mode()? 1: 0; } else if (!strcmp(*av, "check")) { ac--, av++; if (ac == 0) ret = fep; while (ac > 0) { if (!strcmp(fepname[fep], *av)) { ret = fep; break; } ac--, av++; } } else { putstr(fepctrl_version); putstr(" - batch utility\r\n"); putstr("Usage: fepctrl [command]\r\n" "command:\r\n" "\thelp - print this message\r\n" "\ttest - ordinary FEP testing\r\n" "\tname - print installed FEP name\r\n" "\ton - turn FEP on\r\n" "\toff - turn FEP off\r\n" "\tflip - flip FEP status\r\n" "\tstatus - return FEP status\r\n" "\tcheck [fepname ...]\r\n" "\t - check existence of specified FEP\r\n" "fepname:\r\n\t"); for (fep = 1; fep < NFEPS; fep++) { if (fep > 1) putstr(", "); if ((fep % 8) == 0) putstr("\r\n\t"); putstr(fepname[fep]); } putstr("\r\n"); } fep_raw_term(); exit(ret); } #endif /* TEST */ /*--------------------------------------------------------------------*/ #ifdef MSC_INLINE #undef MSC_INLINE #endif #if defined(_MSC_VER) && _MSC_VER >= 600 || defined(_QC) #define MSC_INLINE #endif typedef struct { unsigned char ftype; /* fep type */ unsigned char inum; /* dointr number */ char *dname; /* device name */ } FEPDEV; typedef struct { unsigned char ftype; /* fep type */ unsigned char inum; /* dointr number */ unsigned char offset; /* offset of id string */ unsigned char relative; /* offset is relative? */ char *idstr; /* id string */ } FEPINT; #ifdef DO_USERDEV /* * device names supplied by user for FEP residence check */ static FEPDEV fepudev[] = { { FEP_PC98A, 0, "FP$PC98A" }, { FEP_PC98B, 0, "FP$PC98B" }, { FEP_PC98B, 0, "FP$DUMMY" }, /* backward compatibility */ { FEP_PC98B, 0, "FP$PC98" }, /* backward compatibility */ { FEP_PC98C, 0, "FP$PC98C" }, { FEP_VJE, 0, "FP$VJE" }, { FEP_ATOK6, 0x6f, "FP$ATOK6" }, /* ATOK6, DANGO */ { FEP_MTTK86, 0, "FP$MTTK" }, { FEP_KATANA, 0, "FP$KTN" }, { FEP_EGB2, 0, "FP$EGB2" }, { FEP_EGB3, 0, "FP$EGB3" }, { FEP_WXP, 0, "FP$WXP" }, /* WX, WXS, WXP 1.03a */ { FEP_WX2, 0x70, "FP$WX2" }, /* WX2, WXP 1.04c */ { FEP_MGR2, 0, "FP$MGR2" }, { FEP_JJ, 0, "FP$JJ" }, { FEP_NEC, 0, "FP$NEC" }, { FEP_DFJ, 0, "FP$DFJ" }, { FEP_OMAC, 0, "FP$OMAC" }, { FEP_AJIP1, 0, "FP$AJIP1" }, { FEP_JOKER3, 0xf1, "FP$JOKER" }, { FEP_KAZE, 0, "FP$KAZE" }, #ifdef DO_GENERIC { FEP_OAK, 0, "FP$OAK" }, #endif { FEP_NONE, } }; #endif /* DO_USERDEV */ /* * real ID string placed in the memory */ static FEPINT fepint[] = { { FEP_MTTK86, 0x70, 0x12, 0, "MTTK86" }, { FEP_MTTK2, 0x70, 0x12, 0, "MTTK" }, { FEP_EGB2, 0x70, 0x28, 0, "ERGOA" }, { FEP_EGB3, 0x70, 0x28, 0, "ERGO" }, { FEP_WXP, 0x70, 0x22, 0, "WX " }, { FEP_WX2, 0x70, 0x22, 0, "WX2 " }, { FEP_DFJ, 0x6f, 0x02, 0, "DFJ" }, { FEP_JJ, 0x70, 0x0a, 0, "JJ1_V" }, { FEP_ATOK6, 0x6f, 0x03, 1, "ATOK5020" }, { FEP_ATOK6, 0x6f, 0x1d, 0, "ATOK5020" }, /* backward compat. */ { FEP_KATANA, 0x4b, 0x0b, 0, "KTN" }, { FEP_DANGO, 0x6f, 0x03, 1, "ATOKI" }, { FEP_OMAC, 0x09, 0x12, 0, "Taikei" }, { FEP_JOKER3, 0xf1, 0x12, 0, "JOKER3" }, /* { FEP_AJIP1, 0xf3, 0x0a, 0, "AJ1V01PC" }, */ /* { FEP_VJE, 0x70, 0x12, 0, "VJE-" }, */ /* { FEP_MGR2, 0x70, 0x0a, 0, "#MGR#REX" }, */ /* { FEP_NEC, 0xdc, 0x0a, 0, "$AID#NEC" }, */ /* { FEP_NEC, 0xdc, 0x0a, 0, "$ATC#NEC" }, */ #ifdef DO_GENERIC { FEP_OAK, 0xed, 0x12, 0, "OAK000" }, /* use 0xec to dointr */ { FEP_B16, 0x16, 0x02, 1, "K,YUGEV" }, /* { FEP_RICOH, 0x16, 0x0a, 0, "$NIHONGO" }, */ { FEP_WXPJ, 0x6c, 0x22, 0, "WX " }, { FEP_MIJ, 0x6f, 0x12, 0, "MTTK" }, /* NOT TESTED */ /* { FEP_FEPEX, 0x83, 0x28, 0, "ERGO" }, */ { FEP_AT6AX, 0x65, 0x0d, 1, "ATOK6020" }, { FEP_AT6IBM, 0x60, 0x0a, 0, "ATOK6I%%" }, { FEP_AT6IBM, 0x60, 0x45, 1, "7TO6" }, /* ATOK7 + 7TO6 */ #endif { FEP_NONE, } }; /* * real device names built in by FEPs */ static FEPDEV fepdev[] = { { FEP_VJE, 0, "AS$VJE" }, { FEP_ATOK6, 0x6f, "ATOKF%%%" }, { FEP_MGR2, 0, "#MGR#REX" }, { FEP_AJIP1, 0, "AJ1V01PC" }, { FEP_NEC, 0, "$AID#NEC" }, /* NEC AI Henkan on DOS3.3C */ { FEP_NEC, 0, "$AIC#NEC" }, /* NEC AI Henkan */ { FEP_NEC, 0, "$ATC#NEC" }, /* NEC Chikuji Kana-Kanji */ #ifdef DO_GENERIC { FEP_RICOH, 0, "$NIHONGO" }, /* RICOH Nihongo Nyuryoku */ { FEP_FEPEX, 0, "(ERGOSFT" }, /* FEPEX (on IF800EX/RX) */ { FEP_AT7DOSV, 0, "IAEAT7%%" }, /* ATOK7 on IBM DOS/V $IAS */ { FEP_IAS, 0, "$IBMAIAS" }, /* FEP uses IBM DOS/V $IAS */ #endif { FEP_NONE, } }; /* * FIXER ioctl data packet */ typedef struct { char name[8]; int version; void (far __CDECL *v3func)(void); int v3vec; void (far __CDECL *v4func)(void); int v4vec; } FIXIDP; #if defined(LSI_C) static void (far *fixer_entry)(int, int, int, int); static void (far *atok7_entry)(int, int near *); #elif defined(LATTICE) static void (far __CDECL *fixer_entry)(void); static unsigned atok7_seg, atok7_off; #else /* Turbo C, Microsoft C, Quick C */ static void (far __CDECL *fixer_entry)(void); static void (far __CDECL *atok7_entry)(void); #endif static int api_vec = -1; /* API interrupt vector */ #define GET_IOC_DATA 0x4400 /* Get IOCTL Data */ #define RCV_IOC_CHAR 0x4402 /* Receive IOCTL Character */ #define GET_CBRK 0x3300 /* Get CBREAK (CTRL-C Check) */ #define SET_CBRK 0x3301 /* Set CBREAK (CTRL-C Check) */ #define GET_VECTOR 0x35 /* Get Interrupt Vector */ #define OPEN_HANDLE 0x3d /* Open Handle */ #define CLOSE_HANDLE 0x3e /* Close Handle */ #define DEVICE 0x80 /* handle is not a file */ #define CFLAG 0x0001 /* iAPX86 carry flag bit */ #if defined(__TURBOC__) || defined(LSI_C) #define MK_FAR(seg,off) MK_FP(seg, off) #define FAR_SEG(addr) FP_SEG(addr) #define FAR_OFF(addr) FP_OFF(addr) #define FAR_OFF2(addr) FP_OFF(addr) #elif defined(LATTICE) #define MK_FAR(seg,off) (void far *)(((unsigned long)(seg)<<4)+(unsigned)(off)) #define FAR_SEG(addr) FP_SEG((void far *)(addr)) #define FAR_OFF(addr) FP_OFF((void far *)(addr)) #define FAR_OFF2(addr) ((unsigned)(addr)) /* avoid normalization */ #else /* Microsoft C, Quick C */ #define MK_FAR(seg,off) (void far *)((unsigned long)(seg)<<16|(unsigned)(off)) #define FAR_SEG(addr) ((unsigned)((unsigned long)(addr) >> 16)) #define FAR_OFF(addr) ((unsigned)(addr)) #define FAR_OFF2(addr) ((unsigned)(addr)) #endif #ifdef LATTICE static union REGS regs; static union REGSS xregs; static struct SREGS sregs; /* * we must use int86s()/intdoss(), since Lattice's int86x()/intdosx() * don't return the modified values of segment registers */ #define Int86x(inum, xp1, xp2, dummy) int86s(inum, xp1, xp2) #define Intdosx(xp1, xp2, dummy) intdoss(xp1, xp2) #define Regs xregs #define Sregs xregs.x #else /* Turbo C, Microsoft C, Quick C, LSI C */ static union REGS regs; static struct SREGS sregs; #define Int86x(inum, rp1, rp2, sp) int86x(inum, rp1, rp2, sp) #define Intdosx(rp1, rp2, sp) intdosx(rp1, rp2, sp) #define Regs regs #define Sregs sregs #endif static unsigned char *p; static unsigned char far *fp; #ifndef __TURBOC__ #if defined(LATTICE) /* * fake function to mimic disable() and enable() */ static unsigned char far disable_fake[] = { 0xfa, 0xcb }; /* cli, retf */ static unsigned char far enable_fake[] = { 0xfb, 0xcb }; /* sti, retf */ static void (far *disable)(void) = (void (far *)(void))disable_fake; static void (far *enable)(void) = (void (far *)(void))enable_fake; #elif defined(LSI_C) #define disable() di() #define enable() ei() #else /* Microsoft C, Quick C */ #define disable() _disable() #define enable() _enable() #endif #endif /* !__TURBOC__ */ #ifdef __cplusplus extern "C" { extern int __CDECL strncmp(char *, char *, unsigned int); extern void * __CDECL memset(void *, int, unsigned int); } #else extern int __CDECL strncmp(char *, char *, unsigned int); extern void * __CDECL memset(void *, int, unsigned int); #endif static int near __PASCAL fep_find(void) { FEPDEV *fv; FEPINT *fi; FIXIDP fixer; #ifdef DO_USERDEV /* * detect fep type by its USER SUPPLIED device name */ for (fv = fepudev; fv->ftype != FEP_NONE; fv++) { if (check_dev(fv->dname)) { api_vec = fv->inum; return fv->ftype; } } #endif /* * loaded into bank memory by MELCO's FEP loader (PC-9801 only) */ if (check_dev("FPLD$10")) { if (check_dev("AS$VJE")) return FEP_VJE; /* don't use MS-KANJI API */ if (check_vec(0x70, 0x12, 0, "MTTK")) return FEP_MTTK86; /* don't use INT 70H I/F */ if (check_dev("$AID#NEC")) return FEP_NEC; /* don't use MS-KANJI API */ } #ifdef DO_MSKANJI /* * MS-KANJI FEP and its variants */ if (msknj_find("MS$KANJI")) return FEP_MSKANJI; if (msknj_find("$KANJI")) return FEP_OTEMOTO; #endif /* * detect fep type by its id string */ for (fi = fepint; fi->ftype != FEP_NONE; fi++) { if (check_vec(fi->inum, fi->offset, fi->relative, fi->idstr)) { api_vec = fi->inum; return fi->ftype; } } /* * detect fep type by its device name */ for (fv = fepdev; fv->ftype != FEP_NONE; fv++) { if (check_dev(fv->dname)) { api_vec = fv->inum; return fv->ftype; } } /* * special case: ATOK7 function call */ if (check_atok7(0x6f)) return FEP_ATOK7; #ifdef DO_GENERIC if (check_atok7(0x60) && check_dev("ATOK7I%%")) /* PS/55 DOS 4.0J only; avoid to use ATOK7 API on DOS/V */ return FEP_AT7IBM; #endif /* * special case: FIXER3/4 application interface */ regs.x.ax = GET_IOC_DATA; regs.x.bx = 0; /* stdin */ intdos(®s, ®s); if (regs.x.dx & DEVICE) { regs.x.ax = RCV_IOC_CHAR; regs.x.bx = 0; /* stdin */ regs.x.cx = sizeof(fixer); regs.x.dx = FAR_OFF((void far *)&fixer); sregs.ds = FAR_SEG((void far *)&fixer); intdosx(®s, ®s, &sregs); if (regs.x.ax >= 16 && !strncmp(fixer.name, "FIXER ", 8)) { if (fixer.v3vec != -1) { api_vec = fixer.v3vec; return FEP_FIXER; } if (!check_dev("FPLD$10") && !check_dev("$BNK#DRV") && fixer.v3func != (void far *)0) { fixer_entry = fixer.v3func; return FEP_FIXER; } if (fixer.version < 0x0400) return FEP_PC98B; } } /* * special case: Katana/ACE software dointr interface */ if (check_vec(0x48, 0x0a, 0, "CON ") && check_vec(0x49, 0x0a, 0, "CON ") && check_vec(0x4a, 0x0a, 0, "CON ")) { /* * This may not be a good way to check Katana/ACE. * However, console status report (sending "@" * returns "$") is not reliable here, because we * may have characters in the keyboard buffer. */ return FEP_KATANA; } /* * special case: Panacom MKK software dointr interface */ if (check_vec(0xc0, 0x0a, 0, "CON ") && check_vec(0xc3, 0x0a, 0, "CON ")) return FEP_MKK; return FEP_NONE; } static int near __PASCAL open_dev(char *dname) { static char dbuf[15] = "@:"; char *p = dbuf + 2; while ((*p++ = *dname++) != 0) /* void */; regs.h.ah = OPEN_HANDLE; regs.h.al = 0; regs.x.dx = FAR_OFF((void far *)dbuf); sregs.ds = FAR_SEG((void far *)dbuf); #if defined(LATTICE) if (intdosx(®s, ®s, &sregs) & CFLAG) return -1; #elif defined(LSI_C) intdosx(®s, ®s, &sregs); if (regs.x.flags & CFLAG) return -1; #else /* Turbo C, Microsoft C, Quick C */ intdosx(®s, ®s, &sregs); if (regs.x.cflag) return -1; #endif return regs.x.ax; } static void near __PASCAL close_dev(int fd) { regs.h.ah = CLOSE_HANDLE; regs.x.bx = fd; intdos(®s, ®s); } static int near __PASCAL check_dev(char *dname) { int fd, dc; if ((fd = open_dev(dname)) < 0) return 0; regs.x.ax = GET_IOC_DATA; regs.x.bx = fd; intdos(®s, ®s); dc = regs.x.dx; close_dev(fd); return (dc & DEVICE)? 1: 0; } static int near __PASCAL check_vec(int inum, unsigned offset, unsigned relative, char *idstr) { /* * get dointr vector */ Regs.h.ah = GET_VECTOR; Regs.h.al = (unsigned char)inum; Intdosx(&Regs, &Regs, &Sregs); /* * check id string */ if (relative) offset += Regs.x.bx; fp = (unsigned char far *)MK_FAR(Sregs.es, offset); for (p = (unsigned char *)idstr; *p; p++) if (*p != *fp++) return 0; return 1; } static int near __PASCAL check_atok7(int inum) { Regs.h.ah = GET_VECTOR; Regs.h.al = (unsigned char)inum; Intdosx(&Regs, &Regs, &Sregs); fp = (unsigned char far *)MK_FAR(Sregs.es, Regs.x.bx + 0x30); for (p = (unsigned char *)"ATOK7"; *p; p++) if (*p != *fp++) return 0; #ifdef LATTICE atok7_seg = Sregs.es; atok7_off = Regs.x.bx + 0x20; #else atok7_entry = (void (far __CDECL *)(void)) MK_FAR(Sregs.es, Regs.x.bx+0x20); #endif return 1; } #if !defined(__TURBOC__) && !defined(LSI_C) && !defined(MSC_INLINE) /* * fake function to call fixer_entry() and atok7_entry() * for Microsoft C 5.1 and Lattice C */ static unsigned char far fixer_fake[] = { 0x55, /* push bp */ 0x8b, 0xec, /* mov bp, sp */ 0x8b, 0x46, 0x0a, /* mov ax, word ptr [bp+10] ;func */ 0x8a, 0x56, 0x0c, /* mov dl, byte ptr [bp+12] ;val */ 0xff, 0x5e, 0x06, /* call dword ptr [bp+6] ;addr */ 0x33, 0xc0, /* xor ax, ax */ 0x8a, 0xc2, /* mov al, dl */ 0x8b, 0xe5, /* mov sp, bp */ 0x5d, /* pop bp */ 0xcb /* retf */ }; static unsigned char far atok7_fake[] = { 0x55, /* push bp */ 0x8b, 0xec, /* mov bp, sp */ 0x8b, 0x46, 0x0e, /* mov ax, word ptr [bp+14] ;pseg */ 0x8e, 0xc0, /* mov es, ax */ 0x8b, 0x5e, 0x0c, /* mov bx, word ptr [bp+12] ;poff */ 0x8b, 0x46, 0x0a, /* mov ax, word ptr [bp+10] ;func */ 0xff, 0x5e, 0x06, /* call dword ptr [bp+6] ;addr */ 0x8b, 0xe5, /* mov sp, bp */ 0x5d, /* pop bp */ 0xcb /* retf */ }; #ifdef LATTICE static int (far __CDECL *fixer_dummy)(void (far *)(void), int, int) = (int (far __CDECL *)())fixer_fake; static void (far __CDECL *atok7_dummy)(unsigned,unsigned,int,unsigned,unsigned) = (void (far __CDECL *)())atok7_fake; #endif #endif /* Microsoft C 5.1, Lattice C */ static int near __PASCAL call_fixer(int func, int val) { if (api_vec != -1) { regs.x.ax = func; regs.h.dl = (unsigned char)val; int86(api_vec, ®s, ®s); return regs.h.dl; } #if defined(__TURBOC__) _AX = func; _DL = (unsigned char)val; fixer_entry(); return (int)_DL; #elif defined(LSI_C) fixer_entry(func, 0, 0, val); /* ax = func, dx = val */ _asm_c("\n\txor\tax,ax"); _asm_c("\n\tmov\tal,dl"); /* return ax */ #elif defined(MSC_INLINE) _asm { mov ax,func mov dl,val } fixer_entry(); _asm { xor ax,ax mov al,dl } /* return ax */ #elif defined(LATTICE) return fixer_dummy(fixer_entry, func, val); #else /* Microsoft C 5.1 */ return ((int (far __CDECL *)(void (far __CDECL *)(void), int, int)) fixer_fake)(fixer_entry, func, val); #endif } static int near __PASCAL call_atok7(int func, int val) { #if defined(MSC_INLINE) int pseg, poff; #endif int packet[32]; *packet = val; #if defined(__TURBOC__) _ES = FAR_SEG((void far *)packet); _BX = FAR_OFF((void far *)packet); _AX = func; atok7_entry(); #elif defined(LSI_C) _asm_c("\n\tpush\tss"); _asm_c("\n\tpop\tes"); atok7_entry(func, packet); /* ax = func, es:bx = packet */ #elif defined(MSC_INLINE) pseg = FAR_SEG((void far *)packet); poff = FAR_OFF((void far *)packet); _asm { mov ax,pseg mov es,ax mov bx,poff mov ax,func } atok7_entry(); #elif defined(LATTICE) atok7_dummy(atok7_off, atok7_seg, func, FAR_OFF((void far *)packet), FAR_SEG((void far *)packet)); #else /* Microsoft C 5.1 */ ((void (far __CDECL *)(void (far __CDECL *)(void), int, int far *)) atok7_fake)(atok7_entry, func, (int far *)packet); #endif return *packet; } /* * PC-9801 CRT/KBD BIOS, VRAM */ #define KBDBIOS ((unsigned char far *)MK_FAR(0x0000, 0x0502)) #define CRTWORK ((unsigned char far *)MK_FAR(0x0000, 0x053d)) #define CRTLINES ((unsigned char far *)MK_FAR(0x0000, 0x0713)) #define VRAM ((unsigned char far *)MK_FAR(0xa000, 0x0000)) #define KBDMAX 16 /* max # of keys in KBDBUF */ #define CTRLXFER 0xb500 /* CTRL-XFER key scan code */ struct kbdbios_t { unsigned short buf[KBDMAX]; unsigned char near *tbl; unsigned short near *head; unsigned short near *tail; unsigned char count; } far *kp = (struct kbdbios_t far *)KBDBIOS; /* * Look into CRT BIOS work area and check FEP status */ static int near __PASCAL pc98_crtmode(void) { return (*CRTWORK == 2)? 1: 0; } #ifdef DO_USERDEV /* * Look into VRAM bottom right corner and check FEP status (for FEP_KAZE) */ static int near __PASCAL pc98_vrammode(void) { return ((VRAM[*CRTLINES? 0x0f9d: 0x0c7d] & 0x7f) > '!')? 1: 0; } #endif /* * Set key code directly into PC-9801 BIOS key code buffer */ static void near __PASCAL pc98_setkey(unsigned short keycode) { disable(); *(unsigned short far *)(MK_FAR(0x0000, kp->tail)) = keycode; kp->count++; kp->tail++; if (kp->tail >= (unsigned short near *)FAR_OFF2(&kp->buf[KBDMAX])) kp->tail = (unsigned short near *)FAR_OFF2(kp->buf); enable(); } static void near __PASCAL pc98_flushkey(unsigned short keycode) { while (bdos(6, 0xff, 0) & 0xff) /* void */; pc98_setkey(keycode); while (bdos(6, 0xff, 0) & 0xff) /* void */; } static void near __PASCAL pc98_pushkey(unsigned short keycode) { /* * raise dummy keyboard interrupt after feeding CTRL-XFER. * i know it is a brute force attack, but it works! */ pc98_setkey(keycode); int86(0x09, ®s, ®s); while (bdos(6, 0xff, 0) & 0xff) /* void */; } static int near __PASCAL set_cbrk(int newcbrk) { int curcbrk; /* * get current cbrk value */ regs.x.ax = GET_CBRK; intdos(®s, ®s); curcbrk = regs.h.dl; /* * set new cbrk value */ regs.x.ax = SET_CBRK; regs.h.dl = newcbrk; intdos(®s, ®s); return curcbrk; } static int near __PASCAL dointr(int vec, int ah, int al) { regs.h.ah = ah; regs.h.al = al; int86(vec, ®s, ®s); return regs.h.al; } /* * NEC extended function call (int DCh) */ static void near __PASCAL donec(int cl) { regs.x.ax = 0; regs.h.cl = cl; int86(0xdc, ®s, ®s); } static void near __PASCAL fep_open(void) { if (fep == FEP_NEC) donec(224); } static void near __PASCAL fep_close(void) { if (fep == FEP_NEC) donec(225); } static int near __PASCAL fep_mode(int newmode) { int curmode; switch (fep) { #ifdef DO_MSKANJI case FEP_MSKANJI: case FEP_OTEMOTO: /* mode: 0 = off, 1 = system, 2 = echo */ curmode = msknj_get_mode(); if (newmode != -1 && newmode != curmode) msknj_set_mode(newmode); return curmode; #endif case FEP_VJE: case FEP_EGB2: case FEP_EGB3: /* mode: 0 = off, 1 = system, 2 = echo */ curmode = dointr(0x70, 0, 0); if (newmode != -1 && newmode != curmode) { dointr(0x70, 1, newmode); if (fep == FEP_EGB2) dointr(0x70, 12, 0); /* unlock mode key */ } return curmode; case FEP_ATOK6: /* api_vec = 0x6f */ case FEP_AT6AX: /* api_vec = 0x65 */ case FEP_AT6IBM: /* api_vec = 0x60 */ case FEP_DANGO: /* api_vec = 0x6f */ /* mode: 0=off, 1=roma, 2=kana, 3=alpha, 4=sym, 5=code */ curmode = dointr(api_vec, 102, 0); if (newmode != -1 && newmode != curmode) dointr(api_vec, (!newmode? 11: newmode), 0); return curmode; case FEP_ATOK7: case FEP_AT7IBM: /* mode: 0 = off, 1 = on */ curmode = call_atok7(3, -1)? 1: 0; if (newmode != -1 && newmode != curmode) call_atok7(newmode? 1: 2, 0); return curmode; case FEP_MTTK2: /* api_vec = 0x70 */ case FEP_MIJ: /* api_vec = 0x6f */ /* mode: 0 = off, 1 = on */ Regs.h.ah = 21; Int86x(api_vec, &Regs, &Regs, &Sregs); fp = (unsigned char far *)MK_FAR(Sregs.es, Regs.x.bx); curmode = fp[5]; if (newmode != -1 && newmode != curmode) dointr(api_vec, 0, newmode); return curmode; case FEP_FIXER: /* mode: 0 = off, 1 = echo, 2 = system */ curmode = call_fixer(0x0901, 0); if (newmode != -1 && newmode != curmode) call_fixer(0x0900, newmode); return curmode; case FEP_KATANA: /* mode: 0 = off, 1 = echo, 2 = system */ curmode = dointr(0x48, 2, 0); if (newmode != -1 && newmode != curmode) { int old = set_cbrk(0); dointr(0x48, 3, newmode); set_cbrk(old); } return curmode; case FEP_WXP: /* mode: 0 = off, 1 = echo, 2 = system */ curmode = dointr(0x70, 0x4c, 0); if (newmode == 0 && curmode > 0) { while (dointr(0x70, 0x4c, 0)) pc98_flushkey(CTRLXFER); } else if (newmode > 0 && curmode == 0) { dointr(0x70, 0x5c, newmode); dointr(0x70, 0x52, 1); } return curmode; case FEP_WX2: /* api_vec = 0x70 */ case FEP_WXPJ: /* api_vec = 0x6c */ /* mode: 0 = off, 1 = echo, 2 = system */ curmode = dointr(api_vec, 0x4c, 0); if (newmode != -1 && newmode != curmode) dointr(api_vec, 0, newmode); return curmode; case FEP_MGR2: case FEP_JJ: /* mode: 0 = off, 1 = on */ regs.h.ah = 0; int86(0x70, ®s, ®s); curmode = (regs.h.dl & 0x01); if (newmode != -1 && newmode != curmode) dointr(0x46, 0, newmode); return curmode; case FEP_JOKER3: /* mode: 0 = off, 1 = on */ curmode = dointr(0xf1, 0x8f, 0); if (newmode != -1 && newmode != curmode) dointr(0xf1, newmode? 0x86: 0x85, 0); return curmode; case FEP_NEC: /* mode: 0 = off, 1 = on */ curmode = pc98_crtmode(); if (newmode != -1 && newmode != curmode) donec(newmode? 239: 240); return curmode; case FEP_PC98A: case FEP_MTTK86: case FEP_DFJ: /* mode: 0 = off, 1 = on */ curmode = pc98_crtmode(); if (newmode != -1) while (pc98_crtmode() != newmode) pc98_flushkey(CTRLXFER); return curmode; case FEP_PC98B: case FEP_AJIP1: /* mode: 0 = off, 1 = on */ curmode = pc98_crtmode(); if (newmode != -1 && newmode != curmode) pc98_setkey(CTRLXFER); return curmode; case FEP_PC98C: case FEP_OMAC: /* mode: 0 = off, 1 = on */ curmode = pc98_crtmode(); if (newmode != -1 && newmode != curmode) pc98_pushkey(CTRLXFER); return curmode; #ifdef DO_USERDEV case FEP_KAZE: /* mode: 0 = off, 1 = on */ curmode = pc98_vrammode(); if (newmode != -1 && newmode != curmode) pc98_flushkey(CTRLXFER); return curmode; #endif #ifdef DO_GENERIC case FEP_OAK: /* * mode: 0r010100 = off, 1r010001 = on (r = romaji) * bit7: size: 0 = hankaku, 1 = zenkaku * bit6: romaji entry: 0 = off, 1 = on * bit5: always 0 * bit4: mode change: 0 = disabled, 1 = enabled * bit3: always 0 * bit2-0: char type: 001 = hiragana, 010 = katakana, * 011 = uppercase, 100 = lowercase, 101 = al */ #define OAKOFF(mode) ((mode) == 0 || ((mode) & 0x84) == 0x04) curmode = dointr(0xec, 3, 0); if (newmode == -1) return OAKOFF(curmode)? 0: curmode; if (OAKOFF(newmode) && !OAKOFF(curmode)) dointr(0xec, 2, (curmode & 0x50) | 0x04); else if (!OAKOFF(newmode) && OAKOFF(curmode)) dointr(0xec, 2, newmode); return curmode; case FEP_MKK: /* mode: 0 = off, 1 = system, 2 = echo */ curmode = dointr(0xc0, 1, 0); if (newmode != -1 && newmode != curmode) dointr(0xc0, 0, newmode); return curmode; case FEP_B16: case FEP_RICOH: /* mode: 00000000 = off, 10000000 = on */ curmode = dointr(0x16, 8, 0) & 0x80; if (newmode != -1 && newmode != curmode) dointr(0x16, 7, newmode); return curmode; case FEP_FEPEX: /* mode: 0 = off, 1 = on */ regs.h.cl = 0x0e; int86(0x83, ®s, ®s); curmode = regs.h.al; if (newmode != -1 && newmode != curmode) { regs.h.cl = 0x0b; regs.h.bl = newmode; int86(0x83, ®s, ®s); } return curmode; case FEP_AT7DOSV: /* mode: 00000000 = off, 10000000 = on */ regs.x.ax = 0x1301; int86(0x16, ®s, ®s); curmode = regs.h.dl; if (newmode != -1 && newmode != curmode) { regs.x.ax = 0x1300; regs.h.dl = newmode; int86(0x16, ®s, ®s); } return curmode; case FEP_IAS: /* * mode: 0rxxx000 = off, 1rxxx101 = on (r = romaji) * bit7: kanji: 0 = off, 1 = on * bit6: romaji: 0 = off, 1 = on * bit5-3: reserved * bit2-1: shift: 00=alpha, 01=kata, 10=hira, 11=reserved * bit0: size: 0 = hankaku, 1 = zenkaku */ #define IASOFF(mode) ((mode & 0x87) == 0x00) regs.x.ax = 0x1301; int86(0x16, ®s, ®s); curmode = regs.h.dl; if (newmode == -1) return IASOFF(curmode)? 0: curmode; if (IASOFF(newmode) != IASOFF(curmode)) { regs.x.ax = 0x1300; regs.h.dl = (newmode & 0x87) | (curmode & 0x78); int86(0x16, ®s, ®s); } return curmode; #endif /* DO_GENERIC */ default: return 0; } } #ifdef DO_MSKANJI /* * MS-KANJI Application Interface access routines */ struct Kkname { short wLevel; /* API support level */ char rgchName[8]; /* name of system */ char rgchVersion[4]; /* version # of system */ char rgchRevision[4]; /* revision # of system */ char Reserved[14]; /* reserved */ }; struct Dataparm { short wType; /* display switch */ short wScan; /* key scan code */ short wAscii; /* ascii code */ short wShift; /* shift key status */ short wExShift; /* extended shift key status */ short cchResult; /* size of confirmed string */ char far *lpchResult; /* ptr to confirmed string */ short cchMode; /* size of mode display str */ char far *lpchMode; /* ptr to mode display str */ char far *lpattrMode; /* ptr to attribute of it */ short cchSystem; /* size of system string */ char far *lpchSystem; /* ptr to system string */ char far *lpattrSystem; /* ptr to attribute of it */ short ccBuf; /* size of unconfirmed str */ char far *lpchBuf; /* ptr to unconfirmed str */ char far *lpattrBuf; /* ptr to attribute of it */ short cchBufCursor; /* cursor position in it */ char Reserved[34]; /* reserved */ }; struct Funcparm { short wFunc; /* function # */ short wMode; /* reference or set */ struct Kkname far *lpKkname; /* translation system */ struct Dataparm far *lpDataparm; /* data parameter */ char Reserved[4]; /* reserved */ }; /* * function # for wFunc */ #define KKAsk 1 #define KKOpen 2 #define KKClose 3 #define KKInOut 4 #define KKMode 5 /* * mode bit for wMode */ #define KM_GET 0x0000 #define KM_SET 0x8000 #define KM_OFF 0x0001 #define KM_ON 0x0002 #define KM_SYS 0x0004 #define KM_ECHO 0x0008 #if defined(LSI_C) static int (far *KKfunc)(void); #elif defined(__TURBOC__) static int (far pascal *KKfunc)(struct Funcparm far *); #else /* Microsoft C, Quick C, Lattice C */ static int (far pascal *KKfunc)(int *, struct Funcparm far *); #endif static int near __PASCAL msknj_kkfunc(struct Funcparm far *); static struct Funcparm Funcbuf; static struct Kkname Kkbuf; static int near __PASCAL msknj_find(char *dname) { int fd, n; if (!check_dev(dname)) return 0; /* * get entry address of KKfunc() */ fd = open_dev(dname); regs.x.ax = RCV_IOC_CHAR; regs.x.bx = fd; regs.x.cx = 4; regs.x.dx = FAR_OFF((void far *)&KKfunc); sregs.ds = FAR_SEG((void far *)&KKfunc); intdosx(®s, ®s, &sregs); n = regs.x.ax; close_dev(fd); if (n != 4) /* ioctl failed */ return 0; /* * check API support level */ memset(&Funcbuf, 0, sizeof(Funcbuf)); Funcbuf.wFunc = KKAsk; Funcbuf.lpKkname = (struct Kkname far *)&Kkbuf; if (msknj_kkfunc((struct Funcparm far *)&Funcbuf) < 0) return 0; if (Kkbuf.wLevel < 1) /* level too low */ return 0; /* * we don't use MS-KANJI API upon ATOK7 with MSATOK, * because SoftVision's MSATOK doesn't satisfy the * specification of KKMode function. MSKN 2.0 (later * version of MSATOK; identified as "MSKN ") is O.K. */ if (!strncmp(Kkbuf.rgchName, "MSKNATOK", 8)) return 0; return 1; } static int near __PASCAL msknj_get_mode(void) { memset(&Funcbuf, 0, sizeof(Funcbuf)); Funcbuf.wFunc = KKMode; Funcbuf.wMode = KM_GET; msknj_kkfunc((struct Funcparm far *)&Funcbuf); return (Funcbuf.wMode & KM_OFF)? 0: (Funcbuf.wMode & KM_SYS)? 1: 2; } static int near __PASCAL msknj_set_mode(int mode) { memset(&Funcbuf, 0, sizeof(Funcbuf)); Funcbuf.wFunc = KKMode; Funcbuf.wMode = KM_SET; Funcbuf.wMode |= (mode == 0)? KM_OFF: KM_ON; Funcbuf.wMode |= (mode == 1)? KM_SYS: KM_ECHO; msknj_kkfunc((struct Funcparm far *)&Funcbuf); return 0; } static int near __PASCAL msknj_kkfunc(struct Funcparm far *bufp) { #if defined(__TURBOC__) static int sp, ret; sp = _SP; ret = KKfunc((struct Funcparm far *)bufp); _SP = sp; return ret; #elif defined(LSI_C) static int savesp, ret; savesp = _asm_i("\n\tmov\tax,sp"); /* * pass the parameter to KKfunc() thru stack * mov ax, [bufp].seg * mov bx, [bufp].off * push bx * push ax */ _asm_c("\n\tpush\tbx\n\tpush\tax", (struct Funcparm far *)bufp); ret = KKfunc(); _asm_c("\n\tmov\tsp,ax", savesp); return ret; #else /* Microsoft C, Quick C, Lattice C */ int magic; /* * magic cookie (hinted by Oh!No!): * adjust resulting stack pointer for both C and pascal calls. * valid under all memory models of Microsoft C and Lattice C. */ return KKfunc(&magic, (struct Funcparm far *)bufp); #endif } #endif /* DO_MSKANJI */ #endif /* FEPCTRL */ ng-1.5beta1/sys/msdos/fepctrl.h100644 1750 1750 7615 7126003716 15237 0ustar amurausers/* $Id: fepctrl.h,v 1.1.1.1 2000/06/27 01:47:58 amura Exp $ */ /* * fepctrl.h 1.5 1992/04/08. Public Domain. * * General purpose Japanese FEP control routines for MS-DOS. * Written by Junn Ohta (ohta@src.ricoh.co.jp, msa02563) * * Compiles under: * Turbo C 1.5/2.0, Turbo C++ 1.0, Borland C++ 2.0/3.0, * Microsoft C 5.1, Microsoft C 6.0, Quick C 2.0, * Lattic C 4.1 (need negative stack frame, except huge model), * LSI C-86 3.2/3.3 Sampler (small model only). */ /* * $Log: fepctrl.h,v $ * Revision 1.1.1.1 2000/06/27 01:47:58 amura * import to CVS * */ #ifndef __FEPCTRL_H #define __FEPCTRL_H /* * Holy Oracle for MS-DOS C compilers */ #if defined(__TURBOC__) # if __STDC__ # define _Cdecl # define _Pascal # else # define _Cdecl cdecl # define _Pascal pascal # endif # define __CDECL _Cdecl # define __PASCAL _Pascal #elif defined(LSI_C) # define __CDECL # define __PASCAL #elif defined(LATTICE) # define __CDECL # define __PASCAL pascal #elif defined(_MSC_VER) && _MSC_VER >= 600 # define __CDECL _cdecl # define __PASCAL _fastcall #else /* Microsoft C 5.1, Quick C */ # ifndef NO_EXT_KEYS # define _CDECL cdecl # define _PASCAL pascal # else # define _CDECL # define _PASCAL # endif # define __CDECL _CDECL # define __PASCAL _PASCAL #endif /* * Japanese FEP type (returned by fep_init()) */ enum __fep_t { FEP_NONE, FEP_PC98A, /* FEP controlled via PC-9801 BIOS (type A) */ FEP_PC98B, /* FEP controlled via PC-9801 BIOS (type B) */ FEP_PC98C, /* FEP controlled via PC-9801 BIOS (type C) */ FEP_MSKANJI, /* MS-KANJI Application Interface */ FEP_VJE, /* VACS Japanese Entry System Alpha/Sigma/Beta */ FEP_ATOK6, /* JUSTSYSTEM's Automatic Transfer of Kana-Kanji 6 */ FEP_ATOK7, /* JUSTSYSTEM's Automatic Transfer of Kana-Kanji 7 */ FEP_MTTK86, /* K3's Matsutake (pinetree mushroom) 86 */ FEP_MTTK2, /* K3's Matsutake (pinetree mushroom) V2 */ FEP_KATANA, /* Something Good's Katana/ACE */ FEP_FIXER, /* Citysoft's FIXER3/FIXER4 */ FEP_EGB2, /* ERGOSOFT's EGBridge Ver.2 */ FEP_EGB3, /* ERGOSOFT's EGBridge Ver.3 */ FEP_WXP, /* A.I.Soft's WXP 1.03a, WX 1.0, WXS 1.0 */ FEP_WX2, /* A.I.Soft's WXII with /VZ (and WXP 1.04c) */ FEP_MGR2, /* REED REX's MGR2 */ FEP_JJ, /* REED REX's JJ */ FEP_NEC, /* NEC's Chikuji/AI Kana-Kanji Henkan */ FEP_DFJ, /* Digital Farm's DFJ Ver.1 */ FEP_DANGO, /* Suzuki Kyoiku Soft's DANGO Henkan */ FEP_OTEMOTO, /* Gengo Kogaku Kenkyujo's OTEMOTO (at hand) */ FEP_OMAC, /* Morrin's OMAC */ FEP_AJIP1, /* Acel's AJIP1 */ FEP_JOKER3, /* Micronics's Joker-III */ FEP_KAZE, /* Enzan-Hoshi-Gumi's Kaze / Arashi */ FEP_OAK, /* OASYS Kana-Kanji Henkan (Fujitsu FM-R series) */ FEP_MKK, /* Matsushita Kana-Kanji Henkan (Panacom series) */ FEP_B16, /* Renbunsetsu/Jidou Henkan (Hitachi B16 series) */ FEP_RICOH, /* Nihongo Nyuryoku System (RICOH Mr. Mytool MAGUS) */ FEP_WXPJ, /* A.I.Soft's WXP (Toshiba J3100) */ FEP_MIJ, /* MIJ (Toshiba J3100); NOT TESTED!! */ FEP_FEPEX, /* ERGOSOFT's FEPEX Ver.2 (Oki IF800) */ FEP_AT6AX, /* JUSTSYSTEM's ATOK6 (AX machines) */ FEP_AT6IBM, /* JUSTSYSTEM's ATOK6 (IBM PS/55 JDOS4) */ FEP_AT7IBM, /* JUSTSYSTEM's ATOK7 (IBM PS/55 JDOS4) */ FEP_AT7DOSV, /* JUSTSYSTEM's ATOK7 (IBM DOS/V) */ FEP_IAS, /* IBM DOS/V Input Assist Subsystem (SKK, MKK) */ NFEPS /* Number of FEPs defined */ }; #ifdef __cplusplus extern "C" { int __CDECL fep_init(void); void __CDECL fep_term(void); void __CDECL fep_on(void); void __CDECL fep_off(void); void __CDECL fep_force_on(void); void __CDECL fep_force_off(void); int __CDECL fep_raw_init(void); void __CDECL fep_raw_term(void); int __CDECL fep_get_mode(void); } #else int __CDECL fep_init(void); void __CDECL fep_term(void); void __CDECL fep_on(void); void __CDECL fep_off(void); void __CDECL fep_force_on(void); void __CDECL fep_force_off(void); int __CDECL fep_raw_init(void); void __CDECL fep_raw_term(void); int __CDECL fep_get_mode(void); #endif #endif /* __FEPCTRL_H */ ng-1.5beta1/sys/msdos/fileio.c100644 1750 1750 65110 7252176152 15061 0ustar amurausers/* $Id: fileio.c,v 1.9 2001/03/09 15:53:14 amura Exp $ */ /* * MS-DOS file I/O. (Tested only at MS-DOS 3.1) * * I make this file from BSD UNIX fileio.c. */ /* * $Log: fileio.c,v $ * Revision 1.9 2001/03/09 15:53:14 amura * enable to really work autosave feature * * Revision 1.8 2001/03/02 08:48:31 amura * now AUTOSAVE feature implemented almost all (except for WIN32 * * Revision 1.7 2001/02/18 19:29:04 amura * split dir.c to port depend/independ * * Revision 1.6 2001/01/05 13:55:27 amura * filename completion fixed * * Revision 1.5 2000/12/28 07:27:16 amura * homedirctory support with filename complition * * Revision 1.4 2000/12/27 16:55:42 amura * change d_makename() params for conservative reason, and bugfix in dires_() * * Revision 1.3 2000/12/14 18:10:47 amura * filename length become flexible * * Revision 1.2 2000/07/25 15:06:52 amura * handle Kanji filename of initfile * * Revision 1.1.1.1 2000/06/27 01:47:58 amura * import to CVS * */ /* 90.02.11 Modified for Ng 1.0 MS-DOS ver. by S.Yoshida */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include "def.h" #include #include /* 90.05.30 Add by A.Shirahashi */ #include /* 90.07.26 Add by N.Kamei */ static FILE *ffp; extern char *getenv(), *strncpy(); char *adjustname(); char *fftolower(); /* 90.07.01 Add by S.Yoshida */ /* * Open a file for reading. */ ffropen(fn) char *fn; { char fns[NFILEN]; strcpy(fns, fn); #ifdef KANJI bufetos(fns, strlen(fns)+1); #endif if ((ffp=fopen(fns, "r")) == NULL) return (FIOFNF); return (FIOSUC); } /* * Open a file for writing. * Return TRUE if all is well, and * FALSE on error (cannot create). */ ffwopen(fn) char *fn; { char fns[NFILEN]; strcpy(fns, fn); #ifdef KANJI bufetos(fns, strlen(fns)+1); #endif KANJI if ((ffp=fopen(fns, "w")) == NULL) { ewprintf("Cannot open file for writing"); return (FIOERR); } return (FIOSUC); } /* * Close a file. * Should look at the status. */ ffclose() { (VOID) fclose(ffp); return (FIOSUC); } /* * Write a buffer to the already * opened file. bp points to the * buffer. Return the status. * Check only at the newline and * end of buffer. */ ffputbuf(bp) BUFFER *bp; { register char *cp; register char *cpend; register LINE *lp; register LINE *lpend; #ifdef KANJI /* 90.01.29 by S.Yoshida */ register int kfio; #endif /* KANJI */ lpend = bp->b_linep; #ifdef KANJI /* 90.01.29 by S.Yoshida */ if (bp->b_kfio == NIL) ksetbufcode(bp); /* Set buffer local KANJI code. */ kfio = bp->b_kfio; #endif /* KANJI */ lp = lforw(lpend); do { cp = <ext(lp)[0]; /* begining of line */ cpend = &cp[llength(lp)]; /* end of line */ while(cp != cpend) { #ifdef KANJI /* 90.01.29 by S.Yoshida */ kputc(*cp, ffp, kfio); #else /* NOT KANJI */ putc(*cp, ffp); #endif /* KANJI */ cp++; /* putc may evalualte arguments more than once */ } #ifdef KANJI /* 90.01.29 by S.Yoshida */ if (kfio == JIS) { kfselectcode(ffp, FALSE); } #endif /* KANJI */ lp = lforw(lp); if(lp == lpend) break; /* no implied newline on last line */ putc('\n', ffp); } while(!ferror(ffp)); if(ferror(ffp)) { ewprintf("Write I/O error"); return FIOERR; } return FIOSUC; } /* * Read a line from a file, and store the bytes * in the supplied buffer. Stop on end of file or end of * line. When FIOEOF is returned, there is a valid line * of data without the normally implied \n. */ ffgetline(buf, nbuf, nbytes) register char *buf; register int nbuf; register int *nbytes; { register int c; register int i; i = 0; while((c = getc(ffp))!=EOF && c!='\n') { buf[i++] = c; if (i >= nbuf) return FIOLONG; } if (c == EOF && ferror(ffp) != FALSE) { ewprintf("File read error"); return FIOERR; } *nbytes = i; return c==EOF ? FIOEOF : FIOSUC; } #ifndef NO_BACKUP /* * Rename the file "fname" into a backup * copy. On Unix the backup has the same name as the * original file, with a "~" on the end; this seems to * be newest of the new-speak. The error handling is * all in "file.c". The "unlink" is perhaps not the * right thing here; I don't care that much as * I don't enable backups myself. */ fbackupfile(fn) char *fn; { register char *nname; char *dotp; /* 90.07.26 Add by N.Kamei */ VOID strmfe(); /* 90.07.26 Add by N.Kamei */ char fns[NFILEN]; char nnames[NFILEN]; if ((nname=alloca((unsigned)(strlen(fn)+4+1))) == NULL) { /* 90.07.26 1+1 -> 4+1 by N.Kamei */ ewprintf("Can't get %d bytes", strlen(fn) + 4 +1); return (ABORT); } /* 90.07.26 by N.Kamei This is not good for MS-DOS. (VOID) strcpy(nname, fn); (VOID) strcat(nname, "~"); */ strmfe(nname, fn, "bak"); /* 90.07.26 by N.Kamei */ strcpy(nnames, nname); strcpy(fns, fn); #ifdef KANJI bufetos(nnames, strlen(nnames)+1); bufetos(fns, strlen(fns)+1); #endif KANJI (VOID) unlink(nnames); /* Ignore errors. */ if (rename(fns, nnames) < 0) return (FALSE); return (TRUE); } /* * 90.07.26 Add by N.Kamei. * Add or replace file name extention to ext. * strmfe() is a standard function of Lattice-C. */ VOID strmfe(newname, oldname, ext) char *newname, *oldname, *ext; { char *tmp_p, *node_p; strcpy(newname, oldname); /* search nodename top */ node_p = newname; tmp_p = strchr(node_p, '\\'); while(tmp_p) { node_p = &tmp_p[1]; tmp_p = strchr(node_p, '\\'); } tmp_p = strrchr(node_p, '.'); if (tmp_p) *tmp_p = '\0'; strcat(node_p, "."); strcat(node_p, ext); } #ifdef BUGFIX /* 90.02.16 by S.Yoshida */ #ifndef _SYS_STAT_H_ #if !defined(__TURBOC__) || __TURBOC__ >= 0x0200 /* 90.12.28 For Turbo-C 1.5 by Junn Ohta */ #include #endif /* __TURBOC__ */ #include #define _SYS_STAT_H_ #endif /* _SYS_STAT_H_ */ /* * Get file mode of a file fn. */ fgetfilemode(fn) char *fn; { struct stat filestat; char fns[NFILEN]; strcpy(fns, fn); #ifdef KANJI bufetos(fns, strlen(fns)+1); #endif KANJI if (stat(fns, &filestat) == 0) { return(filestat.st_mode & 0x0fff); } else { return(-1); } } /* * Set file mode of a file fn to the specified mode. */ VOID fsetfilemode(fn, mode) char *fn; int mode; { char fns[NFILEN]; strcpy(fns, fn); #ifdef KANJI bufetos(fns, strlen(fns)+1); #endif KANJI (VOID) chmod(fns, mode); } #endif /* BUGFIX */ #endif #ifdef READONLY /* 91.01.05 by S.Yoshida */ #ifndef _SYS_STAT_H_ #if !defined(__TURBOC__) || __TURBOC__ >= 0x0200 /* 90.12.28 For Turbo-C 1.5 by Junn Ohta */ #include #endif /* __TURBOC__ */ #include #define _SYS_STAT_H_ #endif /* _SYS_STAT_H_ */ /* * Check whether file is read-only of a file fn. */ fchkreadonly(fn) char *fn; { struct stat filestat; char fns[NFILEN]; strcpy(fns, fn); #ifdef KANJI bufetos(fns, strlen(fns)+1); #endif KANJI if (stat(fns, &filestat) == 0) { return(!(filestat.st_mode & S_IWRITE)); } else { return FALSE; } } #endif /* READONLY */ #ifndef NO_DIR #include char *getcwd(); char *fftolower(); /* 90.07.01 Add by S.Yoshida */ extern char *wdir; extern char *startdir; static char cwd[NFILEN]; /* * Initialize anything the directory management routines need */ VOID dirinit() { /* 90.07.01 Add fftolower() by S.Yoshida */ if (!(wdir = fftolower(getcwd(cwd, NFILEN - 1)))) panic("Can't get current directory!"); if (wdir[1]==':' && ISUPPER(wdir[0])) wdir[0] = TOLOWER(wdir[0]); #ifdef KANJI bufstoe(wdir, strlen(wdir)+1); #endif if (startdir == NULL) { int len = strlen(cwd); startdir = malloc(len + 1); if (startdir == NULL) { ewprintf("Cannot alloc %d bytes", len + 1); return; } strcpy(startdir, cwd); } } /* * dirend routine */ VOID dirend() { rchdir(startdir); } /* rchdir() makes some effects to change directory. It will affect system to set the actual current directory to the specified one. This routine is extracted from changedir(), which is currently do some virtual chdir but previously do the actual one. Both bufc and wdir should have enough space to store file path, that is, as long as NFILEN. By Tillanosoft, Mar 22, 1999 */ int rchdir(newdir) char *newdir; { char dir[NFILEN]; int i; strcpy(dir, newdir); #ifdef KANJI bufetos(dir, strlen(dir)+1); #endif i = strlen(dir) - 1; if (dir[i] == '\\' || dir[i] == '/') dir[i] = '\0'; if (dir[1] == ':' && dir[0] != wdir[0]) { int drive; int ndrive; drive = newdir[0]; /* 90.07.01 Change from TOUPPER() to TOLOWER() */ /* by S.Yoshida */ if (ISUPPER(drive)) drive = TOLOWER(drive); /* 90.07.01 Change from 'A' to 'a' by S.Yoshida */ drive = drive - 'a' + 1; #ifdef __TURBOC__ /* 90.03.23 by A.Shirahashi */ (VOID) setdisk(drive - 1); #else _dos_setdrive(drive, &ndrive); /* Need MSC 5.1 */ #endif } if (dir[1] == ':') { if (dir[2] == '\0') { dirinit(); return 0; } else if (chdir(dir+2) == -1) return -1; } else if (chdir(dir) == -1) return -1; dirinit(); return 0; } #endif /* * The string "fn" is a file name. * Perform any required appending of directory name or case adjustments. * If NO_DIR is not defined, the same file should be refered to even if the * working directory changes. */ char *adjustname(fn) register char *fn; { register char *cp; static char fnb[NFILEN]; cp = fnb; if (fn[1] == ':') { *cp++ = *fn++; *cp++ = *fn++; } #ifdef HOMEDIR else if (fn[0]=='~' && (fn[1]=='/' || fn[1]=='\\')) { strcpy(fnb, getenv("HOME")); while (*cp) { if (*cp == '/') *cp = '\\'; cp++; } fn++; } #endif switch(*fn) { case '/': *fn = '\\'; case '\\': /* 91.01.21 Add following if() for bug fix. by S.Yoshida */ /* This fix can consider that when current drive */ /* is "a:", "\file" and "a:\file" are same. */ if (cp == fnb) { *cp++ = wdir[0]; /* Current drive name. */ *cp++ = wdir[1]; /* ':' */ } *cp++ = *fn++; break; default: #ifndef NO_DIR /* 91.01.17 NODIR -> NO_DIR. by S.Yoshida */ if (cp == fnb || fnb[0] == wdir[0]) { (VOID) strcpy(fnb, wdir); cp = fnb + strlen(fnb); } else { /* Different drive. */ int drive; int ndrive; char *getcwd(); drive = fnb[0]; /* 90.07.01 Change from TOUPPER() to TOLOWER() */ /* by S.Yoshida */ if (ISUPPER(drive)) { drive = TOLOWER(drive); } /* 90.07.01 Change from 'A' to 'a' by S.Yoshida */ drive = drive - 'a' + 1; #ifdef __TURBOC__ /* 90.03.27 by A.Shirahashi */ (void) setdisk(drive - 1); #else /* NOT __TURBOC__ */ _dos_setdrive(drive, &ndrive); /* Need MSC 5.1 */ #endif /* __TURBOC__ */ /* 90.07.01 Add fftolower() by S.Yoshida */ if (!fftolower(getcwd(fnb, NFILEN - 1))) { cp = fnb; /* 90.07.01 Change from 'A' to 'a' by S.Yoshida */ *cp++ = drive + 'a' - 1; *cp++ = ':'; } else { cp = fnb + strlen(fnb); } drive = wdir[0]; /* Reset to current drive. */ /* 90.07.01 Change from TOUPPER() to TOLOWER() */ /* by S.Yoshida */ if (ISUPPER(drive)) { drive = TOLOWER(drive); } /* 90.07.01 Change from 'A' to 'a' by S.Yoshida */ drive = drive - 'a' + 1; #ifdef __TURBOC__ /* 90.03.27 by A.Shirahashi */ (void) setdisk(drive - 1); #else /* NOT __TURBOC__ */ _dos_setdrive(drive, &ndrive); /* Need MSC 5.1 */ #endif /* __TURBOC__ */ } break; #else return fn; /* punt */ #endif } if(cp != fnb && cp[-1] != '\\') *cp++ = '\\'; while(*fn) { switch(*fn) { case '.': switch(fn[1]) { case '\0': *--cp = '\0'; return fnb; case '/': case '\\': fn += 2; continue; case '.': if(fn[2]=='\\' || fn[2] == '/' || fn[2] == '\0') { --cp; while(cp > fnb && *--cp != '\\') {} ++cp; if(fn[2]=='\0') { *--cp = '\0'; return fnb; } fn += 3; continue; } break; default: break; } break; case '/': case '\\': fn++; continue; default: break; } while(*fn && (*cp++ = *fn++) != '\\') { /* 90.06.05 by S.Yoshida */ /* 90.06.08 by A.Shirahashi, convert to lower case */ if (ISUPPER(cp[-1])) { cp[-1] = TOLOWER(cp[-1]); } if (cp[-1] == '/') { cp[-1] = '\\'; break; } } } if(cp[-1]=='\\') { /* 91.01.16 bug fix for case only "a:\". by S.Yoshida */ if (cp != &fnb[3] || fnb[1] != ':') { --cp; } } *cp = '\0'; return fnb; } #ifndef NO_STARTUP #include /* * Find a startup file for the user and return its name. As a service * to other pieces of code that may want to find a startup file (like * the terminal driver in particular), accepts a suffix to be appended * to the startup file name. */ char * #ifdef ADDOPT startupfile(ngrcfile, suffix) char* ngrcfile; #else startupfile(suffix) #endif char *suffix; { register char *file; static char home[NFILEN]; char *getenv(); if ((file = getenv("NG")) == NULL) { if ((file = getenv("HOME")) == NULL) goto notfound; } if (strlen(file)+7 >= NFILEN - 1) goto notfound; (VOID) strcpy(home, file); #ifdef ADDOPT if (!ngrcfile) ngrcfile = getenv("NGRC"); if (ngrcfile) { if (access(ngrcfile, 0) == 0) { strncpy(home, ngrcfile, NFILEN); home[NFILEN-1] = '\0'; #ifdef KANJI bufstoe(home, strlen(home)+1); #endif return home; } /* strcat(home, "\\"); strcat(home, ngrcfile); if (access(home, 0) == 0) { #ifdef KANJI bufstoe(home, strlen(home)+1); #endif return home; } (VOID)strcpy(home, file); */ } #endif #ifdef KANJI /* 90.02.10 by S.Yoshida */ (VOID) strcat(home, "\\ng.ini"); #else /* NOT KANJI */ (VOID) strcat(home, "\\mg.ini"); #endif /* KANJI */ if (suffix != NULL) { (VOID) strcat(home, "-"); (VOID) strcat(home, suffix); } if (access(home, 0) == 0) { #ifdef KANJI bufstoe(home, strlen(home)+1); #endif return home; } notfound: #ifdef STARTUPFILE strcpy(home, STARTUPFILE); if (suffix != NULL) { (VOID) strcat(home, "-"); (VOID) strcat(home, suffix); } if (access(home, 0) == 0) { #ifdef KANJI bufstoe(home, strlen(home)+1); #endif return home; } #endif return NULL; } #endif #ifndef NO_DIRED #include #ifdef __TURBOC__ /* 90.03.27 by A.Shirahashi */ #include #define find_t ffblk #define _dos_findfirst(p,a,f) findfirst(p,f,a) #define _dos_findnext(f) findnext(f) #define _A_NORMAL 0 #define _A_RDONLY FA_RDONLY #define _A_SUBDIR FA_DIREC #define _A_ARCH FA_ARCH #define attrib ff_attrib #define wr_date ff_fdate #define wr_time ff_ftime /*#define size ff_fsize*/ /* 90.05.30 remove by A.Shirahashi */ /*#define name ff_name*/ /* 90.05.30 remove by A.Shirahashi */ #else /* NOT __TURBOC__ */ #include #endif /* __TURBOC__ */ #include "kbd.h" copy(frname, toname) char *frname, *toname; { char cmd[256]; char frnames[NFILEN]; char tonames[NFILEN]; strcpy(frnames, frname); strcpy(tonames, toname); #ifdef KANJI bufetos(frnames, strlen(frnames)+1); bufetos(tonames, strlen(tonames)+1); #endif sprintf(cmd, "copy %s %s", frnames, tonames); return (system(cmd) == 0); } BUFFER *dired_(dirname) char *dirname; { register BUFFER *bp; BUFFER *findbuffer(); char **files, **getfilelist(); int numfiles; int i; if((dirname = adjustname(dirname)) == NULL) { ewprintf("Bad directory name"); return NULL; } if(dirname[strlen(dirname)-1] != '\\') (VOID) strcat(dirname, "\\"); if((bp = findbuffer(dirname)) == NULL) { ewprintf("Could not create buffer"); return NULL; } if(bclear(bp) != TRUE) return FALSE; if ((files = getfilelist(&numfiles, dirname)) == NULL) { ewprintf("Could not get directory info"); return NULL; } for (i = 0; i < numfiles; i++) { (VOID) addline(bp, files[i]); free(files[i]); } free(files); bp->b_dotp = lforw(bp->b_linep); /* go to first line */ if(bp->b_fname != NULL) free(bp->b_fname); if((bp->b_fname=malloc(strlen(dirname)+1)) != NULL) (VOID) strcpy(bp->b_fname, dirname); #ifdef EXTD_DIR if(bp->b_cwd != NULL) free(bp->b_cwd); bp->b_cwd = NULL; #endif if((bp->b_modes[0] = name_mode("dired")) == NULL) { bp->b_modes[0] = &map_table[0]; ewprintf("Could not find mode dired"); return NULL; } bp->b_nmodes = 0; return bp; } d_makename(lp, fn, buflen) register LINE *lp; register char *fn; { register char *cp; int len; if(llength(lp) <= 41) return ABORT; len = strlen(curbp->b_fname) + llength(lp) - 41; if (buflen <= len) return ABORT; cp = fn; strcpy(cp, curbp->b_fname); cp += strlen(cp); bcopy(&lp->l_text[41], cp, llength(lp) - 41); cp[llength(lp) - 41] = '\0'; return lgetc(lp, 2) == 'd'; } char ** getfilelist(numfiles, dirname) int *numfiles; char *dirname; { char **files; int maxfiles; struct find_t fileinfo; int i; char filename[NFILEN]; #ifdef KANJI char filenames[NFILEN]; #endif int filelinecmp(); void *calloc(), *realloc(); VOID mkfileline(); if (strlen(dirname) + 4 > NFILEN) return(NULL); (VOID) strcpy(filename, dirname); (VOID) strcat(filename, "*.*"); maxfiles = 50; files = (char **)calloc(maxfiles, sizeof(char *)); if (files == NULL) return(NULL); #ifdef KANJI strcpy(filenames, filename); bufetos(filenames, strlen(filenames) +1); if (_dos_findfirst(filenames, _A_NORMAL | _A_RDONLY | _A_SUBDIR, &fileinfo) == 0) { #else /* not KANJI */ if (_dos_findfirst(filename, _A_NORMAL | _A_RDONLY | _A_SUBDIR, &fileinfo) == 0) { #endif /* KANJI */ files[0] = (char *)calloc(80, 1); if (files[0] == NULL) { free(files); return(NULL); } mkfileline(files[0], &fileinfo); *numfiles = 1; while(_dos_findnext(&fileinfo) == 0) { if (*numfiles >= maxfiles) { files = (char **) realloc(files, sizeof(char *) * (maxfiles + 20)); if (files == NULL) return(NULL); maxfiles += 20; } files[*numfiles] = (char *)calloc(80, 1); if (files[*numfiles] == NULL) { for (i = 0; i < *numfiles; i++) { free(files[i]); } free(files); return(NULL); } mkfileline(files[*numfiles], &fileinfo); (*numfiles)++; } qsort(files, *numfiles, sizeof (char *), filelinecmp); return(files); } return(NULL); } VOID mkfileline(line, info) char *line; struct find_t *info; { int y; line[0] = line[1] = ' '; line[2] = (info->attrib & _A_SUBDIR) ? 'd' : '-'; line[3] = 'r'; line[4] = (info->attrib & _A_RDONLY) ? '-' : 'w'; line[5] = '-'; line[6] = (info->attrib & _A_ARCH) ? 'a' : '-'; #ifdef __TURBOC__ /* 90.05.30 by A.Shirahashi */ (VOID) sprintf(&line[7], "%15ld", info->ff_fsize); #else (VOID) sprintf(&line[7], "%15ld", info->size); #endif y = 1980 + ((info->wr_date >> 9) & 0x7f); y -= (y > 1999) ? 2000 : 1900; (VOID) sprintf(&line[22], " %02d-%02d-%02d %02d:%02d ", y, (info->wr_date >> 5) & 0x0f, info->wr_date & 0x1f, (info->wr_time >> 11) & 0x1f, (info->wr_time >> 5) & 0x3f); #ifdef __TURBOC__ /* 90.05.30 by A.Shirahashi */ /* 90.07.01 Add fftolower() by S.Yoshida */ (VOID) strcpy(&line[41], info->ff_name); #else /* 90.07.01 Add fftolower() by S.Yoshida */ (VOID) strcpy(&line[41], info->name); #endif #ifdef KANJI (VOID) bufstoe(&line[41], strlen(&line[41])+1); #endif /* KANJI */ (VOID) fftolower(&line[41]); } filelinecmp(x, y) char **x, **y; { register unsigned char *xx, *yy; xx = (unsigned char*)&(*x)[41]; yy = (unsigned char*)&(*y)[41]; if (*xx != *yy) { /* for "." ".." directories */ if (*xx == '.') return -1; if (*yy == '.') return 1; return(*xx - *yy); } if (*xx) { for (xx++, yy++; *xx && *xx == *yy; xx++, yy++) {} } return(*xx - *yy); } #endif #ifndef NO_DIRED /* 91.01.15 by K.Maeda */ #ifndef _SYS_STAT_H_ #if !defined(__TURBOC__) || __TURBOC__ >= 0x0200 /* 90.12.28 For Turbo-C 1.5 by Junn Ohta */ #include #endif /* __TURBOC__ */ #include #define _SYS_STAT_H_ #endif /* _SYS_STAT_H_ */ /* * Check whether file "dn" is directory. */ ffisdir(dn) char *dn; { struct stat filestat; char dns[NFILEN]; strcpy(dns, dn); #ifdef KANJI bufetos(dns, strlen(dns)+1); #endif if (stat(dns, &filestat) == 0) { return ((filestat.st_mode & S_IFMT) == S_IFDIR); } else { return FALSE; } } #endif /* NO_DIRED */ #ifndef NO_FILECOMP /* 90.04.04 by K.Maeda */ /* 89.11.20 Original code is for X68K (Human68K). * 90.04.08 Modified for MS-DOS by S.Yoshida. * 90.05.30 Debuged by A.Shirahashi. * Find file names starting with name. * Result is stored in *buf, got from malloc(); * Return the number of files found, or * -1 of error occured. */ #define MALLOC_STEP 256 fffiles(name, buf) char *name, **buf; { char pathbuf[NFILEN], tmpnam[NFILEN]; #ifdef KANJI char pathbufs[NFILEN]; #endif char *cp, *dirpart, *nampart; struct find_t fileinfo; int n, len, size, dirpartlen, nampartlen; char *buffer; void *malloc(), *realloc(); #ifdef HOMEDIR char *home; int homelen; if(name[0] == '~' && (name[1]=='/' || name[1]=='\\') && (home = getenv("HOME"))) { homelen = strlen(home) - 1; strncpy(pathbuf, home, sizeof(pathbuf)); pathbuf[NFILEN-1] = '\0'; strncat(pathbuf, &name[1], sizeof(pathbuf)-strlen(pathbuf)-1); } else { home = NULL; homelen = 0; strncpy(pathbuf, name, sizeof(pathbuf)); pathbuf[NFILEN-1] = '\0'; } #else strncpy(pathbuf, name, sizeof(pathbuf)); pathbuf[NFILEN-1] = '\0'; #endif dirpart = NULL; for (cp = pathbuf; *cp; cp++) { if (*cp == '/') { *cp = '\\'; dirpart = cp; } else if (*cp == '\\') { dirpart = cp; } else if (dirpart == NULL && *cp == ':') { dirpart = cp; } } if (dirpart) { *++dirpart = '\0'; dirpartlen = dirpart - pathbuf; } else { strcpy(pathbuf, ".\\"); /* 90.05.30 by A.Shirahashi */ dirpartlen = 0; } #ifdef HOMEDIR nampart = name + dirpartlen - homelen; #else nampart = name + dirpartlen; #endif nampartlen = strlen(nampart); for (cp = nampart; *cp; cp++) { /* _dos_find*() return */ /* 90.05.30 by A.Shirahashi: Use "toupper()". */ /* 90.06.06 by S.Yoshida: Reused "TOUPPER()". */ /* And add "ISLOWER()". */ if (ISLOWER(*cp)) { *cp = TOUPPER(*cp); /* upper case name. */ } } #ifndef NEW_COMPLETE /* 90.12.10 Sawayanagi Yosirou */ (VOID) strcat(pathbuf, "*.*"); #ifdef KANJI strcpy(pathbufs, pathbuf); bufetos(pathbufs, strlen(pathbufs)+1); if (_dos_findfirst(pathbufs, _A_NORMAL | _A_RDONLY | _A_SUBDIR, &fileinfo) != 0) { #else /* not KANJI */ if (_dos_findfirst(pathbuf, _A_NORMAL | _A_RDONLY | _A_SUBDIR, &fileinfo) != 0) { #endif /* KANJI */ return (-1); } #endif /* NEW_COMPLETE */ buffer = malloc(MALLOC_STEP); if (buffer == NULL) { return (-1); } size = MALLOC_STEP; len = 0; n = 0; #ifdef NEW_COMPLETE /* 90.12.10 Sawayanagi Yosirou */ (VOID) strcat(pathbuf, "*.*"); #ifdef KANJI strcpy(pathbufs, pathbuf); bufetos(pathbufs, strlen(pathbufs)+1); if (_dos_findfirst(pathbufs, _A_NORMAL | _A_RDONLY | _A_SUBDIR, &fileinfo) != 0) { #else /* not KANJI */ if (_dos_findfirst(pathbuf, _A_NORMAL | _A_RDONLY | _A_SUBDIR, &fileinfo) != 0) { #endif /* KANJI */ *buf = buffer; buffer[0] = '\0'; return (0); } #endif /* NEW_COMPLETE */ do { register int l; char ff_namee[NFILEN]; #ifdef __TURBOC__ /* 90.05.30 by A.Shirahashi */ strcpy(ff_namee, fileinfo.ff_name); #else strcpy(ff_namee, fileinfo.name); #endif bufstoe(ff_namee, strlen(ff_namee)+1); if (strncmp(nampart, ff_namee, nampartlen) != 0) continue; /* no-case-sensitive comparison */ strncpy(tmpnam, pathbuf, dirpartlen); strcpy(tmpnam + dirpartlen, ff_namee); if (fileinfo.attrib & _A_SUBDIR) { strcat(tmpnam, "\\"); } l = strlen(tmpnam)+1; /* 90.05.30 by A.Shirahashi */ if (l > 5 && (stricmp(&tmpnam[l-5],".OBJ") == 0 || stricmp(&tmpnam[l-5],".EXE") == 0 || stricmp(&tmpnam[l-5],".COM") == 0)) /* 90.05.30 by A.Shirahashi */ continue; if (l + len >= size) { /* make room for double null */ if ((buffer = realloc(buffer, size += MALLOC_STEP)) == NULL) { return(-1); } } /* 90.06.08 by A.Shirahashi: from */ for (cp = tmpnam; *cp; cp++) { if (ISUPPER(*cp)) { *cp = TOLOWER(*cp); } } /* 90.06.08 by A.Shirahashi: to */ /* 00.12.28 by amura.. contributed by sahf */ #ifdef HOMEDIR if(home) { strcpy(buffer+len, "~"); strcat(buffer+len, tmpnam+homelen+1); l -= homelen; } else #endif strcpy(buffer + len, tmpnam); len += l; n++; } while (_dos_findnext(&fileinfo) == 0); *buf = buffer; buffer[len] = '\0'; return(n); } #endif /* NO_FILECOMP */ /* 90.07.01 Add function to convert strings into lower case by S.Yoshida */ char * fftolower(name) char *name; { register char *p; if ((p = name) != NULL) { while(*p != '\0') { if (ISUPPER(*p)) { *p = TOLOWER(*p); } p++; } } return(name); } #ifdef NEW_COMPLETE /* 90.12.10 Sawayanagi Yosirou */ char * file_name_part (s) char *s; { int i; for (i = strlen (s) - 1; i > 0; i--) { if (s[i - 1] == '/' || s[i - 1] == '\\' || s[i - 1] == ':') break; } return (s + i); } char * copy_dir_name (d, s) char *d; char *s; { int i; i = file_name_part (s) - s; strncpy (d, s, i); d[i] = '\0'; return (d); } #endif /* NEW_COMPLETE */ #ifdef AUTOSAVE VOID autosave_name(buff, name, buflen) char* buff; char* name; { strcpy(buff, name); if (strlen(name)) { char *dot; char *fn = strrchr(name, '/'); if (fn == NULL) fn = strrchr(name, '\\'); if (fn == NULL) fn = strrchr(name, ':'); if (fn == NULL) fn = name; else fn++; dot = strrchr(fn, '.'); if (dot == NULL) dot = name + strlen(name); if (dot-fn < 8) strcpy(&buff[(fn-name)] + 1, fn); buff[fn-name] = '#'; } } #endif /* AUTOSAVE */ ng-1.5beta1/sys/msdos/linkfile100644 1750 1750 1072 7252176152 15143 0ustar amurausersbasic.obj cmode.obj dir.obj dired.obj file.obj line.obj match.obj + parag.obj random.obj region.obj search.obj shell.obj version.obj + window.obj word.obj + buffer.obj complt.obj display.obj echo.obj extend.obj help.obj kbd.obj + keymap.obj macro.obj main.obj modes.obj regex.obj research.obj + kanji.obj kinsoku.obj + cinfo.obj spawn.obj ttyio.obj tty.obj ttykbd.obj + termcap.obj + dosutil.obj fepctrl.obj fepcsub.obj rawgetc.obj putline.obj + fileio.obj skg.obj jump.obj undo.obj autosave.obj c:\msc\lib\setargv.obj ng.exe/E/NOE/NOI/ST:3000/F/PACKCODE ; ng-1.5beta1/sys/msdos/linkfile.tc100644 1750 1750 771 7252176152 15535 0ustar amurausersbasic.obj cmode.obj dir.obj dired.obj file.obj line.obj match.obj + parag.obj random.obj region.obj search.obj shell.obj version.obj + window.obj word.obj + buffer.obj complt.obj display.obj echo.obj extend.obj help.obj kbd.obj + keymap.obj macro.obj main.obj modes.obj regex.obj research.obj + kanji.obj kinsoku.obj + cinfo.obj spawn.obj ttyio.obj tty.obj ttykbd.obj + termcap.obj + dosutil.obj fepctrl.obj rawgetc.obj + fileio.obj putline.obj alloca.obj skg.obj jump.obj undo.obj autosave.obj ng-1.5beta1/sys/msdos/makefile100644 1750 1750 10331 7247657137 15154 0ustar amurausers# $Id: makefile,v 1.2 2001/03/02 08:48:31 amura Exp $ # Makefile for Ng at MS-DOS with MSC 5.1 / 6.0 & UNIX like make. # # This "makefile" is made for MS-C 5.1 / 6.0 and UNIX like "make" command # that isn't included in MS-C 5.1 / 6.0. (may be distributed as free # software) # # If you have only standard "make" utility that is included in MS-C # 5.1 / 6.0, please use "makefile.msc" file. # # $Log: makefile,v $ # Revision 1.2 2001/03/02 08:48:31 amura # now AUTOSAVE feature implemented almost all (except for WIN32 # # Revision 1.1.1.1 2000/06/27 01:47:59 amura # import to CVS # # CDEFS gets defines, and gets passed to lint. CFLAGS gets flags, and doesn't # get passed to lint. # # Now, compile time options are defined in a "config.h". # CDEFS = CFLAGS = -O $(CDEFS) -AL # MACHINE define the MS-DOS machine type. # -DJ3100 and -DPC9801 or none are available. # Define "-DFEPCTRL -DmemL" at FEPDEF if you want to use FEPCTRL function. # MACHINE and FEPDEF must be same as config.h. # MACHINE = #MACHINE = -DJ3100 #MACHINE = -DPC9801 FEPDEF = -DFEPCTRL -DmemL AFLAGS = $(MACHINE) $(FEPDEF) -Mx CC = cl # Objects which only depend on the "standard" includes OBJS = basic.obj dir.obj dired.obj shell.obj version.obj window.obj \ kinsoku.obj jump.obj autosave.obj # Those with unique requirements IND = buffer.obj complt.obj display.obj cmode.obj echo.obj extend.obj \ file.obj help.obj kbd.obj keymap.obj line.obj macro.obj main.obj \ modes.obj match.obj parag.obj random.obj region.obj regex.obj \ research.obj search.obj skg.obj kanji.obj undo.obj word.obj # System dependent objects OOBJS = cinfo.obj spawn.obj tty.obj ttykbd.obj # termlib objects TOBJS = termcap.obj # MS-DOS additional objects DOBJS = dosutil.obj fepctrl.obj fepcsub.obj rawgetc.obj putline.obj OBJ = $(OBJS) $(IND) $(OOBJS) $(TOBJS) $(DOBJS) fileio.obj ttyio.obj OSRCS = cinfo.c fileio.c spawn.c ttyio.c tty.c ttykbd.c TSRCS = termcap.c DSRCS = dosutil.c fepctrl.c rawgetc.asm putline.c SRCS = basic.c cmode.c dir.c dired.c file.c line.c match.c parag.c \ random.c region.c search.c shell.c version.c window.c word.c \ buffer.c complt.c display.c echo.c extend.c help.c kbd.c \ keymap.c macro.c main.c modes.c regex.c research.c kanji.c \ kinsoku.c skg.c jump.c undo.c autosave.c OINCS = ttydef.h sysdef.h chrdef.h INCS = config.h def.h REINCS = regex_e.h regex_j.h regex_j.c regex_e.h kanji_.h kanji_.c ng.exe: $(OBJ) link @linkfile # strip mg once you're satisfied it'll run -- makes it much smaller #strip: # strip mg $(OBJS): $(INCS) $(OINCS) buffer.obj: $(INCS) $(OINCS) kbd.h undo.h cmode.obj file.obj line.obj parag.obj random.obj region.obj undo.obj word.obj: \ ($INCS) $(OINCS) undo.h complt.obj: $(INCS) $(OINCS) kbd.h complt.h display.obj keymap.obj modes.obj fileio.obj: \ $(INCS) $(OINCS) kbd.h echo.obj: $(INCS) $(OINCS) key.h extend.obj help.obj: \ $(INCS) $(OINCS) kbd.h macro.h key.h kanji.obj: $(INCS) $(OINCS) kinit.h kbd.obj: $(INCS) $(OINCS) macro.h kbd.h key.h undo.h macro.obj : $(INCS) $(OINCS) macro.h key.h main.obj search.obj: \ $(INCS) $(OINCS) macro.h match.obj: $(INCS) $(OINCS) key.h research.obj: $(INCS) $(OINCS) $(REINCS) macro.h regex.obj: $(INCS) $(OINCS) $(REINCS) skg.obj: $(INCS) $(OINCS) macro.h key.h undo.h ttyio.obj: $(INCS) $(OINCS) fepctrl.h $(OOBJS): $(INCS) $(OINCS) dosutil.obj putline.obj: config.h fepctrl.obj: config.h fepctrl.h rawgetc.obj: rawgetc.asm masm $(AFLAGS) rawgetc.asm,rawgetc.obj,nul,nul; #sysdef.h: sys/$(SYS)/sysdef.h # Update links, if needed. # rm -f sysdef.h # ln sys/$(SYS)/sysdef.h . #ttydef.h: sys/default/ttydef.h # rm -f ttydef.h # ln sys/default/ttydef.h . #chrdef.h: sys/default/chrdef.h # rm -f chrdef.h # ln sys/default/chrdef.h . #fileio.c: sys/$(SYS)/fileio.c # rm -f fileio.c # ln sys/$(SYS)/fileio.c . #spawn.c: sys/$(SYS)/spawn.c # rm -f spawn.c # ln sys/$(SYS)/spawn.c . #tty.c: sys/default/tty.c # rm -f tty.c # ln sys/default/tty.c . #ttyio.c: sys/$(SYS)/ttyio.c # rm -f ttyio.c # ln sys/$(SYS)/ttyio.c . #ttykbd.c: sys/default/ttykbd.c # rm -f ttykbd.c # ln sys/default/ttykbd.c . #cinfo.c: sys/default/cinfo.c # rm -f cinfo.c # ln sys/default/cinfo.c . #port: $(SRCS) $(INCS) # rm -f port # tar cfb port 1 $? #clean: # del $(OBJ) $(OSRCS) $(OINCS) clean: del *.obj ng-1.5beta1/sys/msdos/makefile.msc100644 1750 1750 11723 7247657137 15743 0ustar amurausers# $Id: makefile.msc,v 1.2 2001/03/02 08:48:31 amura Exp $ # Makefile for Ng at MS-DOS with MS-C 5.1 / 6.0 & MS make. # # This "makefile.msc" is made for MS-C 5.1 / 6.0 and standard "make" utility # that is included in MS-C 5.1 / 6.0. # # If you have more better "make" command (more similar to UNIX make), # please use "makefile" file. # # To use this makefile, please type # A> make makefile.msc # # $Log: makefile.msc,v $ # Revision 1.2 2001/03/02 08:48:31 amura # now AUTOSAVE feature implemented almost all (except for WIN32 # # Revision 1.1.1.1 2000/06/27 01:47:58 amura # import to CVS # # CDEFS gets defines, and gets passed to lint. CFLAGS gets flags, and doesn't # get passed to lint. # # Now, compile time options are defined in a "config.h". # CDEFS = CFLAGS = -O $(CDEFS) -AL # MACHINE define the MS-DOS machine type. # -DJ3100 and -DPC9801 or none are available. # Define "-DFEPCTRL -DmemL" at FEPDEF if you want to use FEPCTRL function. # MACHINE and FEPDEF must be same as config.h. # MACHINE = #MACHINE = -DJ3100 #MACHINE = -DPC9801 FEPDEF = -DFEPCTRL -DmemL AFLAGS = $(MACHINE) $(FEPDEF) -Mx CC = cl # Objects which only depend on the "standard" includes OBJS = basic.obj dir.obj dired.obj shell.obj version.obj window.obj \ kinsoku.obj jump.obj autosave.obj # Those with unique requirements IND = buffer.obj complt.obj display.obj cmode.obj echo.obj extend.obj \ file.obj help.obj kbd.obj keymap.obj line.obj macro.obj main.obj \ modes.obj match.obj parag.obj random.obj region.obj regex.obj \ research.obj search.obj skg.obj kanji.obj undo.obj word.obj # System dependent objects OOBJS = cinfo.obj spawn.obj tty.obj ttykbd.obj # termlib objects TOBJS = termcap.obj # MS-DOS additional objects DOBJS = dosutil.obj fepctrl.obj fepcsub.obj rawgetc.obj putline.obj OBJ = $(OBJS) $(IND) $(OOBJS) $(TOBJS) $(DOBJS) fileio.obj ttyio.obj OSRCS = cinfo.c fileio.c spawn.c ttyio.c tty.c ttykbd.c TSRCS = termcap.c DSRCS = dosutil.c fepctrl.c rawgetc.asm putline.c SRCS = basic.c cmode.c dir.c dired.c file.c line.c match.c parag.c \ random.c region.c search.c version.c window.c word.c \ buffer.c display.c echo.c extend.c help.c kbd.c keymap.c \ macro.c main.c modes.c regex.c research.c kanji.c kinsoku.c \ skg.c jump.c autosave.c OINCS = ttydef.h sysdef.h chrdef.h INCS = config.h def.h REINCS = regex_e.h regex_j.h regex_j.c regex_e.h kanji_.h kanji_.c # strip mg once you're satisfied it'll run -- makes it much smaller #strip: # strip mg .c.obj: $(CC) $(CFLAGS) -c -o $@ $*.c autosave.obj: $(INCS) $(OINCS) basic.obj: $(INCS) $(OINCS) dir.obj: $(INCS) $(OINCS) dired.obj: $(INCS) $(OINCS) file.obj: $(INCS) $(OINCS) line.obj: $(INCS) $(OINCS) shell.obj: $(INCS) $(OINCS) version.obj: $(INCS) $(OINCS) window.obj: $(INCS) $(OINCS) word.obj: $(INCS) $(OINCS) undo.h kinsoku.obj: $(INCS) $(OINCS) buffer.obj: $(INCS) $(OINCS) kbd.h undo.h cmode.obj: $(INCS) $(OINCS) undo.h file.obj: $(INCS) $(OINCS) undo.h line.obj: $(INCS) $(OINCS) undo.h parag.obj: $(INCS) $(OINCS) undo.h random.obj: $(INCS) $(OINCS) undo.h region.obj: $(INCS) $(OINCS) undo.h undo.obj: $(INCS) $(OINCS) undo.h complt.obj: $(INCS) $(OINCS) kbd.h complt.h display.obj: $(INCS) $(OINCS) kbd.h keymap.obj: $(INCS) $(OINCS) kbd.h modes.obj: $(INCS) $(OINCS) kbd.h fileio.obj: $(INCS) $(OINCS) kbd.h echo.obj: $(INCS) $(OINCS) key.h varargs.h extend.obj: $(INCS) $(OINCS) kbd.h key.h macro.h help.obj: $(INCS) $(OINCS) kbd.h key.h macro.h kanji.obj: $(INCS) $(OINCS) kinit.h kbd.obj: $(INCS) $(OINCS) macro.h kbd.h key.h undo.h macro.obj: $(INCS) $(OINCS) macro.h key.h skg.obj: $(INCS) $(OINCS) macro.h key.h undo.h main.obj: $(INCS) $(OINCS) macro.h search.obj: $(INCS) $(OINCS) macro.h match.obj: $(INCS) $(OINCS) key.h research.obj: $(INCS) $(OINCS) $(REINCS) macro.h regex.obj: $(INCS) $(OINCS) $(REINCS) cinfo.obj: $(INCS) $(OINCS) spawn.obj: $(INCS) $(OINCS) ttyio.obj: $(INCS) $(OINCS) fepctrl.h tty.obj: $(INCS) $(OINCS) ttykbd.obj: $(INCS) $(OINCS) fileio.obj: $(INCS) $(OINCS) kbd.h dosutil.obj: config.h fepctrl.obj: config.h fepctrl.h rawgetc.obj: rawgetc.asm masm $(AFLAGS) rawgetc.asm,rawgetc.obj,nul,nul; putline.obj: config.h termcap.obj: ng.exe: $(OBJ) link @linkfile #sysdef.h: sys/$(SYS)/sysdef.h # Update links, if needed. # rm -f sysdef.h # ln sys/$(SYS)/sysdef.h . #ttydef.h: sys/default/ttydef.h # rm -f ttydef.h # ln sys/default/ttydef.h . #chrdef.h: sys/default/chrdef.h # rm -f chrdef.h # ln sys/default/chrdef.h . #fileio.c: sys/$(SYS)/fileio.c # rm -f fileio.c # ln sys/$(SYS)/fileio.c . #spawn.c: sys/$(SYS)/spawn.c # rm -f spawn.c # ln sys/$(SYS)/spawn.c . #tty.c: sys/default/tty.c # rm -f tty.c # ln sys/default/tty.c . #ttyio.c: sys/$(SYS)/ttyio.c # rm -f ttyio.c # ln sys/$(SYS)/ttyio.c . #ttykbd.c: sys/default/ttykbd.c # rm -f ttykbd.c # ln sys/default/ttykbd.c . #cinfo.c: sys/default/cinfo.c # rm -f cinfo.c # ln sys/default/cinfo.c . #port: $(SRCS) $(INCS) # rm -f port # tar cfb port 1 $? #clean: # del $(OBJ) $(OSRCS) $(OINCS) #clean: # del *.obj ng-1.5beta1/sys/msdos/makefile.tc100644 1750 1750 11023 7247657140 15552 0ustar amurausers# $Id: makefile.tc,v 1.3 2001/03/02 08:48:32 amura Exp $ # Makefile for Ng at MS-DOS with Turbo C 1.5 / 2.0 / ++ # # $Log: makefile.tc,v $ # Revision 1.3 2001/03/02 08:48:32 amura # now AUTOSAVE feature implemented almost all (except for WIN32 # # Revision 1.2 2000/09/13 23:37:44 amura # add -DROWS and -DCOLS options to CDEFS # # Revision 1.1.1.1 2000/06/27 01:47:58 amura # import to CVS # # MACHINE define the MS-DOS machine type. # -DJ3100 and -DPC9801 or none are available. #MACHINE = #MACHINE = -DIBMPC MACHINE = -DPC9801 # CDEFS gets defines, and gets passed to lint. CFLAGS gets flags, and doesn't # get passed to lint. # # Now, compile time options are defined in a "config.h". # CDEFS = -DMSDOS $(MACHINE) -DTCCONIO -DSUPPORT_ANSI CFLAGS = -c -O $(CDEFS) -ml -d -w-nod -w-use -w-pro -w-rvi -w-par TCPATH = a:\program\tc CC = $(TCPATH)\tcc #AS = optasm #AS = masm /Mx AS = tasm /mx /I$(TCPATH)\lib # Objects which only depend on the "standard" includes OBJS = basic.obj dir.obj dired.obj shell.obj version.obj window.obj \ kinsoku.obj jump.obj autosave.obj # Those with unique requirements IND = buffer.obj complt.obj display.obj cmode.obj echo.obj extend.obj \ file.obj help.obj kbd.obj keymap.obj line.obj macro.obj main.obj \ modes.obj match.obj parag.obj random.obj region.obj regex.obj \ research.obj search.obj skg.obj kanji.obj undo.obj word.obj # System dependent objects OOBJS = cinfo.obj spawn.obj tty.obj ttykbd.obj # termlib objects TOBJS = termcap.obj # MS-DOS additional objects DOBJS = dosutil.obj fepctrl.obj rawgetc.obj putline.obj OBJ = $(OBJS) $(IND) $(OOBJS) $(TOBJS) $(DOBJS) fileio.obj ttyio.obj alloca.obj OSRCS = cinfo.c fileio.c spawn.c ttyio.c tty.c ttykbd.c TSRCS = termcap.c DSRCS = dosutil.c fepctrl.c rawgetc.c putline.c alloca.c SRCS = basic.c cmode.c dir.c dired.c file.c line.c match.c parag.c \ random.c region.c search.c version.c window.c word.c \ buffer.c display.c echo.c extend.c help.c kbd.c keymap.c \ macro.c main.c modes.c regex.c research.c kanji.c kinsoku.c \ skg.c jump.c undo.c autosave.c OINCS = ttydef.h sysdef.h chrdef.h INCS = config.h def.h REINCS = regex_e.h regex_j.h regex_j.c regex_e.h kanji_.h kanji_.c .c.obj: $(CC) $(CFLAGS) $*.c ng.exe: $(OBJ) tlink $(TCPATH)\lib\c0l.obj @linkfile.tc,ng.exe,nul,$(TCPATH)\lib\cl.lib # strip mg once you're satisfied it'll run -- makes it much smaller #strip: # strip mg $(OBJS): $(INCS) $(OINCS) buffer.obj: $(INCS) $(OINCS) kbd.h undo.h cmode.obj: $(INCS) $(OINCS) undo.h file.obj: $(INCS) $(OINCS) undo.h line.obj: $(INCS) $(OINCS) undo.h parag.obj: $(INCS) $(OINCS) undo.h random.obj: $(INCS) $(OINCS) undo.h region.obj: $(INCS) $(OINCS) undo.h undo.obj: $(INCS) $(OINCS) undo.h word.obj: $(INCS) $(OINCS) undo.h complt.obj: $(INCS) $(OINCS) kbd.h complt.h display.obj: $(INCS) $(OINCS) kbd.h keymap.obj: $(INCS) $(OINCS) kbd.h modes.obj: $(INCS) $(OINCS) kbd.h fileio.obj: $(INCS) $(OINCS) kbd.h echo.obj: $(INCS) $(OINCS) key.h varargs.h extend.obj: $(INCS) $(OINCS) kbd.h key.h macro.h help.obj: $(INCS) $(OINCS) kbd.h key.h macro.h kanji.obj: $(INCS) $(OINCS) kinit.h kbd.obj: $(INCS) $(OINCS) macro.h kbd.h key.h undo.h macro.obj: $(INCS) $(OINCS) macro.h key.h skg.obj: $(INCS) $(OINCS) macro.h key.h undo.h main.obj: $(INCS) $(OINCS) macro.h search.obj: $(INCS) $(OINCS) macro.h match.obj: $(INCS) $(OINCS) key.h research.obj: $(INCS) $(OINCS) $(REINCS) macro.h regex.obj: $(INCS) $(OINCS) $(REINCS) ttyio.obj: $(INCS) $(OINCS) fepctrl.h $(OOBJS): $(INCS) $(OINCS) termcap.obj: $(INCS) dosutil.obj: config.h putline.obj: config.h fepctrl.obj: config.h fepctrl.h rawgetc.obj: rawgetc.asm $(AS) /D__TURBOC__ $(MACHINE) rawgetc.asm,rawgetc.obj,nul,nul; alloca.obj: alloca.asm $(AS) /D__CDECL__ /D__LARGE__ alloca.asm; #sysdef.h: sys/$(SYS)/sysdef.h # Update links, if needed. # rm -f sysdef.h # ln sys/$(SYS)/sysdef.h . #ttydef.h: sys/default/ttydef.h # rm -f ttydef.h # ln sys/default/ttydef.h . #chrdef.h: sys/default/chrdef.h # rm -f chrdef.h # ln sys/default/chrdef.h . #fileio.c: sys/$(SYS)/fileio.c # rm -f fileio.c # ln sys/$(SYS)/fileio.c . #spawn.c: sys/$(SYS)/spawn.c # rm -f spawn.c # ln sys/$(SYS)/spawn.c . #tty.c: sys/default/tty.c # rm -f tty.c # ln sys/default/tty.c . #ttyio.c: sys/$(SYS)/ttyio.c # rm -f ttyio.c # ln sys/$(SYS)/ttyio.c . #ttykbd.c: sys/default/ttykbd.c # rm -f ttykbd.c # ln sys/default/ttykbd.c . #cinfo.c: sys/default/cinfo.c # rm -f cinfo.c # ln sys/default/cinfo.c . #port: $(SRCS) $(INCS) # rm -f port # tar cfb port 1 $? #clean: # del $(OBJ) $(OSRCS) $(OINCS) clean: del *.obj ng-1.5beta1/sys/msdos/ng.ini100644 1750 1750 4376 7126003716 14535 0ustar amurausers; $Id: ng.ini,v 1.1.1.1 2000/06/27 01:47:58 amura Exp $ ;============================================================================= ; ng.ini for Ng 1.3 MS-DOS version. 1991.01.25 ; $B5HEDLPl9g$O!"$3$N%U%!%$%k$N$=$l$>$l$NNc$r;29M$K$7$FI,MW$J@_Dj(B ; $B$r$7$F!"(BNG $B4D6-JQ?t$^$?$O!"(BHOME $B4D6-JQ?t$G;XDj$7$F$"$k%G%#%l%/%H%j$N2<$K(B ; $B$*$$$F$/$@$5$$!#(B ; ; ';' $B$G;O$^$k9T$O%3%a%s%H9T$H$_$J$5$l$^$9!#I,MW$J9T$N@hF,$N(B ';' $B$r:o$C$F(B ; $B$/$@$5$$!#(B ; ; $Bl9g!"' $B$r!"9TKv6XB'J8;z$K(B '<' $B$rDI2C$7$?$$>l9g!"") ;(add-kinsoku-eol-chars "<") ; ; $B9TF,6XB'J8;z$+$i!V!?!W$H!V!@!W$r:o=|$7$?$$>l9g$Ol9g$Ol9g$Oo$KM-8z$K$7$?$$>l9g$Oo$K%V%m%C%/%+!<%=%k$GE@LG$7$J$$$h$&$K$7!"(BNg $B=*N;8e$b(B ; $B$=$N%+!<%=%k$r7QB3$7$?$$>l9g$O #ifndef __TURBOC__ /* 90.04.06 by S.Yoshida */ #define MK_FP(seg,ofs) ((void far *) \ (((unsigned long)(seg) << 16) | (unsigned)(ofs))) #define poke(a,b,c) (*((int far*)MK_FP((a),(b))) = (int)(c)) #define pokeb(a,b,c) (*((char far*)MK_FP((a),(b))) = (char)(c)) #endif /* __TURBOC__ */ #ifdef PC9801 /* 90.03.30 by S.Yoshida ("#ifdef" line only) */ #define iseuc1st(c) ((c) >= 0xa1 && (c) <= 0xfe) #define etoj(c1, c2) {c1 &= 0x7f; c2 &= 0x7f;} #define VRAM_SEG 0xa000 #define ATTR_SEG 0xa200 #define C_BLUE 0x02 #define C_RED 0x04 #define C_PURPLE 0x06 #define C_GREEN 0x08 #define C_CYAN 0xa0 #define C_YELLOW 0xc0 #define C_WHITE 0xe0 #define A_NORMAL 0x01 #define A_REVERSE 0x05 #define CNONE 0 /* Unknown color. */ #define CTEXT 1 /* Text color. */ #define CMODE 2 /* Mode line color. */ #ifndef TCCONIO extern char *SO; #endif #ifdef HOJO_KANJI #include "kinit.h" /* for TOUFU charactor */ #endif VOID #ifdef SS_SUPPORT /* 92.11.21 by S.Sasaki */ putline(int row, int column, unsigned char *s, unsigned char *t, short color) #else /* not SS_SUPPORT */ putline(int row, int column, unsigned char *s, short color) #endif /* SS_SUPPORT */ { unsigned int dest; unsigned int c1, c2; int attr; dest = 160 * (row - 1); if( color == CTEXT ) { attr = C_WHITE|A_NORMAL; } else if( color == CMODE ) { #ifdef TCCONIO attr = C_WHITE|A_REVERSE; #else switch( atoi(SO+2) ) { case 7: attr = C_WHITE|A_REVERSE; break; case 17: case 31: attr = C_RED|A_NORMAL; break; case 18: case 34: attr = C_BLUE|A_NORMAL; break; case 19: case 35: attr = C_PURPLE|A_NORMAL; break; case 20: case 32: attr = C_GREEN|A_NORMAL; break; case 21: case 33: attr = C_YELLOW|A_NORMAL; break; case 22: case 36: attr = C_CYAN|A_NORMAL; break; case 23: case 37: attr = C_WHITE|A_NORMAL; break; case 41: attr = C_RED|A_REVERSE; break; case 44: attr = C_BLUE|A_REVERSE; break; case 45: attr = C_PURPLE|A_REVERSE; break; case 42: attr = C_GREEN|A_REVERSE; break; case 43: attr = C_YELLOW|A_REVERSE; break; case 46: attr = C_CYAN|A_REVERSE; break; case 47: attr = C_WHITE|A_REVERSE; break; default: attr = C_WHITE|A_REVERSE; break; } #endif } while( *s && dest < 160 * row) { #ifdef HANKANA /* 92.11.21 by S.Sasaki */ if ( ISHANKANA(*s) ) { pokeb(ATTR_SEG, dest, attr); poke(VRAM_SEG, dest, *t++); ++s; dest += 2; } else #endif /* HANKANA */ #ifdef HOJO_KANJI if ( ISHOJO(*s) ) { pokeb(ATTR_SEG, dest, attr); pokeb(VRAM_SEG, dest++, TOUFU1ST - 0x20); pokeb(VRAM_SEG, dest++, TOUFU2ND); pokeb(ATTR_SEG, dest, attr); pokeb(VRAM_SEG, dest++, TOUFU1ST - 0x20); pokeb(VRAM_SEG, dest++, TOUFU2ND + 0x80); s += 3; } else #endif if( iseuc1st(*s) ) { c1 = *s++; c2 = *s++; #ifdef HANKANA /* 92.11.21 by S.Sasaki */ t += 2; #endif /* HANKANA */ etoj(c1, c2); pokeb(ATTR_SEG, dest, attr); pokeb(VRAM_SEG, dest++, c1 - 0x20); pokeb(VRAM_SEG, dest++, c2); pokeb(ATTR_SEG, dest, attr); pokeb(VRAM_SEG, dest++, c1 - 0x20); pokeb(VRAM_SEG, dest++, c2 + 0x80); } else { pokeb(ATTR_SEG, dest, attr); #ifdef BACKSLASH if (*s == '\\') { poke(VRAM_SEG, dest, 0xfc); ++s; } else #endif /* BACKSLASH */ poke(VRAM_SEG, dest, *s++); #ifdef HANKANA /* 92.11.21 by S.Sasaki */ ++t; #endif /* HANKANA */ dest += 2; } } } #endif /* PC9801 */ ng-1.5beta1/sys/msdos/rawgetc.asm100644 1750 1750 3603 7126003716 15556 0ustar amurausers; $Id: rawgetc.asm,v 1.1.1.1 2000/06/27 01:47:58 amura Exp $ ; ; int rawgetc(); Get one char from keyboard. If no keyin, return -1. ; ; 1990.02.11 Created by S.Yoshida. ; With original idea from K.Takano. ; 1990.03.15 Modified for C-SPC by K.Takano & S.Yoshida ; 1990.03.31 Modified for Turbo-C by A.Shirahashi ; ; A> masm [-DPC9801|-DIBMPC] -Mx rawgetc.asm,rawgetc.obj,nul,nul ; ; $Log: rawgetc.asm,v $ ; Revision 1.1.1.1 2000/06/27 01:47:58 amura ; import to CVS ; ; (from) 1990.03.31 by A.Shirahashi RAWGETC_TEXT segment byte public 'CODE' DGROUP group _DATA,_BSS assume cs:RAWGETC_TEXT,ds:DGROUP RAWGETC_TEXT ends _DATA segment word public 'DATA' d@ label byte d@w label word _DATA ends _BSS segment word public 'BSS' b@ label byte b@w label word _BSS ends RAWGETC_TEXT segment byte public 'CODE' _rawgetc proc far ; (to) 1990.03.31 by A.Shirahashi mov ah, 06h mov dl, 0ffh int 21h mov ah, 0 jnz L1 mov ax, -1 ifdef PC9801 ; 1990.03.15 by K.Takano jmp short done L1: cmp al, ' ' jne done mov ah, 02h int 18h and ax, 0010h xor al, 10h shl al, 1 done: ; (from) 1991.06.02 by Y.Koyanagi push ax mov ax, 040ah int 18h and ah, 02h ; NFER key pop ax jz L2 or ax, 0100h ; METABIT L2: ; (to) 1991.06.02 by Y.Koyanagi endif ; 1990.03.15 by K.Takano ifdef IBMPC ; 1990.03.15 by S.Yoshida jmp short done L1: cmp al, ' ' jne done mov ah, 02h int 16h and ax, 0004h xor al, 04h jz done mov al, ' ' done: endif ; 1990.03.15 by S.Yoshida. ; (from) 1990.03.31 by A.Shirahashi ifndef PC9801 ifndef IBMPC L1: endif endif ret _rawgetc endp RAWGETC_TEXT ends _DATA segment word public 'DATA' s@ label byte _DATA ends RAWGETC_TEXT segment byte public 'CODE' RAWGETC_TEXT ends public _rawgetc end ; (to) 1990.03.31 by A.Shirahashi ng-1.5beta1/sys/msdos/spawn.c100644 1750 1750 10361 7126003716 14733 0ustar amurausers/* $Id: spawn.c,v 1.1.1.1 2000/06/27 01:47:58 amura Exp $ */ /* * Spawn CLI for MS-DOS. (Tested only at MS-DOS 3.1) * * I make this file from UNIX System V spawn.c. */ /* * $Log: spawn.c,v $ * Revision 1.1.1.1 2000/06/27 01:47:58 amura * import to CVS * */ /* 90.02.11 Modified for Ng 1.0 MS-DOS ver. by S.Yoshida */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include "def.h" #include #include #if defined(__TURBOC__) && __TURBOC__ < 0x0200 /* 90.12.28 by Junn Ohta */ /* For Turbo-C 1.5 */ #include static int (*oldfunc)(); static int (*curfunc)() = SIG_DFL; extern void ctrlbrk(int (*fptr)(void)); static int sigfunc(void) { if (curfunc == SIG_DFL) return 0; /* abort */ if (curfunc != SIG_IGN) { oldfunc = curfunc; curfunc = SIG_DFL; (*oldfunc)(); } return 1; /* resume */ } int (*signal(int sig, int (*func)()))() { if (sig != SIGINT) { errno = EINVAL; return SIG_ERR; } ctrlbrk(sigfunc); oldfunc = curfunc; curfunc = func; return oldfunc; } #endif /* __TURBOC__ */ char *shellp = NULL; /* Saved "SHELL" name. */ extern char *getenv(); /* * On MS-DOS, we no gots job control, so always run * a subshell using spawn. Bound to "C-C", and used * as a subcommand by "C-Z". * * Returns 0 if the shell executed OK, something else if * we couldn't start shell or it exited badly. */ /*ARGSUSED*/ spawncli(f, n) { register void (*oisig)(); int status; if (shellp == NULL) { shellp = getenv("SHELL"); if (shellp == NULL) shellp = getenv("shell"); if (shellp == NULL) shellp = getenv("COMSPEC"); if (shellp == NULL) shellp = getenv("comspec"); if (shellp == NULL) shellp = "command.com"; /* Safer. */ } ttcolor(CTEXT); ttnowindow(); ttmove(nrow-1, 0); if (epresf != FALSE) { tteeol(); epresf = FALSE; } ttclose(); sgarbf = TRUE; /* Force repaint. */ oisig = signal(SIGINT, SIG_IGN); #ifdef EXTD_DIR dirend(); #endif if (spawnlp(P_WAIT, shellp, NULL) == -1) { status = FALSE; } else { status = TRUE; } (VOID) signal(SIGINT, oisig); ttopen(); if(status == FALSE) { ewprintf("Failed to run %s", shellp); sleep(2); /* Show this message for 2 sec */ /* before refresh screen. */ } return (status); } #ifndef NO_SHELL /* 91.01.10 by K.Maeda */ #if !defined(__TURBOC__) || __TURBOC__ >= 0x0200 #include #endif /* __TURBOC__ */ #include #include char tempfile[128]; /* * Call process in subshell. * Execute COMMAND binding standard input to file INPUT. * NULL as INPUT means standard input should be bound to * /dev/null or whatever equivalent in your OS. * All output during the execution (including standard error output) * should go into a scratch file, whose name call_process() returns. * Return value NULL means error in some stage of the execution. * In that case, scratch file should be deleted. */ char * call_process(command, input) char *command; char *input; { char buf[256]; char *tmp; int ostdin, ostdout, ostderr, in, out, s; extern char *mktemp(); char *temp_path; temp_path = getenv("TMP"); if (temp_path == NULL) temp_path = getenv("tmp"); if (temp_path == NULL) temp_path = getenv("TEMP"); if (temp_path == NULL) temp_path = getenv("temp"); tmp = tempfile; if (temp_path && *temp_path) { while (*tmp = *temp_path++) { tmp++; } if (tmp[-1] != '/' && tmp[-1] != '\\') { *tmp++ = '/'; } } strcpy(tmp, "ngXXXXXX"); if ((tmp = mktemp(tempfile)) == NULL) { return NULL; } if ((in = open(input ? input : "nul", 0)) < 0) { return NULL; } if ((out = creat(tmp, S_IREAD | S_IWRITE)) < 0) { close(in); return NULL; } ostdin = dup(0); ostdout = dup(1); ostderr = dup(2); if (ostdin < 0 || ostdout < 0 || ostderr < 0) { s = -1; goto skip; } dup2(in, 0); dup2(out, 1); dup2(out, 2); strcpy(buf, command); #ifdef EXTD_DIR ensurecwd(); #endif s = system(buf); close(in); close(out); dup2(ostdin, 0); dup2(ostdout, 1); dup2(ostderr, 2); skip: close(ostdin); close(ostdout); close(ostderr); if (s == -1) { unlink(tmp); return NULL; } return tmp; } #endif /* NO_SHELL */ ng-1.5beta1/sys/msdos/sysdef.h100644 1750 1750 4121 7302023633 15056 0ustar amurausers/* $Id: sysdef.h,v 1.5 2001/05/20 20:22:51 amura Exp $ */ /* * MS-DOS based systems */ /* * $Log: sysdef.h,v $ * Revision 1.5 2001/05/20 20:22:51 amura * fix silly bug * * Revision 1.4 2001/05/08 17:58:57 amura * fix alloca() probrems with Turbo C * * Revision 1.3 2001/01/05 14:07:08 amura * first implementation of Hojo Kanji support * * Revision 1.2 2000/12/14 18:10:47 amura * filename length become flexible * * Revision 1.1.1.1 2000/06/27 01:47:58 amura * import to CVS * */ #include #ifdef __TURBOC__ /* 90.03.23 by A.Shirahashi */ #include extern void *alloca(int); /* defind in alloca.asm */ #else /* NOT __TURBOC__ */ #include /* need to use memmove(). */ #endif /* __TURBOC__ */ #define KBLOCK 1024 /* Kill grow. */ #define GOOD 0 /* Good exit status. */ #ifndef NO_SHELL /* 91.01.10 by K.Maeda */ #define CMDLINELENGTH 128 /* Maximum length of shell command. */ #endif /* NO_SHELL */ #define NO_RESIZE /* Screen size is constant. */ #define BSMAP TRUE /* Bs map feature can use. */ /* (default mode is bsmap on) */ #define MAKEBACKUP FALSE /* Making backup file is off. */ #ifdef __TURBOC__ /* 90.03.23 by A.Shirahashi */ #define LOCAL_VARARGS #endif /* __TURBOC__ */ typedef long RSIZE; /* Type for file/region sizes */ typedef short KCHAR; /* Type for internal keystrokes */ /* * Macros used by the buffer name making code. * Start at the end of the file name, scan to the left * until BDC1 (or BDC2, if defined) is reached. The buffer * name starts just to the right of that location, and * stops at end of string (or at the next BDC3 character, * if defined). BDC2 and BDC3 are mainly for VMS. */ #define BDC1 '\\' /* Buffer names. */ #define MALLOCROUND(m) (m+=7,m&=~7) /* round up to 8 byte boundry */ #define bcopy(s,d,n) memmove(d,s,n) /* copy memory area. */ #define fncmp strcmp /* file name comparison */ #define unlinkdir(fn) rmdir(fn) /* unlink directory */ char *getenv(); #define gettermtype() getenv("TERM") /* determine terminal type */ ng-1.5beta1/sys/msdos/tty.c100644 1750 1750 31420 7232331537 14425 0ustar amurausers/* $Id: tty.c,v 1.3 2001/01/20 15:48:47 amura Exp $ */ /* * Termcap/terminfo display driver * * Termcap is a terminal information database and routines to describe * terminals on most UNIX systems. Many other systems have adopted * this as a reasonable way to allow for widly varying and ever changing * varieties of terminal types. This should be used where practical. */ /* Known problems: * If you have a terminal with no clear to end of screen and * memory of lines below the ones visible on the screen, display * will be wrong in some cases. I doubt that any such terminal * was ever made, but I thought everyone with delete line would * have clear to end of screen too... * * Code for terminals without clear to end of screen and/or clear * to end of line has not been extensivly tested. * * Cost calculations are very rough. Costs of insert/delete line * may be far from the truth. This is accentuated by display.c * not knowing about multi-line insert/delete. * * Using scrolling region vs insert/delete line should probably * be based on cost rather than the assuption that scrolling * region operations look better. */ /* * $Log: tty.c,v $ * Revision 1.3 2001/01/20 15:48:47 amura * very big terminal supported * * Revision 1.2 2000/09/13 23:36:15 amura * use TCCONIO's window * * Revision 1.1.1.1 2000/06/27 01:47:58 amura * import to CVS * */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include "def.h" #ifdef TCCONIO #include #endif #define BEL 0x07 /* BEL character. */ extern int ttrow; extern int ttcol; extern int tttop; extern int ttbot; extern int tthue; int tceeol; /* Costs are set later */ int tcinsl; int tcdell; #ifdef NO_RESIZE static setttysize(); #endif int ttputc(); #ifndef TCCONIO char *tgetstr(); char *tgoto(); static int insdel; /* Do we have both insert & delete line? */ #define TCAPSLEN 1024 char tcapbuf[TCAPSLEN]; /* PC, UP, and BC are used by termlib, so must be extern and have these * names unless you have a non-standard termlib. */ int LI; /* standard # lines */ char PC, *CM, *CE, *UP, *BC, *IM, /* insert mode */ *IC, /* insert a single space */ *EI, /* end insert mode */ *DC, *AL, /* add line */ *DL, /* del line */ *pAL, /* parameterized add line */ *pDL, /* parameterized delete line */ *TI, /* term init -- start using cursor motion */ *TE, /* term end --- end using cursor motion */ *SO, *SE, *CD, *CS, /* set scroll region */ *SF, /* forw index (used with scroll region) */ *SR; /* back index (used with scroll region) */ # ifdef XKEYS char *KS, *KE; /* enter keypad mode, exit keypad mode */ # endif int SG; /* number of glitches, 0 for invisible, -1 for none */ /* (yes virginia, there are terminals with invisible glitches) */ /* * Initialize the terminal when the editor * gets started up. */ static char tcbuf[1024]; #endif /* TCCONIO */ ttinit() { #ifdef TCCONIO ttresize(); /* set nrow & ncol */ tceeol = 1; tcinsl = 1; tcdell = 1; #else char *tv_stype; char *t, *p, *tgetstr(); # ifndef gettermtype /* (avoid declaration if #define) */ char *gettermtype(); /* system dependent function to determin terminal type */ # endif if((tv_stype = gettermtype()) == NULL) panic("Could not determine terminal type"); if((tgetent(tcbuf, tv_stype)) != 1) { (VOID) strcpy(tcbuf, "Unknown terminal type "); (VOID) strcat(tcbuf, tv_stype); panic(tcbuf); } p = tcapbuf; t = tgetstr("pc", &p); if(t) PC = *t; LI = tgetnum("li"); CD = tgetstr("cd", &p); CM = tgetstr("cm", &p); CE = tgetstr("ce", &p); UP = tgetstr("up", &p); BC = tgetstr("bc", &p); IM = tgetstr("im", &p); IC = tgetstr("ic", &p); EI = tgetstr("ei", &p); DC = tgetstr("dc", &p); AL = tgetstr("al", &p); DL = tgetstr("dl", &p); pAL= tgetstr("AL", &p); /* parameterized insert and del. line */ pDL= tgetstr("DL", &p); TI = tgetstr("ti", &p); TE = tgetstr("te", &p); SO = tgetstr("so", &p); SE = tgetstr("se", &p); CS = tgetstr("cs", &p); /* set scrolling region */ SF = tgetstr("sf", &p); if(!SF || !*SF) { /* this is what GNU Emacs does */ SF = tgetstr("do", &p); if(!SF || !*SF) { SF = tgetstr("nl", &p); if(!SF || !*SF) SF = "\n"; } } SR = tgetstr("sr", &p); SG = tgetnum("sg"); /* standout glitch */ # ifdef XKEYS KS = tgetstr("ks", &p); /* keypad start, keypad end */ KE = tgetstr("ke", &p); # endif if(CM == NULL || UP == NULL) panic("This terminal is to stupid to run MicroGnuEmacs\n"); ttresize(); /* set nrow & ncol */ /* watch out for empty capabilities (sure to be wrong) */ if (CE && !*CE) CE = NULL; if (CS && !*CS) CS = NULL; if (SR && !*SR) SR = NULL; if (AL && !*AL) AL = NULL; if (DL && !*DL) DL = NULL; if (pAL && !*pAL) pAL = NULL; if (pDL && !*pDL) pDL = NULL; if (CD && !*CD) CD = NULL; if(!CE) tceeol = ncol; else tceeol = charcost(CE); /* Estimate cost of inserting a line */ if (CS && SR) tcinsl = charcost(CS)*2 + charcost(SR); else if (pAL) tcinsl = charcost(pAL); else if (AL) tcinsl = charcost(AL); else tcinsl = NROW * NCOL; /* make this cost high enough */ /* Estimate cost of deleting a line */ if (CS) tcdell = charcost(CS)*2 + charcost(SF); else if (pDL) tcdell = charcost(pDL); else if (DL) tcdell = charcost(DL); else tcdell = NROW * NCOL; /* make this cost high enough */ /* Flag to indicate that we can both insert and delete lines */ insdel = (AL || pAL) && (DL || pDL); if (p >= &tcapbuf[TCAPSLEN]) panic("Terminal description too big!\n"); if (TI && *TI) putpad(TI, 1); /* init the term */ #endif /* TCCONIO */ } /* * Clean up the terminal, in anticipation of * a return to the command interpreter. This is a no-op * on the ANSI display. On the SCALD display, it sets the * window back to half screen scrolling. Perhaps it should * query the display for the increment, and put it * back to what it was. */ tttidy() { #ifndef TCCONIO if (TE && *TE) putpad(TE, 1); /* set the term back to normal mode */ putpad(tgoto(CM, 0, ttrow), 1); /* not nrow */ if (CE && *CE) putpad(CE, 1); /* erase one line */ # ifdef XKEYS ttykeymaptidy(); # endif #endif /* TCCONIO */ } /* * Move the cursor to the specified * origin 0 row and column position. Try to * optimize out extra moves; redisplay may * have left the cursor in the right * location last time! */ ttmove(row, col) { if (ttrow!=row || ttcol!=col) { #ifdef TCCONIO ttflush(); gotoxy(col+1, row+1); #else putpad(tgoto(CM, col, row), 1); #endif ttrow = row; ttcol = col; } } /* * Erase to end of line. */ tteeol() { #ifdef TCCONIO ttflush(); clreol(); #else if(CE) putpad(CE, 1); else { register int i=ncol-ttcol; while(i--) ttputc(' '); ttrow = ttcol = HUGE; } #endif } /* * Erase to end of page. */ tteeop() { #ifdef TCCONIO ttflush(); clreol(); { register int line; for (line = ttrow + 1; line <= nrow; ++line) { gotoxy(1,line+1); clreol(); } ttrow = ttcol = HUGE; } #else if(CD) putpad(CD, nrow - ttrow); else { tteeol(); if (insdel) ttdell(ttrow + 1, LI, LI - ttrow - 1); else /* do it by hand */ { register int line; for (line = ttrow + 1; line <= LI; ++line) { ttmove(line, 0); tteeol(); } } ttrow = ttcol = HUGE; } #endif } /* * Make a noise. */ ttbeep() { ttputc(BEL); ttflush(); } /* * Insert nchunk blank line(s) onto the * screen, scrolling the last line on the * screen off the bottom. Use the scrolling * region if possible for a smoother display. * If no scrolling region, use a set * of insert and delete line sequences */ ttinsl(row, bot, nchunk) { register int i, nl; if (row == bot) { /* Case of one line insert is */ ttmove(row, 0); /* special */ tteeol(); return; } #ifdef TCCONIO ttflush(); window(1, row+1, ncol, bot+1); gotoxy(1, 1); while (nchunk--) insline(); window(1, 1, ncol, nrow); ttrow = HUGE; /* Unknown. */ ttcol = HUGE; #else if (CS && SR) { /* Use scroll region and back index */ nl = bot - row; ttwindow(row,bot); ttmove(row, 0); while (nchunk--) putpad(SR, nl); ttnowindow(); return; } else if (insdel) { ttmove(1+bot-nchunk, 0); nl = nrow - ttrow; if (pDL) putpad(tgoto(pDL, 0, nchunk), nl); else for (i=0; i LI ? nrow : LI) - 1, 0), nrow - ttrow); ttrow = HUGE; /* Unknown. */ ttcol = HUGE; tttop = HUGE; /* No scroll region. */ ttbot = HUGE; } #endif } /* * Set the current writing color to the * specified color. Watch for color changes that are * not going to do anything (the color is already right) * and don't send anything to the display. * The rainbow version does this in putline.s on a * line by line basis, so don't bother sending * out the color shift. */ ttcolor(color) register int color; { if (color != tthue) { #ifdef TCCONIO if (color == CTEXT) { /* Normal video. */ ttflush(); textattr(WHITE); } else if (color == CMODE) { /* Reverse video. */ #ifdef REVERSE textattr(WHITE|REVERSE); #else textbackground(WHITE); textcolor(BLACK); #endif } #else if (color == CTEXT) { /* Normal video. */ putpad(SE, 1); } else if (color == CMODE) { /* Reverse video. */ putpad(SO, 1); } #endif tthue = color; /* Save the color. */ } } /* * This routine is called by the * "refresh the screen" command to try and resize * the display. The new size, which must be deadstopped * to not exceed the NROW and NCOL limits, it stored * back into "nrow" and "ncol". Display can always deal * with a screen NROW by NCOL. Look in "window.c" to * see how the caller deals with a change. */ ttresize() { setttysize(); /* found in "ttyio.c", */ /* ask OS for tty size */ if (nrow < 1) /* Check limits. */ nrow = 1; if (ncol < 1) ncol = 1; vtsetsize(ncol, nrow); /* found in "display.c" */ } #ifdef NO_RESIZE static setttysize() { # ifdef TCCONIO struct text_info tinfo; gettextinfo(&tinfo); nrow = tinfo.screenheight; ncol = tinfo.screenwidth; # else nrow = tgetnum("li"); ncol = tgetnum("co"); # endif } #endif #ifndef TCCONIO static int cci; /*ARGSUSED*/ static int /* fake char output for charcost() */ fakec(c) char c; { cci++; } /* calculate the cost of doing string s */ charcost (s) char *s; { cci = 0; tputs(s, nrow, fakec); return cci; } #endif /* TCCONIO */ ng-1.5beta1/sys/msdos/ttyio.c100644 1750 1750 40144 7247657140 14767 0ustar amurausers/* $Id: ttyio.c,v 1.3 2001/03/02 08:48:32 amura Exp $ */ /* * MS-DOS terminal I/O. (Tested only at MS-DOS 3.1) * I make this file from BSD UNIX ttyio.c. */ /* * $Log: ttyio.c,v $ * Revision 1.3 2001/03/02 08:48:32 amura * now AUTOSAVE feature implemented almost all (except for WIN32 * * Revision 1.2 2001/01/20 15:48:47 amura * very big terminal supported * * Revision 1.1.1.1 2000/06/27 01:47:58 amura * import to CVS * */ /* 90.02.11 Modified for Ng 1.0 MS-DOS ver. by S.Yoshida */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include "def.h" #include #ifndef __TURBOC__ /* 90.04.06 by S.Yoshida */ #define MK_FP(seg,ofs) ((void far *) \ (((unsigned long)(seg) << 16) | (unsigned)(ofs))) #define peek(a,b,c) (*((int far*)MK_FP((a),(b)))) #endif /* __TURBOC__ */ #ifdef TCCONIO #include #endif #ifdef FEPCTRL /* 90.11.26 by K.Takano */ #include "fepctrl.h" #endif int nrow; /* Terminal size, rows. */ int ncol; /* Terminal size, columns. */ int ospeed = 13; /* We think 9600 bps is used. */ static int dosversion; /* MS-DOS version number. */ static int breakstat; /* BREAK check mode status. */ static int stdinstat; /* stdin IOCTRL status. */ #ifdef TCCONIO static unsigned int oldmode; /* save old textmode */ static struct text_info tinfo; /* Registers for textinfo(). */ #endif #ifdef DO_METAKEY extern int use_metakey; #endif union REGS inregs, outregs; /* Registers for intdos(). */ static int dummy = 0; /* Dummy value for bdos(). */ #ifdef PC9801 /* 90.03.06 by K.Takano */ static char keysave[10][6]; static int ezkey = FALSE; /* EZkey flag */ #endif /* PC9801 */ #ifdef FEPCTRL /* 90.11.26 by K.Takano and 97.08.16 by A.Muramatsu */ static int fepctrl = FALSE; /* FEP control enable flag */ static int fepmode = TRUE; /* now FEP mode */ static int fepforce = 0; /* force FEP to mode */ #endif /* * This function gets called once, to set up * the terminal channel. */ ttopen() { #ifdef TCCONIO gettextinfo(&tinfo); oldmode = tinfo.currmode; #if TCCONIOMODE textmode(TCCONIOMODE); #endif directvideo = 0; #else register char *tv_stype; char *getenv(), tcbuf[1024], err_str[72]; /* do this the REAL way */ if ((tv_stype = getenv("TERM")) == NULL) { puts("Environment variable TERM not defined!"); exit(1); } if((tgetent(tcbuf, tv_stype)) != 1) { (void) sprintf(err_str, "Unknown terminal type %s!", tv_stype); puts(err_str); exit(1); } #endif /* TCCONIO */ if (ttraw() == FALSE) panic("aborting due to terminal initialize failure"); #ifdef FEPCTRL /* 90.11.26 by K.Takano */ fepmode_init(); #endif } /* * This function sets the Ctrl-C check function off. * This is called both by ttopen() above and by spawncli() to * get the current terminal settings and then change them to what * Ng expects. Thus, stty changes done while spawncli() is in effect * will be reflected in Ng. */ ttraw() { inregs.h.ah = 0x30; /* Check MS-DOS version. */ intdos(&inregs, &outregs); dosversion = outregs.h.al; if (dosversion > 1) { inregs.h.ah = 0x33; /* Get BREAK check status. */ inregs.h.al = 0x00; intdos(&inregs, &outregs); breakstat = outregs.h.dl; inregs.h.al = 0x01; /* Set BREAK check status to */ inregs.h.dl = 0x00; /* no BREAK checking. */ intdos(&inregs, &outregs); if (outregs.h.al == 0xff) { return(FALSE); } inregs.h.ah = 0x44; /* Get IOCTRL status. */ inregs.h.al = 0x00; inregs.x.bx = 0x00; /* 0 = stdin. */ intdos(&inregs, &outregs); stdinstat = outregs.h.dl; inregs.x.dx = (outregs.x.dx | 0x0020) & 0x0027; /* raw mode */ inregs.h.al = 0x01; /* Set IOCTRL to raw. */ intdos(&inregs, &outregs); if (outregs.x.cflag != 0x00) { return(FALSE); } } setttysize(); #ifdef IBMPC /* 90.02.23 by S.Yoshida */ assignkey(); getcursor(); /* 91.01.11 Get cursor info. by S.Yoshida */ #endif /* IBMPC */ #ifdef PC9801 /* 90.03.06 by K.Takano */ assignkey(); if (use_metakey) setezkey(); #endif /* PC9801 */ return(TRUE); } /* * This function gets called just * before we go back home to the shell. Put all of * the terminal parameters back. * Under MS-DOS this just calls ttcooked(), but the ttclose() hook is in * because vttidy() in display.c expects it for portability reasons. */ ttclose() { if (ttcooked() == FALSE) panic(""); /* ttcooked() already printf'd */ #ifdef FEPCTRL /* 90.11.26 by K.Takano */ fepmode_term(); #endif #ifdef TCCONIO #ifdef TCCONIOMODE textmode(oldmode); #endif #endif } /* * This function reset Ctrl-C check function on. */ ttcooked() { ttflush(); if (dosversion > 1) { inregs.h.ah = 0x33; /* Reset BREAK check status. */ inregs.h.al = 0x01; inregs.h.dl = breakstat; intdos(&inregs, &outregs); if (outregs.h.al == 0xff) { ewprintf("ttclose can't set break check status"); return(FALSE); } inregs.h.ah = 0x44; /* Reset IOCTRL status. */ inregs.h.al = 0x01; inregs.x.bx = 0x00; /* 0 = stdin. */ inregs.x.dx = stdinstat & 7; intdos(&inregs, &outregs); if (outregs.x.cflag != 0x00) { ewprintf("ttclose can't set IOCTRL status"); return(FALSE); } } #ifdef IBMPC /* 90.02.23 by S.Yoshida */ cancelkey(); resetcursor(); /* 91.01.05 Reset cursor by S.Yoshida */ #endif /* IBMPC */ #ifdef PC9801 /* 90.03.06 by K.Takano */ cancelkey(); if (use_metakey) resetezkey(); #endif /* PC9801 */ return(TRUE); } #ifdef IBMPC /* 90.02.23 by S.Yoshida */ /* * Assign IBMPC special keys to use Ng. */ assignkey() { printf("\033[29;27p"); /* Assign C-[ key to ESC. */ printf("\033[0;83;127p"); /* Assign Del key to DEL. */ printf("\033[0;75;2p"); /* Assign <- key to C-b. */ printf("\033[0;77;6p"); /* Assign -> key to C-f. */ printf("\033[0;72;16p"); /* Assign up-arrow key to C-p. */ printf("\033[0;80;14p"); /* Assign down-arrow key to C-n. */ printf("\033[0;71;27;60p"); /* Assign Home key to M-<. */ printf("\033[0;73;27;118p"); /* Assign Pg-Up key to M-v. */ printf("\033[0;81;22p"); /* Assign Pg-Dn key to C-v. */ printf("\033[0;79;27;62p"); /* Assign End key to M->. */ } /* * Cancel J-3100 special key assign. */ cancelkey() { printf("\033[29;29p"); /* Cancel C-[ key. */ printf("\033[0;83;0;83p"); /* Cancel Del key. */ printf("\033[0;75;0;75p"); /* Cancel <- key. */ printf("\033[0;77;0;77p"); /* Cancel -> key. */ printf("\033[0;72;0;72p"); /* Cancel up-arrow key. */ printf("\033[0;80;0;80p"); /* Cancel down-arrow key. */ printf("\033[0;71;0;71p"); /* Cancel Home key. */ printf("\033[0;73;0;73p"); /* Cancel Pg-Up key. */ printf("\033[0;81;0;81p"); /* Cancel Pg-Dn key. */ printf("\033[0;79;0;79p"); /* Cancel End key. */ } /* 91.01.11 by S.Yoshida */ static int old_blink_mode; /* Cursor blink mode. */ static int old_start_line; /* Start cursor line. */ static int old_end_line; /* End cursor line. */ static int hold_new_cursor; /* Hold new cursor at Ng exiting. */ static int new_blink_mode; /* Cursor blink mode. */ static int new_start_line; /* Start cursor line. */ static int new_end_line; /* End cursor line. */ /* * 91.01.11 by S.Yoshida * Get old cursor info. */ getcursor() { inregs.h.ah = 0x82; /* Set/Get cursor mode. */ inregs.h.al = 0x04; inregs.h.bl = -1; /* Get mode. */ int86(0x10, &inregs, &outregs); /* INT 10h. */ old_blink_mode = new_blink_mode = outregs.h.al; inregs.h.ah = 0x03; /* Get cursor shape. */ inregs.h.bh = 0; /* Active page. */ int86(0x10, &inregs, &outregs); /* INT 10h. */ old_start_line = new_start_line = outregs.h.ch; /* Start raster pos. */ old_end_line = new_end_line = outregs.h.cl; /* End raster pos. */ hold_new_cursor = 0; /* Not hold new cursor at end. */ } /* * 91.01.05 by S.Yoshida * Set cursor to specify shape. */ setcursor(s, e, b) { inregs.h.ah = 0x82; /* Set/Get cursor mode. */ inregs.h.al = 0x04; inregs.h.bl = b; /* Set blink mode. */ int86(0x10, &inregs, &outregs); /* INT 10h. */ inregs.h.ah = 0x01; /* Set cursor shape. */ inregs.h.ch = s; /* Start raster pos. */ inregs.h.cl = e; /* End raster pos. */ int86(0x10, &inregs, &outregs); /* INT 10h. */ } /* * 91.01.11 by S.Yoshida * Reset cursor to old shape. */ resetcursor() { if (!hold_new_cursor) { setcursor(old_start_line, old_end_line, old_blink_mode); } } /* * 91.01.11 by S.Yoshida * Get cursor mode parameter, and set it. */ /*ARGSUSED*/ j31_set_cursor(f, n) { register int s; register char *p; register char c; register int pos = 0; register int i; char buf[NFILEN]; if ((s = ereply("IBM PC Cursor: ", buf, NFILEN)) != TRUE) { return (s); } i = -1; for (p = buf; *p;) { c = *p++ & 0xff; switch (c) { case ',': case ':': if (i >= 0 && i <= 15) { if (pos == 0) { new_start_line = i; } else if (pos == 1) { new_end_line = i; } } i = -1; if (++pos > 3) { return TRUE; } break; case 't': case 'T': if (pos == 2) { new_blink_mode = 0; /* Blink on. */ } else if (pos == 3) { hold_new_cursor = 1; /* Hold on. */ } break; case 'n': case 'N': if (pos == 2) { new_blink_mode = 1; /* Blink off. */ } else if (pos == 3) { hold_new_cursor = 0; /* Hold off. */ } break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (i == -1) { i = 0; } i = i * 10 + c - '0'; break; } } if (i >= 0 && i <= 15) { if (pos == 0) { new_start_line = i; } else if (pos == 1) { new_end_line = i; } } setcursor(new_start_line, new_end_line, new_blink_mode); return (TRUE); } #endif /* IBMPC */ #ifdef PC9801 /* 90.03.06 by K.Takano */ /* * Assign PC-9801 special keys to use Ng. */ assignkey() { static char keytbl[10][6] = { "\x16\0\0\0\0", /* Assign ROLLUP key to C-v. */ "\x1bv\0\0\0", /* Assign ROLLDOWN key to C-v. */ "\0\0\0\0\0", "\x7f\0\0\0\0", /* Assign Del key to DEL. */ "\x10\0\0\0\0", /* Assign up-arrow key to C-p. */ "\x02\0\0\0\0", /* Assign <- key to C-b. */ "\x06\0\0\0\0", /* Assign -> key to C-f. */ "\x0e\0\0\0\0", /* Assign down-arrow key to C-n. */ "\x1b<\0\0\0", /* Assign HOME key to M-<. */ "\x1b>\0\0\0" /* Assign HELP key to M->. */ }; union REGS regs; register int i; for (i = 0; i < 10; i++) { regs.x.ax = 0x15 + i; regs.h.cl = 0x0c; regs.x.dx = (int)keysave[i]; int86(0xdc, ®s, ®s); regs.x.ax = 0x15 + i; regs.h.cl = 0x0d; regs.x.dx = (int)keytbl[i]; int86(0xdc, ®s, ®s); } } /* * Restore PC-9801 special key assign. */ cancelkey() { union REGS regs; register int i; for (i = 0; i < 10; i++) { regs.x.ax = 0x15 + i; regs.h.cl = 0x0d; regs.x.dx = (int)keysave[i]; int86(0xdc, ®s, ®s); } } #ifdef DO_METAKEY /* * Set EZ-key mode to VZ-mode */ setezkey() { union REGS regs; struct SREGS sregs; regs.x.ax = 0x35e0; int86x(0x21, ®s, ®s, &sregs); if (peek(sregs.es, regs.x.bx-2) == 0x5a45) ezkey = TRUE; else ezkey = FALSE; if (ezkey) { regs.h.al = 1; regs.h.ah = 2; int86(0xe0, ®s, ®s); } } /* * Unset EZ-key mode to VZ-mode */ resetezkey() { union REGS regs; if (ezkey) { regs.h.al = 0; regs.h.ah = 2; int86(0xe0, ®s, ®s); ezkey = FALSE; } } #endif /* DO_METAKEY */ #endif /* PC9801 */ #define TTFLUSH /* 90.06.08 enable ttflush() by A.Shirahashi */ #ifdef TTFLUSH /* 90.06.08 by A.Shirahashi */ #define NOBUF 512 static unsigned char obuf[NOBUF]; static int nobuf = 0; #endif /* * Write character to the display without ^C check. */ ttputc(c) int c; { #ifdef TTFLUSH /* 90.06.08 by A.Shirahashi */ if (nobuf > NOBUF) ttflush(); obuf[nobuf++] = c; #else # if defined(TCCONIO) putch(c); # elif defined(PC9801) && defined(__TURBOC__) /* 90.03.23 by A.Shirahashi */ union REGS regs; struct SREGS sregs; regs.h.cl = 0x10; regs.h.ah = 0x00; regs.h.dl = c; sregs.ds = _DS; sregs.es = _ES; int86x(0xdc, ®s, ®s, &sregs); # else /* NOT PC9801 && __TURBOC__ */ bdos(6, c & 0xff, dummy); # endif /* TTCONIO || PC9801 && __TURBOC__ */ #endif /* TTFLUSH */ } /* * Now ttflush() isn't needed. But some function call this, * so here is dummy. */ ttflush() { #ifdef TTFLUSH /* 90.06.08 by A.Shirahashi */ int i; for (i = 0; i < nobuf; i++) { # if defined(TCCONIO) putch(obuf[i]); # elif defined(PC9801) && defined(__TURBOC__) /* 90.03.23 by A.Shirahashi */ union REGS regs; struct SREGS sregs; regs.h.cl = 0x10; regs.h.ah = 0x00; regs.h.dl = obuf[i]; sregs.ds = _DS; sregs.es = _ES; int86x(0xdc, ®s, ®s, &sregs); # else /* NOT PC9801 && __TURBOC__ */ bdos(6, obuf[i], dummy); # endif /* TCCONIO || PC9801 && __TURBOC__ */ } nobuf = 0; #endif /* TTFLUSH */ } static int ahead = -1; /* Typeahead charactor. */ #ifdef KANJI /* 90.02.05 by S.Yoshida */ static int nkey = 0; /* The number of ungetc charactor. */ static char keybuf[4]; /* Ungetc charactors. */ #endif /* KANJI */ /* * Read character from terminal without ^C check. * All 8 bits are returned, so that you can use * a multi-national terminal. */ ttgetc() { int c; union REGS regs; #ifdef KANJI /* 90.02.05 by S.Yoshida */ if (nkey > 0) { return(keybuf[--nkey]); } else #endif /* KANJI */ if (ahead != -1) { c = ahead; ahead = -1; return(c); } while ((c = rawgetc()) == -1) { #ifdef AUTOSAVE autosave_handler(); #endif } #ifdef DO_METAKEY #ifdef PC9801 if (c<0x20 && use_metakey && ezkey) { int shift; if (c == CCHR('_')) /* NFER code */ return (CCHR('[')); #ifdef __TURBOC__ _AH = 0x02; geninterrupt(0x18); shift = _AL; #else regs.h.ah = 0x02; int86(0x18, ®s, ®s); shift = regs.h.al; #endif if (shift & 0x08) { if (~(shift & 0x10)) c += 0x40; c &= 0x7F; c |= METABIT; } } #endif /* PC9801 */ #endif /* DO_METAKEY */ return (c); } #ifdef KANJI /* 90.02.05 by S.Yoshida */ /* * Save pre-readed char to read again. */ ttungetc(c) int c; { keybuf[nkey++] = c; } #endif /* KANJI */ /* * set the tty size. */ setttysize() { #ifdef TCCONIO gettextinfo(&tinfo); nrow = tinfo.screenheight; ncol = tinfo.screenwidth; #else if ((nrow=tgetnum ("li")) <= 0 || (ncol=tgetnum ("co")) <= 0) { nrow = 24; ncol = 80; } #endif } /* * typeahead returns TRUE if there are characters available to be read * in. */ typeahead() { #ifdef KANJI /* 90.02.05 by S.Yoshida */ if (nkey > 0) { return(TRUE); } #endif /* KANJI */ if (ahead != -1) { return(TRUE); } ahead = rawgetc(); return(ahead != -1); } /* * panic - just exit, as quickly as we can. */ panic(s) char *s; { (void) fputs("panic: ", stderr); (void) fputs(s, stderr); (void) fputc('\n', stderr); (void) fflush(stderr); abort(); /* To leave a core image. */ } #ifndef NO_DPROMPT /* * A program to return TRUE if we wait for 1 seconds without anything * happening, else return FALSE. */ int ttwait() { register int s, ss, se; #ifdef KANJI /* 90.02.05 by S.Yoshida */ if (nkey > 0) { return(FALSE); } #endif /* KANJI */ se = (ss = syssec()) + 100; do { if (typeahead()) { return(FALSE); } s = syssec(); if (se >= 6000 && s < ss) { se -= 6000; } } while (s < se); return(TRUE); } #endif #ifdef FEPCTRL /* 90.11.26 by K.Takano */ fepmode_init() { if (fepctrl) fep_init(); } fepmode_term() { if (fepctrl) fep_term(); } fepmode_on() { if (fepctrl) { if (fepforce) { if (fepforce == 1) fep_force_on(); else fep_force_off(); fepforce = 0; fepmode = TRUE; } else if (!fepmode) { fep_on(); fepmode = TRUE; } } } fepmode_off() { if (fepctrl && fepmode) { fep_off(); fepmode = FALSE; } } fepmode_toggle() { if (fepctrl) { if (fep_get_mode()) fepforce = -1; else fepforce = 1; return (TRUE); } return (FALSE); } fepmode_set(f, n) { register int s; char buf[NFILEN]; if (f & FFARG) { n = (n > 0); } else { if ((s = ereply("FEP Control: ", buf, NFILEN)) != TRUE) return (s); if (ISDIGIT(buf[0]) || buf[0] == '-') n = (atoi(buf) > 0); else if (buf[0] == 't' || buf[0] == 'T') n = TRUE; else /* if (buf[0] == 'n' || buf[0] == 'N') */ n = FALSE; } if (!fepctrl && n) { fep_init(); fepmode = TRUE; } else if (fepctrl && !n) fep_term(); fepctrl = n; return (TRUE); } fepmode_chg(f, n) { if (fepctrl = !fepctrl) { fep_init(); fepmode = TRUE; } else fep_term(); return (TRUE); } #endif /* FEPCTRL */ ng-1.5beta1/sys/sysv/ 40755 1750 1750 0 7642273645 13215 5ustar amurausersng-1.5beta1/sys/sysv/Makefile100644 1750 1750 7735 7626153752 14764 0ustar amurausers# $Id: Makefile,v 1.2.4.1 2003/02/23 14:17:14 amura Exp $ # Makefile for MicroEMACS. # Is there a better way to do the rebuilds, other than using # the links? # # $Log: Makefile,v $ # Revision 1.2.4.1 2003/02/23 14:17:14 amura # move canna.c from sys/default to sys/unix # # Revision 1.2 2000/09/30 15:59:42 amura # add Canna configuration form config.h # # Revision 1.1.1.1 2000/06/27 01:47:59 amura # import to CVS # # Modified for Ng 1.0 by Shigeki Yoshida (shige@csk.CO.JP) 1990.01.29 SYS = sysv # Canna configurations #CANNADEF = -DCANNA #CANNALIB = -L/usr/share/lib -lcanna #CANNAINC = -I/usr/share/include CANNADEF = CANNALIB = CANNAINC = # CDEFS gets defines, and gets passed to lint. CFLAGS gets flags, and doesn't # get passed to lint. # # Now, compile time options are defined in a "config.h". # CDEFS = $(CANNADEF) CFLAGS = -O $(CDEFS) $(CANNAINC) # If your machine have an alloca() in a libPW.a, please add -lPW to the LIBS. #LIBS = $(CANNALIB) -lcurses -lPW LIBS = $(CANNALIB) -lcurses # If your machine don't have an alloca(), please define ALLOCA. #ALLOCA = alloca.o ALLOCA = CC = cc # Objects which only depend on the "standard" includes OBJS = basic.o dir.o dired.o shell.o version.o window.o \ kinsoku.o jump.o # Those with unique requirements IND = buffer.o complt.o display.o cmode.o echo.o extend.o file.o \ help.o kbd.o keymap.o line.o macro.o main.o match.o modes.o \ paragraph.o random.o region.o regex.o re_search.o search.o \ skg.o kanji.o undo.o word.o # System dependent objects OOBJS = cinfo.o spawn.o ttyio.o tty.o ttykbd.o OBJ = $(OBJS) $(IND) $(OOBJS) fileio.o canna.o $(ALLOCA) OSRCS = cinfo.c fileio.c spawn.c ttyio.c tty.c ttykbd.c canna.c alloca.c SRCS = basic.c cmode.c dir.c dired.c file.c line.c match.c paragraph.c \ random.c region.c search.c shell.c version.c window.c word.c \ buffer.c complt.c display.c echo.c extend.c help.c kbd.c \ keymap.c macro.c main.c modes.c regex.c re_search.c kanji.c \ kinsoku.c skg.c jump.c undo.c OINCS = ttydef.h sysdef.h chrdef.h INCS = config.h def.h REINCS = regex_e.h regex_j.h regex_j.c regex_e.h kanji_.h kanji_.c #PROG = mg PROG = ng $(PROG): $(OBJ) $(CC) $(CFLAGS) -o $(PROG) $(OBJ) $(LIBS) # strip mg once you're satisfied it'll run -- makes it much smaller strip: strip $(PROG) lint: $(SRCS) $(OSRCS) $(INCS) $(OINCS) lint -ahbz $(CDEFS) $(SRCS) $(OSRCS) $(OBJ): $(INCS) $(OINCS) $(OOBJS): $(INCS) $(OINCS) buffer.o: $(INCS) $(OINCS) kbd.h undo.h cmode.o file.o line.o paragraph.o random.o region.o undo.o word.o: \ $(INCS) $(OINCS) undo.h complt.o: $(INCS) $(OINCS) kbd.h complt.h display.o keymap.o modes.o fileio.o: \ $(INCS) $(OINCS) kbd.h echo.o: $(INCS) $(OINCS) key.h macro.h complt.h extend.o help.o: \ $(INCS) $(OINCS) kbd.h macro.h key.h kanji.o: $(INCS) $(OINCS) kinit.h kbd.o: $(INCS) $(OINCS) kbd.h macro.h key.h undo.h macro.o canna.o: \ $(INCS) $(OINCS) macro.h key.h main.o search.o: \ $(INCS) $(OINCS) macro.h match.o: $(INCS) $(OINCS) key.h re_search.o: $(INCS) $(OINCS) $(REINCS) macro.h regex.o: $(INCS) $(OINCS) $(REINCS) skg.o: $(INCS) $(OINCS) macro.h key.h undo.h sysdef.h: sys/$(SYS)/sysdef.h # Update links, if needed. rm -f sysdef.h ln sys/$(SYS)/sysdef.h . ttydef.h: sys/default/ttydef.h rm -f ttydef.h ln sys/default/ttydef.h . chrdef.h: sys/default/chrdef.h rm -f chrdef.h ln sys/default/chrdef.h . fileio.c: sys/$(SYS)/fileio.c rm -f fileio.c ln sys/$(SYS)/fileio.c . spawn.c: sys/$(SYS)/spawn.c rm -f spawn.c ln sys/$(SYS)/spawn.c . tty.c: sys/default/tty.c rm -f tty.c ln sys/default/tty.c . ttyio.c: sys/$(SYS)/ttyio.c rm -f ttyio.c ln sys/$(SYS)/ttyio.c . ttykbd.c: sys/default/ttykbd.c rm -f ttykbd.c ln sys/default/ttykbd.c . cinfo.c: sys/default/cinfo.c rm -f cinfo.c ln sys/default/cinfo.c . canna.c: sys/unix/canna.c rm -f canna.c ln sys/unix/canna.c . alloca.c: sys/default/alloca.c rm -f alloca.c ln sys/default/alloca.c . port: $(SRCS) $(INCS) rm -f port tar cfb port 1 $? clean:; rm -f $(OBJ) $(OSRCS) $(OINCS) ng-1.5beta1/sys/sysv/fileio.c100644 1750 1750 41375 7222417416 14745 0ustar amurausers/* $Id: fileio.c,v 1.4 2000/12/27 16:55:42 amura Exp $ */ /* * sys V fileio.c */ /* * $Log: fileio.c,v $ * Revision 1.4 2000/12/27 16:55:42 amura * change d_makename() params for conservative reason, and bugfix in dires_() * * Revision 1.3 2000/12/14 18:17:38 amura * filename length become flexible and small bugfix * * Revision 1.2 2000/12/01 09:50:24 amura * fix problems open "/" and sybolic link directory * * Revision 1.1.1.1 2000/06/27 01:47:59 amura * import to CVS * */ /* 90.01.29 Modified for Ng 1.0 by S.Yoshida */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include "def.h" static FILE *ffp; extern char *getenv(); char *adjustname(); #ifdef SUPPORT_ANSI #include #include #else # ifndef strncpy extern char *strncpy(); # endif #endif #include #include /* * Open a file for reading. */ ffropen(fn) char *fn; { if ((ffp=fopen(fn, "r")) == NULL) return (FIOFNF); return (FIOSUC); } /* * Open a file for writing. * Return TRUE if all is well, and * FALSE on error (cannot create). */ ffwopen(fn) char *fn; { if ((ffp=fopen(fn, "w")) == NULL) { ewprintf("Cannot open file for writing"); return (FIOERR); } return (FIOSUC); } /* * Close a file. * Should look at the status. */ ffclose() { (VOID) fclose(ffp); return (FIOSUC); } /* * Write a buffer to the already * opened file. bp points to the * buffer. Return the status. * Check only at the newline and * end of buffer. */ ffputbuf(bp) BUFFER *bp; { register char *cp; register char *cpend; register LINE *lp; register LINE *lpend; #ifdef KANJI /* 90.01.30 by S.Yoshida */ register int kfio; #endif /* KANJI */ lpend = bp->b_linep; #ifdef KANJI /* 90.02.07 by S.Yoshida */ if (bp->b_kfio == NIL) ksetbufcode(bp); /* Set buffer local KANJI code. */ kfio = bp->b_kfio; #endif /* KANJI */ lp = lforw(lpend); do { cp = <ext(lp)[0]; /* begining of line */ cpend = &cp[llength(lp)]; /* end of line */ while(cp != cpend) { #ifdef KANJI /* 90.01.30 by S.Yoshida */ kputc(*cp, ffp, kfio); #else /* NOT KANJI */ putc(*cp, ffp); #endif /* KANJI */ cp++; /* putc may evalualte arguments more than once */ } #ifdef KANJI /* 90.01.30 by S.Yoshida */ if (kfio == JIS) { kfselectcode(ffp, FALSE); } #endif /* KANJI */ lp = lforw(lp); if(lp == lpend) break; /* no implied newline on last line */ putc('\n', ffp); } while(!ferror(ffp)); if(ferror(ffp)) { ewprintf("Write I/O error"); return FIOERR; } return FIOSUC; } /* * Read a line from a file, and store the bytes * in the supplied buffer. Stop on end of file or end of * line. When FIOEOF is returned, there is a valid line * of data without the normally implied \n. */ ffgetline(buf, nbuf, nbytes) register char *buf; register int nbuf; register int *nbytes; { register int c; register int i; i = 0; while((c = getc(ffp))!=EOF && c!='\n') { buf[i++] = c; if (i >= nbuf) return FIOLONG; } if (c == EOF && ferror(ffp) != FALSE) { ewprintf("File read error"); return FIOERR; } *nbytes = i; return c==EOF ? FIOEOF : FIOSUC; } #ifndef NO_BACKUP /* * Rename the file "fname" into a backup * copy. On Unix the backup has the same name as the * original file, with a "~" on the end; this seems to * be newest of the new-speak. The error handling is * all in "file.c". The "unlink" is perhaps not the * right thing here; I don't care that much as * I don't enable backups myself. */ fbackupfile(fn) char *fn; { register char *nname; if ((nname=alloca((unsigned)(strlen(fn)+1+1))) == NULL) { ewprintf("Can't get %d bytes", strlen(fn) + 1); return (ABORT); } (void) strcpy(nname, fn); (void) strcat(nname, "~"); (void) unlink(nname); /* Ignore errors. */ if (rename(fn, nname) < 0) return (FALSE); return (TRUE); } #ifdef BUGFIX /* 90.02.14 by S.Yoshida */ #ifndef _SYS_STAT_H_ #include #define _SYS_STAT_H_ #endif /* _SYS_STAT_H_ */ /* * Get file mode of a file fn. */ fgetfilemode(fn) char *fn; { struct stat filestat; stat(fn, &filestat); return(filestat.st_mode & 0x0fff); } /* * Set file mode of a file fn to the specified mode. */ fsetfilemode(fn, mode) char *fn; int mode; { chmod(fn, mode); } #endif /* BUGFIX */ #endif #ifdef READONLY /* 91.01.05 by S.Yoshida */ #ifndef _SYS_STAT_H_ #include #define _SYS_STAT_H_ #endif /* _SYS_STAT_H_ */ /* * Check whether file is read-only of a file fn. */ fchkreadonly(fn) char *fn; { struct stat filestat; if (stat(fn, &filestat) == 0) { return(!(filestat.st_mode & S_IWRITE)); } else { return FALSE; } } #endif /* READONLY */ /* * The string "fn" is a file name. * Perform any required appending of directory name or case adjustments. * If NO_DIR is not defined, the same file should be refered to even if the * working directory changes. */ #ifdef SYMBLINK #ifndef BUGFIX /* 90.02.15 by S.Yoshida: Previously included. */ #include #endif /* BUGFIX */ #ifndef _SYS_STAT_H_ /* 90.02.15 by S.Yoshida */ #include #define _SYS_STAT_H_ #endif /* _SYS_STAT_H_ */ #ifndef MAXLINK #define MAXLINK 8 /* maximum symbolic links to follow */ #endif #endif #include #ifndef NO_DIR extern char *wdir; #endif char *adjustname(fn) register char *fn; { register char *cp; static char fnb[NFILEN]; struct passwd *pwent, *getpwnam(); #ifdef SYMBLINK struct stat statbuf; int i, j; char linkbuf[NFILEN]; #endif switch(*fn) { case '/': cp = fnb; *cp++ = *fn++; break; case '~': fn++; if(*fn == '/' || *fn == '\0') { (VOID) strcpy(fnb, getenv("HOME")); cp = fnb + strlen(fnb); if(*fn) fn++; break; } else { cp = fnb; while(*fn && *fn != '/') *cp++ = *fn++; *cp = '\0'; if((pwent = getpwnam(fnb)) != NULL) { (VOID) strcpy(fnb, pwent->pw_dir); cp = fnb + strlen(fnb); break; } else { fn -= strlen(fnb) + 1; /* can't find ~user, continue to default case */ } } default: #ifndef NO_DIR strcpy(fnb, wdir); cp = fnb + strlen(fnb); break; #else return fn; /* punt */ #endif } if(cp != fnb && cp[-1] != '/') *cp++ = '/'; while(*fn) { switch(*fn) { case '.': switch(fn[1]) { case '\0': *--cp = '\0'; return fnb; case '/': fn += 2; continue; case '.': if(fn[2]=='/' || fn[2] == '\0') { #ifdef SYMBLINK cp[-1] = '\0'; for(j = MAXLINK; j-- && lstat(fnb, &statbuf) != -1 && (statbuf.st_mode&S_IFMT) == S_IFLNK && (i = readlink(fnb, linkbuf, sizeof linkbuf)) != -1 ;) { if(linkbuf[0] != '/') { --cp; while(cp > fnb && *--cp != '/') {} ++cp; (VOID) strncpy(cp, linkbuf, i); cp += i; } else { (VOID) strncpy(fnb, linkbuf, i); cp = fnb + i; } if(cp[-1]!='/') *cp++ = '\0'; else cp[-1] = '\0'; } cp[-1] = '/'; #endif --cp; while(cp > fnb && *--cp != '/') {} ++cp; if(fn[2]=='\0') { *--cp = '\0'; return fnb; } fn += 3; continue; } break; default: break; } break; case '/': fn++; continue; default: break; } while(*fn && (*cp++ = *fn++) != '/') {} } if((cp-1)!=fnb && cp[-1]=='/') --cp; *cp = '\0'; return fnb; } #ifndef NO_STARTUP #include #ifndef F_OK #define F_OK 04 /* for stupid Sys V */ #endif /* * Find a startup file for the user and return its name. As a service * to other pieces of code that may want to find a startup file (like * the terminal driver in particular), accepts a suffix to be appended * to the startup file name. */ char * #ifdef ADDOPT startupfile(ngrcfile, suffix) char* ngrcfile; #else startupfile(suffix) #endif char *suffix; { register char *file; static char home[NFILEN]; char *getenv(); #ifdef ADDOPT if (ngrcfile == NULL) ngrcfile = getenv("NGRC"); if (ngrcfile != NULL) if (access(ngrcfile, F_OK) == 0) return ngrcfile; #endif if ((file = getenv("HOME")) == NULL) goto notfound; if (strlen(file)+7 >= NFILEN - 1) goto notfound; (VOID) strcpy(home, file); #ifdef KANJI /* 90.02.10 by S.Yoshida */ (VOID) strcat(home, "/.ng"); #else /* NOT KANJI */ (VOID) strcat(home, "/.mg"); #endif /* KANJI */ if (suffix != NULL) { (VOID) strcat(home, "-"); (VOID) strcat(home, suffix); } if (access(home, F_OK) == 0) return home; notfound: #ifdef STARTUPFILE file = STARTUPFILE; if (suffix != NULL) { (VOID) strcpy(home, file); (VOID) strcat(home, "-"); (VOID) strcat(home, suffix); file = home; } if (access(file, F_OK ) == 0) return file; #endif return NULL; } #endif #ifndef NO_DIRED #include "kbd.h" copy(frname, toname) char *frname, *toname; { int pid; int status; #ifdef BUGFIX /* 91.01.11 by Y.Kaneko */ if((pid = fork()) == 0) { #else /* ORIGINAL */ if(pid = fork()) { if(pid == -1) return -1; #endif /* BUGFIX */ execl("/bin/cp", "cp", frname, toname, (char *)NULL); _exit(1); /* shouldn't happen */ } #ifdef BUGFIX /* 91.01.11 by Y.Kaneko */ if(pid == -1) return -1; #endif /* BUGFIX */ while(wait(&status) != pid) ; return status == 0; } BUFFER *dired_(dirname) char *dirname; { register BUFFER *bp; char line[256]; BUFFER *findbuffer(); FILE *dirpipe; FILE *popen(); if((dirname = adjustname(dirname)) == NULL) { ewprintf("Bad directory name"); return NULL; } #ifdef BUGFIX /* 90.02.06 by S.Yoshida */ if(dirname[strlen(dirname)-1] != '/') (VOID) strcat(dirname, "/"); #endif /* BUGFIX */ if((bp = findbuffer(dirname)) == NULL) { ewprintf("Could not create buffer"); return NULL; } if(bclear(bp) != TRUE) return FALSE; #ifdef EXTD_DIR if (bp->b_cwd) free(bp->b_cwd); if ((bp->b_cwd=malloc(strlen(dirname)+1)) != NULL) strcpy(bp->b_cwd, dirname); ensurecwd(); #endif #ifdef BUGFIX /* 91.02.04 by M.Oki */ (VOID) strcpy(line, "/bin/ls -al "); (VOID) strcpy(&line[12], dirname); #else /* ORIGINAL */ (VOID) strcpy(line, "ls -al "); (VOID) strcpy(&line[7], dirname); #endif /* BUGFIX */ if((dirpipe = popen(line, "r")) == NULL) { ewprintf("Problem opening pipe to ls"); return NULL; } line[0] = line[1] = ' '; while(fgets(&line[2], 254, dirpipe) != NULL) { line[strlen(line) - 1] = '\0'; /* remove ^J */ (VOID) addline(bp, line); } if(pclose(dirpipe) == -1) { ewprintf("Problem closing pipe to ls"); return NULL; } bp->b_dotp = lforw(bp->b_linep); /* go to first line */ if (bp->b_fname) free(bp->b_fname); if ((bp->b_fname=malloc(strlen(dirname)+1)) != NULL) (VOID) strcpy(bp->b_fname, dirname); if((bp->b_modes[0] = name_mode("dired")) == NULL) { bp->b_modes[0] = &map_table[0]; ewprintf("Could not find mode dired"); return NULL; } bp->b_nmodes = 0; return bp; } d_makename(lp, fn, buflen) register LINE *lp; register char *fn; { char* cp; int l,l1,len; char c; /* '56' is a magic number and is not correct always */ if ( llength( lp ) <= 56 ) { return ABORT ; } l = llength(lp); if (lgetc(lp, 2) == 'l') { do { while (l > 2 && lgetc(lp, l) != ' ') l--; if (bcmp(lp->l_text + l - 3, " -> ", 4) == 0) break; l--; } while (l > 2); } else { do { while (l > 2 && lgetc(lp, l)!=' ') l--; l1 = l; while (l > 2 && lgetc(lp, l)==' ') l--; while (l > 2 && (c=lgetc(lp, l))!=' ') { if (c!=':' && (c<'0'||c>'9')) { break; } l--; } } while (l > 2 && c != ' '); l = l1; } if (l <= 2) return ABORT; l++; len = llength(lp) - l + 1; if (buflen <= len+strlen(curbp->b_fname)) return ABORT; cp = fn; strcpy(cp, curbp->b_fname); cp += strlen(cp); bcopy(lp->l_text + l, cp, len); cp[len-1] = '\0'; #ifdef SYMBLINK if (lgetc(lp, 2) == 'l') return ffisdir(curbp->b_fname); #endif return lgetc(lp, 2) == 'd'; } /* * I, a System V novice, could only figure out how to do unlinkdir() * and rename() as exec's of the appropriate functions. So sue me. * --Stephen Walton, December 1987 * * Now, SystemV has rmdir (form Release3) and rename (form Release 4). * I rewrite Ng use them. * --amura, 03 Apr 2000 */ #ifdef SVR2 unlinkdir(f) /* System V Release 2 don't have rmdir(2)? */ char *f; { int status, pid, wpid; if ((pid = fork()) == 0) execl("/bin/rmdir", "rmdir", f, (char *)NULL); else if (pid > 0) while ((wpid = wait(&status)) && wpid != pid) ; else return FALSE; return status == 0; } #endif #ifndef SVR4 rename(f1, f2) /* System V Release 2/3 don't have rename(2)? */ char *f1, *f2; { int status, pid, wpid; if ((pid = fork()) == 0) execl("/bin/mv", "mv", f1, f2, (char *)NULL); else if (pid > 0) while ((wpid = wait(&status)) && wpid != pid) ; else return FALSE; return status == 0; } #endif /* SVR4 */ #endif /* NO_DIRED */ #ifndef NO_DIRED /* 91.01.15 by K.Maeda */ #ifndef _SYS_STAT_H_ #include #define _SYS_STAT_H_ #endif /* _SYS_STAT_H_ */ /* * Check whether file "dn" is directory. */ ffisdir(dn) char *dn; { struct stat filestat; if (stat(dn, &filestat) == 0) { return ((filestat.st_mode & S_IFMT) == S_IFDIR); } else { return FALSE; } } #endif /* NO_DIRED */ #ifndef NO_FILECOMP /* 90.04.04 by K.Maeda */ #ifndef SVR2 /* 91.01.29 SVR3 or later. by S.Yoshida */ #include /* 90.07.16 -> by Y.Nimura */ #else /* SVR2 */ #include #include #endif /* SVR2 */ /* 89.11.20 Original code is for X68K (Human68K). * 90.07.05 Modified for System V UNIX by S.Yoshida * This routine may be compiled only in SysV Rel 3 or later. * 90.07.16 Debuged by Y.Nimura. * 91.01.29 Debug for SysV Rel 2. by S.Yoshida * Find file names starting with name. * Result is stored in *buf, got from malloc(); * Return the number of files found, or * -1 of error occured. */ #define MALLOC_STEP 256 fffiles(name, buf) char *name, **buf; { char pathbuf[128], tmpnam[128]; char *cp, *dirpart, *nampart; #ifndef SVR2 /* 91.01.29 SVR3 or later. by S.Yoshida */ /* 90.07.16 direct -> dirent by Y.Nimura */ DIR *dp; register struct dirent *dirent; #else /* SVR2 */ int dp; struct direct dirbuf; register struct direct *dirent = &dirbuf; #endif /* SVR2 */ int n, len, size, dirpartlen, nampartlen; char *buffer; struct stat st; strcpy(pathbuf, name); dirpart = NULL; for (cp = pathbuf; *cp; cp++) { if (*cp == '/') dirpart = cp; } if (dirpart) { *++dirpart = '\0'; dirpartlen = dirpart-pathbuf; } else { strcpy(pathbuf, "./"); dirpartlen = 0; } nampart = name + dirpartlen; nampartlen = strlen(nampart); #ifndef NEW_COMPLETE /* 90.12.10 Sawayanagi Yosirou */ #ifndef SVR2 /* 91.02.04 SVR3 or later. by Y.Nimura */ if ((dp = opendir(pathbuf)) == NULL) #else /* SVR2 */ if ((dp = open(pathbuf,O_RDONLY)) < 0) #endif /* SVR2 */ return -1; #endif /* NOT NEW_COMPLETE */ buffer = malloc(MALLOC_STEP); if (buffer == NULL) return -1; size = MALLOC_STEP; len = 0; n = 0; #ifdef NEW_COMPLETE /* 90.12.10 Sawayanagi Yosirou */ #ifndef SVR2 /* 91.02.04 SVR3 or later. by Y.Nimura */ if ((dp = opendir(pathbuf)) == NULL) { #else /* SVR2 */ if ((dp = open(pathbuf,O_RDONLY)) < 0) { #endif /* SVR2 */ *buf = buffer; buffer[0] = '\0'; return 0; } #endif /* NEW_COMPLETE */ #ifndef SVR2 /* 91.02.04 SVR3 or later. by Y.Nimura */ while ((dirent = readdir(dp)) != NULL) { #else /* SVR2 */ while (read(dp,dirent,sizeof(struct direct)) == sizeof(struct direct)) { #endif /* SVR2 */ register int l; #ifdef SVR2 /* 91.02.04 by Y.Nimura */ if (dirent->d_ino == 0) continue; #endif /* SVR2 */ if (strncmp(nampart, dirent->d_name, nampartlen) != 0) goto nomatch; /* case-sensitive comparison */ strncpy(tmpnam, pathbuf, dirpartlen); strcpy(tmpnam+dirpartlen, dirent->d_name); if (stat(tmpnam, &st) < -1) goto nomatch; if ((st.st_mode & S_IFMT)==S_IFDIR) strcat(tmpnam, "/"); l = strlen(tmpnam)+1; if (l > 3 && tmpnam[l-3] == '.' && tmpnam[l-2] == 'o') goto nomatch; if (l+len >= size) { /* make room for double null */ if ((buffer = realloc(buffer, size += MALLOC_STEP)) == NULL) return -1; } strcpy(buffer+len, tmpnam); len += l; n++; nomatch:; } #ifndef SVR2 /* 91.02.04 SVR3 or later. by Y.Nimura */ closedir(dp); #else /* SVR2 */ close(dp); #endif /* SVR2 */ *buf = buffer; buffer[len] = '\0'; return n; } #endif #ifdef NEW_COMPLETE /* 90.12.10 Sawayanagi Yosirou */ char * file_name_part (s) char *s; { int i; for (i = strlen (s); i > 0; i--) { if (s[i - 1] == '/') break; } return (s + i); } char * copy_dir_name (d, s) char *d; char *s; { int i; i = file_name_part (s) - s; strncpy (d, s, i); d[i] = '\0'; return (d); } #endif /* NEW_COMPLETE */ ng-1.5beta1/sys/sysv/spawn.c100644 1750 1750 13342 7207221422 14610 0ustar amurausers/* $Id: spawn.c,v 1.3 2000/11/23 14:00:50 amura Exp $ */ /* * Name: MicroGnuEmacs * Spawn CLI for System V. * * Spawn for System V. */ /* * $Log: spawn.c,v $ * Revision 1.3 2000/11/23 14:00:50 amura * fix for some strict compiler * * Revision 1.2 2000/06/27 01:59:43 amura * small bugfix * * Revision 1.1.1.1 2000/06/27 01:47:59 amura * import to CVS * */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include "def.h" #include char *shellp = NULL; /* Saved "SHELL" program. */ char *shname = NULL; /* Saved shell name */ extern char *getenv(); #ifdef HAVE_GETSID extern int job_control; #endif /* * On System V, we no gots job control, so always run * a subshell using fork/exec. Bound to "C-C", and used * as a subcommand by "C-Z". (daveb) * * Returns 0 if the shell executed OK, something else if * we couldn't start shell or it exited badly. */ /*ARGSUSED*/ spawncli(f, n) { extern char *strrchr(); register int pid; register int wpid; register VOID (*oqsig)(); register VOID (*oisig)(); #ifdef ADDFUNC /* 93.07.08 by S.Yoshida */ #ifdef SIGWINCH /* 93.07.08 by S.Yoshida */ register VOID (*owsig)(); #endif #ifdef SIGTSTP /* 93.07.08 by S.Yoshida */ register int omask; #endif #endif /* ADDFUNC */ int status = FALSE; int errp = FALSE; #ifdef XKEYS /* 92.03.16 by Gen KUROKI */ ttykeymaptidy(); #endif /* XKEYS */ if (shellp == NULL) { shellp = getenv("SHELL"); if (shellp == NULL) shellp = getenv("shell"); if (shellp == NULL) shellp = "/bin/sh"; /* Safer. */ shname = strrchr( shellp, '/' ); shname = shname ? shname+1 : shellp; } ttcolor(CTEXT); ttnowindow(); #ifdef ADDFUNC /* 93.07.08 by S.Yoshida */ #ifdef SIGTSTP /* 93.07.08 by S.Yoshida */ if (strcmp(shellp, "/bin/csh") == 0) { if (epresf != FALSE) { ttmove(nrow-1, 0); tteeol(); epresf = FALSE; } /* Csh types a "\n" */ ttmove(nrow-2, 0); /* before "Stopped". */ } else { #endif #endif ttmove(nrow-1, 0); if (epresf != FALSE) { tteeol(); epresf = FALSE; } #ifdef ADDFUNC /* 93.07.08 by S.Yoshida */ #ifdef SIGTSTP /* 93.07.08 by S.Yoshida */ } #endif #endif ttclose(); sgarbf = TRUE; /* Force repaint. */ #ifdef ADDFUNC /* 93.07.08 by S.Yoshida */ #ifdef SIGTSTP /* 93.07.08 by S.Yoshida */ # ifdef HAVE_GETSID if (job_control) { # else if (strcmp(shellp, "/bin/sh")!=0 || getenv("BASH_VERSION") || getenv("BASH")) { /* C shell, ksh or bash */ # endif /* omask = sigsetmask(0); */ oqsig = signal(SIGQUIT, SIG_IGN); oisig = signal(SIGINT, SIG_IGN); #ifdef SIGWINCH /* 93.07.08 by S.Yoshida */ owsig = signal(SIGWINCH, SIG_IGN); #endif (void) kill(0, SIGTSTP); /* (void) sigsetmask(omask); */ signal(SIGINT, oisig); signal(SIGQUIT, oqsig); #ifdef SIGWINCH /* 93.07.08 by S.Yoshida */ signal(SIGWINCH, owsig); #endif } else { /* Bourne shell. */ #endif /* SIGTSTP */ #endif /* ADDFUNC */ oqsig = signal(SIGQUIT, SIG_IGN); oisig = signal(SIGINT, SIG_IGN); #ifdef ADDFUNC /* 93.07.08 by S.Yoshida */ #ifdef SIGWINCH /* 93.07.08 by S.Yoshida */ owsig = signal(SIGWINCH, SIG_IGN); #endif #endif if ((pid=fork()) == 0) { (void) signal(SIGINT, oisig); (void) signal(SIGQUIT, oqsig); #ifdef ADDFUNC /* 93.07.08 by S.Yoshida */ #ifdef SIGWINCH /* 93.07.08 by S.Yoshida */ (void) signal(SIGWINCH, owsig); #endif #endif #ifdef EXTD_DIR dirend(); #endif execlp(shellp, shname, "-i", (char *)NULL); _exit(1); /* Should do better! */ } else if (pid > 0) { while ((wpid=wait(&status))>=0 && wpid!=pid) ; } else errp = TRUE; signal(SIGINT, oisig); signal(SIGQUIT, oqsig); #ifdef ADDFUNC /* 93.07.08 by S.Yoshida */ #ifdef SIGWINCH /* 93.07.08 by S.Yoshida */ signal(SIGWINCH, owsig); #endif #ifdef SIGTSTP /* 93.07.08 by S.Yoshida */ } #endif #endif ttopen(); #ifdef SIGWINCH /* by A.ITO 21 Jan. 1991 / by S.Yoshida */ refresh(FFRAND, 0); /* May be resized. */ #endif if(errp) ewprintf("Failed to create process"); #ifdef XKEYS /* 92.03.16 by Gen KUROKI */ ttykeypadstart(); #endif /* XKEYS */ return !( errp | status ); } #ifndef NO_SHELL /* 91.01.10 by K.Maeda */ #include #include /* * Call process in subshell. * Execute COMMAND binding standard input to file INPUT. * NULL as INPUT means standard input should be bound to * /dev/null or whatever equivalent in your OS. * All output during the execution (including standard error output) * should go into a scratch file, whose name call_process() returns. * Return value NULL means error in some stage of the execution. * In that case, scratch file should be deleted. */ char * call_process(command, input) char *command; char *input; { char buf[256]; char *tmp; static char tmpbuf[20]; int ostdin, ostdout, ostderr, in, out, s; extern char *mktemp(); strcpy(tmpbuf, "/tmp/ngXXXXXX"); if ((tmp = mktemp(tmpbuf)) == NULL) return NULL; if ((in = open(input ? input : "/dev/null", 0)) < 0) return NULL; if ((out = creat(tmp, S_IREAD | S_IWRITE)) < 0) { close(in); return NULL; } ostdin = dup(0); ostdout = dup(1); ostderr = dup(2); if (ostdin < 0 || ostdout < 0 || ostderr < 0) { s = -1; goto skip; } #ifndef SVR2 /* 91.02.04 SVR3 or later. by Junn Ohta */ dup2(in, 0); dup2(out, 1); dup2(out, 2); #else /* SVR2 */ close(0); dup(in); close(1); dup(out); close(2); dup(out); #endif /* SVR2 */ strcpy(buf, command); #ifdef EXTD_DIR ensurecwd(); #endif s = system(buf); close(in); close(out); #ifndef SVR2 /* 91.02.04 SVR3 or later. by Junn Ohta */ dup2(ostdin, 0); dup2(ostdout, 1); dup2(ostderr, 2); #else /* SVR2 */ close(0); dup(ostdin); close(1); dup(ostdout); close(2); dup(ostderr); #endif /* SVR2 */ skip: close(ostdin); close(ostdout); close(ostderr); if (s == -1) { unlink(tmp); return NULL; } return tmp; } #endif /* NO_SHELL */ ng-1.5beta1/sys/sysv/sysdef.h100644 1750 1750 3773 7216206447 14763 0ustar amurausers/* $Id: sysdef.h,v 1.2 2000/12/14 18:10:47 amura Exp $ */ /* * System V system header file */ /* * $Log: sysdef.h,v $ * Revision 1.2 2000/12/14 18:10:47 amura * filename length become flexible * * Revision 1.1.1.1 2000/06/27 01:47:59 amura * import to CVS * */ #include #include /* 00.04.15 by amura */ #define HAVE_GETCWD #define KBLOCK 8192 /* Kill grow. */ #define GOOD 0 /* Good exit status. */ #ifndef NO_SHELL /* 91.01.10 by K.Maeda */ #define CMDLINELENGTH NFILEN /* Maximum length of shell command. */ #endif /* NO_SHELL */ #define BSMAP FALSE /* Bs map feature can use. */ /* (default mode is bsmap off) */ #define MAKEBACKUP TRUE /* Making backup file is on. */ typedef long RSIZE; /* Type for file/region sizes */ typedef short KCHAR; /* Type for internal keystrokes */ #if 0 #ifdef _POSIX_JOB_CONTROL /* This is trick */ # if (0 - _POSIX_JOB_CONTROL - 1) != -1 # define HAVE_GETSID # endif #endif #endif /* * Macros used by the buffer name making code. * Start at the end of the file name, scan to the left * until BDC1 (or BDC2, if defined) is reached. The buffer * name starts just to the right of that location, and * stops at end of string (or at the next BDC3 character, * if defined). BDC2 and BDC3 are mainly for VMS. */ #define BDC1 '/' /* Buffer names. */ #ifdef CANNA #define SYSINIT canna_init() #define SYSCLEANUP canna_end() #endif #define MALLOCROUND(m) (m+=7,m&=~7) /* round up to 8 byte boundry */ #define fncmp strcmp /* file name comparison */ #define bcopy(s,d,n) memcpy(d,s,n) /* memory-to-memory copy */ #define bzero(s,n) memset(s,0,n) /* 91.01.21 Add by H.Kaneko. */ #define bcmp(s,d,n) memcmp(s,d,n) /* 91.02.04 Add by Y.Nimura. */ /* 91.02.04 strncmp -> memcmp */ /* by S.Yoshida */ #ifndef SVR2 /* SVID2(==SVR3) has rmdir. 00.04.03 by amura */ #define unlinkdir(fn) rmdir(fn) /* unlink directory */ #endif char *getenv(); #define gettermtype() getenv("TERM") /* determine terminal type */ char *getcwd(); ng-1.5beta1/sys/sysv/ttyio.c100644 1750 1750 22011 7233243307 14626 0ustar amurausers/* $Id: ttyio.c,v 1.7 2001/01/23 08:54:31 amura Exp $ */ /* * Name: MicroEMACS * System V terminal I/O. * Version: 0 * Last edit: Tue Aug 26 23:57:57 PDT 1986 * By: gonzo!daveb * {sun, amdahl, mtxinu}!rtech!gonzo!daveb * * The functions in this file * negotiate with the operating system for * keyboard characters, and write characters to * the display in a barely buffered fashion. * * This version goes along with tty/termcap/tty.c. * Terminal size is determined there, rather than here, and * this does not open the termcap file */ /* * $Log: ttyio.c,v $ * Revision 1.7 2001/01/23 08:54:31 amura * remove terminal size check all * * Revision 1.6 2001/01/23 08:43:50 amura * reset terminal polling mode in ttwait() * * Revision 1.5 2001/01/20 15:48:47 amura * very big terminal supported * * Revision 1.4 2001/01/17 18:31:53 amura * fix typo POSIXTTY to POSIX_TTY * * Revision 1.3 2000/12/01 09:47:25 amura * fix ttraw() with termios * unset IEXTEN flag on c_lflag * * Revision 1.2 2000/11/16 14:32:03 amura * fix some typos which cause compile error when using * strict ANSI-C compiler (ex ACK, gcc-1.x) * * Revision 1.1.1.1 2000/06/27 01:47:59 amura * import to CVS * */ /* 90.02.05 Modified for Ng 1.0 by S.Yoshida */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include "def.h" #include #include #ifdef POSIXTTY /* by S.Okamoto 93/03/16 */ #include #else #include #endif #ifdef ADDFUNC /* 93.07.08 by S.Yoshida */ #include /* 93.07.08: For SIGWINCH. */ #include /* 00.04.03: amura */ #endif /* ADDFUNC */ #define NOBUF 512 /* Output buffer size. */ char obuf[NOBUF]; /* Output buffer. */ int nobuf; /* buffer count */ #ifdef POSIXTTY /* by S.Okamoto 93/03/16 */ static struct termios ot; /* entry state of the terminal */ static struct termios nt; /* editor's terminal state */ #else static struct termio ot; /* entry state of the terminal */ static struct termio nt; /* editor's terminal state */ #endif static int ttyactivep = FALSE; /* terminal in editor mode? */ static int ttysavedp = FALSE; /* terminal state saved? */ #ifdef BUGFIX /* 91.01.14 by S.Yoshida */ #ifdef TIOCGWINSZ struct winsize winsize; /* 4.3 BSD window sizing */ #endif #endif /* BUGFIX */ int nrow; /* Terminal size, rows. */ int ncol; /* Terminal size, columns. */ #ifdef ADDFUNC /* 93.07.08 by S.Yoshida */ #ifdef SIGWINCH /* 93.07.08 by S.Yoshida */ VOID ttwinch(); #endif #endif #ifdef HAVE_GETSID int job_control; #endif /* These are used to implement typeahead on System V */ int kbdflgs; /* saved keyboard fd flags */ int kbdpoll; /* in O_NDELAY mode */ int kbdqp; /* there is a char in kbdq */ char kbdq; /* char we've already read */ /* * This function gets called once, to set up * the terminal channel. This version turns off flow * control. This may be wrong for your system, but no * good solution has really been found (daveb). */ ttopen() { register char *cp; extern char *getenv(); if (ttyactivep) return; if( !ttysavedp ) { #ifdef POSIXTTY /* by S.Okamoto 93/03/16 */ if (tcgetattr(0, &ot) < 0) #else if (ioctl(0, TCGETA, &ot) < 0) #endif abort(); nt = ot; /* save entry state */ nt.c_cc[VMIN] = 1; /* one character read is OK */ nt.c_cc[VTIME] = 0; /* Never time out. */ nt.c_iflag |= IGNBRK; nt.c_iflag &= ~( ICRNL | INLCR | ISTRIP | IXON | IXOFF ); nt.c_oflag &= ~OPOST; nt.c_cflag |= CS8; /* allow 8th bit on input */ nt.c_cflag &= ~PARENB; /* Don't check parity */ nt.c_lflag &= ~( ECHO | ICANON | ISIG ); #ifdef POSIXTTY nt.c_lflag &= ~IEXTEN; #endif kbdpoll = (((kbdflgs = fcntl(0, F_GETFL, 0)) & O_NDELAY) != 0); #ifdef HAVE_GETSID { pid_t pid,pgid,sid; pid = getpid(); pgid = getpgrp(); sid = getsid(0); if (pid == pgid && pgid != sid) job_control = TRUE; else job_control = FALSE; } #endif /* HAVE_GETSID */ ttysavedp = TRUE; } #ifdef BUGFIX else kbdpoll = ((fcntl(0, F_GETFL, 0) & O_NDELAY) != 0); #endif #ifdef POSIXTTY /* by S.Okamoto 93/03/16 */ if (tcsetattr(0, TCSAFLUSH, &nt) < 0) #else if (ioctl(0, TCSETAF, &nt) < 0) #endif abort(); #ifdef TIOCGWINSZ if (ioctl(0, TIOCGWINSZ, (char *) &winsize) != -1) { nrow = winsize . ws_row; ncol = winsize . ws_col; } else nrow = 0; if (nrow <= 0 || ncol <= 0) #endif /* TIOCGWINSZ */ /* This really belongs in tty/termcap... */ if ((cp=getenv("TERMCAP")) == NULL || (nrow=getvalue(cp, "li")) <= 0 || (ncol=getvalue(cp, "co")) <= 0) { nrow = 24; ncol = 80; } #ifdef ADDFUNC /* 93.07.08 by S.Yoshida */ #ifdef SIGWINCH /* 93.07.08 by S.Yoshida */ (void) signal(SIGWINCH, ttwinch); #endif #endif ttyactivep = TRUE; } /* * This routine scans a string, which is * actually the return value of a getenv call for the TERMCAP * variable, looking for numeric parameter "name". Return the value * if found. Return -1 if not there. Assume that "name" is 2 * characters long. This limited use of the TERMCAP lets us find * out the size of a window on the X display. */ getvalue(cp, name) register char *cp; register char *name; { for (;;) { while (*cp!=0 && *cp!=':') ++cp; if (*cp++ == 0) /* Not found. */ return (-1); if (cp[0]==name[0] && cp[1]==name[1] && cp[2]=='#') return (atoi(cp+3)); /* Stops on ":". */ } } /* * This function gets called just * before we go back home to the shell. Put all of * the terminal parameters back. */ ttclose() { if(!ttysavedp || !ttyactivep) return; ttflush(); #ifdef POSIXTTY if (tcsetattr(0, TCSAFLUSH, &ot) < 0 || fcntl( 0, F_SETFL, kbdflgs ) < 0) #else if (ioctl(0, TCSETAF, &ot) < 0 || fcntl( 0, F_SETFL, kbdflgs ) < 0) #endif abort(); ttyactivep = FALSE; } /* * Write character to the display. * Characters are buffered up, to make things * a little bit more efficient. */ ttputc(c) { if (nobuf >= NOBUF) ttflush(); obuf[nobuf++] = c; } /* * Flush output. */ ttflush() { if (nobuf != 0) { write(1, obuf, nobuf); nobuf = 0; } } #ifdef KANJI /* 90.02.05 by S.Yoshida */ static int nkey = 0; /* The number of ungetc charactor. */ static int keybuf[4]; /* Ungetc charactors. */ #endif /* KANJI */ /* * Read character from terminal. * All 8 bits are returned, so that you can use * a multi-national terminal. * * If keyboard 'queue' already has typeahead from a typeahead() call, * just return it. Otherwise, make sure we are in blocking i/o mode * and read a character. */ ttgetc() { #ifdef KANJI /* 90.02.05 by S.Yoshida */ if (nkey > 0) { return (keybuf[--nkey]); } #endif /* KANJI */ if( kbdqp ) kbdqp = FALSE; else { if( kbdpoll && fcntl( 0, F_SETFL, kbdflgs ) < 0 ) abort(); kbdpoll = FALSE; while (read(0, &kbdq, 1) != 1) ; } return ( kbdq & 0xff ); } #ifdef KANJI /* 90.02.05 by S.Yoshida */ /* * Save pre-readed char to read again. */ ttungetc(c) int c; { keybuf[nkey++] = c; } #endif /* KANJI */ /* * Return non-FALSE if typeahead is pending. * * If already got unread typeahead, do nothing. * Otherwise, set keyboard to O_NDELAY if not already, and try * a one character read. */ typeahead() { #ifdef KANJI /* 90.02.05 by S.Yoshida */ if (nkey > 0) { return (TRUE); } #endif /* KANJI */ if( !kbdqp ) { if( !kbdpoll && fcntl( 0, F_SETFL, kbdflgs | O_NDELAY ) < 0 ) abort(); kbdpoll = TRUE; kbdqp = (1 == read( 0, &kbdq, 1 )); } return ( kbdqp ); } /* * panic: print error and die, leaving core file. * Don't know why this is needed (daveb). */ panic(s) char *s; { fprintf(stderr, "%s\r\n", s); abort(); } /* ** This should check the size of the window, and reset if needed. */ setttysize() { #ifdef TIOCGWINSZ if (ioctl(0, TIOCGWINSZ, (char *) &winsize) != -1) { nrow = winsize . ws_row; ncol = winsize . ws_col; } else #ifdef BUGFIX /* 93.07.08 by S.Yoshida */ nrow = 0; if (nrow <= 0 || ncol <= 0) #endif /* BUGFIX */ #endif if ((nrow=tgetnum ("li")) <= 0 || (ncol=tgetnum ("co")) <= 0) { nrow = 24; ncol = 80; } } #ifdef ADDFUNC /* 93.07.08 by S.Yoshida */ #ifdef SIGWINCH /* 93.07.08 by S.Yoshida */ /* * Signal handler when window size has changed. */ VOID ttwinch() { refresh(FFRAND, 0); /* Very easy way... */ #ifdef CANNA canna_width(); #endif /* CANNA */ (void) signal(SIGWINCH, ttwinch); } #endif /* ADDFUNC */ #endif /* SIGWINCH */ #ifndef NO_DPROMPT #include #include static jmp_buf tohere; static VOID alrm() { longjmp(tohere, -1); } /* * Return TRUE if we wait without doing anything, else return FALSE. */ ttwait() { VOID alrm(); #ifdef KANJI /* 90.02.05 by S.Yoshida */ if (nkey > 0) { return (FALSE); } #endif /* KANJI */ if (kbdqp) return FALSE; /* already pending input */ if (setjmp(tohere)) return TRUE; /* timeout on read if here */ #ifdef BUGFIX /* 90.02.07 by S.Yoshida */ signal(SIGALRM, alrm); alarm(1); #else /* NOT BUGFIX */ signal(SIGALRM, alrm); alarm(2); #endif /* BUGFIX */ if (kbdpoll && fcntl( 0, F_SETFL, kbdflgs ) < 0) abort(); kbdpoll = FALSE; kbdqp = (1 == read(0, &kbdq, 1)); alarm(0); return FALSE; /* successful read if here */ } #endif /* NO_DPROMPT */ ng-1.5beta1/sys/unix/ 40755 1750 1750 0 7642273645 13174 5ustar amurausersng-1.5beta1/sys/unix/Makefile.in100644 1750 1750 10374 7626153752 15361 0ustar amurausers# $Id: Makefile.in,v 1.4.2.1 2003/02/23 14:17:14 amura Exp $ # Makefile.in for Ng / Mg++ # # $Log: Makefile.in,v $ # Revision 1.4.2.1 2003/02/23 14:17:14 amura # move canna.c from sys/default to sys/unix # # Revision 1.4 2001/02/18 17:07:39 amura # append AUTOSAVE feature (but NOW not work) # # Revision 1.3 2000/12/21 16:58:28 amura # add confclean target # # Revision 1.2 2000/12/01 10:06:16 amura # add configure rule and fix strip rule # # Revision 1.1 2000/11/19 18:34:59 amura # support GNU configure system # # # Create from BSD Makefile by MURAMATSU Atsushi SYS = unix CC = @CC@ STRIP = @STRIP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ prefix = @prefix@ exec_prefix = @exec_prefix@ BINDIR = @bindir@ SHAREDIR = @datadir@/ng # CDEFS gets defines, and gets passed to lint. CFLAGS gets flags, and doesn't # get passed to lint. # # Now, compile time options are defined in a "config.h". # CDEFS = @DEFS@ CFLAGS = @CFLAGS@ $(CDEFS) LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ # If your machine don't have an alloca(), please define ALLOCA. ALLOCA = @ALLOCA@ # Objects which only depend on the "standard" includes OBJS = autosave.o basic.o dir.o dired.o shell.o version.o window.o \ kinsoku.o jump.o # Those with unique requirements IND = buffer.o complt.o display.o cmode.o echo.o extend.o file.o \ help.o kbd.o keymap.o line.o macro.o main.o match.o modes.o \ paragraph.o random.o region.o regex.o re_search.o search.o \ skg.o kanji.o undo.o word.o # System dependent objects OOBJS = cinfo.o spawn.o ttyio.o tty.o ttykbd.o OBJ = $(OBJS) $(IND) $(OOBJS) fileio.o canna.o $(ALLOCA) OSRCS = cinfo.c fileio.c spawn.c ttyio.c tty.c ttykbd.c canna.c alloca.c SRCS = basic.c cmode.c dir.c dired.c file.c line.c match.c paragraph.c \ random.c region.c search.c shell.c version.c window.c word.c \ buffer.c complt.c display.c echo.c extend.c help.c kbd.c \ keymap.c macro.c main.c modes.c regex.c re_search.c kanji.c \ kinsoku.c skg.c jump.c undo.c OINCS = ttydef.h sysdef.h chrdef.h INCS = config.h def.h sysconfig.h REINCS = regex_e.h regex_j.h regex_j.c regex_e.h kanji_.h kanji_.c #PROG = mg PROG = ng $(PROG): $(OBJ) $(CC) $(CFLAGS) $(LDFLAGS) -o $(PROG) $(OBJ) $(LIBS) # strip mg once you're satisfied it'll run -- makes it much smaller strip: $(STRIP) $(PROG) install: $(INSTALL) -m 755 -o root -g wheel $(PROG) $(BINDIR) mkdir $(SHAREDIR) $(INSTALL_DATA) -o root -g wheel docs/* $(SHAREDIR) $(INSTALL_DATA) -o root -g wheel bin/* $(SHAREDIR) lint: $(SRCS) $(OSRCS) $(INCS) $(OINCS) lint -ahbz $(CDEFS) $(SRCS) $(OSRCS) sysconfig.h: ./configure $(OBJ): $(INCS) $(OINCS) $(OOBJS): $(INCS) $(OINCS) buffer.o: $(INCS) $(OINCS) kbd.h undo.h cmode.o file.o line.o paragraph.o random.o region.o undo.o word.o: \ $(INCS) $(OINCS) undo.h complt.o: $(INCS) $(OINCS) kbd.h complt.h display.o keymap.o modes.o fileio.o: \ $(INCS) $(OINCS) kbd.h echo.o: $(INCS) $(OINCS) key.h macro.h complt.h extend.o help.o: \ $(INCS) $(OINCS) kbd.h macro.h key.h kanji.o: $(INCS) $(OINCS) kinit.h kbd.o: $(INCS) $(OINCS) kbd.h macro.h key.h undo.h macro.o canna.o: \ $(INCS) $(OINCS) macro.h key.h main.o search.o: \ $(INCS) $(OINCS) macro.h match.o: $(INCS) $(OINCS) key.h re_search.o: $(INCS) $(OINCS) $(REINCS) macro.h regex.o: $(INCS) $(OINCS) $(REINCS) skg.o: $(INCS) $(OINCS) macro.h key.h undo.h sysdef.h: sys/$(SYS)/sysdef.h # Update links, if needed. rm -f sysdef.h ln sys/$(SYS)/sysdef.h . ttydef.h: sys/default/ttydef.h rm -f ttydef.h ln sys/default/ttydef.h . chrdef.h: sys/default/chrdef.h rm -f chrdef.h ln sys/default/chrdef.h . fileio.c: sys/$(SYS)/fileio.c rm -f fileio.c ln sys/$(SYS)/fileio.c . spawn.c: sys/$(SYS)/spawn.c rm -f spawn.c ln sys/$(SYS)/spawn.c . tty.c: sys/default/tty.c rm -f tty.c ln sys/default/tty.c . ttyio.c: sys/$(SYS)/ttyio.c rm -f ttyio.c ln sys/$(SYS)/ttyio.c . ttykbd.c: sys/default/ttykbd.c rm -f ttykbd.c ln sys/default/ttykbd.c . cinfo.c: sys/default/cinfo.c rm -f cinfo.c ln sys/default/cinfo.c . canna.c: sys/$(SYS)/canna.c rm -f canna.c ln sys/$(SYS)/canna.c . alloca.c: sys/default/alloca.c rm -f alloca.c ln sys/default/alloca.c . clean:; rm -f $(OBJ) $(OSRCS) $(OINCS) $(PROG) confclean: clean rm -f config.log config.cache config.status sysconfig.h Makefile ng-1.5beta1/sys/unix/acconfig.h100644 1750 1750 1624 7220433236 15200 0ustar amurausers/* acconfig.h This file is in the public domain. Descriptive text for the C preprocessor macros that the distributed Autoconf macros can define. No software package will use all of them; autoheader copies the ones your configure.in uses into your configuration header file templates. The entries are in sort -df order: alphabetical, case insensitive, ignoring punctuation (such as underscores). Although this order can split up related entries, it makes it easier to check whether a given entry is in the file. Leave the following blank line there!! Autoheader needs it. */ /* Define to `int' if doesn't define. */ #undef fd_set /* Define if you use CANNA */ #undef CANNA /* Define some commands path for dired */ #undef LS_CMD #undef MV_CMD #undef CP_CMD #undef RMDIR_CMD /* Undefing force SIGTSTP because this OS don't have suspend... */ #undef UNDEF_SIGTSTP ng-1.5beta1/sys/unix/canna.c100644 1750 1750 7002 7626153752 14512 0ustar amurausers/* $Id: canna.c,v 1.1.2.1 2003/02/23 14:17:14 amura Exp $ */ /* * Canna Kana-Kanji Henkan server support routine. * original code written by ENDO Yasuhiro */ /* * $Log: canna.c,v $ * Revision 1.1.2.1 2003/02/23 14:17:14 amura * move canna.c from sys/default to sys/unix * * Revision 1.2 2000/07/16 15:43:00 amura * undo support * * Revision 1.1.1.1 2000/06/27 01:48:02 amura * import to CVS * */ #include "config.h" #ifdef CANNA #include "def.h" #include "key.h" #ifndef NO_MACRO #include "macro.h" #endif #ifdef UNDO #include "undo.h" #endif #include #define CANBUF 1024 jrKanjiStatus ks; jrKanjiStatusWithValue ksv; char currentMode[CANBUF]; char origMode[CANBUF]; static char kakutei[CANBUF]; static int oldlength = 0; static int oldrevPos = 0; int canna_toggle() { WINDOW *wp; curbp->b_flag ^= BFCANNA; wp = wheadp; /* Update mode lines. */ while (wp != NULL) { if (wp->w_bufp == curbp) wp->w_flag |= WFMODE; wp = wp->w_wndp; } return TRUE; } int henkan( c ) int c; { int ilen; int i; #ifdef READONLY if (curbp->b_flag & BFRONLY) { warnreadonly(); return TRUE; } #endif ilen = jrKanjiString(0, c, kakutei, CANBUF, &ks); if (ilen < 0) { ewprintf("%s",jrKanjiError); return FALSE; } if(ks.info & KanjiModeInfo){ WINDOW *wp; jrKanjiControl(0,KC_QUERYMODE, currentMode); wp = wheadp; /* Update mode lines. */ while (wp != NULL) { if (wp->w_bufp == curbp) wp->w_flag |= WFMODE; wp = wp->w_wndp; } } if ( ilen > 0) { curwp->w_doto = curwp->w_doto - oldrevPos; ldelete((RSIZE) oldlength, 0); for (i=0 ; kakutei[i] ; i++) { #ifndef NO_MACRO if(macrodef && macrocount < MAXMACRO) macrocount++; #endif key.k_chars[0] = kakutei[i]; key.k_count = 1; #ifdef UNDO ublock_open(curbp); #endif selfinsert(FFRAND,1); #ifdef UNDO ublock_close(curbp); #endif lastflag = thisflag; } oldlength = 0 ; oldrevPos = 0; } if ( ks.length > 0) { curwp->w_doto = curwp->w_doto - oldrevPos; ldelete((RSIZE) oldlength, 0); linsert( 1, '|'); for (i=0 ; *(ks.echoStr + i) ; i++) { linsert(1,*(ks.echoStr + i)); } linsert( 1, '|'); oldlength = ks.length + 2 ; oldrevPos = ks.revPos + 1; curwp->w_doto = curwp->w_doto - oldlength + oldrevPos; } else if ( ks.length == 0 && ilen == 0) { curwp->w_doto = curwp->w_doto - oldrevPos; ldelete((RSIZE) oldlength, 0); oldlength = 0; oldrevPos = 0; } if ( ks.info & KanjiGLineInfo ) { if ( ks.gline.length ) { char kouhobuf[CANBUF]; char *kb=kouhobuf, *gl=ks.gline.line; for(i=0; i= 2) jrKanjiControl(0, KC_SETWIDTH, (char *) ncol-2); else jrKanjiControl(0, KC_SETWIDTH, (char *) 0); } VOID canna_init() { ksv.ks=&ks; ksv.buffer = kakutei; ksv.bytes_buffer = CANBUF; ksv.val = CANNA_MODE_HenkanMode; jrKanjiControl(0,KC_INITIALIZE, NULL); jrKanjiControl(0,KC_SETAPPNAME, "ng"); jrKanjiControl(0,KC_SETBUNSETSUKUGIRI, (char *)&ksv); jrKanjiControl(0,KC_CHANGEMODE, (char *)&ksv); jrKanjiControl(0,KC_QUERYMODE, currentMode); strcpy(origMode, currentMode); canna_width(); } VOID canna_end() { jrKanjiControl(0, KC_KILL, (char *) &ksv); jrKanjiControl(0, KC_FINALIZE, 0); } #endif /* CANNA */ ng-1.5beta1/sys/unix/config.guess100644 1750 1750 113045 7626150564 15646 0ustar amurausers#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002 Free Software Foundation, Inc. timestamp='2002-03-04' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi dummy=dummy-$$ trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int dummy(){}" > $dummy.c ; for c in cc gcc c89 ; do ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; if test $? = 0 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; rm -f $dummy.c $dummy.o $dummy.rel ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit 0 ;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; arc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; macppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme88k:OpenBSD:*:*) echo m88k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvmeppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; pmax:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sgi:OpenBSD:*:*) echo mipseb-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sun3:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; wgrisc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} exit 0 ;; alpha:OSF1:*:*) if test $UNAME_RELEASE = "V4.0"; then UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` fi # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. cat <$dummy.s .data \$Lformat: .byte 37,100,45,37,120,10,0 # "%d-%x\n" .text .globl main .align 4 .ent main main: .frame \$30,16,\$26,0 ldgp \$29,0(\$27) .prologue 1 .long 0x47e03d80 # implver \$0 lda \$2,-1 .long 0x47e20c21 # amask \$2,\$1 lda \$16,\$Lformat mov \$0,\$17 not \$1,\$18 jsr \$26,printf ldgp \$29,0(\$26) mov 0,\$16 jsr \$26,exit .end main EOF eval $set_cc_for_build $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null if test "$?" = 0 ; then case `./$dummy` in 0-0) UNAME_MACHINE="alpha" ;; 1-0) UNAME_MACHINE="alphaev5" ;; 1-1) UNAME_MACHINE="alphaev56" ;; 1-101) UNAME_MACHINE="alphapca56" ;; 2-303) UNAME_MACHINE="alphaev6" ;; 2-307) UNAME_MACHINE="alphaev67" ;; 2-1307) UNAME_MACHINE="alphaev68" ;; esac fi rm -f $dummy.s $dummy echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit 0 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit 0 ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit 0;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit 0 ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit 0 ;; *:OS/390:*:*) echo i370-ibm-openedition exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit 0 ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit 0 ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit 0 ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit 0 ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit 0 ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit 0 ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit 0 ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit 0 ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit 0 ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD $dummy.c -o $dummy \ && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit 0 ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit 0 ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit 0 ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit 0 ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit 0 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit 0 ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit 0 ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit 0 ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit 0 ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit 0 ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit 0 ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit 0 ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:*:*) echo rs6000-ibm-aix exit 0 ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit 0 ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit 0 ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit 0 ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit 0 ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit 0 ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit 0 ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`./$dummy` if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi rm -f $dummy.c $dummy fi ;; esac echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit 0 ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit 0 ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit 0 ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit 0 ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit 0 ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit 0 ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit 0 ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit 0 ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3D:*:*:*) echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit 0 ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit 0 ;; x86:Interix*:3*) echo i386-pc-interix3 exit 0 ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i386-pc-interix exit 0 ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit 0 ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit 0 ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; *:GNU:*:*) echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux exit 0 ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` rm -f $dummy.c test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0 ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit 0 ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit 0 ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #ifdef __INTEL_COMPILER LIBC=gnu #else LIBC=gnuaout #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` rm -f $dummy.c test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit 0 ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit 0 ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit 0 ;; i*86:*:5:[78]*) case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit 0 ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit 0 ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit 0 ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit 0 ;; paragon:*:*:*) echo i860-intel-osf1 exit 0 ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit 0 ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4.3${OS_REL} && exit 0 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4 && exit 0 ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit 0 ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit 0 ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit 0 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit 0 ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit 0 ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit 0 ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit 0 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit 0 ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit 0 ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit 0 ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit 0 ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit 0 ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit 0 ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Darwin:*:*) echo `uname -p`-apple-darwin${UNAME_RELEASE} exit 0 ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) if test "${UNAME_MACHINE}" = "x86pc"; then UNAME_MACHINE=pc echo i386-${UNAME_MACHINE}-nto-qnx else echo `uname -p`-${UNAME_MACHINE}-nto-qnx fi exit 0 ;; *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; NSR-[GKLNPTVW]:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit 0 ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit 0 ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit 0 ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit 0 ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit 0 ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit 0 ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit 0 ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit 0 ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit 0 ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit 0 ;; *:ITS:*:*) echo pdp10-unknown-its exit 0 ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit 0 ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit 0 ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; c34*) echo c34-convex-bsd exit 0 ;; c38*) echo c38-convex-bsd exit 0 ;; c4*) echo c4-convex-bsd exit 0 ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: ng-1.5beta1/sys/unix/config.sub100644 1750 1750 70543 7626150564 15276 0ustar amurausers#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002 Free Software Foundation, Inc. timestamp='2002-03-07' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit 0;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ | c4x | clipper \ | d10v | d30v | dsp16xx \ | fr30 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | m32r | m68000 | m68k | m88k | mcore \ | mips | mips16 | mips64 | mips64el | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el | mips64vr4300 \ | mips64vr4300el | mips64vr5000 | mips64vr5000el \ | mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \ | mipsisa32 | mipsisa64 \ | mn10200 | mn10300 \ | ns16k | ns32k \ | openrisc | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | sh | sh[34] | sh[34]eb | shbe | shle | sh64 \ | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ | strongarm \ | tahoe | thumb | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xscale | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armv*-* \ | avr-* \ | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c54x-* \ | clipper-* | cydra-* \ | d10v-* | d30v-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | m32r-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | mcore-* \ | mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \ | mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \ | mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* | sh64-* \ | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ | xtensa-* \ | ymp-* \ | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; c90) basic_machine=c90-cray os=-unicos ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; crds | unos) basic_machine=m68k-crds ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; mmix*) basic_machine=mmix-knuth os=-mmixware ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; or32 | or32-*) basic_machine=or32-unknown os=-coff ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon) basic_machine=i686-pc ;; pentiumii | pentium2) basic_machine=i686-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3d) basic_machine=alpha-cray os=-unicos ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; windows32) basic_machine=i386-pc os=-windows32-msvcrt ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh3 | sh4 | sh3eb | sh4eb) basic_machine=sh-unknown ;; sh64) basic_machine=sh64-unknown ;; sparc | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; c4x*) basic_machine=c4x-none os=-coff ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto*) os=-nto-qnx ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-ibm) os=-aix ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -ptx*) vendor=sequent ;; -vxsim* | -vxworks*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: ng-1.5beta1/sys/unix/configure.in100644 1750 1750 7766 7626150635 15615 0ustar amurausersdnl Process this file with autoconf to produce a configure script. dnl $Id: configure.in,v 1.7.2.1 2003/02/23 13:50:21 amura Exp $ AC_REVISION($Revision: 1.7.2.1 $) AC_INIT(basic.c) AC_CONFIG_HEADER(sysconfig.h:sys/unix/sysconfig.h.in) AC_CONFIG_AUX_DIR(sys/unix) dnl Checks for programs. AC_CANONICAL_HOST USER_CFLAGS=$CFLAGS AC_PROG_CC AC_PROG_INSTALL dnl Don't strip if we don't have it AC_CHECK_PROG(STRIP, strip, strip, :) dnl Set default value for CFLAGS if none is defined or it's empty if test -z "$USER_CFLAGS"; then CFLAGS="-O" test "$GCC" = yes && CFLAGS="-O2" else CFLAGS=$USER_CFLAGS fi AC_MINIX dnl Checks for libraries. dnl Search tgetstr() in termcap, termlib, curses AC_ARG_WITH(terminfo, [ --with-terminfo Build with terminfo library.], [ts_with_terminfo="yes"], [ts_with_terminfo="no"]) AC_ARG_WITH(termcap, [ --with-termcap Build with termcap library. (default)], [ts_with_terminfo="no"]) if test "$ts_with_terminfo" = "yes"; then AC_SEARCH_LIBS(tgetstr, curses ncurses termlib) else AC_SEARCH_LIBS(tgetstr, termcap curses ncurses) fi dnl Checks for header files. AC_HEADER_DIRENT AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(fcntl.h sys/file.h sys/ioctl.h sys/time.h termio.h termios.h sgtty.h unistd.h sys/param.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_PID_T AC_TYPE_SIZE_T AC_HEADER_TIME dnl CYGWIN has fd_set, but cannot detect it by AC_CHECK_TYPE if test "$host_os" != "cygwin"; then AC_CHECK_TYPE(fd_set, int) fi dnl Minix define SIGTSTP but don't have suspend yet... dnl I want to use $host_os, but cannot use it because Minix's sed has bug... case "$host" in *-*-minix*) AC_DEFINE(UNDEF_SIGTSTP, 1);; esac dnl Checks for library functions. AC_FUNC_ALLOCA AC_PROG_GCC_TRADITIONAL AC_FUNC_MEMCMP AC_TYPE_SIGNAL AC_FUNC_VFORK AC_CHECK_FUNCS(getcwd rmdir rename opendir select mkstemp bcopy bzero bcmp) AC_CHECK_FUNCS(rindex symlink dup2 sigprocmask getgroups) dnl Checks for commands called from dired AC_PATH_PROG(cp_cmd, cp) AC_DEFINE_UNQUOTED(CP_CMD, "$cp_cmd") AC_PATH_PROG(mv_cmd, mv) AC_DEFINE_UNQUOTED(MV_CMD, "$mv_cmd") AC_PATH_PROG(ls_cmd, ls) AC_DEFINE_UNQUOTED(LS_CMD, "$ls_cmd") AC_PATH_PROG(rmdir_cmd, rmdir) AC_DEFINE_UNQUOTED(RMDIR_CMD, "$rmdir_cmd") dnl If the user wants canna support. AC_MSG_CHECKING(if --enable-canna option specified) AC_ARG_ENABLE(canna, [ --enable-canna[=DIR] Build a canna version.], [cv_canna="yes"; cannapath=$enableval], [cv_canna="no"]) AC_MSG_RESULT($cv_canna) if test "$cv_canna" = "yes"; then dnl Some operating system include canna libraries by default. dnl Use that pathname by default. dnl for freebsd2.*, order DOES matter. don't bother. if test "$cannapath" = "yes"; then case "$host_os" in bsdi2.1) cannapath="/usr/contrib/canna";; netbsd*) cannapath="/usr/pkg";; freebsd2.2*) cannapath="/usr/local";; freebsd2*) cannapath="/usr/local/canna";; freebsd*) cannapath="/usr/local";; *) cannapath="/usr/local/canna";; esac fi if test "$cannapath" != "yes"; then CFLAGS="-I$cannapath/include $CFLAGS" LDFLAGS="-L$cannapath/lib $LDFLAGS" fi dnl we use AC_TRY_COMPILE not AC_CHECK_HEADER, to avoid unnecessery dnl use of CPPFLAGS. (why?) AC_MSG_CHECKING(for canna/jrkanji.h) AC_CACHE_VAL(ac_cv_cannahdrcheck, [dnl AC_TRY_COMPILE([#include ], jrKanjiStatus ks;, [ac_cv_cannahdrcheck="yes"], [ac_cv_cannahdrcheck="no"])]) AC_MSG_RESULT($ac_cv_cannahdrcheck) if test "$cannahdrcheck" = "no"; then echo -n "Fatal error: no canna header in suggested path" if test "$cannapath" != "yes"; then echo ", $cannapath/include." else echo "." fi exit 1 fi AC_CHECK_LIB(canna, jrKanjiControl, [cv_cannalibcheck="yes"], [cv_cannalibcheck="no"]) if test "$cannalibcheck" = "no"; then echo "Fatal error: no canna library in suggested path" if test "$cannapath" != "yes"; then echo ", $cannapath/lib." else echo "." fi exit 1 fi LIBS="-lcanna $LIBS" AC_DEFINE(CANNA) fi AC_OUTPUT(Makefile:sys/unix/Makefile.in) ng-1.5beta1/sys/unix/fileio.c100644 1750 1750 50003 7247657140 14717 0ustar amurausers/* $Id: fileio.c,v 1.12 2001/03/02 08:48:32 amura Exp $ */ /* * unix file I/O. (for configure) * * Create from BSD UNIX version by amura, 2000 */ /* * $Log: fileio.c,v $ * Revision 1.12 2001/03/02 08:48:32 amura * now AUTOSAVE feature implemented almost all (except for WIN32 * * Revision 1.11 2001/02/18 19:29:04 amura * split dir.c to port depend/independ * * Revision 1.10 2001/02/18 17:07:40 amura * append AUTOSAVE feature (but NOW not work) * * Revision 1.9 2001/02/11 15:39:01 amura * change getuid() geteuid() * * Revision 1.8 2001/01/05 13:55:28 amura * filename completion fixed * * Revision 1.7 2000/12/28 07:25:40 amura * fix filename complition * * Revision 1.6 2000/12/27 16:55:43 amura * change d_makename() params for conservative reason, and bugfix in dires_() * * Revision 1.5 2000/12/22 20:02:14 amura * readonly check is more correctly * * Revision 1.4 2000/12/21 16:56:25 amura * filename length become flexible * * Revision 1.3 2000/12/14 18:16:50 amura * filename length become flexible and * expand HOME directory in completion * * Revision 1.2 2000/12/01 09:51:23 amura * fix problems open "/" and sybolic link directory, remove typos * * Revision 1.1 2000/11/19 18:35:00 amura * support GNU configure system * */ #include "config.h" #include "def.h" static FILE *ffp; #ifdef STDC_HEADERS #include #else extern char *getenv(), *strncpy(); #endif char *adjustname(); /* * Open a file for reading. */ ffropen(fn) char *fn; { if ((ffp=fopen(fn, "r")) == NULL) return (FIOFNF); return (FIOSUC); } /* * Open a file for writing. * Return TRUE if all is well, and * FALSE on error (cannot create). */ ffwopen(fn) char *fn; { if ((ffp=fopen(fn, "w")) == NULL) { ewprintf("Cannot open file for writing"); return (FIOERR); } return (FIOSUC); } /* * Close a file. * Should look at the status. */ ffclose() { (VOID) fclose(ffp); return (FIOSUC); } /* * Write a buffer to the already * opened file. bp points to the * buffer. Return the status. * Check only at the newline and * end of buffer. */ ffputbuf(bp) BUFFER *bp; { register char *cp; register char *cpend; register LINE *lp; register LINE *lpend; #ifdef KANJI /* 90.01.29 by S.Yoshida */ register int kfio; #endif /* KANJI */ lpend = bp->b_linep; #ifdef KANJI /* 90.01.29 by S.Yoshida */ if (bp->b_kfio == NIL) ksetbufcode(bp); /* Set buffer local KANJI code. */ kfio = bp->b_kfio; #endif /* KANJI */ lp = lforw(lpend); do { cp = <ext(lp)[0]; /* begining of line */ cpend = &cp[llength(lp)]; /* end of line */ while(cp != cpend) { #ifdef KANJI /* 90.01.29 by S.Yoshida */ kputc(*cp, ffp, kfio); #else /* NOT KANJI */ putc(*cp, ffp); #endif /* KANJI */ cp++; /* putc may evalualte arguments more than once */ } #ifdef KANJI /* 90.01.29 by S.Yoshida */ if (kfio == JIS) { kfselectcode(ffp, FALSE); } #endif /* KANJI */ lp = lforw(lp); if(lp == lpend) break; /* no implied newline on last line */ putc('\n', ffp); } while(!ferror(ffp)); if(ferror(ffp)) { ewprintf("Write I/O error"); return FIOERR; } return FIOSUC; } /* * Read a line from a file, and store the bytes * in the supplied buffer. Stop on end of file or end of * line. When FIOEOF is returned, there is a valid line * of data without the normally implied \n. */ ffgetline(buf, nbuf, nbytes) register char *buf; register int nbuf; register int *nbytes; { register int c; register int i; i = 0; while((c = getc(ffp))!=EOF && c!='\n') { buf[i++] = c; if (i >= nbuf) return FIOLONG; } if (c == EOF && ferror(ffp) != FALSE) { ewprintf("File read error"); return FIOERR; } *nbytes = i; return c==EOF ? FIOEOF : FIOSUC; } #ifndef NO_BACKUP /* * Rename the file "fname" into a backup * copy. On Unix the backup has the same name as the * original file, with a "~" on the end; this seems to * be newest of the new-speak. The error handling is * all in "file.c". The "unlink" is perhaps not the * right thing here; I don't care that much as * I don't enable backups myself. */ fbackupfile(fn) char *fn; { register char *nname; if ((nname=alloca((unsigned)(strlen(fn)+1+1))) == NULL) { ewprintf("Can't get %d bytes", strlen(fn) + 1); return (ABORT); } (void) strcpy(nname, fn); (void) strcat(nname, "~"); (void) unlink(nname); /* Ignore errors. */ if (rename(fn, nname) < 0) return (FALSE); return (TRUE); } #ifdef BUGFIX /* 90.02.14 by S.Yoshida */ #ifndef _SYS_STAT_H_ #include #define _SYS_STAT_H_ #endif /* _SYS_STAT_H_ */ /* * Get file mode of a file fn. */ fgetfilemode(fn) char *fn; { struct stat filestat; stat(fn, &filestat); return(filestat.st_mode & 0x0fff); } /* * Set file mode of a file fn to the specified mode. */ fsetfilemode(fn, mode) char *fn; int mode; { chmod(fn, mode); } #endif /* BUGFIX */ #endif #ifdef READONLY /* 91.01.05 by S.Yoshida */ #ifndef _SYS_STAT_H_ #include #define _SYS_STAT_H_ #endif /* _SYS_STAT_H_ */ #ifndef S_IWUSR #define S_IWUSR S_IWRITE #endif /* * Check whether file is read-only of a file fn. */ fchkreadonly(fn) char *fn; { struct stat filestat; if (stat(fn, &filestat) == 0) { if (filestat.st_mode&S_IWOTH) return FALSE; if (filestat.st_mode&S_IWGRP && filestat.st_gid==getegid()) return FALSE; #ifdef HAVE_GETGROUPS if (filestat.st_mode & S_IWGRP) { gid_t *gids; int i, num; num = getgroups(0, NULL); if (num!=0 && (gids=alloca(sizeof(gid_t)*num))!=NULL) { num = getgroups(num, gids); for (i=0; i #define _SYS_STAT_H_ #endif /* _SYS_STAT_H_ */ #ifndef MAXSYMLINKS # ifdef MAXLINK #define MAXSYMLINKS MAXLINK /* maximum symbolic links to follow */ # else #define MAXSYMLINKS 8 /* maximum symbolic links to follow */ # endif /* MAXLINK */ #endif /* MAXSYMLINKS */ #endif /* HAVE_SYMLINK */ #include char *adjustname(fn) register char *fn; { register char *cp; static char fnb[NFILEN]; struct passwd *pwent; #ifdef HAVE_SYMLINK struct stat statbuf; int i, j; char linkbuf[NFILEN]; #endif switch(*fn) { case '/': cp = fnb; *cp++ = *fn++; break; case '~': fn++; if(*fn == '/' || *fn == '\0') { (VOID) strcpy(fnb, getenv("HOME")); cp = fnb + strlen(fnb); if(*fn) fn++; break; } else { cp = fnb; while(*fn && *fn != '/') *cp++ = *fn++; *cp = '\0'; if((pwent = getpwnam(fnb)) != NULL) { (VOID) strcpy(fnb, pwent->pw_dir); cp = fnb + strlen(fnb); break; } else { fn -= strlen(fnb) + 1; /* can't find ~user, continue to default case */ } } default: #ifndef NO_DIR strcpy(fnb, wdir); cp = fnb + strlen(fnb); break; #else return fn; /* punt */ #endif } if(cp != fnb && cp[-1] != '/') *cp++ = '/'; while(*fn) { switch(*fn) { case '.': switch(fn[1]) { case '\0': *--cp = '\0'; return fnb; case '/': fn += 2; continue; case '.': if(fn[2]=='/' || fn[2] == '\0') { #ifdef HAVE_SYMLINK cp[-1] = '\0'; for(j = MAXSYMLINKS; j-- && lstat(fnb, &statbuf) != -1 && (statbuf.st_mode&S_IFMT) == S_IFLNK && (i = readlink(fnb, linkbuf, sizeof linkbuf)) != -1 ;) { if(linkbuf[0] != '/') { --cp; while(cp > fnb && *--cp != '/') {} ++cp; (VOID) strncpy(cp, linkbuf, i); cp += i; } else { (VOID) strncpy(fnb, linkbuf, i); cp = fnb + i; } if(cp[-1]!='/') *cp++ = '\0'; else cp[-1] = '\0'; } cp[-1] = '/'; #endif /* HAVE_SYMLINK */ --cp; while(cp > fnb && *--cp != '/') {} ++cp; if(fn[2]=='\0') { *--cp = '\0'; return fnb; } fn += 3; continue; } break; default: break; } break; case '/': fn++; continue; default: break; } while(*fn && (*cp++ = *fn++) != '/') {} } if((cp-1)!=fnb && cp[-1]=='/') --cp; *cp = '\0'; return fnb; } #ifndef NO_STARTUP #ifdef HAVE_SYS_FILE_H #include #endif #ifndef F_OK #define F_OK 04 /* for stupid Sys V */ #endif /* * Find a startup file for the user and return its name. As a service * to other pieces of code that may want to find a startup file (like * the terminal driver in particular), accepts a suffix to be appended * to the startup file name. */ char * #ifdef ADDOPT startupfile(ngrcfile, suffix) char* ngrcfile; #else startupfile(suffix) #endif char *suffix; { register char *file; static char home[NFILEN]; char *getenv(); #ifdef ADDOPT if (ngrcfile == NULL) ngrcfile = getenv("NGRC"); if (ngrcfile != NULL) if (access(ngrcfile, F_OK) == 0) return ngrcfile; #endif if ((file = getenv("HOME")) == NULL) goto notfound; if (strlen(file)+7 >= NFILEN - 1) goto notfound; (VOID) strcpy(home, file); #ifdef KANJI /* 90.02.10 by S.Yoshida */ (VOID) strcat(home, "/.ng"); #else /* NOT KANJI */ (VOID) strcat(home, "/.mg"); #endif /* KANJI */ if (suffix != NULL) { (VOID) strcat(home, "-"); (VOID) strcat(home, suffix); } if (access(home, F_OK ) == 0) return home; notfound: #ifdef STARTUPFILE file = STARTUPFILE; if (suffix != NULL) { (VOID) strcpy(home, file); (VOID) strcat(home, "-"); (VOID) strcat(home, suffix); file = home; } if (access(file, F_OK ) == 0) return file; #endif return NULL; } #endif #ifndef NO_DIRED #ifdef HAVE_SYS_WAIT_H #include #endif #ifdef HAVE_VFORK_H #include #endif #include "kbd.h" #ifndef CP_CMD #define CP_CMD "/bin/cp" #endif copy(frname, toname) char *frname, *toname; { int pid; char *eargv[3]; int status; /* change for Digital UNIX */ #ifdef BUGFIX /* 91.01.11 by Y.Kaneko */ if((pid = vfork()) == 0) { execl(CP_CMD, "cp", frname, toname, (char *)NULL); #else /* ORIGINAL */ if(pid = vfork()) { if(pid == -1) return -1; eargv[0] = frname; eargv[1] = toname; eargv[2] = NULL; execve("cp", eargv, (char **)NULL); #endif /* BUGFIX */ _exit(1); /* shouldn't happen */ } #ifdef BUGFIX /* 91.01.11 by Y.Kaneko */ if(pid == -1) return -1; #endif /* BUGFIX */ while(wait((int*)&status) != pid) {} return status == 0; } #ifndef LS_CMD #define LS_CMD "/bin/ls" #endif BUFFER *dired_(dirname) char *dirname; { register BUFFER *bp; char line[CMDLINELENGTH]; BUFFER *findbuffer(); FILE *dirpipe; FILE *popen(); if((dirname = adjustname(dirname)) == NULL) { ewprintf("Bad directory name"); return NULL; } if(dirname[strlen(dirname)-1] != '/') (VOID) strcat(dirname, "/"); if((bp = findbuffer(dirname)) == NULL) { ewprintf("Could not create buffer"); return NULL; } if(bclear(bp) != TRUE) return FALSE; #ifdef EXTD_DIR if(bp->b_cwd != NULL) free(bp->b_cwd); if((bp->b_cwd=malloc(strlen(dirname)+1)) == NULL) { ewprintf("Could not create buffer"); return NULL; } strcpy(bp->b_cwd, dirname); ensurecwd(); #endif #ifdef BUGFIX /* 91.02.04 by M.Oki / 2000.12.xx amura */ (VOID) strncpy(line, LS_CMD " -al '", sizeof(line)); line[sizeof(line)-1] = '\0'; (VOID) strncat(line, dirname, sizeof(line)-strlen(line)-1); (VOID) strncat(line, "' 2>&1", sizeof(line)-strlen(line)-1); #else /* ORIGINAL */ (VOID) strcpy(line, "ls -al "); (VOID) strcpy(&line[7], dirname); #endif /* BUGFIX */ if((dirpipe = popen(line, "r")) == NULL) { ewprintf("Problem opening pipe to ls"); return NULL; } line[0] = line[1] = ' '; while(fgets(&line[2], 254, dirpipe) != NULL) { line[strlen(line) - 1] = '\0'; /* remove ^J */ (VOID) addline(bp, line); } if(pclose(dirpipe) == -1) { ewprintf("Problem closing pipe to ls"); return NULL; } bp->b_dotp = lforw(bp->b_linep); /* go to first line */ if(bp->b_fname != NULL) free(bp->b_fname); if((bp->b_fname=malloc(strlen(dirname)+1)) != NULL) (VOID)strcpy(bp->b_fname, dirname); if((bp->b_modes[0] = name_mode("dired")) == NULL) { bp->b_modes[0] = &map_table[0]; ewprintf("Could not find mode dired"); return NULL; } bp->b_nmodes = 0; return bp; } d_makename(lp, fn, buflen) register LINE *lp; register char *fn; { char* cp; int l,l1,len; char c; /* '30' is a magic number and is not correct always */ if ( llength( lp ) <= 30 ) { return ABORT ; } l = llength(lp); if (lgetc(lp, 2) == 'l') { do { while (l > 2 && lgetc(lp, l) != ' ') l--; if (bcmp(lp->l_text + l - 3, " -> ", 4) == 0) break; l--; } while (l > 2); } else { do { while (l > 2 && lgetc(lp, l)!=' ') l--; l1 = l; while (l > 2 && lgetc(lp, l)==' ') l--; while (l > 2 && (c=lgetc(lp, l))!=' ') { if (c!=':' && (c<'0'||c>'9')) { break; } l--; } } while (l > 2 && c != ' '); l = l1; } if (l <= 2) return ABORT; l++; len = llength(lp) - l + 1; if (buflen <= len+strlen(curbp->b_fname)) return ABORT; cp = fn; strcpy(cp, curbp->b_fname); cp += strlen(cp); bcopy(lp->l_text + l, cp, len); cp[len-1] = '\0'; #ifdef HAVE_SYMLINK if (lgetc(lp, 2) == 'l') return ffisdir(curbp->b_fname); #endif return lgetc(lp, 2) == 'd'; } /* * I, a System V novice, could only figure out how to do unlinkdir() * and rename() as exec's of the appropriate functions. So sue me. * --Stephen Walton, December 1987 * * Now, SystemV has rmdir (from Release3) and rename (from Release 4). * I rewrite Ng use them. * --amura, 03 Apr 2000 */ #ifndef HAVE_RMDIR #ifndef RMDIR_CMD #define RMDIR_CMD "/bin/rmdir" #endif unlinkdir(f) /* System V Release 2 don't have rmdir(2)? */ char *f; { int status, pid, wpid; if ((pid = vfork()) == 0) execl(RMDIR_CMD, "rmdir", f, (char *)NULL); else if (pid > 0) while ((wpid = wait(&status)) && wpid != pid) ; else return FALSE; return status == 0; } #endif /* !HAVE_RMDIR */ #ifndef HAVE_RENAME #ifndef MV_CMD #define MV_CMD "/bin/mv" #endif rename(f1, f2) /* System V Release 2/3 don't have rename(2)? */ char *f1, *f2; { int status, pid, wpid; if ((pid = vfork()) == 0) execl(MV_CMD, "mv", f1, f2, (char *)NULL); else if (pid > 0) while ((wpid = wait(&status)) && wpid != pid) ; else return FALSE; return status == 0; } #endif /* !HAVE_RENAME */ #endif /* NO_DIRED */ #ifndef NO_DIRED /* 91.01.15 by K.Maeda */ #ifndef _SYS_STAT_H_ #include #define _SYS_STAT_H_ #endif /* _SYS_STAT_H_ */ /* * Check whether file "dn" is directory. */ ffisdir(dn) char *dn; { struct stat filestat; if (stat(dn, &filestat) == 0) { return ((filestat.st_mode & S_IFMT) == S_IFDIR); } else { return FALSE; } } #endif /* NO_DIRED */ #ifndef NO_FILECOMP /* 90.04.04 by K.Maeda */ #ifdef HAVE_DIRENT_H #include #endif #ifdef HAVE_SYS_DIR_H #include #endif #ifdef HAVE_FCNTL_H #include #endif /* 89.11.20 Original code is for X68K (Human68K). * 90.04.04 Modified for BSD UNIX by S.Yoshida * Find file names starting with name. * Result is stored in *buf, got from malloc(); * Return the number of files found, or * -1 of error occured. */ #define MALLOC_STEP 256 fffiles(name, buf) char *name, **buf; { char pathbuf[NFILEN], tmpnam[NFILEN]; char *cp, *dirpart, *nampart; #ifdef HAVE_OPENDIR DIR *dp; #ifdef HAVE_DIRENT_H register struct dirent *dirent; #else register struct direct *dirent; #endif #else /* not HAVE_OPENDIR */ int dp; struct direct dirbuf; register struct direct *dirent = &dirbuf; #endif int n, len, size, dirpartlen, nampartlen; char *buffer; struct stat st; char *home; int homelen; if(name[0] == '~' && name[1] == '/' && (home = getenv("HOME"))) { homelen = strlen(home) - 1; strncpy(pathbuf, home, sizeof(pathbuf)); pathbuf[NFILEN-1] = '\0'; strncat(pathbuf, &name[1], sizeof(pathbuf)-strlen(pathbuf)-1); cp = pathbuf + homelen; } else { home = NULL; homelen = 0; strncpy(pathbuf, name, sizeof(pathbuf)); pathbuf[NFILEN-1] = '\0'; cp = pathbuf; } dirpart = NULL; for (; *cp; cp++) { if (*cp == '/') dirpart = cp; } if (dirpart) { *++dirpart = '\0'; dirpartlen = dirpart - pathbuf; } else { strcpy(pathbuf, "./"); dirpartlen = 0; } nampart = name + dirpartlen - homelen; nampartlen = strlen(nampart); #ifndef NEW_COMPLETE /* 90.12.10 Sawayanagi Yosirou */ #ifdef HAVE_OPENDIR if ((dp = opendir(pathbuf)) == NULL) #else if ((dp = open(pathbuf,O_RDONLY)) < 0) #endif return -1; #endif /* NOT NEW_COMPLETE */ buffer = malloc(MALLOC_STEP); if (buffer == NULL) return -1; size = MALLOC_STEP; len = 0; n = 0; #ifdef NEW_COMPLETE /* 90.12.10 Sawayanagi Yosirou */ #ifdef HAVE_OPENDIR if ((dp = opendir(pathbuf)) == NULL) { #else if ((dp = open(pathbuf,O_RDONLY)) < 0) { #endif *buf = buffer; buffer[0] = '\0'; return 0; } #endif /* NEW_COMPLETE */ #ifdef HAVE_OPENDIR while ((dirent = readdir(dp)) != NULL) { #else while (read(dp,dirent,sizeof(struct direct)) == sizeof(struct direct)) { #endif register int l; #ifndef HAVE_OPENDIR if (dirent->d_ino == 0) continue; #endif if (strncmp(nampart, dirent->d_name, nampartlen) != 0) goto nomatch; /* case-sensitive comparison */ strncpy(tmpnam, pathbuf, dirpartlen); strcpy(tmpnam+dirpartlen, dirent->d_name); if (stat(tmpnam, &st) < -1) goto nomatch; if ((st.st_mode & S_IFMT)==S_IFDIR) strcat(tmpnam, "/"); l = strlen(tmpnam)+1; if (l > 3 && tmpnam[l-3] == '.' && tmpnam[l-2] == 'o') goto nomatch; if (l+len >= size) { /* make room for double null */ if ((buffer = realloc(buffer, size += MALLOC_STEP)) == NULL) return -1; } if(home) { strcpy(buffer+len, "~"); strcat(buffer+len, tmpnam+homelen+1); l -= homelen; } else strcpy(buffer+len, tmpnam); len += l; n++; nomatch:; } #ifdef HAVE_OPENDIR closedir(dp); #else close(dp); #endif *buf = buffer; buffer[len] = '\0'; return n; } #endif /* !NO_FILECOMP */ #ifdef NEW_COMPLETE /* 90.12.10 Sawayanagi Yosirou */ char * file_name_part (s) char *s; { int i; for (i = strlen (s); i > 0; i--) { if (s[i - 1] == '/') break; } return (s + i); } char * copy_dir_name (d, s) char *d; char *s; { int i; i = file_name_part (s) - s; strncpy (d, s, i); d[i] = '\0'; return (d); } #endif /* NEW_COMPLETE */ #ifdef AUTOSAVE VOID autosave_name(buff, name, buflen) char* buff; char* name; { strcpy(buff, name); if (strlen(name)) { char *fn = rindex(name, '/'); if (fn == NULL){ fn = buff; } else { fn++; } strcpy(&buff[strlen(buff)-strlen(fn)], "#"); strcat(buff, fn); strcat(buff, "#"); } } #endif /* AUTOSAVE */ ng-1.5beta1/sys/unix/install-sh100755 1750 1750 12671 7626150572 15317 0ustar amurausers#!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else : fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: chmodcmd="" else instcmd=$mkdirprog fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then : else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else : fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else : fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else : fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else : fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 ng-1.5beta1/sys/unix/spawn.c100644 1750 1750 15054 7220433236 14574 0ustar amurausers/* $Id: spawn.c,v 1.5 2000/12/21 16:58:06 amura Exp $ */ /* * Spawn. (for configure) * This interracts with the job control stuff * in the 4.X BSD C shell and SysVR4. * By: rtech!daveb, to use stop for ksh. * * Create from BSD UNIX version by amura, 2000 */ /* * $Log: spawn.c,v $ * Revision 1.5 2000/12/21 16:58:06 amura * suspend support can enable most of OS * * Revision 1.4 2000/12/18 17:20:41 amura * edit for cygwin * * Revision 1.3 2000/12/01 10:09:11 amura * fix typos and edit MACROS adapting for POSIX * * Revision 1.2 2000/11/23 14:10:33 amura * small fixes on spawncli() * * Revision 1.1 2000/11/19 18:35:00 amura * support GNU configure system * */ #include "config.h" #include "def.h" #include #include #ifdef HAVE_VFORK_H #include #endif #ifdef HAVE_SYS_WAIT_H #include #endif /* some system don't have job-control even if SIGTSTP is defined... */ #ifdef UNDEF_SIGTSTP # ifdef SIGTSTP # undef SIGTSTP # endif #endif #ifndef HAVE_RINDEX #define rindex(s,c) strrchr(s,c) #endif char *shellp = NULL; /* Saved "SHELL" name. */ char *shname; extern char *getenv(); /* * This code does a one of 2 different * things, depending on what version of the shell * you are using. If you are using the C shell, which * implies that you are using job control, then MicroEMACS * moves the cursor to a nice place and sends itself a * stop signal. If you are using the Bourne shell it runs * a subshell using fork/exec. Bound to "C-C", and used * as a subcommand by "C-Z". * * Daveb -- changed sense of test so that we only spawn if you * are explicitly using /bin/sh. This makes it stop * work with the ksh. */ /*ARGSUSED*/ spawncli(f, n) { register pid_t pid, wpid; #ifdef SIGTSTP #ifdef HAVE_SIGPROCMASK sigset_t omask,newmask; #else register int omask; #endif #endif /* SIGTSTP */ register RETSIGTYPE (*oqsig)(),(*oisig)(); #ifdef ADDFUNC /* 90.02.14 by S.Yoshida */ #ifdef SIGWINCH /* 90.02.14 by S.Yoshida */ register RETSIGTYPE (*owsig)(); #endif /* SIGWINCH */ #endif /* ADDFUNC */ int status; #ifdef XKEYS /* 92.03.16 by Gen KUROKI */ ttykeymaptidy(); #endif /* XKEYS */ if (shellp == NULL) { shellp = getenv("SHELL"); if (shellp == NULL) shellp = getenv("shell"); if (shellp == NULL) shellp = "/bin/sh"; /* Safer. */ shname = rindex( shellp, '/' ); shname = shname ? shname+1 : shellp; } ttcolor(CTEXT); ttnowindow(); if (strcmp(shellp, "/bin/csh") == 0) { if (epresf != FALSE) { ttmove(nrow-1, 0); tteeol(); epresf = FALSE; } /* Csh types a "\n" */ ttmove(nrow-2, 0); /* before "Stopped". */ } else { ttmove(nrow-1, 0); if (epresf != FALSE) { tteeol(); epresf = FALSE; } } if (ttcooked() == FALSE) return (FALSE); #ifdef SIGTSTP if (strcmp(shellp, "/bin/sh")!=0 || getenv("BASH_VERSION") || getenv("BASH")) { /* C shell, ksh or bash */ #ifdef HAVE_SIGPROCMASK sigfillset(&newmask); sigprocmask(SIG_UNBLOCK, &newmask, &omask); (void) kill(0, SIGTSTP); sigprocmask(SIG_SETMASK, &omask, NULL); #else omask = sigsetmask(0); (void) kill(0, SIGTSTP); (void) sigsetmask(omask); #endif #ifdef ADDFUNC /* 90.02.14 by S.Yoshida */ #ifdef SIGWINCH /* 90.02.14 by S.Yoshida */ refresh(FFRAND, 0); /* May be resized. */ #endif /* SIGWINCH */ #endif /* ADDFUNC */ } else { /* Bourne shell. */ #endif /* SIGTSTP */ oqsig = signal(SIGQUIT, SIG_IGN); oisig = signal(SIGINT, SIG_IGN); #ifdef ADDFUNC /* 90.02.14 by S.Yoshida */ #ifdef SIGWINCH /* 90.02.14 by S.Yoshida */ owsig = signal(SIGWINCH, SIG_IGN); #endif /* SIGWINCH */ #endif /* ADDFUNC */ if ((pid=vfork()) < 0) { (void) signal(SIGQUIT, oqsig); (void) signal(SIGINT, oisig); #ifdef ADDFUNC /* 90.02.14 by S.Yoshida */ #ifdef SIGWINCH /* 90.02.14 by S.Yoshida */ (void) signal(SIGWINCH, owsig); #endif /* SIGWINCH */ #endif /* ADDFUNC */ ewprintf("Failed to create process"); return (FALSE); } if (pid == 0) { #ifdef EXTD_DIR dirend(); #endif execl(shellp, shname, "-i", NULL); _exit(0); /* Should do better! */ } while ((wpid=wait((int*)&status))>=0 && wpid!=pid) ; (void) signal(SIGQUIT, oqsig); (void) signal(SIGINT, oisig); #ifdef ADDFUNC /* 90.02.14 by S.Yoshida */ #ifdef SIGWINCH /* 90.02.14 by S.Yoshida */ (void) signal(SIGWINCH, owsig); refresh(FFRAND, 0); /* May be resized. */ #endif /* SIGWINCH */ #endif /* ADDFUNC */ #ifdef SIGTSTP } #endif sgarbf = TRUE; /* Force repaint. */ #ifdef XKEYS /* 92.03.16 by Gen KUROKI */ ttykeypadstart(); #endif /* XKEYS */ return ttraw(); } #ifndef NO_SHELL /* 91.01.10 by K.Maeda */ #include #include #ifndef S_IRUSR /* for old system compat? */ #define S_IRUSR S_IREAD #define S_IWUSR S_IWRITE #endif /* * Call process in subshell. * Execute COMMAND binding standard input to file INPUT. * NULL as INPUT means standard input should be bound to * /dev/null or whatever equivalent in your OS. * All output during the execution (including standard error output) * should go into a scratch file, whose name call_process() returns. * Return value NULL means error in some stage of the execution. * In that case, scratch file should be deleted. */ char * call_process(command, input) char *command; char *input; { char buf[256]; static char tmpbuf[20]; char *tmp; int ostdin, ostdout, ostderr, in, out, s; #ifndef HAVE_MKSTEMP extern char *mktemp(); #endif strcpy(tmpbuf, "/tmp/ngXXXXXX"); if ((in = open(input ? input : "/dev/null", 0)) < 0) return NULL; #ifdef HAVE_MKSTEMP if ((out = mkstemp(tmpbuf)) < 0) { close(in); return NULL; } tmp = tmpbuf; #else if ((tmp = mktemp(tmpbuf)) == NULL) { close(in); return NULL; } if ((out = creat(tmp, S_IRUSR | S_IWUSR)) < 0) { close(in); return NULL; } #endif ostdin = dup(0); ostdout = dup(1); ostderr = dup(2); if (ostdin < 0 || ostdout < 0 || ostderr < 0) { s = -1; goto skip; } #ifdef HAVE_DUP2 dup2(in, 0); dup2(out, 1); dup2(out, 2); #else close(0); dup(in); close(1); dup(out); close(2); dup(out); #endif strcpy(buf, command); #ifdef EXTD_DIR ensurecwd(); #endif s = system(buf); close(in); close(out); #ifdef HAVE_DUP2 dup2(ostdin, 0); dup2(ostdout, 1); dup2(ostderr, 2); #else close(0); dup(ostdin); close(1); dup(ostdout); close(2); dup(ostderr); #endif skip: close(ostdin); close(ostdout); close(ostderr); if (s == -1) { unlink(tmp); return NULL; } return tmp; } #endif /* NO_SHELL */ ng-1.5beta1/sys/unix/sysconfig.h.in100644 1750 1750 7717 7225407147 16060 0ustar amurausers/* sys/unix/sysconfig.h.in. Generated automatically from configure.in by autoheader. */ /* Define if using alloca.c. */ #undef C_ALLOCA /* Define to empty if the keyword does not work. */ #undef const /* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. This function is required for alloca.c support on those systems. */ #undef CRAY_STACKSEG_END /* Define if you have alloca, as a function or macro. */ #undef HAVE_ALLOCA /* Define if you have and it should be used (not on Ultrix). */ #undef HAVE_ALLOCA_H /* Define if you have that is POSIX.1 compatible. */ #undef HAVE_SYS_WAIT_H /* Define if you have . */ #undef HAVE_VFORK_H /* Define if on MINIX. */ #undef _MINIX /* Define to `int' if doesn't define. */ #undef pid_t /* Define if the system does not provide POSIX.1 features except with this defined. */ #undef _POSIX_1_SOURCE /* Define if you need to in order for stat and other things to work. */ #undef _POSIX_SOURCE /* Define as the return type of signal handlers (int or void). */ #undef RETSIGTYPE /* Define to `unsigned' if doesn't define. */ #undef size_t /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at run-time. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ #undef STACK_DIRECTION /* Define if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Define vfork as fork if vfork does not work. */ #undef vfork /* Define to `int' if doesn't define. */ #undef fd_set /* Define if you use CANNA */ #undef CANNA /* Define some commands path for dired */ #undef LS_CMD #undef MV_CMD #undef CP_CMD #undef RMDIR_CMD /* Undefing force SIGTSTP because this OS don't have suspend... */ #undef UNDEF_SIGTSTP /* Define if you have the bcmp function. */ #undef HAVE_BCMP /* Define if you have the bcopy function. */ #undef HAVE_BCOPY /* Define if you have the bzero function. */ #undef HAVE_BZERO /* Define if you have the dup2 function. */ #undef HAVE_DUP2 /* Define if you have the getcwd function. */ #undef HAVE_GETCWD /* Define if you have the getgroups function. */ #undef HAVE_GETGROUPS /* Define if you have the mkstemp function. */ #undef HAVE_MKSTEMP /* Define if you have the opendir function. */ #undef HAVE_OPENDIR /* Define if you have the rename function. */ #undef HAVE_RENAME /* Define if you have the rindex function. */ #undef HAVE_RINDEX /* Define if you have the rmdir function. */ #undef HAVE_RMDIR /* Define if you have the select function. */ #undef HAVE_SELECT /* Define if you have the sigprocmask function. */ #undef HAVE_SIGPROCMASK /* Define if you have the symlink function. */ #undef HAVE_SYMLINK /* Define if you have the header file. */ #undef HAVE_DIRENT_H /* Define if you have the header file. */ #undef HAVE_FCNTL_H /* Define if you have the header file. */ #undef HAVE_NDIR_H /* Define if you have the header file. */ #undef HAVE_SGTTY_H /* Define if you have the header file. */ #undef HAVE_SYS_DIR_H /* Define if you have the header file. */ #undef HAVE_SYS_FILE_H /* Define if you have the header file. */ #undef HAVE_SYS_IOCTL_H /* Define if you have the header file. */ #undef HAVE_SYS_NDIR_H /* Define if you have the header file. */ #undef HAVE_SYS_PARAM_H /* Define if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define if you have the header file. */ #undef HAVE_TERMIO_H /* Define if you have the header file. */ #undef HAVE_TERMIOS_H /* Define if you have the header file. */ #undef HAVE_UNISTD_H ng-1.5beta1/sys/unix/sysdef.h100644 1750 1750 5021 7626151566 14734 0ustar amurausers/* $Id: sysdef.h,v 1.5.2.1 2003/02/23 13:58:14 amura Exp $ */ /* * unix based systems (for configure) */ /* * $Log: sysdef.h,v $ * Revision 1.5.2.1 2003/02/23 13:58:14 amura * canna_init() must be called after setttysize() on ttyio.c * * Revision 1.5 2001/03/02 08:48:32 amura * now AUTOSAVE feature implemented almost all (except for WIN32 * * Revision 1.4 2001/02/18 19:29:04 amura * split dir.c to port depend/independ * * Revision 1.3 2000/12/14 18:14:12 amura * filename length become flexible * * Revision 1.2 2000/12/01 10:07:09 amura * edit for Minix * * Revision 1.1 2000/11/19 18:35:00 amura * support GNU configure system * */ #include #ifdef HAVE_UNISTD_H #include #include #endif #ifdef HAVE_SYS_PARAM_H #include #endif /* for use alloca() */ #ifndef __GNUC__ # ifdef HAVE_ALLOCA_H # include # else # ifdef _AIX # pragma alloca # else # ifndef alloca /* predefined by HP cc +Olibcalls */ char *alloca (); # endif # endif # endif #endif /* __GNUC__ */ #define KBLOCK 8192 /* Kill grow. */ #define GOOD 0 /* Good exit status. */ #ifndef NO_SHELL #define CMDLINELENGTH NFILEN /* Maximum length of shell command. */ #endif /* NO_SHELL */ #define BSMAP FALSE /* Bs map feature can use. */ /* (default mode is bsmap off) */ #define MAKEBACKUP TRUE /* Making backup file is on. */ #define ITIMER TRUE /* Interval timer support */ typedef long RSIZE; /* Type for file/region sizes */ typedef short KCHAR; /* Type for internal keystrokes */ #ifndef FD_SET # define FD_SET(fd,fdsp) ((*fdsp) |= (1<<(fd))) # define FD_ZERO(fdsp) ((*fdsp) = 0) #endif /* * Macros used by the buffer name making code. * Start at the end of the file name, scan to the left * until BDC1 (or BDC2, if defined) is reached. The buffer * name starts just to the right of that location, and * stops at end of string (or at the next BDC3 character, * if defined). BDC2 and BDC3 are mainly for VMS. */ #define BDC1 '/' /* Buffer names. */ #define MALLOCROUND(m) (m+=7,m&=~7) /* round up to 8 byte boundry */ #define fncmp strcmp /* file name comparison */ #ifndef HAVE_BCOPY #define bcopy(s,d,n) memcpy(d,s,n) #endif #ifndef HAVE_BZERO #define bzero(s,n) memset(s,0,n) #endif #ifndef HAVE_BCMP #define bcmp(s,d,n) memcmp(s,d,n) #endif #ifdef HAVE_RMDIR #define unlinkdir(fn) rmdir(fn) /* unlink directory */ #endif char *getenv(); #define gettermtype() getenv("TERM") /* determine terminal type */ #ifndef NO_DIR #define dirend() (VOID)0 #endif ng-1.5beta1/sys/unix/ttyio.c100644 1750 1750 33433 7626151566 14632 0ustar amurausers/* $Id: ttyio.c,v 1.9.2.2 2003/02/23 13:58:14 amura Exp $ */ /* * Unix terminal I/O. (for configure) * The functions in this file * negotiate with the operating system for * keyboard characters, and write characters to * the display in a barely buffered fashion. * * Create from BSD UNIX version by amura, 2000 */ /* * $Log: ttyio.c,v $ * Revision 1.9.2.2 2003/02/23 13:58:14 amura * canna_init() must be called after setttysize() on ttyio.c * * Revision 1.9.2.1 2002/02/10 12:34:38 amura * cannot compile problem with Cygwin is fixed * * Revision 1.9 2001/03/02 08:48:32 amura * now AUTOSAVE feature implemented almost all (except for WIN32 * * Revision 1.8 2001/02/18 19:28:12 amura * ttflush() is modified for Solaris * * Revision 1.7 2001/02/14 09:22:30 amura * always use select() even if ioctl() does NOT support FIONREAD * * Revision 1.6 2001/01/23 08:43:50 amura * reset terminal polling mode in ttwait() * * Revision 1.5 2001/01/20 15:48:47 amura * very big terminal supported * * Revision 1.4 2000/12/18 17:20:41 amura * edit for cygwin * * Revision 1.3 2000/12/01 10:12:55 amura * edit for adapting to POSIX * * Revision 1.2 2000/11/23 14:03:32 amura * some fix for FreeBSD's termios interface * * Revision 1.1 2000/11/19 18:35:00 amura * support GNU configure system * */ #include "config.h" #include "def.h" #include #ifdef HAVE_TERMIOS_H #include #else #ifdef HAVE_TERMIO_H #include #else #ifdef HAVE_SGTTY_H #include #else #error "What tty do you use?" #endif /* HAVE_SGTTY_H */ #endif /* HAVE_TERMIO_H */ #endif /* HAVE_SGTTY_H */ #ifdef HAVE_FCNTL_H #include #endif #ifdef HAVE_SYS_TIME_H #include #endif #ifdef ADDFUNC /* 90.02.14 by S.Yoshida */ #include /* 90.02.13: For SIGWINCH. */ #include /* 00.04.03: amura */ #endif /* ADDFUNC */ #define NOBUF 512 /* Output buffer size. */ char obuf[NOBUF]; /* Output buffer. */ int nobuf; #if defined(HAVE_TERMIO_H)||defined(HAVE_TERMIOS_H) static int ttyactivep = FALSE; /* terminal in editor mode? */ static int ttysavedp = FALSE; /* terminal state saved? */ #ifdef HAVE_TERMIOS_H static struct termios ot; /* entry state of the terminal */ static struct termios nt; /* editor's terminal state */ #else static struct termio ot; /* entry state of the terminal */ static struct termio nt; /* editor's terminal state */ #endif #else /* not HAVE_TERMIO_H || HAVE_TERMIOS_H */ struct sgttyb oldtty; /* V6/V7 stty data. */ struct sgttyb newtty; struct tchars oldtchars; /* V7 editing. */ struct tchars newtchars; struct ltchars oldltchars; /* 4.2 BSD editing. */ struct ltchars newltchars; #endif /* HAVE_TERMIO_H || HAVE_TERMIOS_H */ #ifdef TIOCGWINSZ struct winsize winsize; /* 4.3 BSD window sizing */ #endif int nrow; /* Terminal size, rows. */ int ncol; /* Terminal size, columns. */ #ifdef ADDFUNC /* 90.02.14 by S.Yoshida */ #ifdef SIGWINCH /* 90.02.13 by S.Yoshida */ RETSIGTYPE ttwinch(); #endif /* SIGWINCH */ #endif /* ADDFUNC */ #ifndef HAVE_SELECT /* These are used to implement typeahead on System V */ int kbdflgs; /* saved keyboard fd flags */ int kbdpoll; /* in O_NONBLOCK mode */ int kbdqp; /* there is a char in kbdq */ char kbdq; /* char we've already read */ #ifndef O_NONBLOCK /* for old system compat? */ #define O_NONBLOCK O_NDELAY #endif #endif /* HAVE_SELECT */ /* * This function gets called once, to set up * the terminal channel. On Ultrix is's tricky, since * we want flow control, but we don't want any characters * stolen to send signals. Use CBREAK mode, and set all * characters but start and stop to 0xFF. */ ttopen() { register char *tv_stype; char *getenv(), *tgetstr(), tcbuf[2048], err_str[72]; #ifndef SUPPORT_ANSI int sprintf(); #endif /* do this the REAL way */ if ((tv_stype = getenv("TERM")) == NULL) { puts("Environment variable TERM not defined!"); exit(1); } if((tgetent(tcbuf, tv_stype)) != 1) { (void) sprintf(err_str, "Unknown terminal type %s!", tv_stype); puts(err_str); exit(1); } if (ttraw() == FALSE) panic("aborting due to terminal initialize failure"); #ifdef ADDFUNC /* 90.02.14 by S.Yoshida */ #ifdef SIGWINCH /* 90.02.13 by S.Yoshida */ (void) signal(SIGWINCH, ttwinch); #endif /* SIGWINCH */ #endif /* ADDFUNC */ #ifdef CANNA canna_init(); #endif } /* * This function sets the terminal to RAW mode, as defined for the current * shell. This is called both by ttopen() above and by spawncli() to * get the current terminal settings and then change them to what * mg expects. Thus, stty changes done while spawncli() is in effect * will be reflected in mg. */ ttraw() { #if defined(HAVE_TERMIO_H)||defined(HAVE_TERMIOS_H) if (ttyactivep) return TRUE; if( !ttysavedp ) { #ifdef HAVE_TERMIOS_H if (tcgetattr(0, &ot) < 0) { #else if (ioctl(0, TCGETA, &ot) < 0) { #endif ewprintf("ttopen can't get termio/termios"); return(FALSE); } nt = ot; /* save entry state */ nt.c_cc[VMIN] = 1; /* one character read is OK */ nt.c_cc[VTIME] = 0; /* Never time out. */ nt.c_iflag |= IGNBRK; nt.c_iflag &= ~( ICRNL | INLCR | ISTRIP | IXON | IXOFF ); nt.c_oflag &= ~OPOST; nt.c_cflag |= CS8; /* allow 8th bit on input */ nt.c_cflag &= ~PARENB; /* Don't check parity */ nt.c_lflag &= ~( ECHO | ICANON | ISIG ); #ifdef IEXTEN nt.c_lflag &= ~IEXTEN; #endif #ifndef HAVE_SELECT kbdpoll = (((kbdflgs = fcntl(0, F_GETFL, 0)) & O_NONBLOCK) != 0); #endif ttysavedp = TRUE; } #ifndef HAVE_SELECT else kbdpoll = ((fcntl(0, F_GETFL, 0) & O_NONBLOCK) != 0); #endif #ifdef HAVE_TERMIOS_H if (tcsetattr(0, TCSAFLUSH, &nt) < 0) { #else if (ioctl(0, TCSETAF, &nt) < 0) { #endif ewprintf("ttopen can't set termio/termios"); return(FALSE); } ttyactivep = TRUE; #else /* not HAVE_TERMIO_H || HAVE_TERMIOS_H */ extern short ospeed; if (ioctl(0, TIOCGETP, (char *) &oldtty) < 0) { ewprintf("ttopen can't get sgtty"); return(FALSE); } newtty.sg_ospeed = ospeed = oldtty.sg_ospeed; newtty.sg_ispeed = oldtty.sg_ispeed; newtty.sg_erase = oldtty.sg_erase; newtty.sg_kill = oldtty.sg_kill; newtty.sg_flags = oldtty.sg_flags; newtty.sg_flags &= ~(ECHO|CRMOD); /* Kill echo, CR=>NL. */ #ifdef FLOWCONTROL newtty.sg_flags |= CBREAK; /* Half-cooked mode. */ #else newtty.sg_flags |= RAW|ANYP; /* raw mode for 8 bit path.*/ #endif if (ioctl(0, TIOCSETP, (char *) &newtty) < 0) { ewprintf("ttopen can't set sgtty"); return(FALSE); } if (ioctl(0, TIOCGETC, (char *) &oldtchars) < 0) { ewprintf("ttopen can't get chars"); return(FALSE); } newtchars.t_intrc = 0xFF; /* Interrupt. */ newtchars.t_quitc = 0xFF; /* Quit. */ #if FLOWCONTROL newtchars.t_startc = 0x11; /* ^Q, for terminal. */ newtchars.t_stopc = 0x13; /* ^S, for terminal. */ #else newtchars.t_startc = 0xFF; /* ^Q, for terminal. */ newtchars.t_stopc = 0xFF; /* ^S, for terminal. */ #endif newtchars.t_eofc = 0xFF; newtchars.t_brkc = 0xFF; if (ioctl(0, TIOCSETC, (char *) &newtchars) < 0) { ewprintf("ttopen can't set chars"); return(FALSE); } if (ioctl(0, TIOCGLTC, (char *) &oldltchars) < 0) { panic("ttopen can't get ltchars"); return(FALSE); } newltchars.t_suspc = 0xFF; /* Suspend #1. */ newltchars.t_dsuspc = 0xFF; /* Suspend #2. */ newltchars.t_rprntc = 0xFF; newltchars.t_flushc = 0xFF; /* Output flush. */ newltchars.t_werasc = 0xFF; newltchars.t_lnextc = 0xFF; /* Literal next. */ if (ioctl(0, TIOCSLTC, (char *) &newltchars) < 0) { ewprintf("ttopen can't set ltchars"); return(FALSE); } #endif /* HAVE_TERMIO_H || HAVE_TERMIOS_H */ setttysize() ; return(TRUE); } /* * This function gets called just * before we go back home to the shell. Put all of * the terminal parameters back. * Under UN*X this just calls ttcooked(), but the ttclose() hook is in * because vttidy() in display.c expects it for portability reasons. */ ttclose() { if (ttcooked() == FALSE) panic(""); /* ttcooked() already printf'd */ #ifdef CANNA canna_end(); #endif } /* * This function restores all terminal settings to their default values, * in anticipation of exiting or suspending the editor. */ ttcooked() { #if defined(HAVE_TERMIO_H)||defined(HAVE_TERMIOS_H) if(!ttysavedp || !ttyactivep) return(TRUE); ttflush(); #ifdef HAVE_TERMIOS_H if (tcsetattr(0, TCSAFLUSH, &ot) < 0 #else if (ioctl(0, TCSETAF, &ot) < 0 #endif #ifndef HAVE_SELECT || fcntl( 0, F_SETFL, kbdflgs ) < 0 #endif ) { ewprintf("ttclose can't set termio/termios"); return(FALSE); } ttyactivep = FALSE; #else /* not HAVE_TERMIO_H || HAVE_TERMIOS_H */ ttflush(); if (ioctl(0, TIOCSLTC, (char *) &oldltchars) < 0) { ewprintf("ttclose can't set ltchars"); return(FALSE); } if (ioctl(0, TIOCSETC, (char *) &oldtchars) < 0) { ewprintf("ttclose can't set chars"); return(FALSE); } if (ioctl(0, TIOCSETP, (char *) &oldtty) < 0) { ewprintf("ttclose can't set sgtty"); return(FALSE); } #endif /* HAVE_TERMIO_H || HAVE_TERMIOS_H */ return(TRUE); } /* * Write character to the display. * Characters are buffered up, to make things * a little bit more efficient. */ ttputc(c) int c; { if (nobuf >= NOBUF) ttflush(); obuf[nobuf++] = c; } /* * Flush output. */ ttflush() { char *p = obuf; int outlen; if (nobuf != 0) { if ((outlen=write(1, p, nobuf)) != nobuf) { p += nobuf; nobuf -= outlen; } nobuf = 0; } } #ifdef KANJI /* 90.02.05 by S.Yoshida */ static int nkey = 0; /* The number of ungetc charactor. */ static int keybuf[4]; /* Ungetc charactors. */ #endif /* KANJI */ /* * Read character from terminal. * All 8 bits are returned, so that you can use * a multi-national terminal. */ ttgetc() { #ifdef HAVE_SELECT char buf[1]; #endif #ifdef KANJI /* 90.02.05 by S.Yoshida */ if (nkey > 0) { return (keybuf[--nkey]); } #endif /* KANJI */ #ifdef HAVE_SELECT while (read(0, &buf[0], 1) != 1) ; return (buf[0] & 0xFF); #else /* not HAVE_SELECT */ if( kbdqp ) kbdqp = FALSE; else { if( kbdpoll && fcntl( 0, F_SETFL, kbdflgs ) < 0 ) abort(); kbdpoll = FALSE; while (read(0, &kbdq, 1) != 1) ; } return ( kbdq & 0xff ); #endif /* HAVE_SELECT */ } #ifdef KANJI /* 90.02.05 by S.Yoshida */ /* * Save pre-readed char to read again. */ ttungetc(c) int c; { keybuf[nkey++] = c; } #endif /* KANJI */ /* * set the tty size. Functionized for 43BSD. */ setttysize() { #ifdef TIOCGWINSZ if (ioctl(0, TIOCGWINSZ, (char *) &winsize) != -1) { nrow = winsize . ws_row; ncol = winsize . ws_col; } else nrow = 0; if(nrow<=0 || ncol<=0) #endif if ((nrow=tgetnum ("li")) <= 0 || (ncol=tgetnum ("co")) <= 0) { nrow = 24; ncol = 80; } } #ifdef ADDFUNC /* 90.02.14 by S.Yoshida */ #ifdef SIGWINCH /* 90.02.13 by S.Yoshida */ /* * Signal handler when window size has changed. */ RETSIGTYPE ttwinch() { refresh(FFRAND, 0); /* Very easy way... */ #ifdef CANNA canna_width(); #endif /* CANNA */ (void) signal(SIGWINCH, ttwinch); /* for old scheme */ } #endif /* SIGWINCH */ #endif /* ADDFUNC */ /* * typeahead returns TRUE if there are characters available to be read * in. */ typeahead() { #ifdef KANJI /* 90.02.05 by S.Yoshida */ if (nkey > 0) { return (TRUE); } #endif /* KANJI */ #ifdef HAVE_SELECT #ifdef FIONREAD { int x; return ((ioctl(0, FIONREAD, (char *) &x) < 0) ? FALSE : x); } #else /* not FIONREAD */ { struct timeval tmout; fd_set readfd; tmout.tv_sec = 0; tmout.tv_usec = 0; FD_ZERO(&readfd); FD_SET(0, &readfd); return ((select(1, &readfd, (fd_set *)0, (fd_set *)0, &tmout) == 0) ? FALSE : TRUE); } #endif /* FIONREAD */ #else /* not HAVE_SELECT */ if( !kbdqp ) { if( !kbdpoll && fcntl( 0, F_SETFL, kbdflgs | O_NONBLOCK) < 0 ) abort(); kbdpoll = TRUE; kbdqp = (1 == read( 0, &kbdq, 1 )); } return ( kbdqp ); #endif /* HAVE_SELECT */ } /* * panic - just exit, as quickly as we can. */ panic(s) char *s; { (void) fputs("panic: ", stderr); (void) fputs(s, stderr); (void) fputc('\n', stderr); (void) fflush(stderr); abort(); /* To leave a core image. */ } #ifndef NO_DPROMPT #ifdef HAVE_SELECT /* * A program to return TRUE if we wait for 2 seconds without anything * happening, else return FALSE. Cribbed from mod.sources xmodem. */ int ttwait() { fd_set readfd; struct timeval tmout; #ifdef KANJI /* 90.02.05 by S.Yoshida */ if (nkey > 0) { return (FALSE); } #endif /* KANJI */ #ifdef BUGFIX /* 90.02.07 by S.Yoshida */ tmout.tv_sec = 1; #else /* NOT BUGFIX */ tmout.tv_sec = 2; #endif /* BUGFIX */ tmout.tv_usec = 0; FD_ZERO(&readfd); FD_SET(0, &readfd); if ((select(1, &readfd, (fd_set *)0, (fd_set *)0, &tmout)) == 0) return(TRUE); return(FALSE); } #else /* not HAVE_SELECT */ #include #include static jmp_buf tohere; static VOID alrm() { longjmp(tohere, -1); } /* * Return TRUE if we wait without doing anything, else return FALSE. */ ttwait() { VOID alrm(); VOID (*old_alrm)(); unsigned int old_time; #ifdef KANJI /* 90.02.05 by S.Yoshida */ if (nkey > 0) { return (FALSE); } #endif /* KANJI */ if (kbdqp) return FALSE; /* already pending input */ if (setjmp(tohere)) return TRUE; /* timeout on read if here */ old_alrm = signal(SIGALRM, alrm); old_time = alarm(1); if (kbdpoll && fcntl( 0, F_SETFL, kbdflgs ) < 0) abort(); kbdpoll = FALSE; kbdqp = (1 == read(0, &kbdq, 1)); signal(SIGALRM, old_alrm); alarm(old_time); return FALSE; /* successful read if here */ } #endif /* HAVE_SELECT */ #endif /* NO_DPROMPT */ #ifdef AUTOSAVE VOID itimer(func, sec) VOID (*func)(); time_t sec; { if (sec == 0) alarm(0); else { signal(SIGALRM, func); alarm(sec); } } #endif /* AUTOSAVE */ ng-1.5beta1/sys/win32/ 40755 1750 1750 0 7642273647 13155 5ustar amurausersng-1.5beta1/sys/win32/appicon.ico100644 1750 1750 2776 7126003717 15375 0ustar amurausers 6 (( @誓 zpazxHz az&H zzfHzazHzazzY兆O     ??( @誓DGxDOppDOpDOxppDO盟pxDO鳴xxppDO鳴pDO鳴xppDO鳴pxDO鳴pDO鳴pDO鳴pGp婆p模pppppwwwwwwwwww??( 誓面面面ng-1.5beta1/sys/win32/buttons.bmp100644 1750 1750 766 7204766550 15433 0ustar amurausersBMv(0誓wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwxwwwwwwpwwwwwpwwwwwwwwwwwwwwwwwwwwwwwwwwwwwp銕wwwwpwwwwwwwwwww銕wwwwp銕wwwwwwwwwp銕銕wwwp銕wwwwwwww銕wwwp銕wwwwwwwwp銕www銕wwwwwwwp銕wwwp銕銕wwwwwwwp銕wwww銕wwwwwwwwpwwwwp銕wwwwwwwwwwwwwwwwwwwwwwwwwwwwwpwwwwwpwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwng-1.5beta1/sys/win32/ce1appicon.ico100644 1750 1750 1406 7126003717 15753 0ustar amurausers &(( @誓 zpazxHz az&H zzfHzazHzazzY兆O     ??( 誓面面面ng-1.5beta1/sys/win32/ce2appicon.ico100644 1750 1750 2776 7126003717 15767 0ustar amurausers 6 (( @誓 zpazxHz az&H zzfHzazHzazzY兆O     ??( @誓DGxDOppDOpDOxppDO盟pxDO鳴xxppDO鳴pDO鳴xppDO鳴pxDO鳴pDO鳴pDO鳴pGp婆p模pppppwwwwwwwwww??( 誓面面面ng-1.5beta1/sys/win32/cefep.c100644 1750 1750 11563 7204766550 14520 0ustar amurausers/* $Id: cefep.c,v 1.1 2000/11/16 14:21:28 amura Exp $ */ /* OS dependent code used by Ng for WinCE. * Copyright (C) 1998 Eiichiro Ito * Modified for Ng for Win32 * Copyright (C) 1999,2000 Toru Imai * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * ree Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* * NG : NG FEP controll routine * * 1998/11/14:Eiichiroh Itoh * */ /* * $Log: cefep.c,v $ * Revision 1.1 2000/11/16 14:21:28 amura * merge Ng for win32 0.5 * */ #ifndef STRICT #define STRICT #endif #include #include #include "config.h" #include "def.h" #if defined(KANJI) && defined(USE_KCTRL) #include "cefep.h" #define NO_CTRLSPACE #define GawaroBaseKey TEXT("Software\\Gawaro") #define VAR_FEPNAME TEXT("FepName") #define VAR_FEPPROGRAM TEXT("FepProgram") #define VAR_USECTRL TEXT("UseCtrl") TCHAR g_szFepName[ MAX_PATH ] = TEXT("KANJIIN") ; TCHAR g_szFepProgram[ MAX_PATH ] = TEXT("KanjiIn.exe") ; BOOL g_fKanji = FALSE ; BOOL g_fUseCtrl = FALSE ; BOOL g_fFepOption = FALSE ; /* * Initilize FEP */ BOOL InitFep( void ) { HKEY hk ; LONG lret ; LPCTSTR name ; LPBYTE lpData ; TCHAR sValue[ 256 ] ; DWORD dwType, cbData, dwValue ; /* Open Registory */ lret = RegOpenKeyEx( HKEY_CURRENT_USER, GawaroBaseKey, 0, KEY_QUERY_VALUE, &hk ) ; if ( lret == ERROR_SUCCESS ) { /* FEP name */ name = VAR_FEPNAME ; dwType = REG_SZ ; lpData = (LPBYTE) sValue ; cbData = sizeof sValue ; if ( RegQueryValueEx( hk, name, NULL, &dwType, lpData, &cbData ) == ERROR_SUCCESS ) { _tcscpy( g_szFepName, sValue ) ; } /* FEP Program Name */ name = VAR_FEPPROGRAM ; dwType = REG_SZ ; lpData = (LPBYTE) sValue ; cbData = sizeof sValue ; if ( RegQueryValueEx( hk, name, NULL, &dwType, lpData, &cbData ) == ERROR_SUCCESS ) { _tcscpy( g_szFepProgram, sValue ) ; } /* CTRL/ALT swapping */ name = VAR_USECTRL ; dwType = REG_DWORD ; lpData = (LPBYTE) &dwValue ; cbData = sizeof dwValue ; if ( RegQueryValueEx( hk, name, NULL, &dwType, lpData, &cbData ) == ERROR_SUCCESS ) { g_fUseCtrl = dwValue ; } /* Close Registory */ RegCloseKey( hk ) ; } return TRUE ; } /* * Open FEP */ void Fep_Execute( HWND hWnd ) { HWND hWndFep ; hWndFep = FindWindow( g_szFepName, NULL ) ; if ( hWndFep ) { /* If FEP process exist, change it state */ g_fKanji = SendMessage( hWndFep, WM_COMMAND, IDM_FEPGETMODE, 0 ) ; SendMessage( hWndFep, WM_COMMAND, IDM_FEPSETMODE, g_fKanji ? 0 : 1 ) ; #ifdef _WIN32_WCE } else { /* FEP process is not exist */ PROCESS_INFORMATION pi ; TCHAR param[ 20 ] ; wsprintf( param, TEXT("%d"), hWnd ) ; g_fKanji = CreateProcess( g_szFepProgram, param, NULL, NULL, FALSE, 0, NULL, NULL, NULL, &pi ) ; #endif /* _WIN32_WCE */ } } /* * WM_CHAR */ BOOL Fep_WM_CHAR( HWND hWnd, TCHAR chCharCode, LONG lKeyData ) { HWND hWndFep ; #ifndef NO_CTRLSPACE if ( chCharCode == TEXT(' ') ) { if ( g_fUseCtrl && (GetKeyState( VK_CONTROL) & 0x80) ) { /* Pressed CTRL + SPACE */ Fep_Execute( hWnd ) ; return TRUE ; } return FALSE ; } #endif /* NO_CTRLSPACE */ if ( chCharCode < TEXT(' ') ) { return FALSE ; } hWndFep = FindWindow( g_szFepName, NULL ) ; if ( hWndFep ) { g_fKanji = SendMessage( hWndFep, WM_COMMAND, IDM_FEPGETMODE, 0 ) ? FALSE : TRUE ; } else { g_fKanji = FALSE ; } if ( g_fKanji && (chCharCode != TEXT(' ')) ) { SendMessage( hWndFep, WM_COMMAND, MAKEWPARAM( IDM_ACTIVATE_HWND, chCharCode ), (LPARAM) hWnd ) ; return TRUE ; } return FALSE ; } /* * WM_SYSCHAR */ BOOL Fep_WM_SYSCHAR( HWND hWnd, TCHAR chCharCode, LONG lKeyData ) { #ifndef NO_CTRLSPACE if ( chCharCode == TEXT(' ') ) { if ( !g_fUseCtrl && (lKeyData & 0x20000000) ) { /* Pressed ALT + SPACE */ Fep_Execute( hWnd ) ; return TRUE ; } } #endif /* NO_CTRLSPACE */ return FALSE ; } BOOL Fep_WM_ACTIVATE( HWND hWnd, WORD fActive, BOOL fMinimize, HWND hWndDeactive ) { if ( g_fFepOption ) { if ( fActive == WA_ACTIVE || fActive == WA_CLICKACTIVE ) { HWND hWndFep = FindWindow( g_szFepName, NULL ) ; if ( hWndFep ) { g_fKanji = SendMessage( hWndFep, WM_COMMAND, IDM_FEPGETMODE, 0 ) ? FALSE : TRUE ; if ( g_fKanji ) { SendMessage( hWndFep, WM_COMMAND, IDM_FEPSETMODE, 1 ) ; } } } } return FALSE ; } #endif /* defined(KANJI) && defined(USE_KCTRL) */ ng-1.5beta1/sys/win32/cefep.h100644 1750 1750 4124 7204766550 14500 0ustar amurausers/* $Id: cefep.h,v 1.1 2000/11/16 14:21:28 amura Exp $ */ /* OS dependent code used by Ng for WinCE. * Copyright (C) 1998 Eiichiro Ito * Modified for Ng for Win32 * Copyright (C) 1999,2000 Toru Imai * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * ree Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* * $Log: cefep.h,v $ * Revision 1.1 2000/11/16 14:21:28 amura * merge Ng for win32 0.5 * */ #define CTRL_FEPBOX TEXT("FEPBOX") #define IDM_PEXCEL (41258) #define IDM_UNKNOWN (41259) #define IDM_FEPOK (41260) #define IDM_ACTIVATE (41261) #define IDM_FEPKEY (41262) #define IDM_FEPCHAR (41263) #define IDM_ACTIVATE_HWND (41264) #define IDM_FEPGETMODE (41265) #define IDM_FEPSETMODE (41266) #define IDM_WMCHAR (41267) #define IDM_EXPLORE (1) #define FEP_ISSENDING (WM_USER+0x0100) #ifdef __cplusplus extern "C" { #endif BOOL FepBoxRegisterClass( HINSTANCE hInst ) ; HWND GetCenterWindow() ; void FepSetParent( HWND hWnd, BOOL bForce ) ; BOOL FepSetDict( LPCTSTR dict_path ) ; BOOL InitFep( void ) ; void Fep_Execute( HWND hWnd ) ; BOOL Fep_WM_CHAR( HWND hWnd, TCHAR chCharCode, LONG lKeyData ) ; BOOL Fep_WM_SYSCHAR( HWND hWnd, TCHAR chCharCode, LONG lKeyData ) ; BOOL Fep_WM_ACTIVATE( HWND hWnd, WORD fActive, BOOL fMinimize, HWND hWndDeactive ) ; extern TCHAR g_szFepName[ MAX_PATH ] ; extern TCHAR g_szFepProgram[ MAX_PATH ] ; extern BOOL g_fKanji ; extern BOOL g_fUseCtrl ; extern BOOL g_fFepOption ; #ifdef __cplusplus } ; #endif ng-1.5beta1/sys/win32/fileio.c100644 1750 1750 66262 7266346741 14717 0ustar amurausers/* $Id: fileio.c,v 1.14 2001/04/15 16:35:45 amura Exp $ */ /* OS dependent code used by Ng for WinCE. * Copyright (C) 1998 Eiichiro Ito * Modified for Ng for Win32 * Copyright (C) 1999,2000 Toru Imai * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * ree Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* * $Log: fileio.c,v $ * Revision 1.14 2001/04/15 16:35:45 amura * patch for VC 6.0 from Katsuyoshi Ohara * * Revision 1.13 2001/03/02 08:48:32 amura * now AUTOSAVE feature implemented almost all (except for WIN32 * * Revision 1.12 2001/02/18 19:29:04 amura * split dir.c to port depend/independ * * Revision 1.11 2001/01/17 18:34:53 amura * now compile successfull on VC++ and BC++ * * Revision 1.10 2001/01/05 14:07:08 amura * first implementation of Hojo Kanji support * * Revision 1.9 2001/01/05 13:55:28 amura * filename completion fixed * * Revision 1.8 2000/12/28 07:27:16 amura * homedirctory support with filename complition * * Revision 1.7 2000/12/27 16:55:44 amura * change d_makename() params for conservative reason, and bugfix in dires_() * * Revision 1.6 2000/12/14 18:10:48 amura * filename length become flexible * * Revision 1.5 2000/11/16 14:21:28 amura * merge Ng for win32 0.5 * * Revision 1.4 2000/10/23 16:52:51 amura * add GPL copyright to header * * Revision 1.3 2000/10/23 13:18:45 amura * support Windoze line backup file * * Revision 1.2 2000/09/01 19:37:52 amura * support KANJI filename on WIN32 * * Revision 1.1.1.1 2000/06/27 01:47:59 amura * import to CVS * */ #include #include #include "config.h" #include "def.h" #include "tools.h" #include "resource.h" #ifdef KANJI void bufetos( char *p, int len ) ; int bufstoe_c( char *p, int len ) ; int bufstoe( char *p, int len ) ; #endif void kputc( char c, FILE* fp, int kfio ) ; #if 0 char* fftolower( char *name ) ; #endif int bclear( BUFFER *bp ) ; int addline( BUFFER *bp, char *text ) ; #ifdef _WIN32_WCE extern strnicmp(char *, char *, size_t); #endif #ifndef HAVE_RINDEX #define rindex(s,c) strrchr(s,c) #endif TCHAR g_szPath[ MAX_PATH ] = TEXT("") ; TCHAR g_szCurDir[ MAX_PATH ] = TEXT("\\") ; #define MALLOC_STEP 256 int fffiles( char *name, char **buf ) { char pathbuf[ NFILEN ], tmpnam[ NFILEN ] ; char pathbufs[ NFILEN ], ff_namee[ NFILEN ] ; char *cp, *dirpart, *nampart, *buffer ; int n, len, size, dirpartlen, nampartlen, l ; HANDLE hFind ; WIN32_FIND_DATA find ; TCHAR findPath[ MAX_PATH ], unicode[ MAX_PATH ] ; #ifdef HOMEDIR char *home; int homelen; #endif #ifndef _WIN32_WCE if (name[1] == ':' && name[2] == '\0') { return -1; } #endif #ifdef HOMEDIR if (name[0] == '~' && (name[1]=='/' || name[1]=='\\') && (home = getenv("HOME"))) { homelen = strlen(home)-1; strncpy(pathbuf, home, sizeof(pathbuf)); pathbuf[NFILEN-1] = '\0'; strncat(pathbuf, &name[1], sizeof(pathbuf)-strlen(pathbuf)-1); } else { home = NULL; homelen = 0; strncpy(pathbuf, name, sizeof(pathbuf)); pathbuf[NFILEN-1] = '\0'; } #else strncpy(pathbuf, name, sizeof(pathbuf)); pathbuf[NFILEN-1] = '\0'; #endif dirpart = NULL ; for ( cp = pathbuf ; *cp ; cp ++ ) { if ( *cp == '/' ) { *cp = '\\' ; dirpart = cp ; } else if ( *cp == '\\' ) { dirpart = cp ; } else if ( dirpart == NULL && *cp == ':' ) { dirpart = cp ; } } if ( dirpart ) { *++dirpart = '\0' ; dirpartlen = dirpart - pathbuf ; } else { strcpy( pathbuf, ".\\" ) ; /* 90.05.30 by A.Shirahashi */ dirpartlen = 0 ; } #ifdef HOMEDIR nampart = name + dirpartlen - homelen; #else nampart = name + dirpartlen; #endif nampartlen = strlen( nampart ) ; buffer = malloc( MALLOC_STEP ) ; if ( buffer == NULL ) { return -1 ; } size = MALLOC_STEP ; len = 0 ; n = 0 ; (VOID) strcat( pathbuf, "*.*" ) ; strcpy( pathbufs, pathbuf ) ; #ifdef KANJI bufetos( pathbufs, strlen(pathbufs) + 1 ) ; #endif /* Convert the search path to UNICODE and get absolute path */ sjis2unicode( (LPBYTE) pathbufs, unicode, sizeof unicode ) ; rel2abs( findPath, g_szCurDir, unicode ) ; /* Find first file */ hFind = FindFirstFile( findPath, &find ) ; if ( hFind == INVALID_HANDLE_VALUE ) { *buf = buffer ; buffer[0] = '\0' ; return 0 ; } do { if ( !lstrcmp( find.cFileName, TEXT(".") ) ) { continue ; } else if ( !lstrcmp( find.cFileName, TEXT("..") ) ) { continue ; } unicode2sjis( find.cFileName, (LPBYTE) ff_namee, sizeof ff_namee ) ; #ifdef KANJI bufstoe( ff_namee, strlen(ff_namee) + 1 ) ; #endif if ( strnicmp( nampart, ff_namee, nampartlen ) ) { continue ; /* no-case-sensitive comparison */ } strncpy( tmpnam, pathbuf, dirpartlen ) ; strcpy( tmpnam + dirpartlen, ff_namee ) ; if ( find.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) { strcat( tmpnam, "\\" ) ; } l = strlen(tmpnam) + 1 ; /* 90.05.30 by A.Shirahashi */ if ( l > 5 && (stricmp( &tmpnam[l-5], ".OBJ" ) == 0 || stricmp( &tmpnam[l-5], ".EXE" ) == 0 || stricmp( &tmpnam[l-5], ".COM" ) == 0 ) ) { /* 90.05.30 by A.Shirahashi */ continue ; } if ( l + len >= size ) { /* make room for double null */ if ( ( buffer = realloc( buffer, size += MALLOC_STEP ) ) == NULL ) { FindClose(hFind); return -1 ; } } /* 90.06.08 by A.Shirahashi: to */ /* 00.12.28 by amura.. contributed by sahf */ #ifdef HOMEDIR if(home) { strcpy(buffer+len, "~"); strcat(buffer+len, tmpnam+homelen+1); l -= homelen; } else #endif strcpy( buffer + len, tmpnam ) ; len += l ; n ++ ; } while ( FindNextFile( hFind, &find ) ) ; FindClose(hFind); *buf = buffer ; buffer[len] = '\0' ; return n ; } char * file_name_part( char *s ) { int i ; for (i = strlen (s); i > 0; i--) { if (s[i - 1] == '/' || s[i - 1] == '\\' || s[i - 1] == ':') { break ; } } return s + i ; } #ifndef NO_DIR #include #include #ifndef __BORLANDC__ #define chdir _tchdir #define getcwd _tgetcwd #endif /* __BORLANDC__ */ extern char *wdir; extern char *startdir; static char cwd[NFILEN]; /* * Initialize anything the directory management routines need */ VOID dirinit() { char wdir2[NFILEN]; if (!(wdir = getcwd(cwd, NFILEN-1))) panic("Can't get current directory!"); unicode2sjis(wdir, wdir2, sizeof(wdir2)); strcpy(wdir, wdir2); #ifdef KANJI bufstoe(wdir, strlen(wdir)+1); #endif #ifndef _WIN32_WCE if (wdir[1]==':' && ISUPPER(wdir[0])) wdir[0] = TOLOWER(wdir[0]); #endif /* _WIN32_WCE */ if (startdir == NULL) { int len = strlen(cwd); startdir = malloc(len + 2); if (startdir == NULL) { ewprintf("Cannot alloc %d bytes", len + 2); return; } strcpy(startdir, cwd); } } /* rchdir() makes some effects to change directory. It will affect system to set the actual current directory to the specified one. This routine is extracted from changedir(), which is currently do some virtual chdir but previously do the actual one. Both bufc and wdir should have enough space to store file path, that is, as long as NFILEN. By Tillanosoft, Mar 22, 1999 */ int rchdir(newdir) char *newdir; { char dir[NFILEN], dir2[NFILEN]; int i; strcpy(dir2, newdir); #ifdef KANJI bufetos(dir2, strlen(dir2)+1); #endif sjis2unicode(dir2, dir, sizeof(dir)); i = strlen(dir) - 1; if (dir[i] == '\\') dir[i] = '\0'; #ifndef _WIN32_WCE /* WinCE has no drive */ if (dir[1] == ':' && dir[0] != wdir[0]) { int drive = newdir[0]; /* 90.07.01 Change from TOUPPER() to TOLOWER() */ /* by S.Yoshida */ if (ISUPPER(drive)) drive = TOLOWER(drive); /* 90.07.01 Change from 'A' to 'a' by S.Yoshida */ drive = drive - 'a' + 1; _chdrive(drive); } if (dir[1] == ':') { if (dir[2]=='\0') { dirinit(); return 0; } else if (chdir(dir+2) == -1) return -1; } else #endif if (chdir(dir) == -1) return -1; dirinit(); return 0; } #endif /* * The string "fn" is a file name. * Perform any required appending of directory name or case adjustments. * If NO_DIR is not defined, the same file should be refered to even if the * working directory changes. */ char * adjustname( char *fn ) { HANDLE hFind; TCHAR findPath[MAX_PATH]; WIN32_FIND_DATA find; char *cp ; static char fnb[ NFILEN ] ; cp = fnb ; #ifndef _WIN32_WCE if (fn[1] == ':') { *cp++ = *fn++; *cp++ = *fn++; } #endif #ifdef HOMEDIR #ifndef _WIN32_WCE else #endif if (fn[0]=='~' && (fn[1]=='/' || fn[1]=='\\')) { strcpy(fnb, getenv("HOME")); while (*cp) { if (*cp == '/') *cp = '\\'; cp++; } fn++; } #endif switch( *fn ) { case '/': *fn = '\\' ; case '\\': *cp++ = *fn++ ; break ; #ifndef _WIN32_WCE case '\0': break; #endif default: #ifndef NO_DIR /* 91.01.17 NODIR -> NO_DIR. by S.Yoshida */ #if 0 /* something incomprehensive thing is done here */ extern char *wdir ; if ( cp == fnb || fnb[0] == wdir[0] ) { (VOID) strcpy( fnb, wdir ) ; cp = fnb + strlen( fnb ) ; } else #endif { /* Different drive. */ unicode2sjis( g_szCurDir, (LPBYTE) fnb, NFILEN - 1 ) ; #if 0 /* to prevent making lower case */ /* 90.07.01 Add fftolower() by S.Yoshida */ if ( !fftolower( fnb ) ) { cp = fnb ; } else { cp = fnb + strlen( fnb ) ; } #else /* not 0 */ cp = fnb ? fnb + strlen(fnb) : fnb; #endif } break ; #else return fn ; /* punt */ #endif } if ( cp != fnb && cp[-1] != '\\' ) { *cp++ = '\\' ; } while ( *fn ) { switch ( *fn ) { case '.': switch ( fn[1] ) { case '\0': *--cp = '\0' ; return fnb ; case '/': case '\\': fn += 2 ; continue ; case '.': if ( fn[2]=='\\' || fn[2] == '/' || fn[2] == '\0' ) { --cp ; while ( cp > fnb && *--cp != '\\' ) { } ++cp ; if ( fn[2] == '\0' ) { *cp = '\0' ; goto finalcheck; } fn += 3 ; continue ; } break ; default: break ; } break ; case '/': case '\\': fn ++ ; continue ; default: break ; } while ( *fn && (*cp++ = *fn++) != '\\' ) { #if 0 /* 90.06.05 by S.Yoshida */ /* 90.06.08 by A.Shirahashi, convert to lower case */ if ( ISUPPER( cp[-1] ) ) { cp[-1] = TOLOWER( cp[-1] ) ; } #endif if ( cp[-1] == '/' ) { cp[-1] = '\\' ; break ; } } } finalcheck: if ( cp[-1] == '\\' ) { #ifndef _WIN32_WCE if (cp == &fnb[3] && fnb[1] == ':') { /* It's OK */ } else #endif if ( cp != &fnb[1] ) { --cp ; } } *cp = '\0' ; /* Do final confirmation for the case of the file name. This is very essential because Win32 file system tells the case of file names for writing but does not tell for reading. The purpose here is to confirm the actual case of the existing file name by reading the folder using FindFirstFile(). */ sjis2unicode(fnb, findPath, MAX_PATH * sizeof(TCHAR)); hFind = FindFirstFile(findPath, &find); if (hFind != INVALID_HANDLE_VALUE) { for (cp = fnb + strlen(fnb) ; fnb < cp ;) { if (*--cp == '\\') { cp++; break; } } unicode2sjis(find.cFileName, cp, NFILEN - (cp - fnb)); FindClose(hFind); } return fnb ; } /* * Open a file for reading. */ int ffropen( char *fn ) { CHAR fns[ NFILEN ] ; TCHAR unicode[ MAX_PATH ] ; strcpy( fns, fn ) ; #ifdef KANJI bufetos( fns, strlen(fns) + 1 ) ; #endif unicode[0] = 0 ; sjis2unicode( (LPBYTE) fns, unicode, sizeof unicode ) ; rel2abs( g_szPath, g_szCurDir, unicode ) ; if ( !Fopen( g_szPath, TEXT("r") ) ) { return FIOFNF ; } return FIOSUC ; } /* * Open a file for writing. * Return TRUE if all is well, and * FALSE on error (cannot create). */ int ffwopen( char *fn ) { CHAR fns[ NFILEN ] ; TCHAR unicode[ MAX_PATH ] ; strcpy( fns, fn ) ; #ifdef KANJI bufetos( fns, strlen(fns) + 1 ) ; #endif unicode[0] = 0 ; sjis2unicode( (LPBYTE) fns, unicode, sizeof unicode ) ; rel2abs( g_szPath, g_szCurDir, unicode ) ; if ( !Fopen( g_szPath, TEXT("w") ) ) { ewprintf( "Cannot open file for writing" ) ; return FIOERR ; } return FIOSUC ; } /* * Close a file. * Should look at the status. */ int ffclose() { Fclose() ; return FIOSUC ; } /* * Write a buffer to the already * opened file. bp points to the * buffer. Return the status. * Check only at the newline and * end of buffer. */ int ffputbuf( BUFFER *bp ) { char *cp ; char *cpend ; LINE *lp ; LINE *lpend ; #ifdef KANJI int kfio ; #endif lpend = bp->b_linep ; #ifdef KANJI kfio = bp->b_kfio ; #endif lp = lforw(lpend) ; do { cp = <ext(lp)[0] ; /* begining of line */ cpend = &cp[llength(lp)] ; /* end of line */ while ( cp != cpend ) { #ifdef KANJI kputc( *cp, NULL, kfio ) ; #else putc(*cp, NULL); #endif cp ++ ; /* putc may evalualte arguments more than once */ } #ifdef KANJI if ( kfio == JIS ) { kfselectcode(NULL, FALSE) ; } #endif lp = lforw( lp ) ; if ( lp == lpend ) { break ; /* no implied newline on last line */ } putc( '\n', NULL) ; } while( !Ferror() ) ; if ( Ferror() ) { ewprintf( "Write I/O error" ) ; return FIOERR ; } return FIOSUC ; } /* * Read a line from a file, and store the bytes * in the supplied buffer. Stop on end of file or end of * line. When FIOEOF is returned, there is a valid line * of data without the normally implied \n. */ int ffgetline( char *buf, int nbuf, int *nbytes ) { int c ; int i ; i = 0 ; while ( ( c = Fgetc() ) != -1 && c != '\n' ) { buf[ i++ ] = c ; if ( i >= nbuf ) { return FIOLONG ; } } if ( c == -1 && Ferror() != FALSE ) { ewprintf( "File read error" ) ; return FIOERR ; } *nbytes = i ; return c == -1 ? FIOEOF : FIOSUC ; } #ifdef READONLY /* * Check whether file is read-only of a file fn. */ int fchkreadonly( char *fn ) { DWORD attr ; char fns[ NFILEN ] ; TCHAR szPath[ MAX_PATH ], unicode[ MAX_PATH ] ; strcpy( fns, fn ) ; #ifdef KANJI bufetos( fns, strlen( fns ) + 1 ) ; #endif /* Generate absolute path based on the current directory */ sjis2unicode( (LPBYTE) fns, unicode, sizeof unicode ) ; rel2abs( szPath, g_szCurDir, unicode ) ; attr = GetFileAttributes( szPath ) ; if ( attr == 0xFFFFFFFF ) { return FALSE ; } return attr & FILE_ATTRIBUTE_READONLY ; } #endif /* READONLY */ #ifndef NO_STARTUP /* * Find a startup file for the user and return its name. As a service * to other pieces of code that may want to find a startup file (like * the terminal driver in particular), accepts a suffix to be appended * to the startup file name. */ /*ARGSUSED*/ char * #ifdef ADDOPT startupfile(ngrcfile, suffix) char* ngrcfile; #else startupfile(suffix) #endif char* suffix; { static BYTE sjis[MAX_PATH]; TCHAR unicode[MAX_PATH]; DWORD foo = sizeof(unicode); #ifdef ADDOPT if (ngrcfile) { lstrcpy(unicode, ngrcfile); if (GetFileAttributes(unicode) != 0xFFFFFFFF) { #ifdef _WIN32_WCE unicode2sjis(unicode, sjis, sizeof sjis); #else strncpy(sjis, unicode, sizeof sjis); sjis[(sizeof sjis)-1] = '\0'; #endif #ifdef KANJI bufstoe(sjis, strlen(sjis)+1); #endif return (char*)sjis; } } #endif if (RegQueryString(HKEY_CURRENT_USER, NGREGKEY, NGSTARTUPFILEVAL, unicode, &foo) != ERROR_SUCCESS) { if (GetFileAttributes(unicode) == 0xFFFFFFFF) { lstrcpy(unicode, NGDEFAULTINIFILE); if (GetFileAttributes(unicode) == 0xFFFFFFFF) { lstrcpy(unicode, TEXT("\\Storage Card") NGDEFAULTINIFILE); if (GetFileAttributes(unicode) == 0xFFFFFFFF) { return NULL; } } } } unicode2sjis(unicode, sjis, sizeof sjis); #ifdef KANJI bufstoe(sjis, strlen(sjis)+1); #endif return (char*)sjis; } #endif /* NO_STARTUP */ #ifndef NO_DIRED #include "kbd.h" int mkfileline( LPSTR *_line, WIN32_FIND_DATA *info ) ; int unlink( const char *fn ) { char fns[ NFILEN ] ; TCHAR unicode[ MAX_PATH ], szPath[ MAX_PATH ] ; strcpy( fns, fn ) ; #ifdef KANJI bufetos( fns, strlen( fns ) + 1 ) ; #endif sjis2unicode( (LPBYTE) fns, unicode, sizeof unicode ) ; rel2abs( szPath, g_szCurDir, unicode ) ; return DeleteFile( szPath ) ? 0 : -1 ; } int rmdir( const char *fn ) { char fns[ NFILEN ] ; TCHAR unicode[ MAX_PATH ], szPath[ MAX_PATH ] ; strcpy( fns, fn ) ; #ifdef KANJI bufetos( fns, strlen( fns ) + 1 ) ; #endif sjis2unicode( (LPBYTE) fns, unicode, sizeof unicode ) ; rel2abs( szPath, g_szCurDir, unicode ) ; return RemoveDirectory( szPath ) ? 0 : -1 ; } int rename( const char *oldfn, const char *newfn ) { static char oldfns[ NFILEN ], newfns[ NFILEN ] ; static TCHAR unicode[ MAX_PATH ], szOldPath[ MAX_PATH ], szNewPath[ MAX_PATH ] ; strcpy( oldfns, oldfn ) ; #ifdef KANJI bufetos( oldfns, strlen( oldfns ) + 1 ) ; #endif sjis2unicode( (LPBYTE) oldfns, unicode, sizeof unicode ) ; rel2abs( szOldPath, g_szCurDir, unicode ) ; strcpy( newfns, newfn ) ; #ifdef KANJI bufetos( newfns, strlen( newfns ) + 1 ) ; #endif sjis2unicode( (LPBYTE) newfns, unicode, sizeof unicode ) ; rel2abs( szNewPath, g_szCurDir, unicode ) ; return MoveFile( szOldPath, szNewPath ) ? 0 : -1 ; } int copy( char *oldfn, char *newfn ) { static char oldfns[ NFILEN ], newfns[ NFILEN ] ; static TCHAR unicode[ MAX_PATH ], szOldPath[ MAX_PATH ], szNewPath[ MAX_PATH ] ; strcpy( oldfns, oldfn ) ; #ifdef KANJI bufetos( oldfns, strlen( oldfns ) + 1 ) ; #endif sjis2unicode( (LPBYTE) oldfns, unicode, sizeof unicode ) ; rel2abs( szOldPath, g_szCurDir, unicode ) ; strcpy( newfns, newfn ) ; #ifdef KANJI bufetos( newfns, strlen( newfns ) + 1 ) ; #endif sjis2unicode( (LPBYTE) newfns, unicode, sizeof unicode ) ; rel2abs( szNewPath, g_szCurDir, unicode ) ; return CopyFile( szOldPath, szNewPath, FALSE ) ? 0 : -1 ; } BUFFER * dired_( char *dirname ) { BUFFER *bp ; BUFFER *findbuffer() ; char **files, **getfilelist() ; int numfiles ; int i ; if ( ( dirname = adjustname( dirname ) ) == NULL ) { ewprintf( "Bad directory name" ) ; return NULL ; } if ( dirname[ strlen( dirname ) - 1 ] != '\\' ) { (VOID) strcat( dirname, "\\" ) ; } if ( ( bp = findbuffer( dirname ) ) == NULL ) { ewprintf( "Could not create buffer" ) ; return NULL ; } if ( bclear( bp ) != TRUE ) { return FALSE ; } if ( ( files = getfilelist( &numfiles, dirname ) ) == NULL ) { ewprintf( "Could not get directory info" ) ; return NULL ; } for ( i = 0 ; i < numfiles ; i ++ ) { (VOID) addline( bp, files[i] ) ; free( files[i] ) ; } free( files ) ; bp->b_dotp = lforw( bp->b_linep ) ; /* go to first line */ if (bp->b_fname != NULL) free(bp->b_fname); if ((bp->b_fname=malloc(strlen(dirname)+1)) != NULL) (VOID) strcpy(bp->b_fname, dirname); #ifdef EXTD_DIR if(bp->b_cwd != NULL) free(bp->b_cwd); bp->b_cwd = NULL; #endif if ( ( bp->b_modes[0] = name_mode( "dired" ) ) == NULL ) { bp->b_modes[0] = &map_table[0] ; ewprintf( "Could not find mode dired" ) ; return NULL ; } bp->b_nmodes = 0 ; return bp ; } int d_makename( LINE *lp, char *fn, int buflen) { char *cp ; int len; if ( llength( lp ) <= 41 ) { return ABORT ; } len = strlen(curbp->b_fname) + llength(lp) - 41; if (buflen <= len) return ABORT; cp = fn; strcpy(cp, curbp->b_fname); cp += strlen(cp); bcopy(lp->l_text + 41, cp, llength(lp) - 41); fn[len] = '\0'; return lgetc(lp, 2) == 'd'; } static int __cdecl #ifdef __BORLANDC__ filelinecmp(const void *x, const void *y) #else filelinecmp(const char **x, const char **y) #endif { register unsigned char *xx, *yy; #ifdef __BORLANDC__ xx = (unsigned char*)&(*(char **)x)[41]; yy = (unsigned char*)&(*(char **)y)[41]; #else xx = (unsigned char*)&(*x)[41]; yy = (unsigned char*)&(*y)[41]; #endif if (*xx != *yy) { /* for "." ".." directories */ if (*xx == '.') return -1; if (*yy == '.') return 1; return(*xx - *yy); } if (*xx) { for (xx++, yy++; *xx && *xx == *yy; xx++, yy++) {} } return(*xx - *yy); } char ** getfilelist( int *numfiles, char *dirname ) { char **files; int maxfiles, n; char filename[NFILEN]; char filenames[NFILEN]; HANDLE hFind = INVALID_HANDLE_VALUE; TCHAR unicode[MAX_PATH], findPath[MAX_PATH]; WIN32_FIND_DATA find; n = 0; /* store n to *numfiles later */ if (strlen(dirname) + 4 > NFILEN) { *numfiles = n; return NULL; } (VOID)strcpy(filename, dirname); (VOID)strcat(filename, "*.*"); maxfiles = 50; /* Magic number here. Should be eliminated */ files = (char **)malloc(maxfiles * sizeof(char *)); if (files) { memset(files, 0, maxfiles * sizeof(char *)); strcpy(filenames, filename); #ifdef KANJI bufetos(filenames, strlen(filenames) + 1); #endif /* Convert the search path to UNICODE and get absolute path */ sjis2unicode((LPBYTE)filenames, unicode, sizeof(unicode)); rel2abs(findPath, g_szCurDir, unicode); /* Add ".." except for root dir */ if (*dirname && strcmp(dirname, "\\")) { if (!mkfileline(files + n, NULL)) { goto failed; } n++; } /* Find first file */ hFind = FindFirstFile(findPath, &find); if (hFind != INVALID_HANDLE_VALUE) { do { if (!lstrcmp(find.cFileName, TEXT("."))) { continue; /* ignore '.' */ } else if (!lstrcmp(find.cFileName, TEXT(".."))) { continue; /* ignore '..' */ } if (n >= maxfiles) { files = (char **)realloc(files, sizeof(char *) * (maxfiles + 20)); if (files == NULL) { goto failed; } maxfiles += 20; } if (mkfileline(files + n, &find)) { n++; } } while (FindNextFile(hFind, &find)); FindClose(hFind); qsort(files, n, sizeof(char *), filelinecmp); *numfiles = n; return files; } else { DWORD err = GetLastError(); if (err == ERROR_NO_MORE_FILES || err == ERROR_FILE_NOT_FOUND) { *numfiles = n; /* 'n' must be 1 */ return files; } } } failed: if (hFind != INVALID_HANDLE_VALUE) { FindClose(hFind); } if (files) { char **pp, **epp; for (pp = files, epp = pp + n ; pp < epp ; pp++) { free(*pp); } free(files); } *numfiles = 0; return NULL; } int mkfileline( LPSTR *lptr, WIN32_FIND_DATA *info ) { SYSTEMTIME st ; FILETIME lft ; int len ; BYTE sjis[ MAX_PATH ] ; TCHAR unicode[ MAX_PATH ], *line = unicode ; line[0] = line[1] = TEXT(' ') ; line[2] = !info || (info->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? TEXT('d') : TEXT('-') ; line[3] = TEXT('r') ; line[4] = !info || (info->dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? TEXT('-') : TEXT('w') ; line[5] = TEXT('-') ; line[6] = info && (info->dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE) ? TEXT('a') : TEXT('-') ; wsprintf( &line[7], TEXT("%13d"), info ? info->nFileSizeLow : 0 ) ; if ( info && FileTimeToLocalFileTime( &info->ftLastWriteTime, &lft ) && FileTimeToSystemTime( &lft, &st ) ) { wsprintf( &line[20], TEXT(" %4d-%02d-%02d %02d:%02d "), st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute ) ; } else { lstrcpy( &line[20], TEXT(" ") ) ; } lstrcpy( &line[41], info ? info->cFileName : TEXT("..") ) ; unicode2sjis( unicode, sjis, sizeof sjis ) ; #ifdef KANJI len = bufstoe_c( sjis, strlen( sjis ) + 1 ) ; #else len = strlen(sjis) + 1; #endif (*lptr) = (LPSTR) malloc( len * sizeof (CHAR) ) ; if ( !*lptr ) { return FALSE ; } strcpy( *lptr, sjis ) ; #ifdef KANJI (VOID) bufstoe( &(*lptr)[41], strlen( &(*lptr)[41] ) + 1 ) ; #endif #if 0 (VOID) fftolower( &(*lptr)[41] ) ; #endif return TRUE ; } /* * Check whether file "dn" is directory. */ int ffisdir( char *dn ) { DWORD attr ; char dns[ NFILEN ] ; TCHAR szPath[ MAX_PATH ], szUnicode[ MAX_PATH ] ; strcpy( dns, dn ) ; #ifdef KANJI bufetos( dns, strlen( dns ) + 1 ) ; #endif sjis2unicode( (LPBYTE) dns, szUnicode, sizeof szUnicode ) ; /* Generate absolute path based on the current directory */ rel2abs( szPath, g_szCurDir, szUnicode ) ; attr = GetFileAttributes( szPath ) ; if ( attr == 0xFFFFFFFF ) { #if 0 DWORD err = GetLastError(); #endif return FALSE ; } return attr & FILE_ATTRIBUTE_DIRECTORY ; } #endif #if 0 /* 90.07.01 Add function to convert strings into lower case by S.Yoshida */ char * fftolower( char *name ) { char *p ; if ( (p = name) != NULL ) { while ( *p != '\0' ) { if ( ISUPPER( *p ) ) { *p = TOLOWER( *p ) ; } p ++ ; } } return name ; } #endif int chdir( const char *dir ) { DWORD attr ; TCHAR unicode[ MAX_PATH ], szPath[ MAX_PATH ] ; sjis2unicode( (LPBYTE) dir, unicode, sizeof unicode ) ; rel2abs( szPath, g_szCurDir, unicode ) ; attr = GetFileAttributes( szPath ) ; if ( attr == 0xFFFFFFFF || !(attr & FILE_ATTRIBUTE_DIRECTORY) ) { return -1 ; } lstrcpy( g_szCurDir, szPath ) ; return 0 ; } #ifndef NO_BACKUP /* * Get file mode of a file fn. */ int fgetfilemode( char *fn ) { DWORD attr ; char fns[ NFILEN ] ; TCHAR unicode[ MAX_PATH ], szPath[ MAX_PATH ] ; strcpy( fns, fn ) ; #ifdef KANJI bufetos( fns, strlen( fns ) + 1 ) ; #endif sjis2unicode( (LPBYTE) fns, unicode, sizeof unicode ) ; rel2abs( szPath, g_szCurDir, unicode ) ; attr = GetFileAttributes( szPath ) ; if ( attr == 0xFFFFFFFF ) { return -1 ; } return (int) attr ; } /* * Set file mode of a file fn to the specified mode. */ VOID fsetfilemode( char *fn, int mode ) { char fns[ NFILEN ] ; TCHAR unicode[ MAX_PATH ], szPath[ MAX_PATH ] ; strcpy( fns, fn ) ; #ifdef KANJI bufetos( fns, strlen( fns ) + 1 ) ; #endif sjis2unicode( (LPBYTE) fns, unicode, sizeof unicode ) ; rel2abs( szPath, g_szCurDir, unicode ) ; SetFileAttributes( szPath, (DWORD) mode ) ; } /* * Rename the file "fname" into a backup * copy. On Unix the backup has the same name as the * original file, with a "~" on the end; this seems to * be newest of the new-speak. The error handling is * all in "file.c". */ int fbackupfile( char *fn ) { int len; char *nname ; VOID strmfe() ; /* 90.07.26 Add by N.Kamei */ char fns[ NFILEN ] ; char nnames[ NFILEN ] ; TCHAR unicode[NFILEN]; TCHAR szFns[ MAX_PATH ] ; TCHAR szNNames[ MAX_PATH ] ; #ifdef EMACS_BACKUP_STYLE len = strlen(fn) + 1 + 1; #else len = strlen(fn) + 4 + 1; #endif if ( ( nname = alloca(len) ) == NULL ) { ewprintf( "Can't get %d bytes", len) ; return ABORT ; } (VOID) strcpy(nname, fn); #ifdef EMACS_BACKUP_STYLE (VOID) strcat(nname, "~"); #else (VOID) strcat(nname, ".bak"); #endif strcpy( nnames, nname ) ; strcpy( fns, fn ) ; #ifdef KANJI bufetos( nnames, strlen( nnames ) + 1 ) ; bufetos( fns, strlen( fns ) + 1 ) ; #endif sjis2unicode( (LPBYTE) nnames, unicode, sizeof unicode ) ; rel2abs( szNNames, g_szCurDir, unicode ) ; sjis2unicode( (LPBYTE) fns, unicode, sizeof unicode ) ; rel2abs( szFns, g_szCurDir, unicode ) ; DeleteFile( szNNames ) ; if ( MoveFile( szFns, szNNames ) < 0 ) return FALSE ; return TRUE ; } #endif /* NO_BACKUP */ #ifdef AUTOSAVE VOID autosave_name(buff, name, buflen) char* buff; char* name; { strcpy(buff, name); if (strlen(name)) { char *fn = rindex(name, '/'); if (fn == NULL) fn = rindex(name, '\\'); if (fn == NULL) fn = rindex(name, ':'); if (fn == NULL){ fn = buff; } else { fn++; } strcpy(&buff[strlen(buff)-strlen(fn)], "#"); strcat(buff, fn); strcat(buff, "#"); } } #endif /* AUTOSAVE */ ng-1.5beta1/sys/win32/mg.ini100644 1750 1750 3027 7204766551 14353 0ustar amurausers;============================================================================= ; mg.ini for Mg for Win32. Translated and Modified by Tillanosoft ; Sep 11, 2000 ; Based on ng.ini by Shigeki Yoshida ; Jan 25, 1991 ;============================================================================= ; ; This is a template for the "mg.ini", the configuration file for Mg ; for Win32. ; ; Add your favorite modification to this file to configure your Mg for ; Win32. ; ; Lines begin with `;' are treated as comments thus skipped. ; ; The following two lines are the default configuration so that they ; are not necessary. They are just for your reference. ; ;(bsmap-mode) ;(global-set-key "\^@" 'set-mark-command) ; ; To show match of parentheses. ; ;(global-set-key ")" 'blink-matching-paren-hack) ;(global-set-key "}" 'blink-matching-paren-hack) ;(global-set-key "]" 'blink-matching-paren-hack) ; ; The following can do the same thing easier. ; ;(set-default-mode 1 "blink") ; ; The following are sample configuration for C-mode ; ;(set-c-argdecl-indent 0) ;(set-c-continued-statement-offset 8) ;(set-c-indent-level 8) ;(set-c-label-offset -4) ;(set-c-tab-always-indent nil) ; ; To leave back-up file... ; ;(make-backup-files t) ; Iconify assign to ctrl-Z ; ;(global-set-key "\^z" 'iconify-frame) ; To make `auto fill mode' on in default. ; ;(set-default-mode 1 "fill") ;; ;; To assign dired-do-shell-command to Enter key at `dired' mode. ;; ;(define-key 'dired "\^m" 'dired-do-shell-command) ng-1.5beta1/sys/win32/mg.rc100644 1750 1750 16712 7231362715 14217 0ustar amurausers//Microsoft Developer Studio generated resource script. // #include "resource.h" #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 2 resource. // #ifndef NO_MFC #include "afxres.h" #else #include #include #ifndef IDC_STATIC #define IDC_STATIC (-1) #endif #endif /* NO_MFC */ ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // English (U.S.) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) #ifdef _WIN32 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US #pragma code_page(1252) #endif //_WIN32 #ifdef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // TEXTINCLUDE // 1 TEXTINCLUDE DISCARDABLE BEGIN "resource.h\0" END 2 TEXTINCLUDE DISCARDABLE BEGIN "#include ""newres.h""\r\n" "\0" END 3 TEXTINCLUDE DISCARDABLE BEGIN "\r\n" "\0" END #endif // APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // Icon // // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. IDI_APPICON ICON DISCARDABLE "appicon.ico" ///////////////////////////////////////////////////////////////////////////// // // Dialog // IDD_STARTUPFILE DIALOG DISCARDABLE 0, 0, 222, 67 STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Path" BEGIN EDITTEXT IDC_STARTUPFILE,6,41,189,14,ES_AUTOHSCROLL PUSHBUTTON "...",IDC_FILEOPENDLG,199,41,15,14 GROUPBOX "Specify the ini file",IDC_STATIC,2,24,217,43 LTEXT "You can specify an arbitrary file as an mg.ini file. The change will be valid from the next execution time of Mg for Win32", IDC_STATIC,4,4,214,17 END IDD_KEY DIALOG DISCARDABLE 0, 0, 222, 67 STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Key" BEGIN LTEXT "Keyboard configuration can be done here.",IDC_STATIC,4, 4,214,17 CONTROL "Use Tab key as a Control key",IDC_CONTROLMAP,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,10,42,134,10 GROUPBOX "Key mapping",IDC_STATIC,2,24,217,43 END IDD_VIEW DIALOG DISCARDABLE 0, 0, 222, 67 STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "View" BEGIN LTEXT "Configure the view of application window.",IDC_STATIC,4, 4,214,10 CONTROL "Show menubar",IDC_SHOWMENUBAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,28,90,10 LTEXT "Execute M-x configure to expose this dialog box when the menubar is not shown.", IDC_STATIC,10,41,200,20 GROUPBOX "Configure the view",IDC_STATIC,2,18,217,49 END IDD_BEEP DIALOG DISCARDABLE 0, 0, 222, 67 STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Beep" BEGIN CONTROL "Use beep sound",IDC_BEEP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,15,67,10 PUSHBUTTON "Play",IDC_PLAY,84,14,21,11 CONTROL "System defined",IDC_MESSAGEBEEP,"Button", BS_AUTORADIOBUTTON,11,34,86,10 COMBOBOX IDC_MESSAGECOMBO,106,31,96,61,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP CONTROL "Wave file",IDC_PLAYSOUND,"Button",BS_AUTORADIOBUTTON,11, 50,94,10 EDITTEXT IDC_SOUNDFILE,106,48,96,14,ES_AUTOHSCROLL PUSHBUTTON "...",IDC_SOUNDBUTTON,204,48,10,14 GROUPBOX "Beep sound configuration",IDC_STATIC,2,2,217,65 END IDD_FONT DIALOG DISCARDABLE 0, 0, 222, 67 STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Font" BEGIN CONTROL "Use &default for Mg for Win32",IDC_NOSPECIFY,"Button", BS_AUTORADIOBUTTON,10,14,158,10 CONTROL "&Specify font and line spacing",IDC_SPECIFY,"Button", BS_AUTORADIOBUTTON,10,27,111,10 LTEXT "&Font:",IDC_STATIC,15,46,20,8 COMBOBOX IDC_FONTNAME,41,44,65,64,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_POINT,109,44,28,86,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP LTEXT "&Line spacing:",IDC_STATIC,144,47,42,8 EDITTEXT IDC_LINESPACE,190,44,14,14,ES_AUTOHSCROLL | ES_NUMBER CONTROL "Spin1",IDC_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_AUTOBUDDY | UDS_ARROWKEYS,203,44,9,14 GROUPBOX "Configuration for Font",IDC_STATIC,2,2,217,65 END ///////////////////////////////////////////////////////////////////////////// // // Bitmap // IDB_REBAR BITMAP DISCARDABLE "rebar.bmp" IDB_BUTTONS BITMAP DISCARDABLE "buttons.bmp" ///////////////////////////////////////////////////////////////////////////// // // Toolbar // IDB_BUTTONS TOOLBAR DISCARDABLE 16, 16 BEGIN BUTTON IDBN_MARK BUTTON IDBN_NEXT BUTTON IDBN_PRIOR END ///////////////////////////////////////////////////////////////////////////// // // Data // IDR_PPCMENU SHMENUBAR DISCARDABLE BEGIN IDR_PPCMENU, 4, I_IMAGENONE, IDM_MENUITEM1, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE, IDS_FILE, 0, 0, 0, IDC_MARK, TBSTATE_ENABLED, TBSTYLE_AUTOSIZE, 0, 0, 1, 2, IDC_PRIOR, TBSTATE_ENABLED, TBSTYLE_AUTOSIZE, 0, 0, 1, 1, IDC_NEXT, TBSTATE_ENABLED, TBSTYLE_AUTOSIZE, 0, 0, 1, END ///////////////////////////////////////////////////////////////////////////// // // Menu // IDR_MAINMENU MENU DISCARDABLE BEGIN POPUP "File" BEGIN MENUITEM "&Option...", IDC_OPTION MENUITEM "E&xit", IDC_CLOSE END END IDR_PPCMENU MENU DISCARDABLE BEGIN POPUP "File" BEGIN MENUITEM "Option...", IDC_OPTION MENUITEM "Exit", IDC_CLOSE END END ///////////////////////////////////////////////////////////////////////////// // // String Table // STRINGTABLE DISCARDABLE BEGIN IDS_FILE "File" IDS_CONFIGNAME "Mg for Win32 properties" IDS_OK "OK" IDS_ICONASTERISK "Information" IDS_ICONEXCLAMATION "Caution" IDS_ICONHAND "Error" IDS_ICONQUESTION "Question" IDS_CUT "Cut(C-w)" IDS_COPY "Copy(M-w)" IDS_PASTE "Paste(C-y)" IDS_MARK "Mark(C-@)" IDS_NEXT "Scroll up(C-v)" IDS_PRIOR "Scroll down(M-v)" END #endif // English (U.S.) resources ///////////////////////////////////////////////////////////////////////////// #ifndef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 3 resource. // ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED ng-1.5beta1/sys/win32/newres.h100644 1750 1750 2372 7204766551 14725 0ustar amurausers#ifndef __NEWRES_H__ #define __NEWRES_H__ #ifndef _WIN32_WCE #include "afxres.h" /* The following are for CE resources. Just define for the compilation. */ #define I_IMAGENONE (-2) #define TBSTATE_ENABLED 0x04 #define TBSTYLE_DROPDOWN 0x0008 #define TBSTYLE_AUTOSIZE 0x0010 #endif #if !defined(UNDER_CE) #define UNDER_CE _WIN32_WCE #endif #if defined(_WIN32_WCE) #if !defined(WCEOLE_ENABLE_DIALOGEX) #define DIALOGEX DIALOG DISCARDABLE #endif #include #define SHMENUBAR RCDATA #if (WINVER >= 0x0400) /* */ #define SS_SUNKEN 0x00001000L #else #define SS_SUNKEN 0 #endif #if defined(WIN32_PLATFORM_PSPC) && (_WIN32_WCE >= 300) #include #define AFXCE_IDR_SCRATCH_SHMENU 28700 #else #define I_IMAGENONE (-2) #define NOMENU 0xFFFF #define IDS_SHNEW 1 #define IDM_SHAREDNEW 10 #define IDM_SHAREDNEWDEFAULT 11 #endif // _WIN32_WCE_PSPC #define AFXCE_IDD_SAVEMODIFIEDDLG 28701 #endif // _WIN32_WCE #ifdef RC_INVOKED #ifndef _INC_WINDOWS #define _INC_WINDOWS #include "winuser.h" // extract from windows header #if 0 #include "winver.h" #endif #endif #endif #ifdef IDC_STATIC #undef IDC_STATIC #endif #define IDC_STATIC (-1) #endif //__NEWRES_H__ ng-1.5beta1/sys/win32/ng.dsp100644 1750 1750 175360 7303500513 14415 0ustar amurausers# Microsoft Developer Studio Project File - Name="ng" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 5.00 # ** W ** # TARGTYPE "Win32 (WCE x86em) Application" 0x0b01 # TARGTYPE "Win32 (x86) Application" 0x0101 # TARGTYPE "Win32 (WCE MIPS) Application" 0x0a01 # TARGTYPE "Win32 (WCE SH) Application" 0x0901 CFG=ng - Win32 Debug NO UNICODE !MESSAGE L頒恩箕荷B 面炳灼個靄湶爪 NMAKE gpB !MESSAGE [匆弧Р夢現累按] 栽歡gpタs !MESSAGE !MESSAGE NMAKE /f "ng.mak". !MESSAGE !MESSAGE NMAKE タs\w !MESSAGE 栽歡 弉渡雇`B: !MESSAGE !MESSAGE NMAKE /f "ng.mak" CFG="ng - Win32 Debug NO UNICODE" !MESSAGE !MESSAGE I\繁湶爪 唹爪: !MESSAGE !MESSAGE "ng - Win32 Release" ("Win32 (x86) Application" p) !MESSAGE "ng - Win32 Debug" ("Win32 (x86) Application" p) !MESSAGE "ng - Win32 (WCE x86em) Release" ("Win32 (WCE x86em) Application" p) !MESSAGE "ng - Win32 (WCE x86em) Debug" ("Win32 (WCE x86em) Application" p) !MESSAGE "ng - Win32 (WCE MIPS) Release" ("Win32 (WCE MIPS) Application" p) !MESSAGE "ng - Win32 (WCE MIPS) Debug" ("Win32 (WCE MIPS) Application" p) !MESSAGE "ng - Win32 (WCE SH) Release" ("Win32 (WCE SH) Application" p) !MESSAGE "ng - Win32 (WCE SH) Debug" ("Win32 (WCE SH) Application" p) !MESSAGE "ng - Win32 Debug NO UNICODE" ("Win32 (x86) Application" p) !MESSAGE "ng - Win32 Release NO UNICODE" ("Win32 (x86) Application" p) !MESSAGE # Begin Project # PROP Scc_ProjName ""$/ng", MBAAAAAA" # PROP Scc_LocalPath "." !IF "$(CFG)" == "ng - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Release" # PROP Intermediate_Dir "Release" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" F90=df.exe # ADD BASE F90 /include:"Release/" # ADD F90 /include:"Release/" CPP=cl.exe # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c # ADD CPP /nologo /MT /W3 /GX /O2 /I "./sys/win32" /I "./sys/default" /I "." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "STRICT" /D "_UNICODE" /D "UNICODE" /YX /FD /c MTL=midl.exe # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 RSC=rc.exe # ADD BASE RSC /l 0x411 /d "NDEBUG" # ADD RSC /l 0x411 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib imm32.lib winmm.lib /nologo /subsystem:windows /machine:I386 !ELSEIF "$(CFG)" == "ng - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "Debug" # PROP Intermediate_Dir "Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" F90=df.exe # ADD BASE F90 /include:"Debug/" # ADD F90 /include:"Debug/" CPP=cl.exe # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c # ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "./sys/win32" /I "./sys/default" /I "." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "STRICT" /D "_UNICODE" /D "UNICODE" /YX /FD /c MTL=midl.exe # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 RSC=rc.exe # ADD BASE RSC /l 0x411 /d "_DEBUG" # ADD RSC /l 0x411 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib imm32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept # SUBTRACT LINK32 /nodefaultlib !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "x86emRel" # PROP BASE Intermediate_Dir "x86emRel" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "x86emRel" # PROP Intermediate_Dir "x86emRel" # PROP Target_Dir "" EMPFILE=empfile.exe # ADD BASE EMPFILE -COPY # ADD EMPFILE -COPY LINK32=link.exe # ADD BASE LINK32 commctrl.lib coredll.lib /nologo /subsystem:windows /machine:I386 /windowsce:emulation # ADD LINK32 commctrl.lib coredll.lib /nologo /subsystem:windows /machine:I386 /windowsce:emulation BSC32=bscmake.exe # ADD BASE BSC32 /NOLOGO # ADD BSC32 /NOLOGO MTL=midl.exe # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 RSC=rc.exe # ADD BASE RSC /l 0x411 /d UNDER_CE=$(CEVersion) /d "UNICODE" /d "_UNICODE" /d "WIN32" /d "STRICT" /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "_WIN32_WCE_EMULATION" /d "INTERNATIONAL" /d "USA" /d "INTLMSG_CODEPAGE" /d "NDEBUG" # ADD RSC /l 0x411 /d UNDER_CE=$(CEVersion) /d "UNICODE" /d "_UNICODE" /d "WIN32" /d "STRICT" /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "_WIN32_WCE_EMULATION" /d "INTERNATIONAL" /d "USA" /d "INTLMSG_CODEPAGE" /d "NDEBUG" CPP=cl.exe # ADD BASE CPP /nologo /ML /W3 /O2 /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "WIN32" /D "STRICT" /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D "_WIN32_WCE_EMULATION" /D "INTERNATIONAL" /D "USA" /D "INTLMSG_CODEPAGE" /D "NDEBUG" /D "x86" /D "i486" /D "_x86_" /YX /c # ADD CPP /nologo /MT /W3 /O2 /I "./sys/win32" /I "./sys/default" /I "." /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "WIN32" /D "STRICT" /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D "_WIN32_WCE_EMULATION" /D "INTERNATIONAL" /D "USA" /D "INTLMSG_CODEPAGE" /D "NDEBUG" /D "x86" /D "i486" /D "_x86_" /YX /c !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "x86emDbg" # PROP BASE Intermediate_Dir "x86emDbg" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "x86emDbg" # PROP Intermediate_Dir "x86emDbg" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" EMPFILE=empfile.exe # ADD BASE EMPFILE -COPY # ADD EMPFILE -COPY LINK32=link.exe # ADD BASE LINK32 commctrl.lib coredll.lib /nologo /subsystem:windows /debug /machine:I386 /windowsce:emulation # ADD LINK32 commctrl.lib coredll.lib /nologo /subsystem:windows /debug /machine:I386 /windowsce:emulation BSC32=bscmake.exe # ADD BASE BSC32 /NOLOGO # ADD BSC32 /NOLOGO MTL=midl.exe # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 RSC=rc.exe # ADD BASE RSC /l 0x411 /d UNDER_CE=$(CEVersion) /d "UNICODE" /d "_UNICODE" /d "WIN32" /d "STRICT" /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "_WIN32_WCE_EMULATION" /d "INTERNATIONAL" /d "USA" /d "INTLMSG_CODEPAGE" /d "_DEBUG" /d "x86" /d "i486" /d "_x86_" # ADD RSC /l 0x411 /d UNDER_CE=$(CEVersion) /d "UNICODE" /d "_UNICODE" /d "WIN32" /d "STRICT" /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "_WIN32_WCE_EMULATION" /d "INTERNATIONAL" /d "USA" /d "INTLMSG_CODEPAGE" /d "_DEBUG" /d "x86" /d "i486" /d "_x86_" CPP=cl.exe # ADD BASE CPP /nologo /MLd /W3 /Gm /Zi /Od /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "WIN32" /D "STRICT" /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D "_WIN32_WCE_EMULATION" /D "INTERNATIONAL" /D "USA" /D "INTLMSG_CODEPAGE" /D "_DEBUG" /D "x86" /D "i486" /D "_x86_" /YX /c # ADD CPP /nologo /MTd /W3 /Gm /Zi /Od /I "./sys/win32" /I "./sys/default" /I "." /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "_UNICODE" /D "WIN32" /D "STRICT" /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D "_WIN32_WCE_EMULATION" /D "INTERNATIONAL" /D "USA" /D "INTLMSG_CODEPAGE" /D "_DEBUG" /D "x86" /D "i486" /D "_x86_" /YX /c !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "WMIPSRel" # PROP BASE Intermediate_Dir "WMIPSRel" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "WMIPSRel" # PROP Intermediate_Dir "WMIPSRel" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" PFILE=pfile.exe # ADD BASE PFILE COPY # ADD PFILE COPY LINK32=link.exe # ADD BASE LINK32 commctrl.lib coredll.lib /nologo /machine:MIPS /subsystem:$(CESubsystem) # SUBTRACT BASE LINK32 /pdb:none /nodefaultlib # ADD LINK32 commctrl.lib coredll.lib /nologo /machine:MIPS /subsystem:$(CESubsystem) # SUBTRACT LINK32 /pdb:none /nodefaultlib BSC32=bscmake.exe # ADD BASE BSC32 /NOLOGO # ADD BSC32 /NOLOGO MTL=midl.exe # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 RSC=rc.exe # ADD BASE RSC /l 0x411 /r /d "MIPS" /d "_MIPS_" /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "UNICODE" /d "NDEBUG" # ADD RSC /l 0x411 /r /d "MIPS" /d "_MIPS_" /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "UNICODE" /d "NDEBUG" CPP=clmips.exe # ADD BASE CPP /nologo /ML /W3 /O2 /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D "NDEBUG" /D "MIPS" /D "_MIPS_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /YX /QMRWCE /c # ADD CPP /nologo /MT /W3 /O2 /I "./sys/win32" /I "./sys/default" /I "." /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D "NDEBUG" /D "MIPS" /D "_MIPS_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "STRICT" /YX /QMRWCE /c !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "WMIPSDbg" # PROP BASE Intermediate_Dir "WMIPSDbg" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "WMIPSDbg" # PROP Intermediate_Dir "WMIPSDbg" # PROP Target_Dir "" PFILE=pfile.exe # ADD BASE PFILE COPY # ADD PFILE COPY LINK32=link.exe # ADD BASE LINK32 commctrl.lib coredll.lib /nologo /debug /machine:MIPS /subsystem:$(CESubsystem) # SUBTRACT BASE LINK32 /pdb:none /nodefaultlib # ADD LINK32 commctrl.lib coredll.lib /nologo /debug /machine:MIPS /subsystem:$(CESubsystem) # SUBTRACT LINK32 /pdb:none /nodefaultlib BSC32=bscmake.exe # ADD BASE BSC32 /NOLOGO # ADD BSC32 /NOLOGO MTL=midl.exe # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 RSC=rc.exe # ADD BASE RSC /l 0x411 /r /d "MIPS" /d "_MIPS_" /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "UNICODE" /d "DEBUG" # ADD RSC /l 0x411 /r /d "MIPS" /d "_MIPS_" /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "UNICODE" /d "DEBUG" CPP=clmips.exe # ADD BASE CPP /nologo /MLd /W3 /Zi /Od /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D "DEBUG" /D "MIPS" /D "_MIPS_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /YX /QMRWCE /c # ADD CPP /nologo /MTd /W3 /Zi /Od /I "./sys/win32" /I "./sys/default" /I "." /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D "DEBUG" /D "MIPS" /D "_MIPS_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "STRICT" /YX /QMRWCE /c !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "WCESHRel" # PROP BASE Intermediate_Dir "WCESHRel" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "WCESHRel" # PROP Intermediate_Dir "WCESHRel" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" PFILE=pfile.exe # ADD BASE PFILE COPY # ADD PFILE COPY LINK32=link.exe # ADD BASE LINK32 commctrl.lib coredll.lib /nologo /machine:SH3 /subsystem:$(CESubsystem) # SUBTRACT BASE LINK32 /pdb:none /nodefaultlib # ADD LINK32 commctrl.lib coredll.lib /nologo /machine:SH3 /subsystem:$(CESubsystem) # SUBTRACT LINK32 /pdb:none /nodefaultlib BSC32=bscmake.exe # ADD BASE BSC32 /NOLOGO # ADD BSC32 /NOLOGO MTL=midl.exe # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 RSC=rc.exe # ADD BASE RSC /l 0x411 /r /d "SHx" /d "SH3" /d "_SH3_" /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "UNICODE" /d "NDEBUG" # ADD RSC /l 0x411 /r /d "SHx" /d "SH3" /d "_SH3_" /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "UNICODE" /d "NDEBUG" CPP=shcl.exe # ADD BASE CPP /nologo /ML /W3 /O2 /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D "NDEBUG" /D "SHx" /D "SH3" /D "_SH3_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /YX /c # ADD CPP /nologo /MT /W3 /O2 /I "./sys/win32" /I "./sys/default" /I "." /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D "NDEBUG" /D "SHx" /D "SH3" /D "_SH3_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "STRICT" /YX /c !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "WCESHDbg" # PROP BASE Intermediate_Dir "WCESHDbg" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "WCESHDbg" # PROP Intermediate_Dir "WCESHDbg" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" PFILE=pfile.exe # ADD BASE PFILE COPY # ADD PFILE COPY LINK32=link.exe # ADD BASE LINK32 commctrl.lib coredll.lib /nologo /debug /machine:SH3 /subsystem:$(CESubsystem) # SUBTRACT BASE LINK32 /pdb:none /nodefaultlib # ADD LINK32 commctrl.lib coredll.lib /nologo /debug /machine:SH3 /subsystem:$(CESubsystem) # SUBTRACT LINK32 /pdb:none /nodefaultlib BSC32=bscmake.exe # ADD BASE BSC32 /NOLOGO # ADD BSC32 /NOLOGO MTL=midl.exe # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 RSC=rc.exe # ADD BASE RSC /l 0x411 /r /d "SHx" /d "SH3" /d "_SH3_" /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "UNICODE" /d "DEBUG" # ADD RSC /l 0x411 /r /d "SHx" /d "SH3" /d "_SH3_" /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "UNICODE" /d "DEBUG" CPP=shcl.exe # ADD BASE CPP /nologo /MLd /W3 /Zi /Od /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D "DEBUG" /D "SHx" /D "SH3" /D "_SH3_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /YX /c # ADD CPP /nologo /MTd /W3 /Zi /Od /I "./sys/win32" /I "./sys/default" /I "." /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D "DEBUG" /D "SHx" /D "SH3" /D "_SH3_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /D "STRICT" /YX /c !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "ng___Win" # PROP BASE Intermediate_Dir "ng___Win" # PROP BASE Ignore_Export_Lib 0 # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "NOUNIDbg" # PROP Intermediate_Dir "NOUNIDbg" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" F90=df.exe # ADD BASE F90 /include:"ng___Win/" # ADD F90 /include:"NOUNIDbg/" CPP=cl.exe # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "sys/win32" /I "sys/default" /I "." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "STRICT" /D "_UNICODE" /D "UNICODE" /YX /FD /c # ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "./sys/win32" /I "./sys/default" /I "." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "STRICT" /YX /FD /c MTL=midl.exe # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32 RSC=rc.exe # ADD BASE RSC /l 0x411 /d "_DEBUG" # ADD RSC /l 0x411 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib imm32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept # SUBTRACT BASE LINK32 /nodefaultlib # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib imm32.lib winmm.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept # SUBTRACT LINK32 /nodefaultlib !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "ng___Wi0" # PROP BASE Intermediate_Dir "ng___Wi0" # PROP BASE Ignore_Export_Lib 0 # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "NOUNIRel" # PROP Intermediate_Dir "NOUNIRel" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" F90=df.exe # ADD BASE F90 /include:"ng___Wi0/" # ADD F90 /include:"NOUNIRel/" CPP=cl.exe # ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "sys/win32" /I "sys/default" /I "." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "STRICT" /D "_UNICODE" /D "UNICODE" /YX /FD /c # ADD CPP /nologo /MT /W3 /GX /O2 /I "./sys/win32" /I "./sys/default" /I "." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "STRICT" /YX /FD /c MTL=midl.exe # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32 RSC=rc.exe # ADD BASE RSC /l 0x411 /d "NDEBUG" # ADD RSC /l 0x411 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib imm32.lib winmm.lib /nologo /subsystem:windows /machine:I386 # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib imm32.lib winmm.lib /nologo /subsystem:windows /machine:I386 !ENDIF # Begin Target # Name "ng - Win32 Release" # Name "ng - Win32 Debug" # Name "ng - Win32 (WCE x86em) Release" # Name "ng - Win32 (WCE x86em) Debug" # Name "ng - Win32 (WCE MIPS) Release" # Name "ng - Win32 (WCE MIPS) Debug" # Name "ng - Win32 (WCE SH) Release" # Name "ng - Win32 (WCE SH) Debug" # Name "ng - Win32 Debug NO UNICODE" # Name "ng - Win32 Release NO UNICODE" # Begin Source File SOURCE=.\sys\win32\appicon.ico # End Source File # Begin Source File SOURCE=.\autosave.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\basic.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_BASIC=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_BASIC=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_BASIC=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\buffer.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_BUFFE=\ ".\config.h"\ ".\def.h"\ ".\kbd.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_BUFFE=\ ".\config.h"\ ".\def.h"\ ".\kbd.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_BUFFE=\ ".\config.h"\ ".\def.h"\ ".\kbd.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\sys\win32\buttons.bmp # End Source File # Begin Source File SOURCE=.\sys\win32\cefep.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\sys\win32\cefep.h # End Source File # Begin Source File SOURCE=.\sys\default\chrdef.h # End Source File # Begin Source File SOURCE=.\sys\default\cinfo.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_CINFO=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_CINFO=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_CINFO=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\cmode.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_CMODE=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_CMODE=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_CMODE=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\complt.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_COMPL=\ ".\complt.h"\ ".\config.h"\ ".\def.h"\ ".\kbd.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_COMPL=\ ".\complt.h"\ ".\config.h"\ ".\def.h"\ ".\kbd.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_COMPL=\ ".\complt.h"\ ".\config.h"\ ".\def.h"\ ".\kbd.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\complt.h # End Source File # Begin Source File SOURCE=.\config.h # End Source File # Begin Source File SOURCE=.\def.h # End Source File # Begin Source File SOURCE=.\dir.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_DIR_C=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_DIR_C=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_DIR_C=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\dired.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_DIRED=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_DIRED=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_DIRED=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\display.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_DISPL=\ ".\config.h"\ ".\def.h"\ ".\kbd.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_DISPL=\ ".\config.h"\ ".\def.h"\ ".\kbd.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_DISPL=\ ".\config.h"\ ".\def.h"\ ".\kbd.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\echo.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_ECHO_=\ ".\complt.h"\ ".\config.h"\ ".\def.h"\ ".\key.h"\ ".\macro.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_ECHO_=\ ".\complt.h"\ ".\config.h"\ ".\def.h"\ ".\key.h"\ ".\macro.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_ECHO_=\ ".\complt.h"\ ".\config.h"\ ".\def.h"\ ".\key.h"\ ".\macro.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\extend.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_EXTEN=\ ".\config.h"\ ".\def.h"\ ".\kbd.h"\ ".\key.h"\ ".\macro.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_EXTEN=\ ".\config.h"\ ".\def.h"\ ".\kbd.h"\ ".\key.h"\ ".\macro.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_EXTEN=\ ".\config.h"\ ".\def.h"\ ".\kbd.h"\ ".\key.h"\ ".\macro.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\file.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_FILE_=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_FILE_=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_FILE_=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\sys\win32\fileio.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_FILEI=\ ".\config.h"\ ".\def.h"\ ".\kbd.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ ".\sys\win32\tools.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_FILEI=\ ".\config.h"\ ".\def.h"\ ".\kbd.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ ".\sys\win32\tools.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_FILEI=\ ".\config.h"\ ".\def.h"\ ".\kbd.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ ".\sys\win32\tools.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\help.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_HELP_=\ ".\config.h"\ ".\def.h"\ ".\kbd.h"\ ".\key.h"\ ".\macro.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_HELP_=\ ".\config.h"\ ".\def.h"\ ".\kbd.h"\ ".\key.h"\ ".\macro.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_HELP_=\ ".\config.h"\ ".\def.h"\ ".\kbd.h"\ ".\key.h"\ ".\macro.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\jump.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\kanji.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_KANJI=\ ".\config.h"\ ".\def.h"\ ".\kinit.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_KANJI=\ ".\config.h"\ ".\def.h"\ ".\kinit.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_KANJI=\ ".\config.h"\ ".\def.h"\ ".\kinit.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\kbd.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_KBD_C=\ ".\config.h"\ ".\def.h"\ ".\kbd.h"\ ".\key.h"\ ".\macro.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_KBD_C=\ ".\config.h"\ ".\def.h"\ ".\kbd.h"\ ".\key.h"\ ".\macro.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_KBD_C=\ ".\config.h"\ ".\def.h"\ ".\kbd.h"\ ".\key.h"\ ".\macro.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\kbd.h # End Source File # Begin Source File SOURCE=.\key.h # End Source File # Begin Source File SOURCE=.\keymap.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_KEYMA=\ ".\config.h"\ ".\def.h"\ ".\kbd.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ NODEP_CPP_KEYMA=\ ".\amiga_maps.c"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_KEYMA=\ ".\config.h"\ ".\def.h"\ ".\kbd.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ NODEP_CPP_KEYMA=\ ".\amiga_maps.c"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_KEYMA=\ ".\config.h"\ ".\def.h"\ ".\kbd.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ NODEP_CPP_KEYMA=\ ".\amiga_maps.c"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\kinit.h # End Source File # Begin Source File SOURCE=.\kinsoku.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_KINSO=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_KINSO=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_KINSO=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\line.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_LINE_=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_LINE_=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_LINE_=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\macro.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_MACRO=\ ".\config.h"\ ".\def.h"\ ".\key.h"\ ".\macro.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_MACRO=\ ".\config.h"\ ".\def.h"\ ".\key.h"\ ".\macro.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_MACRO=\ ".\config.h"\ ".\def.h"\ ".\key.h"\ ".\macro.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\macro.h # End Source File # Begin Source File SOURCE=.\main.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_MAIN_=\ ".\config.h"\ ".\def.h"\ ".\macro.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_MAIN_=\ ".\config.h"\ ".\def.h"\ ".\macro.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_MAIN_=\ ".\config.h"\ ".\def.h"\ ".\macro.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\match.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_MATCH=\ ".\config.h"\ ".\def.h"\ ".\key.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_MATCH=\ ".\config.h"\ ".\def.h"\ ".\key.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_MATCH=\ ".\config.h"\ ".\def.h"\ ".\key.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\modes.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_MODES=\ ".\config.h"\ ".\def.h"\ ".\kbd.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_MODES=\ ".\config.h"\ ".\def.h"\ ".\kbd.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_MODES=\ ".\config.h"\ ".\def.h"\ ".\kbd.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\sys\win32\newres.h # End Source File # Begin Source File SOURCE=.\sys\win32\ng.rc !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\paragraph.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_PARAG=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_PARAG=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_PARAG=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\random.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_RANDO=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_RANDO=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_RANDO=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\re_search.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_RE_SE=\ ".\config.h"\ ".\def.h"\ ".\macro.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ NODEP_CPP_RE_SE=\ ".\regex.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_RE_SE=\ ".\config.h"\ ".\def.h"\ ".\macro.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ NODEP_CPP_RE_SE=\ ".\regex.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_RE_SE=\ ".\config.h"\ ".\def.h"\ ".\macro.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ NODEP_CPP_RE_SE=\ ".\regex.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\sys\win32\rebar.bmp # End Source File # Begin Source File SOURCE=.\regex.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_REGEX=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ NODEP_CPP_REGEX=\ ".\buffer.h"\ ".\lisp.h"\ ".\proto.h"\ ".\regex.h"\ ".\syntax.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_REGEX=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ NODEP_CPP_REGEX=\ ".\buffer.h"\ ".\lisp.h"\ ".\proto.h"\ ".\regex.h"\ ".\syntax.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_REGEX=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ NODEP_CPP_REGEX=\ ".\buffer.h"\ ".\lisp.h"\ ".\proto.h"\ ".\regex.h"\ ".\syntax.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\regex.h # End Source File # Begin Source File SOURCE=.\region.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_REGIO=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_REGIO=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_REGIO=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\sys\win32\resource.h # End Source File # Begin Source File SOURCE=.\search.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_SEARC=\ ".\config.h"\ ".\def.h"\ ".\macro.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_SEARC=\ ".\config.h"\ ".\def.h"\ ".\macro.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_SEARC=\ ".\config.h"\ ".\def.h"\ ".\macro.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\shell.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_SHELL=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_SHELL=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_SHELL=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\skg.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\sys\win32\spawn.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_SPAWN=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_SPAWN=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_SPAWN=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\sys\win32\sysdef.h # End Source File # Begin Source File SOURCE=.\sys\win32\tools.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_TOOLS=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ ".\sys\win32\tools.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_TOOLS=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ ".\sys\win32\tools.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_TOOLS=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ ".\sys\win32\tools.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\sys\win32\tools.h # End Source File # Begin Source File SOURCE=.\sys\win32\tty.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_TTY_C=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ ".\sys\win32\tools.h"\ ".\sys\win32\winmain.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_TTY_C=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ ".\sys\win32\tools.h"\ ".\sys\win32\winmain.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_TTY_C=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ ".\sys\win32\tools.h"\ ".\sys\win32\winmain.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\sys\win32\ttyctrl.cpp !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_TTYCT=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ ".\sys\win32\tools.h"\ ".\sys\win32\ttyctrl.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_TTYCT=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ ".\sys\win32\tools.h"\ ".\sys\win32\ttyctrl.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_TTYCT=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ ".\sys\win32\tools.h"\ ".\sys\win32\ttyctrl.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\sys\win32\ttyctrl.h # End Source File # Begin Source File SOURCE=.\sys\default\ttydef.h # End Source File # Begin Source File SOURCE=.\sys\win32\ttyio.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_TTYIO=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ ".\sys\win32\tools.h"\ ".\sys\win32\winmain.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_TTYIO=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ ".\sys\win32\tools.h"\ ".\sys\win32\winmain.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_TTYIO=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ ".\sys\win32\tools.h"\ ".\sys\win32\winmain.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\undo.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\undo.h # End Source File # Begin Source File SOURCE=.\version.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_VERSI=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_VERSI=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_VERSI=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\window.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_WINDO=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_WINDO=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_WINDO=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\sys\win32\winmain.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_WINMA=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ ".\sys\win32\tools.h"\ ".\sys\win32\ttyctrl.h"\ ".\sys\win32\winmain.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_WINMA=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ ".\sys\win32\tools.h"\ ".\sys\win32\ttyctrl.h"\ ".\sys\win32\winmain.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_WINMA=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ ".\sys\win32\tools.h"\ ".\sys\win32\ttyctrl.h"\ ".\sys\win32\winmain.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # Begin Source File SOURCE=.\sys\win32\winmain.h # End Source File # Begin Source File SOURCE=.\word.c !IF "$(CFG)" == "ng - Win32 Release" !ELSEIF "$(CFG)" == "ng - Win32 Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Release" !ELSEIF "$(CFG)" == "ng - Win32 (WCE x86em) Debug" DEP_CPP_WORD_=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Release" DEP_CPP_WORD_=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE MIPS) Debug" !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Release" DEP_CPP_WORD_=\ ".\config.h"\ ".\def.h"\ ".\sys\default\chrdef.h"\ ".\sys\default\ttydef.h"\ ".\sys\win32\sysdef.h"\ !ELSEIF "$(CFG)" == "ng - Win32 (WCE SH) Debug" !ELSEIF "$(CFG)" == "ng - Win32 Debug NO UNICODE" !ELSEIF "$(CFG)" == "ng - Win32 Release NO UNICODE" !ENDIF # End Source File # End Target # End Project ng-1.5beta1/sys/win32/ng.dsw100644 1750 1750 1156 7126003717 14362 0ustar amurausersMicrosoft Developer Studio Workspace File, Format Version 5.00 # x: 目宛粛澎 箕荷 W! ############################################################################### Project: "ng"=.\ng.dsp - Package Owner=<4> Package=<5> {{{ begin source code control "$/ng", MBAAAAAA . end source code control }}} Package=<4> {{{ }}} ############################################################################### Global: Package=<5> {{{ }}} Package=<3> {{{ }}} ############################################################################### ng-1.5beta1/sys/win32/ng.ini100644 1750 1750 6455 7204766552 14365 0ustar amurausers; $Id: ng.ini,v 1.3 2000/11/16 14:21:30 amura Exp $ ;============================================================================= ; ng.ini for Ng 1.3 Win32 version. 1991.01.25 ; gc (shige@csk.CO.JP) ; Sample added 1999.04.15 ; Tillanosoft ;============================================================================= ; ; Ng 1.3 Win32 o[Wpt@C "ng.ini" Tv ; B ; ; At@CQlKv ; ANG AHOME wfBNg ; B ; (Ng for Win32 M-x configure ng.ini w ; B by Tillanosoft) ; ; ';' nsRgsBKvs ';' ; B ; ; QsftHgAKvA ; ヲB ; ;(bsmap-mode) ;(global-set-key "\^\\" 'set-mark-command) ; ; ot@CR[h EUC AB ; ;(set-default-fileio-code 'euc) ;(set-kanji-fileio-code 'euc) ; ; s '>' As '<' A ; B ; ;(add-kinsoku-bol-chars ">") ;(add-kinsoku-eol-chars "<") ; ; su^vu_vB ; ;(delete-bol-kinsoku-chars "^_") ; ; ゥI\ヲB ; ;(global-set-key ")" 'blink-matching-paren-hack) ;(global-set-key "}" 'blink-matching-paren-hack) ;(global-set-key "]" 'blink-matching-paren-hack) ;; ;; Ll(by Tillanosoft) ; ;; blink [hftHgIB ;(set-default-mode 1 "blink") ; ; ESC C-s/C-r K\B ; ;(global-set-key "\^[\^s" 're-search-forward) ;(global-set-key "\^[\^r" 're-search-backward) ; ; C [hI C X^C ; B ; ;(set-c-argdecl-indent 0) ;(set-c-continued-statement-offset 8) ;(set-c-indent-level 8) ;(set-c-label-offset -4) ;(set-c-tab-always-indent nil) ; ; FEP ゥ@\LB ; (set-fep-control t) ; ;;IMEIItC-oB(by Tillanosoft) ;(global-set-key "\^o" 'fep-toggle) ; ;;C-z ACRB(by amura) ;(global-set-key "\^z" 'iconify-frame) ; ; J-3100 J[\ubNJ[\_ANg I ; J[\pB ; ;(j31-set-cursor "0,15,n,t") ; ;; sTv Tillanosoft TvB ;; ;;obNAbvt@C ;(make-backup-files t) ;; auto-fill-mode ftHgIB ;(set-default-mode 1 "fill") ;; ;; help C-x h ;; ;(global-set-key "\^xh" 'help) ;; ;; dired A^[L[Adired-do-shell-command ;; ;(define-key 'dired "\^m" 'dired-do-shell-command) ;; ;; bsmap g C-h uvA ;; DEL Windows KuEvB ;; ;(bsmap-mode 0) ;(global-set-key "\^h" 'delete-backward-char) ;(global-set-key "\^?" 'delete-char) ng-1.5beta1/sys/win32/ng.rc100644 1750 1750 16153 7231362715 14217 0ustar amurausers//Microsoft Developer Studio generated resource script. // #include "resource.h" #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 2 resource. // #ifndef NO_MFC #include "afxres.h" #else #include #include #ifndef IDC_STATIC #define IDC_STATIC (-1) #endif #endif /* NO_MFC */ ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// // Japanese resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) #ifdef _WIN32 LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT #pragma code_page(932) #endif //_WIN32 #ifdef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // TEXTINCLUDE // 1 TEXTINCLUDE DISCARDABLE BEGIN "resource.h\0" END 2 TEXTINCLUDE DISCARDABLE BEGIN "#include ""afxres.h""\r\n" "\0" END 3 TEXTINCLUDE DISCARDABLE BEGIN "\r\n" "\0" END #endif // APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // Icon // // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. IDI_APPICON ICON DISCARDABLE "appicon.ico" ///////////////////////////////////////////////////////////////////////////// // // Dialog // IDD_STARTUPFILE DIALOG DISCARDABLE 0, 0, 222, 67 STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "pX" FONT 9, "lr oSVbN" BEGIN EDITTEXT IDC_STARTUPFILE,6,41,189,14,ES_AUTOHSCROLL PUSHBUTTON "...",IDC_FILEOPENDLG,199,41,15,14 GROUPBOX "t@Cw",IDC_STATIC,2,24,217,43 LTEXT "t@Cwt@CpBwXANg for Win32 NVt@CgB", IDC_STATIC,4,4,214,17 END IDD_KEY DIALOG DISCARDABLE 0, 0, 222, 67 STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "L[" FONT 9, "lr oSVbN" BEGIN LTEXT "Ng for Win32 pL[sB",IDC_STATIC, 4,4,214,17 CONTROL "{L[zp",IDC_KEYBOARDLOCALE,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,10,37,90,10 CONTROL "pL[Rg[L[p",IDC_CONTROLMAP, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,49,134,10 GROUPBOX "L[",IDC_STATIC,2,24,217,43 END IDD_VIEW DIALOG DISCARDABLE 0, 0, 222, 67 STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "\ヲ" FONT 9, "lr oSVbN" BEGIN LTEXT "EBhE\ヲsB",IDC_STATIC,4, 4,214,10 CONTROL "j[o[\ヲ",IDC_SHOWMENUBAR,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,10,28,90,10 LTEXT "j[o[\ヲAo M-x configure タsB", IDC_STATIC,10,41,200,20 GROUPBOX "\ヲ",IDC_STATIC,2,18,217,49 END IDD_BEEP DIALOG DISCARDABLE 0, 0, 222, 67 STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "r[v" FONT 9, "lr oSVbN" BEGIN CONTROL "r[v",IDC_BEEP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,9,15,67,10 PUSHBUTTON "Play",IDC_PLAY,84,14,21,11 CONTROL "KTEhI",IDC_MESSAGEBEEP,"Button", BS_AUTORADIOBUTTON,11,34,86,10 COMBOBOX IDC_MESSAGECOMBO,106,31,96,61,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP CONTROL "Cwavet@Cw",IDC_PLAYSOUND,"Button", BS_AUTORADIOBUTTON,11,50,94,10 EDITTEXT IDC_SOUNDFILE,106,48,96,14,ES_AUTOHSCROLL PUSHBUTTON "...",IDC_SOUNDBUTTON,204,48,10,14 GROUPBOX "r[v",IDC_STATIC,2,2,217,65 END IDD_FONT DIALOG DISCARDABLE 0, 0, 222, 67 STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "tHg" FONT 9, "lr oSVbN" BEGIN CONTROL "Ng for Win32 ftHgtHgp (&D)", IDC_NOSPECIFY,"Button",BS_AUTORADIOBUTTON,10,14,158,10 CONTROL "LtHg/sp (&S)",IDC_SPECIFY,"Button", BS_AUTORADIOBUTTON,10,27,111,10 LTEXT "tHg(&F)F",IDC_STATIC,15,46,35,8 COMBOBOX IDC_FONTNAME,51,44,70,64,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_POINT,125,44,28,86,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP LTEXT "s(&L)F",IDC_STATIC,158,47,26,8 EDITTEXT IDC_LINESPACE,186,44,18,14,ES_AUTOHSCROLL | ES_NUMBER CONTROL "Spin1",IDC_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_AUTOBUDDY | UDS_ARROWKEYS,203,44,9,14 GROUPBOX "eLXgtHg",IDC_STATIC,2,2,217,65 END ///////////////////////////////////////////////////////////////////////////// // // Bitmap // IDB_REBAR BITMAP DISCARDABLE "rebar.bmp" IDB_BUTTONS BITMAP DISCARDABLE "buttons.bmp" ///////////////////////////////////////////////////////////////////////////// // // Toolbar // IDB_BUTTONS TOOLBAR DISCARDABLE 16, 16 BEGIN BUTTON IDBN_MARK BUTTON IDBN_NEXT BUTTON IDBN_PRIOR END ///////////////////////////////////////////////////////////////////////////// // // Menu // IDR_MAINMENU MENU DISCARDABLE BEGIN POPUP "t@C" BEGIN MENUITEM "IvV(&O)...", IDC_OPTION MENUITEM "I(&X)", IDC_CLOSE END END ///////////////////////////////////////////////////////////////////////////// // // String Table // STRINGTABLE DISCARDABLE BEGIN IDS_CONFIGNAME "Ng for Win32" IDS_OK "mF" IDS_ICONASTERISK "" IDS_ICONEXCLAMATION "x" IDS_ICONHAND "G[" IDS_ICONQUESTION "" IDS_CUT "(C-w)" IDS_COPY "Rs[(M-w)" IDS_PASTE "\t(C-y)" IDS_MARK "}[N(C-@)" IDS_NEXT "XN[Abv(C-v)" IDS_PRIOR "XN[_E(M-v)" END #endif // Japanese resources ///////////////////////////////////////////////////////////////////////////// #ifndef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// // // Generated from the TEXTINCLUDE 3 resource. // ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED ng-1.5beta1/sys/win32/ngbc.mak100644 1750 1750 11702 7247657140 14671 0ustar amurausers# $Id: ngbc.mak,v 1.5 2001/03/02 08:48:32 amura Exp $ # Makefile for Ng at Win32 with Borland C++ 5.2/5.5 # # $Log: ngbc.mak,v $ # Revision 1.5 2001/03/02 08:48:32 amura # now AUTOSAVE feature implemented almost all (except for WIN32 # # Revision 1.4 2001/01/17 18:34:53 amura # now compile successfull on VC++ and BC++ # # Revision 1.3 2000/11/16 14:21:30 amura # merge Ng for win32 0.5 # # Revision 1.2 2000/07/17 14:10:07 amura # some typo bug fixed # # Revision 1.1.1.1 2000/06/27 01:48:00 amura # import to CVS # SYS = win32 # CDEFS gets defines, and gets passed to lint. CFLAGS gets flags, and doesn't # get passed to lint. # # Now, compile time options are defined in a "config.h". # INTDIR = objs OUTDIR = objs COPT = -O -d -f- CDEFS = -DWIN32 CINCL = -Isys\$(SYS) -Isys\default CMISC = -n$(INTDIR) -tWM -w-nod -w-use -w-pro -w-rvi -w-par CFLAGS = -c $(CDEFS) $(COPT) $(CINCL) $(CMISC) ## BCC 5.5 BCPATH = c:\Borland\bcc55 CC = $(BCPATH)\bin\bcc32 -q RSC = $(BCPATH)\bin\brc32 -r -i"$(BCPATH)\include" -dNO_MFC LINK = $(BCPATH)\bin\ilink32 -c -v- -x -Gn -aa -j$(INTDIR) LIB = import32.lib cw32.lib # C Builder 5.2 #BCPATH = C:\Program Files\Borland\CBuilder #CC = bcc32 #RSC = brcc32 -isys\$(SYS) -i"$(BCPATH)\include" -dNO_MFC #LINK = tlink32 -c -v- -x -aa -Tpe -j$(INTDIR) #LIB = import32.lib cw32mt.lib # Objects which only depend on the "standard" includes OBJS = basic.obj dir.obj dired.obj shell.obj version.obj window.obj \ kinsoku.obj jump.obj autosave.obj # Those with unique requirements IND = buffer.obj complt.obj display.obj cmode.obj echo.obj extend.obj \ file.obj help.obj kbd.obj keymap.obj line.obj macro.obj main.obj \ modes.obj match.obj paragraph.obj random.obj region.obj regex.obj \ re_search.obj search.obj skg.obj kanji.obj undo.obj word.obj # System dependent objects OOBJS = cinfo.obj spawn.obj tty.obj ttykbd.obj # Win32 additional objects WOBJS = tools.obj ttyctrl.obj winmain.obj cefep.obj OBJ = $(OBJS) $(IND) $(OOBJS) $(WOBJS) fileio.obj ttyio.obj OSRCS = cinfo.c fileio.c spawn.c ttyio.c tty.c ttykbd.c WSRCS = tools.c ttyctrl.cpp winmain.c SRCS = basic.c cmode.c dir.c dired.c file.c line.c match.c paragraph.c \ random.c region.c search.c version.c window.c word.c \ buffer.c display.c echo.c extend.c help.c kbd.c keymap.c \ macro.c main.c modes.c regex.c re_search.c kanji.c kinsoku.c \ skg.c jump.c undo.c autosave.c OINCS = sys/default/ttydef.h sys/default/chrdef.h sys/$(SYS)/sysdef.h INCS = config.h def.h REINCS = regex_e.h regex_j.h regex_j.c regex_e.h kanji_.h kanji_.c .path.obj=$(INTDIR) .path.res=$(INTDIR) .path.exe=$(OUTDIR) .path.map=$(OUTDIR) {.}.c {$(INTDIR)}.obj: $(CC) $(CFLAGS) $< {sys\default}.c {$(INTDIR)}.obj: $(CC) $(CFLAGS) $< {sys\$(SYS)}.c {$(INTDIR)}.obj: $(CC) $(CFLAGS) $< {sys\$(SYS)}.cpp {$(INTDIR)}.obj: $(CC) $(CFLAGS) $< {sys\$(SYS)}.rc {$(INTDIR)}.res: $(RSC) -fo $@ $< all: $(INTDIR) ng.exe ng.exe: $(OBJ) ng.res $(LINK) c0w32.obj $(OBJ),$(OUTDIR)\ng.exe,,$(LIB),,ng.res $(OBJS): $(INCS) $(OINCS) $(OOBJS): $(INCS) $(OINCS) buffer.obj: $(INCS) $(OINCS) kbd.h undo.h cmode.obj: $(INCS) $(OINCS) undo.h file.obj: $(INCS) $(OINCS) undo.h line.obj: $(INCS) $(OINCS) undo.h paragraph.obj: $(INCS) $(OINCS) undo.h random.obj: $(INCS) $(OINCS) undo.h region.obj: $(INCS) $(OINCS) undo.h undo.obj: $(INCS) $(OINCS) undo.h word.obj: $(INCS) $(OINCS) undo.h complt.obj: $(INCS) $(OINCS) kbd.h complt.h display.obj: $(INCS) $(OINCS) kbd.h keymap.obj: $(INCS) $(OINCS) kbd.h modes.obj: $(INCS) $(OINCS) kbd.h fileio.obj: $(INCS) $(OINCS) kbd.h sys/$(SYS)/tools.h sys/$(SYS)/resource.h echo.obj: $(INCS) $(OINCS) key.h macro.h complt.h extend.obj: $(INCS) $(OINCS) kbd.h key.h macro.h help.obj: $(INCS) $(OINCS) kbd.h key.h macro.h kanji.obj: $(INCS) $(OINCS) kinit.h kbd.obj: $(INCS) $(OINCS) macro.h kbd.h key.h undo.h macro.obj: $(INCS) $(OINCS) macro.h key.h skg.obj: $(INCS) $(OINCS) macro.h key.h undo.h main.obj: $(INCS) $(OINCS) macro.h search.obj: $(INCS) $(OINCS) macro.h match.obj: $(INCS) $(OINCS) key.h re_search.obj: $(INCS) $(OINCS) $(REINCS) macro.h regex.obj: $(INCS) $(OINCS) $(REINCS) jump.obj: $(INCS) $(OINCS) regex_e.h regex_j.h ttyio.obj: $(INCS) $(OINCS) sys/$(SYS)/tools.h sys/$(SYS)/winmain.h tools.obj: $(INCS) $(OINCS) sys/$(SYS)/tools.h tty.obj: $(INCS) $(OINCS) sys/$(SYS)/tools.h sys/$(SYS)/winmain.h ttyctrl.obj: $(INCS) $(OINCS) \ sys/$(SYS)/tools.h sys/$(SYS)/ttyctrl.h \ sys/$(SYS)/cefep.h sys/$(SYS)/resource.h spawn.obj: $(INCS) $(OINCS) sys/$(SYS)/tools.h winmain.obj: $(INCS) $(OINCS) \ sys/$(SYS)/tools.h sys/$(SYS)/ttyctrl.h \ sys/$(SYS)/winmain.h sys/$(SYS)/resource.h sys/$(SYS)/cefep.h cefep.obj: $(INCS) $(OINCS) sys/$(SYS)/cefep.h ng.res: sys/$(SYS)/resource.h sys/$(SYS)/appicon.ico \ sys/$(SYS)/rebar.bmp sys/$(SYS)/buttons.bmp $(INTDIR): @if not exist $(INTDIR) mkdir $(INTDIR) #clean: # del $(OBJ) $(OSRCS) $(OINCS) clean: -if exist ng.tds del ng.tds -if exist $(INTDIR) del /f/q $(INTDIR) -if exist $(INTDIR) rmdir $(INTDIR) ng-1.5beta1/sys/win32/rebar.bmp100644 1750 1750 452 7204766552 15022 0ustar amurausersBM*v(誓         D@ s30 ww0DDD wsw0 面 w ng-1.5beta1/sys/win32/resource.h100644 1750 1750 5400 7204766552 15245 0ustar amurausers//{{NO_DEPENDENCIES}} // Microsoft Developer Studio generated include file. // Used by mg.rc // #define IDI_APPICON 101 #define IDD_STARTUPFILE 102 #define IDD_KEY 103 #define IDD_BEEP 104 #define IDB_REBAR 104 #define IDD_FONT 105 #define IDR_MAINMENU 105 #define IDR_PPCMENU 106 #define IDB_BUTTONS 107 #define IDD_VIEW 108 #define IDC_STARTUPFILE 1000 #define IDC_FILEOPENDLG 1001 #define IDC_CONTROLMAP 1002 #define IDC_BEEP 1003 #define IDC_KEYBOARDLOCALE 1003 #define IDC_MESSAGEBEEP 1004 #define IDC_PLAYSOUND 1005 #define IDC_OPTION 1006 #define IDC_SOUNDFILE 1007 #define IDC_SOUNDBUTTON 1008 #define IDC_MESSAGECOMBO 1009 #define IDC_PLAY 1010 #define IDC_FONTNAME 1011 #define IDC_POINT 1012 #define IDC_LINESPACE 1013 #define IDC_SHOWMENUBAR 1014 #define IDC_SPIN 1015 #define IDC_NOSPECIFY 1016 #define IDC_SPECIFY 1017 #define IDC_CUT 1018 #define IDC_COPY 1019 #define IDC_PASTE 1020 #define IDC_MARK 1021 #define IDC_NEXT 1022 #define IDC_PRIOR 1023 #define IDC_CLOSE 1024 #define IDS_FILE 1025 #define IDS_CONFIGNAME 1026 #define IDS_OK 1027 #define IDS_ICONASTERISK 1028 #define IDS_ICONEXCLAMATION 1029 #define IDS_ICONHAND 1030 #define IDS_ICONQUESTION 1031 #define IDS_CUT 1032 #define IDS_COPY 1033 #define IDS_PASTE 1034 #define IDS_MARK 1035 #define IDS_NEXT 1036 #define IDS_PRIOR 1037 #define IDBN_MARK 40001 #define IDBN_NEXT 40002 #define IDBN_PRIOR 40003 #define IDM_MENUITEM1 40004 #define IDM_MENUITEM2 40007 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 109 #define _APS_NEXT_COMMAND_VALUE 40008 #define _APS_NEXT_CONTROL_VALUE 1038 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif ng-1.5beta1/sys/win32/spawn.c100644 1750 1750 12110 7216206576 14553 0ustar amurausers/* $Id: spawn.c,v 1.4 2000/12/14 18:12:14 amura Exp $ */ /* * Spawn CLI for Win32. * * I make this file from MS-DOS spawn.c. */ /* * $Log: spawn.c,v $ * Revision 1.4 2000/12/14 18:12:14 amura * use alloca() and more memory secure * * Revision 1.3 2000/11/16 14:21:31 amura * merge Ng for win32 0.5 * * Revision 1.2 2000/10/23 13:19:52 amura * now impliment call_process() and spawncli() * * Revision 1.1.1.1 2000/06/27 01:48:00 amura * import to CVS * */ /* 90.02.11 Modified for Ng 1.0 MS-DOS ver. by S.Yoshida */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include #include "def.h" #include "tools.h" int spawncli( int f, int n) { STARTUPINFO si; PROCESS_INFORMATION pi; BOOL bSuccess; char *shell; ewprintf("[Starting new shell]"); if ((shell=getenv("COMSPEC")) == NULL) { ewprintf("Can't find shell"); return FALSE; } memset(&si, 0, sizeof(si)); si.cb = sizeof(si); si.lpTitle = "MicroEmacs Subprocess"; #ifdef EXTD_DIR ensurecwd(); #endif bSuccess = CreateProcess(NULL, shell, NULL, NULL, FALSE, CREATE_NEW_CONSOLE, NULL, NULL, &si, &pi); return (bSuccess) ? TRUE : FALSE; } int tticon( int f, int n ) { extern HWND g_hwndMain; #ifdef _WIN32_WCE #if 0 HWND next; next = GetWindow(g_hwndMain, GW_HWNDNEXT); if (next) { #ifdef CTRLMAP extern DWORD g_ctrlmap; if (g_ctrlmap) { /* send ctrl key `up' event in order to prevent ctrl key to be kept in a state of `depressed' */ keybd_event(VK_CONTROL, 0, KEYEVENTF_KEYUP, 0); } #endif SetForegroundWindow(next); } else { SetWindowPos(g_hwndMain, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE #ifdef SWP_NOSENDCHANGING | SWP_NOSENDCHANGING); #endif } #else /* Always activate */ SetWindowPos(g_hwndMain, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE #ifdef SWP_NOSENDCHANGING | SWP_NOSENDCHANGING); #endif #endif /* 1 */ #else /* not _WIN32_WCE */ CloseWindow(g_hwndMain); #endif /* _WIN32_WCE */ return TRUE; } #ifndef NO_SHELL /* 91.01.10 by K.Maeda / Modified by sahf and amura */ char tempfile[NFILEN]; /* * Call process in subshell. * Execute COMMAND binding standard input to file INPUT. * NULL as INPUT means standard input should be bound to * /dev/null or whatever equivalent in your OS. * All output during the execution (including standard error output) * should go into a scratch file, whose name call_process() returns. * Return value NULL means error in some stage of the execution. * In that case, scratch file should be deleted. */ char * call_process(command, input) char *command; char *input; { extern char *mktemp(); int cmdlen; char *sbuf, *tmp, *temp_path, *shell; LPTSTR buf; BOOL bSuccess; HANDLE hRead, hWrite; SECURITY_ATTRIBUTES sa; STARTUPINFO si; PROCESS_INFORMATION pi; if ((shell=getenv("COMSPEC")) != NULL) { int shlen; cmdlen = strlen(command) + strlen(shell) + 5; if ((sbuf=alloca(cmdlen)) == NULL) return NULL; strcpy(sbuf, shell); strcat(sbuf, " /c "); #ifdef KANJI shlen = strlen(sbuf); strcat(sbuf, command); bufetos(sbuf+shlen, cmdlen-shlen); #else strcat(sbuf, command); #endif } else { cmdlen = strlen(command)+1; if ((sbuf=malloc(cmdlen)) == NULL) return NULL; strcpy(sbuf, command); #ifdef KANJI bufetos(sbuf, cmdlen); #endif } cmdlen = sjis2unicode((LPBYTE)sbuf, NULL, 0); if ((buf=alloca(cmdlen)) == NULL) return NULL; sjis2unicode(sbuf, buf, cmdlen); temp_path = getenv("TMP"); if (temp_path == NULL) temp_path = getenv("tmp"); if (temp_path == NULL) temp_path = getenv("TEMP"); if (temp_path == NULL) temp_path = getenv("temp"); tmp = tempfile; if (temp_path && *temp_path) { while (*tmp = *temp_path++) { tmp++; } if (tmp[-1] != '/' && tmp[-1] != '\\') { *tmp++ = '/'; } } strcpy(tmp, "ngXXXXXX"); if ((tmp = mktemp(tempfile)) == NULL) { return NULL; } sa.nLength = sizeof(SECURITY_ATTRIBUTES); sa.lpSecurityDescriptor = NULL; sa.bInheritHandle = TRUE; hRead = CreateFile(input ? input : "NUL", GENERIC_READ, 0, &sa, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); hWrite = CreateFile(tmp, GENERIC_READ | GENERIC_WRITE, 0, &sa, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); /* For OS panic during spawn child process */ if (GetFileType(tmp) == FILE_TYPE_UNKNOWN) MoveFileEx(tmp, NULL, MOVEFILE_DELAY_UNTIL_REBOOT); memset(&si, 0, sizeof(si)); si.cb = sizeof(si); si.hStdInput = hRead; si.hStdOutput = hWrite; si.hStdError = hWrite; si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; si.wShowWindow = SW_MINIMIZE; /* or SW_HIDE */ #ifdef EXTD_DIR ensurecwd(); #endif bSuccess = CreateProcess(NULL, buf, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi); WaitForSingleObject(pi.hProcess, INFINITE); CloseHandle(pi.hThread); CloseHandle(pi.hProcess); CloseHandle(hRead); CloseHandle(hWrite); if (!bSuccess) { unlink(tmp); return NULL; } return tmp; } #endif /* NO_SHELL */ ng-1.5beta1/sys/win32/sysdef.h100644 1750 1750 6120 7303500513 14672 0ustar amurausers/* $Id: sysdef.h,v 1.8 2001/05/25 15:59:07 amura Exp $ */ /* * Win32 based systems */ /* * $Log: sysdef.h,v $ * Revision 1.8 2001/05/25 15:59:07 amura * WIN32 version support AUTOSAVE feature * * Revision 1.7 2001/02/18 19:29:05 amura * split dir.c to port depend/independ * * Revision 1.6 2001/02/18 17:00:02 amura * some definitions are imported form def.h * * Revision 1.5 2001/01/17 18:34:53 amura * now compile successfull on VC++ and BC++ * * Revision 1.4 2001/01/05 14:07:09 amura * first implementation of Hojo Kanji support * * Revision 1.3 2000/12/14 18:10:48 amura * filename length become flexible * * Revision 1.2 2000/09/18 10:22:39 amura * some macro definition is changed * * Revision 1.1.1.1 2000/06/27 01:47:59 amura * import to CVS * */ #ifdef _WIN32_WCE #ifndef NULL #ifdef __cplusplus #define NULL 0 #else #define NULL ((void *)0) #endif #endif #else /* _WIN32_WCE */ #include #include /* need to use memmove(). */ #endif /* _WIN32_WCE */ #define KBLOCK 1024 /* Kill grow. */ #define GOOD 0 /* Good exit status. */ #ifndef NO_SHELL /* 91.01.10 by K.Maeda */ #define CMDLINELENGTH NFILEN /* Maximum length of shell command. */ #endif /* NO_SHELL */ #define NO_RESIZE /* Screen size is constant. */ #define BSMAP TRUE /* Bs map feature can use. */ /* (default mode is bsmap on) */ #ifndef _WIN32_WCE #define NG_PROCESS_IME_MESSAGES 1 #endif /* #define TARGET_WCEVER_IS_100 */ /* define this if appropriate */ #ifndef TARGET_WCEVER_IS_100 #ifdef CTRLMAP #undef CTRLMAP /* Build ctrlmap feature in as default off */ #endif #endif #define MAKEBACKUP FALSE /* Making backup file is off. */ typedef long RSIZE; /* Type for file/region sizes */ typedef short KCHAR; /* Type for internal keystrokes */ /* * Macros used by the buffer name making code. * Start at the end of the file name, scan to the left * until BDC1 (or BDC2, if defined) is reached. The buffer * name starts just to the right of that location, and * stops at end of string (or at the next BDC3 character, * if defined). BDC2 and BDC3 are mainly for VMS. */ #define BDC1 '\\' /* Buffer names. */ #define MALLOCROUND(m) (m+=7,m&=~7) /* round up to 8 byte boundry */ #define bcopy(s,d,n) memmove(d,s,n) /* copy memory area. */ #define bzero(s,n) memset(s,0,n) #define bcmp(s,d,n) memcmp(s,d,n) #define fncmp strcmp /* file name comparison */ #define unlinkdir(fn) rmdir(fn) /* unlink directory */ char *getenv(); #define gettermtype() getenv("TERM") /* determine terminal type */ #ifndef NO_DIR #define dirend() (VOID)0 #endif #ifdef __BORLANDC__ #include /* for alloca() definition */ #else #define alloca(n) _alloca(n) #endif #ifdef __cplusplus extern "C" { #endif void strcat_num(char *str, int num); void strcat_char(char *str, int c); int stricmp(const char *src, const char *dst); int chdir(const char *dir); int rchdir(char *dir); int Fputc(int c); int Sprintf(char *buf, const char *fmt, ... ); #ifdef __cplusplus } #endif #ifdef putc #undef putc #endif #define putc(c,fp) Fputc(c) #define exit(rc) Exit(rc) #define sprintf Sprintf ng-1.5beta1/sys/win32/tools.c100644 1750 1750 52167 7216206576 14603 0ustar amurausers/* $Id: tools.c,v 1.9 2000/12/14 18:12:14 amura Exp $ */ /* OS dependent code used by Ng for WinCE. * Copyright (C) 1998 Eiichiro Ito * Modified for Ng for Win32 * Copyright (C) 1999,2000 Toru Imai * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * ree Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* * NG : C library compatible routine for Ng * * 1997/11/06:Eiichiroh Itoh * (1) Start development * History of modifications * 1998/04/03:Eiichiroh Itoh * (1) Convert from IrCopy for POBox * */ /* * $Log: tools.c,v $ * Revision 1.9 2000/12/14 18:12:14 amura * use alloca() and more memory secure * * Revision 1.8 2000/11/16 14:21:31 amura * merge Ng for win32 0.5 * * Revision 1.7 2000/10/23 16:52:51 amura * add GPL copyright to header * * Revision 1.6 2000/10/02 16:13:07 amura * ignore mouse event in minibuffer editing * * Revision 1.5 2000/09/01 19:39:12 amura * fix choped data bug on receiving from clipboard * * Revision 1.4 2000/07/25 15:04:21 amura * fix filevisit() args * * Revision 1.3 2000/07/22 20:46:32 amura * support "Drag&Drop" * * Revision 1.2 2000/07/18 12:40:35 amura * for Win32, enable to handle japanese directory * * Revision 1.1.1.1 2000/06/27 01:48:00 amura * import to CVS * */ #include #include #include "config.h" #include "tools.h" #include "def.h" #define etos(c1, c2) \ {\ c1 &= 0x7f;\ c2 &= 0x7f;\ if(c1 >= 0x5f)\ c1 += 0x80;\ if((c1 % 2) == 0) {\ c1 = (c1 - 0x30) / 2 + 0x88;\ c2 += 0x7e;\ } else {\ if(c2 >= 0x60)\ c2 += 0x01;\ c1 = (c1 - 0x31) / 2 + 0x89;\ c2 += 0x1f;\ }\ c1 &= 0xff;\ c2 &= 0xff;\ } HANDLE g_hfile1 = INVALID_HANDLE_VALUE ; BOOL g_bEof1 = FALSE ; BOOL g_bBinary1 = FALSE ; BOOL g_bError1 = FALSE ; DWORD g_dwRin1 = 0 ; DWORD g_dwRout1 = 0 ; DWORD g_dwWin1 = 0 ; BYTE g_rBuf1[ 256 ] ; BYTE g_sBuf1[ 256 ] ; BOOL Fopen( LPCTSTR path, LPCTSTR modestr ) { BOOL f_trunc = FALSE, f_last = FALSE ; DWORD access = GENERIC_READ ; DWORD mode = FILE_SHARE_READ ; DWORD dist = OPEN_EXISTING ; g_bBinary1 = FALSE ; g_bError1 = FALSE ; if ( *modestr == TEXT('r') ) { access = GENERIC_READ ; dist = OPEN_EXISTING ; if ( modestr[1] == TEXT('+') ) { access = GENERIC_READ|GENERIC_WRITE ; dist = OPEN_ALWAYS ; if ( modestr[2] == TEXT('b') ) { g_bBinary1 = TRUE ; } } else if ( modestr[1] == TEXT('b') ) { g_bBinary1 = TRUE ; } } else if ( *modestr == TEXT('w') ) { access = GENERIC_WRITE ; dist = CREATE_ALWAYS ; f_trunc = TRUE ; if ( modestr[1] == TEXT('+') ) { access = GENERIC_READ|GENERIC_WRITE ; if ( modestr[2] == TEXT('b') ) { g_bBinary1 = TRUE ; } } else if ( modestr[1] == TEXT('b') ) { g_bBinary1 = TRUE ; } } else if ( *modestr == TEXT('a') ) { access = GENERIC_WRITE ; dist = CREATE_ALWAYS ; f_last = TRUE ; if ( modestr[1] == TEXT('+') ) { access = GENERIC_READ|GENERIC_WRITE ; if ( modestr[2] == TEXT('b') ) { g_bBinary1 = TRUE ; } } else if ( modestr[1] == TEXT('b') ) { g_bBinary1 = TRUE ; } } else { return FALSE ; } g_hfile1 = CreateFile( path, access, mode, NULL, dist, FILE_ATTRIBUTE_NORMAL, 0 ) ; if ( g_hfile1 == INVALID_HANDLE_VALUE ) { return FALSE ; } if ( f_trunc ) { SetEndOfFile( g_hfile1 ) ; } else if ( f_last ) { SetFilePointer( g_hfile1, 0, NULL, FILE_END ) ; } g_bEof1 = FALSE ; g_dwRin1 = g_dwRout1 = g_dwWin1 = 0 ; return TRUE ; } void Fclose( void ) { DWORD nWrite ; if ( g_hfile1 != INVALID_HANDLE_VALUE ) { if ( g_dwWin1 ) { WriteFile( g_hfile1, g_sBuf1, g_dwWin1, &nWrite, NULL ) ; } CloseHandle( g_hfile1 ) ; g_hfile1 = INVALID_HANDLE_VALUE ; } } int Fgetc( void ) { int c ; BOOL ret ; DWORD nRead ; do { if ( g_bEof1 ) { return -1 ; } if ( g_dwRin1 == g_dwRout1 ) { g_dwRin1 = g_dwRout1 = 0 ; ret = ReadFile( g_hfile1, g_rBuf1, sizeof g_rBuf1, &nRead, NULL ) ; if ( !ret || !nRead ) { g_bEof1 = TRUE ; return -1 ; } g_dwRin1 = nRead ; g_dwRin1 %= sizeof g_rBuf1 ; } c = (int) g_rBuf1[ g_dwRout1 ] ; g_dwRout1 ++ ; g_dwRout1 %= sizeof g_rBuf1 ; } while ( !g_bBinary1 && c == '\r' ) ; return c ; } char * Fgets( char *buf, int size ) { int c ; LPBYTE ptr = buf ; size -- ; while ( (c = Fgetc()) != -1 ) { if ( !size ) { break ; } *ptr++ = c ; if ( c == '\n' ) { break ; } } *ptr = 0 ; return ptr == buf ? NULL : buf ; } static int Fputc_sub( int c ) { DWORD tmp, nWrite ; g_sBuf1[ g_dwWin1 ] = c ; g_dwWin1 ++ ; g_dwWin1 %= sizeof g_sBuf1 ; if ( !g_dwWin1 || c == '\n' ) { tmp = g_dwWin1 ? g_dwWin1 : sizeof g_sBuf1 ; g_dwWin1 = 0 ; if ( !WriteFile( g_hfile1, g_sBuf1, tmp, &nWrite, NULL ) ) { g_bError1 = TRUE ; return FALSE ; } else if ( nWrite == 0 ) { g_bError1 = TRUE ; return FALSE ; } } return TRUE ; } int Fputc( int c ) { if ( !g_bBinary1 && c == '\n' ) { if ( !Fputc_sub( '\r' ) ) { return -1 ; } } return Fputc_sub( c ) ? c : -1 ; } int Fputs( const char *buf ) { BYTE c ; int last = -1 ; while ( c = *buf++ ) { last = (int) c ; if ( Fputc( last ) == -1 ) { return -1 ; } } return last ; } void Fwrite( const char *buf, int size ) { if ( !size ) { return ; } do { Fputc( *buf++ ) ; } while ( -- size ) ; } BOOL Ferror( void ) { return g_bError1 ; } void slash2backslash( LPTSTR str ) { LPTSTR ptr ; /* convert '/' to '\' */ while ( ptr = _tcschr( str, TEXT('/') ) ) { *ptr = TEXT('\\') ; } } void catdir( LPTSTR body, LPCTSTR adddir, LPTSTR pPrevDir ) { DWORD len ; LPTSTR ptr ; slash2backslash( body ) ; if ( pPrevDir ) { lstrcpy( pPrevDir, TEXT("..") ) ; } while ( *adddir ) { if ( _tcschr( TEXT("/\\"), *adddir ) ) { /* skip header if it is "/" or "\" */ adddir ++ ; continue ; } if ( adddir[0] == TEXT('.') && adddir[1] == TEXT('.') ) { ptr = _tcsrchr( body, TEXT('\\') ) ; if ( ptr && pPrevDir ) { lstrcpy( pPrevDir, ptr + 1 ) ; } if ( ptr && ptr != body ) { *ptr = 0 ; } else { lstrcpy( body, TEXT("\\") ) ; } adddir += 2 ; } else if ( adddir[0] == TEXT('.') ) { adddir ++ ; } else { break ; } } if ( !*adddir ) { return ; } len = lstrlen( body ) ; if ( !len || body[ len - 1 ] != TEXT('\\') ) { body[ len ++ ] = TEXT('\\') ; } lstrcpy( &body[ len ], adddir ) ; slash2backslash( body ) ; } void rel2abs( LPTSTR newPath, LPCTSTR oldPath, LPCTSTR adddir ) { #ifndef _WIN32_WCE if (adddir[1] == TEXT(':')) { *newPath++ = *adddir++; *newPath++ = *adddir++; } #endif if ( _tcschr( TEXT("/\\"), *adddir ) ) { lstrcpy( newPath, adddir ) ; slash2backslash( newPath ) ; } else { lstrcpy( newPath, oldPath ) ; catdir( newPath, adddir, NULL ) ; } } int sleep( int sec ) { Sleep( sec * 1000 ) ; return 0 ; } #ifndef NO_STDIO #undef islower #define islower(c) ((c)>='a'&&(c)<='z') #define toupper(c) (islower(c)?(c)-'a'+'A':(c)) int stricmp( const char *src, const char *dst ) { char c = 0, c1 ; while ( (c = *src++) ) { c = toupper( c ) ; c1 = *dst++ ; c1 = toupper( c1 ) ; if ( c != c1 ) { return c - c1 ; } } c = toupper( c ) ; c1 = *dst++ ; c1 = toupper( c1 ) ; return c - c1 ; } int strnicmp(const char *src, const char *dst, size_t len) { char c = 0, c1 ; while ( len && (c = *src++) ) { c = toupper( c ) ; c1 = *dst++ ; c1 = toupper( c1 ) ; if ( c != c1 ) { return c - c1 ; } len -- ; } c = toupper( c ) ; c1 = *dst++ ; c1 = toupper( c1 ) ; return len ? c - c1 : 0 ; } #if 0 int bcmp( char *s1, char *s2, int len ) { return memcmp( s1, s2, len ) ; } int bzero( char *s, int len ) { memset( s, 0, len ) ; return 0 ; } #endif void strcat_num( char *str, int num ) { CHAR digits[ 10 ], *ptr = digits ; str += strlen( str ) ; if ( num < 0 ) { *str++ = '-' ; num = - num ; } if ( num ) { while ( num ) { *ptr++ = '0' + (CHAR) (num % 10) ; num /= 10 ; } } else { *ptr++ = '0' ; } while ( ptr -- != digits ) { *str++ = *ptr ; } *str = 0 ; } void strcat_char( char *str, int c ) { str += strlen( str ) ; *str++ = (char) (c & 0xFF) ; *str = 0 ; } #endif /* NO_STDIO */ #ifndef NO_SPRINTF static void SprintfNum( char **buf, int i, int r ) { int q ; if ( i < 0 ) { *(*buf) ++ = '-' ; i = -i ; } q = i / r ; if ( q ) { SprintfNum( buf, q, r ) ; } *(*buf) ++ = '0' + i % r ; } static int SprintfSub( char *buf, const char *fmt, va_list *ap ) { int c ; char *orgbuf = buf ; while ( ( c = *fmt++ ) != '\0' ) { if ( c != '%') { *buf++ = c ; } else { c = *fmt++ ; switch ( c ) { case 'c': *buf++ = (char) (0xFF & va_arg( *ap, int )) ; break ; case 'l': c = *fmt++ ; case 'd': SprintfNum( &buf, va_arg( *ap, int ), 10 ) ; break ; case 'o': SprintfNum( &buf, va_arg( *ap, int ), 8 ) ; break ; case 's': strcpy( buf, va_arg( *ap, char * ) ) ; buf += strlen( buf ) ; break ; default: *buf++ = c ; } } } *buf = 0 ; return strlen( orgbuf ) ; } int Sprintf( char *buf, const char *fmt, ... ) { int ret ; va_list pvar ; va_start( pvar, fmt ) ; ret = SprintfSub( buf, fmt, &pvar ) ; va_end( pvar ) ; return ret ; } #endif /* NO_SPRINTF */ #define CETOOLS_MAX_TEMP_BUF 4 #define CETOOLS_MAX_FILE_NAME 160 /* c.f. NFILEN at mg/def.h is 80 */ #ifdef KANJI #ifndef USE_KCTRL int unicode2sjis(const char *src, unsigned char *dst, int max) { #ifdef UNICODE return (unsigned long)WideCharToMultiByte(CP_ACP, 0, (LPCTSTR)src, -1, (LPWSTR)dst, max, NULL, NULL); #else int size = lstrlen(src) + 1; if (dst) { bcopy(src, dst, size); } return size; #endif } int sjis2unicode(const unsigned char *src, char *dst, int max) { #ifdef UNICODE return MultiByteToWideChar(CP_ACP, 0, (LPCWSTR)src, -1, (LPSTR)dst, max / sizeof(TCHAR)) * sizeof(TCHAR); #else int size = strlen(src) + 1; if (dst) { bcopy(src, dst, size); } return size; #endif } WORD unicode2sjis_char(TCHAR c) { TCHAR unic[CETOOLS_MAX_TEMP_BUF]; BYTE sjis[CETOOLS_MAX_TEMP_BUF]; WORD retval; unic[0] = c; unic[1] = 0; #ifdef UNICODE WideCharToMultiByte(CP_ACP, 0, unic, -1, sjis, CETOOLS_MAX_TEMP_BUF, NULL, NULL); #else if (sjis) { bcopy(unic, sjis, lstrlen(unic) + 1); } #endif retval = (WORD)sjis[0]; if (sjis[1]) { retval = ((retval << 8) | (WORD)sjis[1]); } return retval; } TCHAR sjis2unicode_char(WORD c) { TCHAR unic[CETOOLS_MAX_TEMP_BUF]; BYTE sjis[CETOOLS_MAX_TEMP_BUF], *p = sjis; if (c & 0x0ff00L) { *p++ = (c >> 8); } *p++ = (BYTE)c; *p = (BYTE)0; #ifdef UNICODE MultiByteToWideChar(CP_ACP, 0, sjis, p - sjis, unic, CETOOLS_MAX_TEMP_BUF); #else if (unic) { bcopy(sjis, unic, strlen(sjis) + 1); } #endif return unic[0]; } #endif /* USE_KCTRL */ #else /* !KANJI */ int unicode2sjis(const char *src, unsigned char *dst, int max) { BYTE *p = dst, *ep = p + max - 1; LPCTSTR sp = src; if (dst) { while (*sp && p < ep) { *p++ = (BYTE)*sp++; } *p++ = (BYTE)0; return p - dst; } else { return lstrlen(src) + 1; } } int sjis2unicode(const unsigned char *src, char *dst, int max) { LPTSTR p = dst, ep = p + max - 1; const BYTE *sp = src; if (dst) { while (*sp && p < ep) { *p++ = (TCHAR)*sp++; } *p++ = (TCHAR)0; return p - dst; } else { return sizeof(TCHAR) * (strlen(src) + 1); } } WORD unicode2sjis_char(TCHAR c) { TCHAR unic[CETOOLS_MAX_TEMP_BUF]; BYTE sjis[CETOOLS_MAX_TEMP_BUF]; WORD retval; unic[0] = c; unic[1] = 0; unicode2sjis(unic, sjis, CETOOLS_MAX_TEMP_BUF); retval = (WORD)sjis[0]; if (sjis[1]) { retval = ((retval << 8) | (WORD)sjis[1]); } return retval; } TCHAR sjis2unicode_char(WORD c) { TCHAR unic[CETOOLS_MAX_TEMP_BUF]; BYTE sjis[CETOOLS_MAX_TEMP_BUF], *p = sjis; if (c & 0x0ff00L) { *p++ = (c >> 8); } *p++ = (BYTE)c; *p = (BYTE)0; sjis2unicode(sjis, unic, CETOOLS_MAX_TEMP_BUF); return unic[0]; } #endif /* KANJI */ extern int allow_mouse_event; /* * Callback function for mouse events. This function will be called while * calling a function getkbd(). */ VOID MouseEvent(int fn, int x, int y) { if (allow_mouse_event) { WINDOW *wp = wheadp; int startrow; int offset; LINE *lp; extern int rowcol2offset(LINE *lp, int row, int col); while (wp) { startrow = wp->w_toprow; if (startrow <= y && y < startrow + wp->w_ntrows + 1) { if (y < startrow + wp->w_ntrows) { curwp = wp; curbp = wp->w_bufp; lp = wp->w_linep; y = y - startrow + wp->w_lines; offset = rowcol2offset(lp, y, x); while (offset < 0) { y = -offset - 1; if (lforw(lp) != curbp->b_linep) { lp = lforw(lp); offset = rowcol2offset(lp, y, x); } else { offset = llength(lp); break; } } wp->w_dotp = lp; wp->w_doto = offset; } else { /* In case on a mode line, do nothing. */ } break; } wp = wp->w_wndp; } update(); } } #ifdef DROPFILES /* 00.07.07 by sahf */ VOID DropEvent(const char *files, int y) { if (allow_mouse_event) { WINDOW *wp = wheadp; const char *mp; char filename[NFILEN]; int startrow; extern int filevisit pro((int,int)); /* change current window to drag'n drop */ while (wp) { startrow = wp->w_toprow; if (startrow <= y && y < startrow + wp->w_ntrows + 1) { curwp = wp; curbp = wp->w_bufp; break; } wp = wp->w_wndp; } /* 各ファイル名について find_file() 実行 */ mp = files; do { unicode2sjis(mp, filename, NFILEN-1); #ifdef KANJI bufstoe(filename, strlen(filename)+1); #endif eargset(filename); if (!filevisit(FFRAND, 0)) break; mp += lstrlen(mp)+1; } while ( *mp != 0 ); update(); } } #endif /* DROPFILES */ #ifdef CLIPBOARD int euc2sjis_crlf( char *dst, const char *euc, int len ) { int c1, count ; const char *endp = euc + len ; count = 0 ; while ( euc < endp ) { c1 = *euc++ & 0xff ; #ifdef KANJI if ( ISKANJI( c1 ) ) { #ifdef HANKANA if ( c1 == SS2 ) { if ( dst ) { *dst++ = *euc++ ; } count ++ ; } else #endif /* HANKANA */ { int c2 = *euc++ & 0xff; etos( c1, c2 ) ; if ( dst ) { *dst++ = c1 ; *dst++ = c2 ; } count += 2 ; } } else #endif if ( c1 == '\n' ) { if ( dst ) { *dst++ = '\r' ; *dst++ = '\n' ; } count += 2 ; } else { if ( dst ) { *dst++ = c1 ; } count ++ ; } } return count ; } int send_clipboard_(const char *euc, int len) { char *sjis; LPTSTR ptr; DWORD size; #ifdef _WIN32_WCE HLOCAL hGMem; #else HGLOBAL hGMem; #endif size = euc2sjis_crlf(NULL, euc, len); sjis = alloca(size+1); if (sjis == NULL) return FALSE; (void)euc2sjis_crlf(sjis, euc, len); sjis[size] = '\0'; size = sjis2unicode((LPBYTE) sjis, NULL, 0 ) ; if (size == 0) return TRUE ; /* Open clipboard */ if ( !OpenClipboard( 0 ) ) { return FALSE; } else if ( !EmptyClipboard() ) { CloseClipboard() ; return FALSE; } /* allocate memory for some amount needed */ #ifdef _WIN32_WCE hGMem = LocalAlloc( LMEM_FIXED, size ) ; ptr = (LPTSTR) hGMem ; #else /* _WIN32_WCE */ hGMem = GlobalAlloc( GMEM_MOVEABLE|GMEM_DDESHARE, size ) ; ptr = (LPTSTR) GlobalLock( hGMem ) ; #endif /* _WIN32_WCE */ /* Convert UNICODE to SJIS */ sjis2unicode( (LPBYTE) sjis, ptr, size ) ; /* Store the result to clipboard */ #ifdef UNICODE SetClipboardData( CF_UNICODETEXT, hGMem ) ; #else SetClipboardData(CF_TEXT, hGMem); #endif #ifndef _WIN32_WCE GlobalUnlock( hGMem ) ; #endif /* Close clipboard */ CloseClipboard() ; return TRUE; } int size_clipboard_() { LPCTSTR cbptr ; char *p; int i, cbsize, size, ret = 0; #ifdef _WIN32_WCE HLOCAL hGMem ; #else /* _WIN32_WCE */ HGLOBAL hGMem ; #endif /* _WIN32_WCE */ if ( !OpenClipboard( 0 ) ) { return 0; } #ifdef _WIN32_WCE hGMem = GetClipboardData(CF_UNICODETEXT) ; cbsize = LocalSize(hGMem); cbptr = (LPCTSTR) hGMem; #else /* _WIN32_WCE */ #ifdef UNICODE hGMem = GetClipboardData(CF_UNICODETEXT); #else hGMem = GetClipboardData(CF_TEXT); #endif cbsize = GlobalSize( hGMem ) ; cbptr = (LPCTSTR) GlobalLock( hGMem ) ; #endif /* _WIN32_WCE */ if ( !cbsize ) { goto exit ; } ret = unicode2sjis(cbptr, (LPBYTE)NULL, 0); size = 1; /* ASCIZ NULL byte */ for (i=0,p=(char *)cbptr; i 0xA0 && *p < 0xE0) /* *p is kana */ size += 2; else if (*p != '\r') size++; } if (size > ret) ret = size; exit: #ifndef _WIN32_WCE GlobalUnlock( hGMem ) ; #endif /* _WIN32_WCE */ CloseClipboard() ; return ret; } int recieve_clipboard_(char *buffer, int *size) { LPCTSTR cbptr ; int cbsize, ret = FALSE; char *src,*dst; char c; #ifdef _WIN32_WCE HLOCAL hGMem ; #else HGLOBAL hGMem ; #endif if ( !OpenClipboard( 0 ) ) { return FALSE; } #ifdef _WIN32_WCE hGMem = GetClipboardData(CF_UNICODETEXT) ; cbsize = LocalSize( hGMem ); cbptr = (LPCTSTR) hGMem; #else /* _WIN32_WCE */ #ifdef UNICODE hGMem = GetClipboardData(CF_UNICODETEXT) ; #else hGMem = GetClipboardData(CF_TEXT); #endif cbsize = GlobalSize(hGMem) ; cbptr = (LPCTSTR) GlobalLock(hGMem) ; #endif /* _WIN32_WCE */ if ( !cbsize ) { goto exit ; } ret = unicode2sjis(cbptr, (LPBYTE)buffer, cbsize); dst = src = buffer; while (c = *src++) { if (c != '\r') { *dst++ = c; } } #ifdef KANJI *size = bufstoe(buffer, dst-buffer); #else *size = dst - buffer; #endif exit: #ifndef _WIN32_WCE GlobalUnlock( hGMem ) ; #endif CloseClipboard() ; return ret; } #endif /* NO_CLIPBOARD */ #ifndef NO_DIRED void WinExecute(char *fname) { SHELLEXECUTEINFO sei; extern HWND g_hwndTty; int sz; char *sjis; BOOL res; #ifdef KANJI extern void bufetos(char *, int); #endif bzero((char *)&sei, sizeof(sei)); sei.cbSize = sizeof(sei); sei.hwnd = g_hwndTty; sei.lpVerb = (LPCTSTR)0; sei.nShow = SW_SHOW; sz = strlen(fname) + 1; sei.lpFile =(LPTSTR)alloca(sz * (sizeof(TCHAR) + 1)); if (sei.lpFile == NULL) { ewprintf("Memory exhausted!"); return; } sjis = (char *)(sei.lpFile + sz); strcpy(sjis, fname); #ifdef KANJI bufetos(sjis, sz); #endif sjis2unicode(sjis, (LPTSTR)sei.lpFile, sizeof(TCHAR) * sz); res = ShellExecuteEx(&sei); if (!res) { DWORD err = GetLastError(); } } #endif LONG RegSetSomething(HKEY hKey, LPCTSTR lpSubKey, LPTSTR lpValueName, LPBYTE lpSomething, DWORD dwSize, DWORD dwType) { LONG retval; HKEY newkey; DWORD disposition; retval = RegCreateKeyEx(hKey, lpSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &newkey, &disposition); if (retval == ERROR_SUCCESS) { retval = RegSetValueEx(newkey, lpValueName, 0, dwType, lpSomething, dwSize); RegCloseKey(newkey); } return retval; } LONG RegSetDWord(HKEY hKey, LPCTSTR lpSubKey, LPTSTR lpValueName, DWORD data) { return RegSetSomething(hKey, lpSubKey, lpValueName, (LPBYTE)&data, sizeof(DWORD), REG_DWORD); } /* Caution! No distinction between 0 return value and fail */ DWORD RegQueryDWord(HKEY hKey, LPCTSTR lpSubKey, LPTSTR lpValueName) { LONG retval; HKEY newkey; DWORD val, valsize; retval = RegOpenKeyEx(hKey, lpSubKey, REG_OPTION_NON_VOLATILE, KEY_READ, &newkey); if (retval == ERROR_SUCCESS) { DWORD datatype; valsize = sizeof(DWORD); retval = RegQueryValueEx(newkey, lpValueName, (LPDWORD)NULL, &datatype, (LPBYTE)&val, &valsize); RegCloseKey(newkey); } if (retval == ERROR_SUCCESS) { return val; } else { return (DWORD)0; } } LONG RegQueryString(HKEY hKey, LPCTSTR lpSubKey, LPTSTR lpValueName, LPTSTR lpstr, DWORD *lpstrsize) { LONG retval; HKEY newkey; retval = RegOpenKeyEx(hKey, lpSubKey, REG_OPTION_NON_VOLATILE, KEY_READ, &newkey); if (retval == ERROR_SUCCESS) { DWORD datatype; retval = RegQueryValueEx(newkey, lpValueName, (LPDWORD)NULL, &datatype, (LPBYTE)lpstr, lpstrsize); RegCloseKey(newkey); } return retval; } LONG RegSetString(HKEY hKey, LPCTSTR lpSubKey, LPTSTR lpValueName, LPTSTR lpstr) { return RegSetSomething(hKey, lpSubKey, lpValueName, (LPBYTE)lpstr, sizeof(TCHAR) * (lstrlen(lpstr) + 1), REG_SZ); } LONG RegSetBinary(HKEY hKey, LPCTSTR lpSubKey, LPTSTR lpValueName, LPBYTE lpByte, DWORD dwSize) { return RegSetSomething(hKey, lpSubKey, lpValueName, (LPBYTE)lpByte, dwSize, REG_BINARY); } LONG RegRemoveValue(HKEY hKey, LPCTSTR lpSubKey, LPTSTR lpValueName) { LONG retval; HKEY newkey; retval = RegOpenKeyEx(hKey, lpSubKey, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, &newkey); if (retval == ERROR_SUCCESS) { retval = RegDeleteValue(newkey, lpValueName); RegCloseKey(newkey); } return retval; } ng-1.5beta1/sys/win32/tools.h100644 1750 1750 6062 7204766553 14564 0ustar amurausers/* $Id: tools.h,v 1.4 2000/11/16 14:21:31 amura Exp $ */ /* OS dependent code used by Ng for WinCE. * Copyright (C) 1998 Eiichiro Ito * Modified for Ng for Win32 * Copyright (C) 1999,2000 Toru Imai * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * ree Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* * $Log: tools.h,v $ * Revision 1.4 2000/11/16 14:21:31 amura * merge Ng for win32 0.5 * * Revision 1.3 2000/10/23 16:52:51 amura * add GPL copyright to header * * Revision 1.2 2000/07/18 12:40:35 amura * for Win32, enable to handle japanese directory * * Revision 1.1.1.1 2000/06/27 01:48:00 amura * import to CVS * */ #ifndef APP_TOOLS1 #define APP_TOOLS1 #ifdef __cplusplus extern "C" { #endif BOOL Fopen( LPCTSTR path, LPCTSTR modestr ) ; void Fclose( void ) ; int Fgetc( void ) ; char* Fgets( char *buf, int size ) ; int Fputc( int c ) ; int Fputs( const char *buf ) ; void Fwrite( const char *buf, int size ) ; BOOL Ferror( void ) ; void slash2backslash( LPTSTR str ) ; void catdir( LPTSTR body, LPCTSTR adddir, LPTSTR pPrevDir ) ; void rel2abs( LPTSTR newPath, LPCTSTR oldPath, LPCTSTR adddir ) ; int SendClipboard( const char *sjis ) ; int ReceiveClipboard(char *sjis, int bufsize); int unicode2sjis(const char *src, unsigned char *dst, int max); int sjis2unicode(const unsigned char *src, char *dst, int max); TCHAR sjis2unicode_char(WORD sjis); WORD unicode2sjis_char(TCHAR unicode); LONG RegQueryString(HKEY, LPCTSTR, LPTSTR, LPTSTR, DWORD*); LONG RegSetString(HKEY, LPCTSTR, LPTSTR, LPTSTR); LONG RegSetBinary(HKEY, LPCTSTR, LPTSTR, LPBYTE, DWORD); LONG RegSetDWord(HKEY, LPCTSTR, LPTSTR, DWORD); DWORD RegQueryDWord(HKEY, LPCTSTR, LPTSTR); LONG RegRemoveValue(HKEY, LPCTSTR, LPTSTR); #ifdef __cplusplus } ; #endif #ifdef KANJI #define NGREGKEY TEXT("Software\\mg-developers\\Ng") #define NGDEFAULTINIFILE TEXT("\\ng.ini") #else #define NGREGKEY TEXT("Software\\mg-developers\\MG") #define NGDEFAULTINIFILE TEXT("\\mg.ini") #endif #define NGSTARTUPFILEVAL TEXT("Startup File") #define NGCTRLKEYMAPVAL TEXT("Control Key Mapping") #define NGBEEPSOUNDVAL TEXT("Beep Sound") #define NGBEEPFILEVAL TEXT("Beep Sound File") #define NGFONTNAMEVAL TEXT("Font Name") #define NGFONTSIZEVAL TEXT("Font Size") #define NGLINESPACEVAL TEXT("Line Space") #define NGPREVPOSVAL TEXT("Previous Position") #define NGKEYBOARDLOCALEVAL TEXT("Keyboard Locale") #define NGKEYBOARD_US 1 #define NGKEYBOARD_JP 81 #define NG_WAVE_OFFSET 2 #endif /* APP_TOOLS1 */ ng-1.5beta1/sys/win32/tty.c100644 1750 1750 10251 7175066343 14247 0ustar amurausers/* $Id: tty.c,v 1.2 2000/10/23 16:52:51 amura Exp $ */ /* OS dependent code used by Ng for WinCE. * Copyright (C) 1998 Eiichiro Ito * Modified for Ng for Win32 * Copyright (C) 1999,2000 Toru Imai * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * ree Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* * $Log: tty.c,v $ * Revision 1.2 2000/10/23 16:52:51 amura * add GPL copyright to header * * Revision 1.1.1.1 2000/06/27 01:48:00 amura * import to CVS * */ #include #include "config.h" #include "def.h" #include "winmain.h" #include "tools.h" extern int ttrow ; extern int ttcol ; extern int tttop ; extern int ttbot ; extern int tthue ; int SG = 0 ; int tceeol ; /* Costs are set later */ int tcinsl ; int tcdell ; int ttinit() { tceeol = ttcol ; tcdell = NROW * NCOL ; tcinsl = NROW * NCOL ; return 0 ; } int tttidy() { return 0 ; } int ttmove( int row, int col ) { if ( ttrow != row || ttcol != col ) { GotoXY( col, row ) ; ttrow = row ; ttcol = col ; } return 0 ; } /* * Erase to end of line. */ int tteeol() { GotoXY( ttcol, ttrow ) ; EraseEOL() ; return 0 ; } int ttnowindow() { ttrow = HUGE ; ttcol = HUGE ; tttop = HUGE ; ttbot = HUGE ; return 0 ; } /* * Set the current writing color to the * specified color. Watch for color changes that are * not going to do anything (the color is already right) * and don't send anything to the display. * The rainbow version does this in putline.s on a * line by line basis, so don't bother sending * out the color shift. */ int ttcolor( int color ) { if ( color != tthue ) { tthue = color ; /* Save the color. */ } return 0 ; } /* * Erase to end of page. */ int tteeop() { GotoXY( ttcol, ttrow ) ; EraseEOP() ; return 0 ; } /* * Delete nchunk line(s) from "row", replacing the * bottom line on the screen with a blank line. * Unless we're using the scrolling region, this is * done with a crafty sequences of insert and delete * lines. The presence of the echo area makes a * boundry condition go away. */ int ttdell( int row, int bot, int nchunk ) { ttrow = HUGE ; ttcol = HUGE ; return 0 ; } /* * Insert nchunk blank line(s) onto the * screen, scrolling the last line on the * screen off the bottom. Use the scrolling * region if possible for a smoother display. * If no scrolling region, use a set * of insert and delete line sequences */ int ttinsl( int row, int bot, int nchunk ) { ttrow = HUGE ; ttcol = HUGE ; return 0 ; } /* * Make a noise. */ int ttbeep() { extern DWORD g_beepsound; extern TCHAR g_beepfile[]; switch (g_beepsound) { case 0: /* no sounds */ break; #ifndef TARGET_WCEVER_IS_100 case 1: /* play specified sound file */ if (g_beepfile[0]) { sndPlaySound(g_beepfile, SND_ASYNC | SND_NODEFAULT); break; } #endif default: MessageBeep(0xFFFFFFFF); /* Default wave sound */ break; case MB_OK + NG_WAVE_OFFSET: case MB_ICONASTERISK + NG_WAVE_OFFSET: case MB_ICONEXCLAMATION + NG_WAVE_OFFSET: case MB_ICONHAND + NG_WAVE_OFFSET: case MB_ICONQUESTION + NG_WAVE_OFFSET: MessageBeep(g_beepsound - NG_WAVE_OFFSET); break; } return 0; } /* * This routine is called by the * "refresh the screen" command to try and resize * the display. The new size, which must be deadstopped * to not exceed the NROW and NCOL limits, it stored * back into "nrow" and "ncol". Display can always deal * with a screen NROW by NCOL. Look in "window.c" to * see how the caller deals with a change. */ int ttresize() { extern void setttysize pro((void)); setttysize(); return 0; } ng-1.5beta1/sys/win32/ttyctrl.cpp100644 1750 1750 74476 7303500513 15500 0ustar amurausers/* $Id: ttyctrl.cpp,v 1.9 2001/05/25 15:59:07 amura Exp $ */ /* OS dependent code used by Ng for WinCE. * Copyright (C) 1998 Eiichiro Ito * Modified for Ng for Win32 * Copyright (C) 1999,2000 Toru Imai * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * ree Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* * $Log: ttyctrl.cpp,v $ * Revision 1.9 2001/05/25 15:59:07 amura * WIN32 version support AUTOSAVE feature * * Revision 1.8 2001/01/05 14:07:09 amura * first implementation of Hojo Kanji support * * Revision 1.7 2000/11/16 14:21:31 amura * merge Ng for win32 0.5 * * Revision 1.6 2000/10/23 16:52:51 amura * add GPL copyright to header * * Revision 1.5 2000/09/21 17:19:30 amura * TtyView::PutLine is replaced by old code for speed reason * * Revision 1.4 2000/07/24 15:34:55 amura * rewrite PutLine() * * Revision 1.3 2000/07/22 20:46:33 amura * support "Drag&Drop" * * Revision 1.2 2000/07/18 12:42:33 amura * support IME convertion on the spot * * Revision 1.1.1.1 2000/06/27 01:48:00 amura * import to CVS * */ #include "config.h" #include #include #include #include "def.h" #include "ttyctrl.h" #include "tools.h" #include "resource.h" #if defined(KANJI) && defined(USE_KCTRL) #include "kctrl.h" #include "cefep.h" #endif #ifndef USE_KCTRL #define CONFIG_FONT #endif #ifdef KANJI #ifndef SHIFTJIS_CHARSET #define SHIFTJIS_CHARSET 128 #endif #endif #define is_kanji(x) (((x)>=0x81 && (x)<=0x9F)||((x)>=0xE0 && (x)<=0xFC)) #define MAX_KEYBUF 256 #define MAX_WINEVENTBUF 32 #ifdef DROPFILES /* 00.07.07 by sahf */ #define MAX_DROPBUF 32 #endif /* DROPFILES */ #ifdef KANJI #ifndef USE_KCTRL #define DEFAULT_HMARGIN 2 #define PUTLINE_ADJUSTMENT 0 #else /* if USE_KCTRL */ #define DEFAULT_HMARGIN 1 #define PUTLINE_ADJUSTMENT 1 #endif /* USE_KCTRL */ #else /* if !KANJI */ #define DEFAULT_POINT 9 #define DEFAULT_HMARGIN 0 #define PUTLINE_ADJUSTMENT 1 #endif /* !KANJI */ #ifndef USE_KCTRL static LOGFONT lfont = { #ifdef KANJI #if 0 14, 7, 0, 0, 0x190, 0x00, 0x00, 0x00, SHIFTJIS_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DRAFT_QUALITY, FF_MODERN | FIXED_PITCH, // {0xFF2D, 0xFF33, 0x0020, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0x0000} TEXT("") #else /* if !0 */ 12, 6, 0, 0, 0x0, 0x00, 0x00, 0x00, SHIFTJIS_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DRAFT_QUALITY, FF_MODERN | FIXED_PITCH, // {0xFF2D, 0xFF33, 0x0020, 0x30B4, 0x30B7, 0x30C3, 0x30AF, 0x0000} TEXT("") #endif /* !0 */ #else /* if !KANJI */ 12, 6, 0, 0, 0x0, 0x00, 0x00, 0x00, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DRAFT_QUALITY, FF_MODERN | FIXED_PITCH, #ifdef _WIN32_WCE TEXT("Courier New") #else /* if !_WIN32_WCE */ TEXT("") #endif /* !_WIN32_WCE */ #endif /* !KANJI */ }; #endif /* !USE_KCTRL */ #if !defined(KANJI) || !defined(USE_KCTRL) #define GetFontH() (lfont.lfHeight + 1) #define GetFontHW() (lfont.lfWidth) #define KDrawText(hdc, str, len, rect, f) do { HFONT hOldFont; \ hOldFont = (HFONT)SelectObject(hdc, m_hFont); \ DrawText(hdc, str, len, rect, (DT_NOPREFIX | DT_LEFT | DT_EXPANDTABS)); \ SelectObject(hdc, hOldFont); } while (0/*CONSTCOND*/) #endif class TtyView { protected: HWND m_hwnd ; /* Window handle of this control */ HWND m_hwndParent ; /* Parent window of the control */ WORD m_idCtrl ; /* Id of the control */ DWORD m_dwCols ; /* Number of columns in a line */ DWORD m_dwLines ; /* Number of lines in a screen */ DWORD m_dwHMargin ; /* Virtical margin */ DWORD m_dwFontW ; /* Font width */ DWORD m_dwFontH ; /* Font height */ DWORD m_dwTabSize ; /* TAB size */ HBITMAP m_bmpScreen ; /* Screen image */ RECT m_rcInvalidate ; /* RECT drawn by PutChar */ DWORD m_dwCurCol ; /* cursor column */ DWORD m_dwCurLine ; /* cursor row */ DWORD m_dwCurH ; /* Height of cursor */ DWORD m_dwLastCurWidth ; /* Width of cursor */ DWORD m_dwLastCurX ; /* Cursor horizontal position */ DWORD m_dwLastCurY ; /* Cursor virtical position */ HANDLE m_hevtKey ; /* Key input event */ WORD m_szKeyBuf[ MAX_KEYBUF ] ; /* Key input buffer */ DWORD m_dwKeyIn ; /* Key input point */ DWORD m_dwKeyOut ; /* Key output point */ int m_szWinEventBuf[MAX_WINEVENTBUF]; /* Window Event buffer */ DWORD m_dwWinEventOut; /* Window Event output pointer */ DWORD m_dwWinEventIn; /* Window Event input pointer */ #ifdef DROPFILES /* 00.07.07 by sahf */ HLOCAL m_szDropBuf[ MAX_DROPBUF ] ; /* Drag And Drop Infos */ int m_iDropLine[ MAX_DROPBUF ] ; /* Drag and Drop point saver */ DWORD m_dwDropIn ; DWORD m_dwDropOut ; #endif /* DROPFILES */ HFONT m_hFont; /* handle for font */ DWORD m_keyboardlocale; /* Keyboard locale */ #ifdef DROPFILES /* 00.07.07 by sahf */ int GetDropFiles( HLOCAL *lphMemory ) ; #endif /* DROPFILES */ void SetupEvent( HANDLE hEvent ) ; void ClearScreen() ; void PutChar( BYTE c ) ; void PutKChar( BYTE c1, BYTE c2 ) ; void GotoXY( WORD x, WORD y ) ; void EraseEOL() ; void EraseEOP() ; void PutLine( WORD y, WORD color, LPCSTR sjis ) ; void Flush() ; BOOL Kbhit() const ; int GetChar() ; DWORD GetWH() const ; void AddMetaChar( TCHAR c ) ; void AddChar( TCHAR c ) ; void Command(WPARAM, LPARAM); void SetKeyboardLocale(DWORD val); void ShowCursor(void); void HideCursor(void); void ResetContent() ; int GetWindowEvent(void); void AddWindowEvent(int); #ifndef USE_KCTRL void SetFontValues(LOGFONT *, HDC); #endif void AdjustScreen(HWND, HDC); public: TtyView() ; ~TtyView() ; BOOL Create() { return FALSE ; } #ifdef DROPFILES /* 00.07.07 by sahf */ void WMDropFiles( HDROP hDrop ) ; #endif /* DROPFILES */ void WMCreate( HWND hWnd, LPCREATESTRUCT lpcs ) ; void WMPaint() ; LRESULT WMCommand( HWND hWnd, UINT msg, WPARAM wp, LPARAM lp ) ; BOOL WMCopydata( PCOPYDATASTRUCT cds ) ; BOOL WMSysChar( TCHAR c, LONG keydata ) ; void WMChar( TCHAR c, LONG keydata ) ; BOOL WMKeyDown( int nVirtKey, LONG lKeyData ) ; void WMMouseDown( WPARAM wParam, LPARAM lParam ) ; void WMSize( DWORD fwSize, WORD nWidth, WORD nHeight ) ; BOOL WMCopy(void) ; void WMLButtonDown(int x, int y); void WMSetFocus(void); void WMKillFocus(void); void SetTab( DWORD wParam, BOOL bUpdate ) ; void SetHMargin( DWORD wParam, BOOL bUpdate ) ; #ifdef CONFIG_FONT void FontChanged(void); #endif friend LRESULT CALLBACK TtyViewWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) ; } ; typedef TtyView *PTtyView ; TtyView::TtyView() { m_dwCols = 0 ; m_dwLines = 0 ; m_dwHMargin = DEFAULT_HMARGIN; m_dwFontW = GetFontHW() ; m_dwFontH = GetFontH() + m_dwHMargin ; m_dwTabSize = 8 ; m_bmpScreen = 0 ; SetRectEmpty( &m_rcInvalidate ) ; m_dwCurCol = 0 ; m_dwCurLine = 0 ; m_dwCurH = GetFontH() ; m_dwLastCurWidth = 0 ; m_dwLastCurX = 0 ; m_dwLastCurY = 0 ; m_hevtKey = 0 ; m_dwKeyIn = 0 ; m_dwKeyOut = 0 ; m_dwWinEventIn = m_dwWinEventOut = 0; #ifdef DROPFILES /* 00.07.07 by sahf */ m_dwDropIn = m_dwDropOut = 0; #endif /* DROPFILES */ m_hFont = (HFONT)0; } TtyView::~TtyView() { if ( m_bmpScreen ) { DeleteObject( m_bmpScreen ) ; m_bmpScreen = 0 ; } if (m_hFont) { DeleteObject(m_hFont); m_hFont = (HFONT)0; } } /* * Clear screen buffer */ void TtyView::ClearScreen() { RECT rect ; HGDIOBJ hOldObj ; HDC hDC, hdcBmp ; HideCursor(); GetClientRect( m_hwnd, &rect ) ; hDC = GetDC( m_hwnd ) ; hdcBmp = CreateCompatibleDC( hDC ) ; hOldObj = SelectObject( hdcBmp, m_bmpScreen ) ; FillRect( hdcBmp, &rect, (HBRUSH) GetStockObject( WHITE_BRUSH ) ) ; FillRect( hDC, &rect, (HBRUSH) GetStockObject( WHITE_BRUSH ) ) ; SelectObject( hdcBmp, hOldObj ) ; DeleteDC( hdcBmp ) ; ReleaseDC( m_hwnd, hDC ) ; ShowCursor(); } void TtyView::SetupEvent( HANDLE hEvent ) { m_hevtKey = hEvent ; } void TtyView::PutChar( BYTE c ) { RECT rect ; HGDIOBJ hOldObj ; HDC hDC, hdcBmp ; TCHAR unicode[ 2 ] ; if ( c == '\b' ) { if ( m_dwCurCol ) GotoXY( (WORD) (m_dwCurCol - 1), (WORD) m_dwCurLine ) ; return ; } rect.left = m_dwCurCol * m_dwFontW ; rect.top = m_dwCurLine * m_dwFontH ; rect.right = rect.left + m_dwFontW - 1 ; rect.bottom = rect.top + m_dwFontH - 1 ; unicode[0] = sjis2unicode_char( c ) ; unicode[1] = 0 ; HideCursor(); hDC = GetDC( m_hwnd ) ; hdcBmp = CreateCompatibleDC( hDC ) ; hOldObj = SelectObject( hdcBmp, m_bmpScreen ) ; if ( unicode[0] == TEXT(' ') ) { rect.right ++ ; rect.bottom ++ ; FillRect( hdcBmp, &rect, (HBRUSH) GetStockObject( WHITE_BRUSH ) ) ; // FillRect( hDC, &rect, (HBRUSH) GetStockObject( WHITE_BRUSH ) ) ; rect.right -- ; rect.bottom -- ; } else { KDrawText( hdcBmp, unicode, -1, &rect, 0 ) ; // BitBlt( hDC, rect.left, rect.top, rect.right - rect.left + 1, rect.bottom - rect.top + 1, // hdcBmp, rect.left, rect.top, SRCCOPY ) ; } UnionRect( &m_rcInvalidate, &m_rcInvalidate, &rect ) ; SelectObject( hdcBmp, hOldObj ) ; DeleteDC( hdcBmp ) ; m_dwCurCol ++ ; if ( m_dwCurCol >= m_dwCols ) { m_dwCurCol = 0 ; m_dwCurLine ++ ; if ( m_dwCurLine >= m_dwLines ) { m_dwCurLine = 0 ; } } ReleaseDC( m_hwnd, hDC ) ; ShowCursor(); } void TtyView::PutKChar(BYTE c1, BYTE c2) { RECT rect; HGDIOBJ hOldObj; HDC hDC, hdcBmp; TCHAR unicode[2]; BYTE foo[3]; rect.left = m_dwCurCol * m_dwFontW; rect.top = m_dwCurLine * m_dwFontH; rect.right = rect.left + (m_dwFontW * 2) - 1; rect.bottom = rect.top + m_dwFontH - 1; foo[0] = c1; foo[1] = c2; foo[2] = (BYTE)0; sjis2unicode(foo, unicode, sizeof(unicode)); HideCursor(); hDC = GetDC(m_hwnd); hdcBmp = CreateCompatibleDC(hDC); hOldObj = SelectObject(hdcBmp, m_bmpScreen); KDrawText(hdcBmp, unicode, -1, &rect, 0); UnionRect(&m_rcInvalidate, &m_rcInvalidate, &rect); SelectObject(hdcBmp, hOldObj); DeleteDC(hdcBmp); m_dwCurCol += 2; if (m_dwCurCol >= m_dwCols) { m_dwCurCol = 0; m_dwCurLine++; if (m_dwCurLine >= m_dwLines) m_dwCurLine = 0; } ReleaseDC(m_hwnd, hDC); ShowCursor(); } void TtyView::GotoXY( WORD x, WORD y ) { HideCursor(); m_dwCurCol = x ; m_dwCurLine = y ; ShowCursor(); #if defined(FEPCTRL) && !defined(USE_KCTRL) { HIMC hIMC = ImmGetContext(m_hwnd); if (hIMC) { COMPOSITIONFORM cf; cf.dwStyle = CFS_POINT; cf.ptCurrentPos.x = m_dwLastCurX; cf.ptCurrentPos.y = m_dwLastCurY; ImmSetCompositionWindow(hIMC, &cf); ImmReleaseContext(m_hwnd, hIMC); } } #endif } BOOL TtyView::Kbhit() const { return m_dwKeyIn != m_dwKeyOut ; } void TtyView::EraseEOL() { RECT rect ; HGDIOBJ hOldObj ; HDC hDC, hdcBmp ; HideCursor(); hDC = GetDC( m_hwnd ) ; hdcBmp = CreateCompatibleDC( hDC ) ; hOldObj = SelectObject( hdcBmp, m_bmpScreen ) ; rect.left = m_dwCurCol * m_dwFontW ; rect.top = m_dwCurLine * m_dwFontH ; rect.right = m_dwCols * m_dwFontW ; rect.bottom = rect.top + m_dwFontH ; FillRect( hdcBmp, &rect, (HBRUSH) GetStockObject( WHITE_BRUSH ) ) ; // FillRect( hDC, &rect, (HBRUSH) GetStockObject( WHITE_BRUSH ) ) ; UnionRect( &m_rcInvalidate, &m_rcInvalidate, &rect ) ; SelectObject( hdcBmp, hOldObj ) ; DeleteDC( hdcBmp ) ; ReleaseDC( m_hwnd, hDC ) ; ShowCursor(); } void TtyView::EraseEOP() { RECT rect ; HGDIOBJ hOldObj ; HDC hDC, hdcBmp ; HideCursor(); hDC = GetDC( m_hwnd ) ; hdcBmp = CreateCompatibleDC( hDC ) ; hOldObj = SelectObject( hdcBmp, m_bmpScreen ) ; rect.left = m_dwCurCol * m_dwFontW ; rect.top = m_dwCurLine * m_dwFontH ; rect.right = m_dwCols * m_dwFontW ; rect.bottom = rect.top + m_dwFontH ; if ( !IsRectEmpty( &rect ) ) { FillRect( hdcBmp, &rect, (HBRUSH) GetStockObject( WHITE_BRUSH ) ) ; FillRect( hDC, &rect, (HBRUSH) GetStockObject( WHITE_BRUSH ) ) ; } rect.left = 0 ; rect.top = (m_dwCurLine + 1) * m_dwFontH ; rect.right = m_dwCols * m_dwFontW ; rect.bottom = m_dwLines * m_dwFontH ; if ( !IsRectEmpty( &rect ) ) { FillRect( hdcBmp, &rect, (HBRUSH) GetStockObject( WHITE_BRUSH ) ) ; FillRect( hDC, &rect, (HBRUSH) GetStockObject( WHITE_BRUSH ) ) ; } SelectObject( hdcBmp, hOldObj ) ; DeleteDC( hdcBmp ) ; ReleaseDC( m_hwnd, hDC ) ; ShowCursor(); } void TtyView::PutLine( WORD y, WORD color, LPCSTR sjis ) { RECT rect ; HGDIOBJ hOldObj ; HDC hDC, hdcBmp ; TCHAR unicode[ 256 ] ; HideCursor(); hDC = GetDC( m_hwnd ) ; hdcBmp = CreateCompatibleDC( hDC ) ; hOldObj = SelectObject( hdcBmp, m_bmpScreen ) ; rect.left = 0 ; rect.top = y * m_dwFontH ; rect.right = m_dwCols * m_dwFontW - 1 ; rect.bottom = rect.top + m_dwFontH - 1 ; sjis2unicode( (LPBYTE) sjis, unicode, sizeof unicode ) ; KDrawText( hdcBmp, unicode, -1, &rect, 0 ) ; if ( color ) { PatBlt(hdcBmp, rect.left, rect.top, rect.right - rect.left, m_dwCurH - PUTLINE_ADJUSTMENT, PATINVERT); } BitBlt( hDC, rect.left, rect.top, rect.right - rect.left + 1, rect.bottom - rect.top + 1, hdcBmp, rect.left, rect.top, SRCCOPY ) ; SelectObject( hdcBmp, hOldObj ) ; DeleteDC( hdcBmp ) ; ReleaseDC( m_hwnd, hDC ) ; ShowCursor(); } void TtyView::Flush() { if ( !IsRectEmpty( &m_rcInvalidate ) ) { InvalidateRect( m_hwnd, &m_rcInvalidate, TRUE ) ; // UpdateWindow( m_hwnd ) ; SetRectEmpty( &m_rcInvalidate ) ; } } /* * Get one character */ int TtyView::GetChar() { WORD c; if (m_dwKeyIn == m_dwKeyOut) return -1; c = m_szKeyBuf[m_dwKeyOut]; m_dwKeyOut = (m_dwKeyOut + 1) % MAX_KEYBUF; return (int) c; } DWORD TtyView::GetWH() const { return MAKELONG( m_dwLines, m_dwCols ) ; } /* To process the commands which corresponds to push buttons on the main window of MG */ void TtyView::Command(WPARAM wparam, LPARAM lparam) { switch (LOWORD(wparam)) { case IDC_PRIOR: AddMetaChar(TEXT('V')); break; case IDC_NEXT: AddChar(TEXT('V') - TEXT('@')); break; case IDC_MARK: AddChar(TEXT('@') - TEXT('@')); break; case IDC_CUT: AddChar(TEXT('W') - TEXT('@')); break; case IDC_COPY: AddMetaChar(TEXT('W')); break; case IDC_PASTE: AddChar(TEXT('Y') - TEXT('@')); break; case IDC_CLOSE: AddChar(TEXT('X') - TEXT('@')); AddChar(TEXT('C') - TEXT('@')); break; default: break; } } void TtyView::AddMetaChar( TCHAR c ) { DWORD next1 ; next1 = (m_dwKeyIn + 1) % MAX_KEYBUF ; if ( next1 == m_dwKeyOut ) { return ; } #ifdef DO_METAKEY m_szKeyBuf[ m_dwKeyIn ] = METABIT | (c % METABIT) ; m_dwKeyIn = next1 ; if ( m_hevtKey ) { ::SetEvent( m_hevtKey ) ; } #else /* if !DO_METAKEY */ AddChar('\033'); /* ESC */ AddChar(c); #endif } void TtyView::AddChar( TCHAR c ) { WORD sjisChar ; DWORD next1, next2 ; sjisChar = c ? unicode2sjis_char( c ) : 0 ; next1 = (m_dwKeyIn + 1) % MAX_KEYBUF ; if ( next1 == m_dwKeyOut ) return ; if ( sjisChar / 0x100 ) { next2 = (m_dwKeyIn + 2) % MAX_KEYBUF ; if ( next2 == m_dwKeyOut ) { return ; } m_szKeyBuf[ m_dwKeyIn ] = sjisChar / 0x100 ; m_dwKeyIn = next1 ; next1 = next2 ; } m_szKeyBuf[ m_dwKeyIn ] = sjisChar % 0x100 ; m_dwKeyIn = next1 ; if ( m_hevtKey ) { ::SetEvent( m_hevtKey ) ; } } #ifdef DROPFILES /* 00.07.07 by sahf */ /* * Get Drag & Drop files (from main thread) */ int TtyView::GetDropFiles( HLOCAL *lphMemory ) { int line; if ( lphMemory == NULL ) return -1; if (m_dwDropIn == m_dwDropOut) return -1; *lphMemory = m_szDropBuf[m_dwDropOut]; line = m_iDropLine[m_dwDropOut]; m_dwDropOut = (m_dwDropOut + 1) % MAX_DROPBUF; return line; } #endif /* DROPFILES */ /* * Put a window event onto a queue. */ int TtyView::GetWindowEvent() { int c; if (m_dwWinEventIn == m_dwWinEventOut) { return -1 ; } c = m_szWinEventBuf[m_dwWinEventOut]; m_dwWinEventOut = (m_dwWinEventOut + 1) % MAX_WINEVENTBUF; return c; } /* * Get a window event from a queue. */ void TtyView::AddWindowEvent(int ev) { DWORD next1; next1 = (m_dwWinEventIn + 1) % MAX_WINEVENTBUF; if (next1 == m_dwWinEventOut) { return; } m_szWinEventBuf[m_dwWinEventIn] = ev; m_dwWinEventIn = next1; if (m_hevtKey) { ::SetEvent(m_hevtKey); } } /*---------------------------------------------------------------------* * Drawing cursor *---------------------------------------------------------------------*/ #define CARETWIDTH 2 /* * Show cursor */ void TtyView::ShowCursor(void) { if (!m_dwLastCurWidth) { m_dwLastCurWidth = CARETWIDTH; m_dwLastCurX = m_dwFontW * m_dwCurCol; m_dwLastCurY = m_dwFontH * m_dwCurLine; SetCaretPos(m_dwLastCurX, m_dwLastCurY); ShowCaret(m_hwnd); } } /* * Hide cursor */ void TtyView::HideCursor(void) { if (m_dwLastCurWidth) { m_dwLastCurWidth = 0; HideCaret(m_hwnd); } } void TtyView::ResetContent() { ClearScreen() ; } #ifndef USE_KCTRL void TtyView::SetFontValues(LOGFONT *lf, HDC hdc) { DWORD val, point, linespace; FLOAT cyDpi, cxDpi; POINT pt; TCHAR fontname[LF_FACESIZE]; cxDpi = (FLOAT)GetDeviceCaps(hdc, LOGPIXELSX); cyDpi = (FLOAT)GetDeviceCaps(hdc, LOGPIXELSY); val = sizeof(fontname); if (RegQueryString(HKEY_CURRENT_USER, NGREGKEY, NGFONTNAMEVAL, fontname, &val) == ERROR_SUCCESS) { point = RegQueryDWord(HKEY_CURRENT_USER, NGREGKEY, NGFONTSIZEVAL); if (point > 0) { linespace = RegQueryDWord(HKEY_CURRENT_USER, NGREGKEY, NGLINESPACEVAL); #ifndef KANJI calcsizes: #endif pt.x = (int)(point * cxDpi / 72); pt.y = (int)(point * cyDpi / 72); #ifndef _WIN32_WCE DPtoLP(hdc, &pt, 1); /* What should I do for Windows CE for above? */ #endif if (pt.y < 0) { /* obtain an absolute value */ pt.y = -pt.y; } /* specify character height, not cell one */ lf->lfHeight = -(int)pt.y; lf->lfWidth = 0; lstrcpy(lf->lfFaceName, fontname); m_dwHMargin = linespace; return; } } m_dwHMargin = DEFAULT_HMARGIN; #ifdef KANJI /* reset to default values */ lf->lfHeight = 12; lf->lfWidth = 6; lf->lfFaceName[0] = TEXT('\0'); #else /* if !KANJI */ /* reset to default values */ point = DEFAULT_POINT; linespace = DEFAULT_HMARGIN; #ifdef _WIN32_WCE lstrcpy(lf->lfFaceName, TEXT("Courier New")); #else /* if !_WIN32_WCE */ lf->lfFaceName[0] = TEXT('\0'); #endif /* !_WIN32_WCE */ goto calcsizes; #endif /* !KANJI */ } #endif /* !USE_KCTRL */ void TtyView::AdjustScreen(HWND hWnd, HDC hDC) { RECT rect; #ifndef USE_KCTRL TEXTMETRIC tm; /* create an handle of required font */ SetFontValues(&lfont, hDC); m_hFont = CreateFontIndirect(&lfont); /* re-calculate the font metrics */ SelectObject(hDC, m_hFont); GetTextMetrics(hDC, &tm); m_dwFontW = tm.tmAveCharWidth; m_dwFontH = tm.tmHeight + m_dwHMargin; m_dwCurH = tm.tmHeight; #ifdef FEPCTRL /* set font to imm */ { HIMC hIMC = ImmGetContext(m_hwnd); if (hIMC) { ImmSetCompositionFont(hIMC, &lfont); ImmReleaseContext(m_hwnd, hIMC); } } #endif /* FEPCTRL */ #endif /* !USE_KCTRL */ /* Calculate the line numbers and column numbers */ GetClientRect(m_hwnd, &rect); m_dwLines = rect.bottom / m_dwFontH; m_dwCols = rect.right / m_dwFontW; /* Create a display buffer */ if (m_bmpScreen) DeleteObject(m_bmpScreen); m_bmpScreen = CreateCompatibleBitmap(hDC, rect.right, rect.bottom); } void TtyView::SetKeyboardLocale(DWORD val) { m_keyboardlocale = val; } void TtyView::WMCreate( HWND hWnd, LPCREATESTRUCT lpcs ) { HDC hDC ; m_hwnd = hWnd ; m_hwndParent = lpcs->hwndParent ; m_idCtrl = (WORD) lpcs->hMenu ; hDC = GetDC(m_hwnd); AdjustScreen(hWnd, hDC); ReleaseDC(m_hwnd, hDC); ClearScreen() ; } void TtyView::WMPaint() { PAINTSTRUCT ps ; RECT rect ; HGDIOBJ hOldObj ; HDC hDC, hdcBmp ; GetClientRect( m_hwnd, &rect ) ; hDC = ::BeginPaint( m_hwnd, &ps ) ; /* HideCursor( hDC ) ; */ hdcBmp = CreateCompatibleDC( hDC ) ; hOldObj = SelectObject( hdcBmp, m_bmpScreen ) ; BitBlt( hDC, 0, 0, rect.right, rect.bottom, hdcBmp, 0, 0, SRCCOPY ) ; SelectObject( hdcBmp, hOldObj ) ; DeleteDC( hdcBmp ) ; /* ShowCursor( hDC ) ; */ ::EndPaint( m_hwnd, &ps ) ; } void TtyView::WMChar( TCHAR chCharCode, LONG lKeyData ) { BOOL fControl = 0x80 & GetKeyState( VK_CONTROL ) ; #if defined(KANJI) && defined(USE_KCTRL) if ( Fep_WM_CHAR( m_hwnd, chCharCode, lKeyData ) ) { return ; } else #endif if ( chCharCode == TEXT(' ') && fControl ) { chCharCode = 0 ; } AddChar( chCharCode ) ; } BOOL TtyView::WMSysChar( TCHAR chCharCode, LONG lKeyData ) { #if defined(KANJI) && defined(USE_KCTRL) if ( Fep_WM_SYSCHAR( m_hwnd, chCharCode, lKeyData ) ) { return TRUE ; } else #endif if ( !(lKeyData & 0x20000000) ) { return FALSE ; } AddMetaChar( chCharCode ) ; return TRUE ; } BOOL TtyView::WMKeyDown( int nVirtKey, LONG lKeyData ) { BOOL fShift = 0x80 & GetKeyState( VK_SHIFT ) ; BOOL fControl = 0x80 & GetKeyState( VK_CONTROL ) ; BOOL fRepeat = (lKeyData & 0x000F) > 1 ? TRUE : FALSE ; switch ( nVirtKey ) { case VK_UP: AddChar( TEXT('P') - TEXT('@') ) ; break ; case VK_DOWN: AddChar( TEXT('N') - TEXT('@') ) ; break ; case VK_LEFT: AddChar( TEXT('B') - TEXT('@') ) ; break ; case VK_RIGHT: AddChar( TEXT('F') - TEXT('@') ) ; break ; case VK_PRIOR: AddMetaChar( TEXT('V') ) ; break ; case VK_NEXT: AddChar( TEXT('V') - TEXT('@') ) ; break ; case VK_HOME: if (fControl) AddMetaChar(TEXT('<')); else AddChar(TEXT('A') - TEXT('@')); break ; case VK_END: if (fControl) AddMetaChar(TEXT('>')); else AddChar(TEXT('E') - TEXT('@')); break ; case VK_DELETE: AddChar(0x7f); break; #ifdef JAPANESE_KEYBOARD /* The following mapping is achieved by observing the behavior of Windows CE Japanese version. It looks as if the virtual key code is the same as English one, but mapping from virtual key to character differs. */ default: if (m_keyboardlocale == NGKEYBOARD_JP) { #if defined(VK_LBRACKET) || defined(VK_BACKQUOTE) || defined(VK_EQUAL) switch (nVirtKey) { #ifdef VK_LBRACKET case VK_LBRACKET: if (fControl) AddChar(TEXT('@') - TEXT('@')); break; #endif #ifdef VK_BACKQUOTE case VK_BACKQUOTE: if (fControl) AddChar(TEXT('_') - TEXT('@')); break; #endif #ifdef VK_EQUAL case VK_EQUAL: if (fControl) AddChar(TEXT('^') - TEXT('@')); break; #endif } #endif /* defined(VK_LBRACKET) || defined(VK_BACKQUOTE) || defined(VK_EQUAL) */ } #if 0 else { switch (nVirtKey) { #ifdef VK_LBRACKET case VK_LBRACKET: if (fControl) AddChar(TEXT('[') - TEXT('@')); break; #endif #ifdef VK_RBRACKET case VK_RBRACKET: if (fControl) AddChar(TEXT(']') - TEXT('@')); break; #endif } } #endif break; #else /* not JAPANESE_KEYBOARD */ default: #endif /* JAPANESE_KEYBOARD */ return FALSE; } return TRUE; } LRESULT TtyView::WMCommand( HWND hWnd, UINT msg, WPARAM wp, LPARAM lp ) { int nVirtKey ; switch ( LOWORD(wp) ) { case IDM_FEPOK: /* return ACK for accepting FEP */ return IDM_FEPOK ; case IDM_FEPKEY: /* Key input from FEP */ nVirtKey = lp & 0xFF ; WMKeyDown( nVirtKey, 0 ) ; break ; } return 0 ; } BOOL TtyView::WMCopydata( PCOPYDATASTRUCT cds ) { TCHAR c ; LPCTSTR ptr = (LPCTSTR) cds->lpData ; while ( c = *ptr++ ) { AddChar( c ) ; } return TRUE ; } void TtyView::WMSize( DWORD fwSize, WORD nWidth, WORD nHeight ) { HDC hDC ; RECT rect ; DWORD prevlines, prevcols; prevlines = m_dwLines; prevcols = m_dwCols; /* Get how many columns in a line and lines in a screen */ GetClientRect( m_hwnd, &rect ) ; m_dwLines = rect.bottom / m_dwFontH ; m_dwCols = rect.right / m_dwFontW ; /* Create a screen buffer */ if ( m_bmpScreen ) { DeleteObject( m_bmpScreen ) ; } /* Create a screen buffer */ hDC = GetDC( m_hwnd ) ; m_bmpScreen = CreateCompatibleBitmap( hDC, rect.right, rect.bottom ) ; ReleaseDC( m_hwnd, hDC ) ; ResetContent() ; if (prevlines != m_dwLines || prevcols != m_dwCols) { AddWindowEvent(TTY_WM_RESIZE); } } void TtyView::WMLButtonDown(int x, int y) { int xx, yy; xx = x / m_dwFontW; yy = y / m_dwFontH; AddWindowEvent((yy << 18) | (xx << 4) | TTY_WM_MOUSE); } #ifdef DROPFILES /* 00.07.07 by sahf */ void TtyView::WMDropFiles( HDROP hDrop ) { UINT iFile ; HLOCAL hMemory ; POINT sDropPoint ; /* allocate memory for store filename */ hMemory = LocalAlloc(LPTR, 16) ; /* get file count which is dropped */ iFile = DragQueryFile(hDrop, 0xFFFFFFFF, NULL, 0) ; if (iFile && hMemory) { UINT iMemSize ; /* allocated memory size */ UINT iMemPos ; DragQueryPoint(hDrop, &sDropPoint); iMemSize = LocalSize( hMemory ) ; iMemPos = 0 ; while (iFile--) { UINT bufsz ; /* filename length (unit : byte) */ UINT newsize ; /* request memory size */ char *fname ; /* get filename length for allocate buffer */ bufsz = DragQueryFile(hDrop, iFile, NULL, 0) ; ++bufsz ; bufsz *= sizeof(TCHAR) ;/* char count -> byte count */ /* check room of hMemory */ newsize = iMemPos + bufsz + sizeof(TCHAR) ; if ( iMemSize < newsize ) { HLOCAL hNewMem ; /* realloc hMemory if it is too small */ hNewMem = LocalAlloc(LPTR, newsize) ; if ( hNewMem == NULL ) { LocalFree( hMemory ); hMemory = NULL; break ; } CopyMemory(hNewMem, hMemory, iMemSize); LocalFree(hMemory); hMemory = hNewMem; iMemSize = LocalSize( hMemory ) ; } /* beginning of filename is hMemory[iMemPos] */ fname = (char *) hMemory ; fname += iMemPos ; iMemPos += bufsz ; fname[bufsz] = 0; /* get filename */ DragQueryFile(hDrop, iFile, (LPTSTR) fname, bufsz) ; } } DragFinish(hDrop); if ( hMemory ) { DWORD next1 ; next1 = (m_dwDropIn + 1) % MAX_DROPBUF ; if ( next1 == m_dwDropOut ) { return ; } m_szDropBuf[ m_dwDropIn ] = hMemory ; m_iDropLine[ m_dwDropIn ] = sDropPoint.y / m_dwFontH ; m_dwDropIn = next1 ; } AddWindowEvent(TTY_WM_DROPFILES); } #endif /* DROPFILES */ void TtyView::WMSetFocus(void) { CreateCaret(m_hwnd, NULL, CARETWIDTH, m_dwCurH); m_dwLastCurWidth = 0; ShowCursor(); } void TtyView::WMKillFocus(void) { HideCursor(); DestroyCaret(); } #if 0 /* * Set TAB size */ void TtyView::SetTab( DWORD wParam, BOOL bUpdate ) { if ( m_dwTabSize == wParam ) { return ; } m_dwTabSize = wParam ; if ( bUpdate ) { ResetContent() ; } } #endif /* * Set virtical margin */ void TtyView::SetHMargin( DWORD wParam, BOOL bUpdate ) { RECT rect ; if ( m_dwHMargin == wParam ) { return ; } GetClientRect( m_hwnd, &rect ) ; m_dwHMargin = wParam ; m_dwFontH = GetFontH() + m_dwHMargin ; m_dwLines = rect.bottom / m_dwFontH ; if ( bUpdate ) { ResetContent() ; } } #ifdef CONFIG_FONT /* * Notified if font was changed. */ void TtyView::FontChanged(void) { HDC hDC ; hDC = GetDC(m_hwnd); AdjustScreen(m_hwnd, hDC); ReleaseDC(m_hwnd, hDC); ClearScreen() ; AddWindowEvent(TTY_WM_RESIZE); } #endif BOOL TtyViewRegisterClass( HINSTANCE hInst ) { WNDCLASS wc ; wc.style = 0 ; wc.lpfnWndProc = (WNDPROC) TtyViewWndProc ; wc.cbClsExtra = 0 ; wc.cbWndExtra = 4 ; wc.hInstance = hInst ; wc.hIcon = NULL ; #ifndef IDC_ARROW wc.hCursor = NULL ; #else wc.hCursor = LoadCursor(NULL, IDC_ARROW); #endif wc.hbrBackground = (HBRUSH) GetStockObject( WHITE_BRUSH ) ; wc.lpszMenuName = 0 ; wc.lpszClassName = CTRL_TTYVIEW ; return ::RegisterClass( &wc ) ; } LRESULT CALLBACK TtyViewWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) { PTtyView pWindow ; if ( msg == WM_CREATE ) { LPCREATESTRUCT lpStruct = (LPCREATESTRUCT) lParam ; pWindow = new TtyView() ; SetWindowLong( hWnd, 0, (LONG) pWindow ) ; pWindow->WMCreate( hWnd, lpStruct ) ; #ifdef DROPFILES /* 00.07.07 by sahf */ DragAcceptFiles(hWnd, TRUE) ; #endif /* DROPFILES */ return 0 ; } pWindow = (PTtyView) GetWindowLong( hWnd, 0 ) ; if ( !pWindow ) return DefWindowProc( hWnd, msg, wParam, lParam ) ; switch ( msg ) { case WM_DESTROY: #ifdef DROPFILES /* 00.07.07 by sahf */ DragAcceptFiles( hWnd, FALSE ) ; #endif /* DROPFILES */ delete pWindow ; SetWindowLong( hWnd, 0, (LONG) 0 ) ; break ; case WM_COMMAND: return pWindow->WMCommand( hWnd, msg, wParam, lParam ) ; case WM_COPYDATA: return pWindow->WMCopydata( (PCOPYDATASTRUCT) lParam ) ; case WM_PAINT: pWindow->WMPaint() ; break ; case WM_CHAR: pWindow->WMChar( (TCHAR) wParam, lParam ) ; break ; case WM_SYSCHAR: if ( !pWindow->WMSysChar( (TCHAR) wParam, lParam ) ) DefWindowProc( hWnd, msg, wParam, lParam ) ; break ; case WM_KEYDOWN: if ( !pWindow->WMKeyDown( (int) wParam, lParam ) ) return DefWindowProc( hWnd, msg, wParam, lParam ) ; break ; case WM_SIZE: pWindow->WMSize( wParam, LOWORD(lParam), HIWORD(lParam) ) ; break ; case WM_GETDLGCODE: return DLGC_WANTALLKEYS ; case WM_LBUTTONDOWN: pWindow->WMLButtonDown((int)(lParam & 0xffff), (int)((lParam >> 16) & 0xffff)); break; #ifdef DROPFILES /* 00.07.07 by sahf */ case WM_DROPFILES: pWindow->WMDropFiles( (HDROP) wParam ) ; break ; #endif /* DROPFILES */ case WM_SETFOCUS: pWindow->WMSetFocus(); break; case WM_KILLFOCUS: pWindow->WMKillFocus(); break; #if 0 case TTYM_SETTAB: pWindow->SetTab( (DWORD) wParam, (BOOL) lParam ) ; break ; case TTYM_SETHMARGIN: pWindow->SetHMargin( (DWORD) wParam, (BOOL) lParam ) ; break ; #endif case TTYM_SETEVENT: pWindow->SetupEvent( (HANDLE) wParam ) ; break ; #ifdef CONFIG_FONT case TTYM_FONTCHANGED: pWindow->FontChanged(); break; #endif case TTYM_GOTOXY: pWindow->GotoXY( HIWORD(wParam), LOWORD(wParam) ) ; break ; case TTYM_PUTCHAR: pWindow->PutChar( (BYTE) wParam ) ; break ; case TTYM_PUTKCHAR: pWindow->PutKChar( (BYTE) HIWORD(wParam), (BYTE) LOWORD(wParam) ) ; break ; case TTYM_PUTLINE: pWindow->PutLine( HIWORD(wParam), LOWORD(wParam), (LPCSTR) lParam ) ; break ; case TTYM_ERASEEOL: pWindow->EraseEOL() ; break ; case TTYM_ERASEEOP: pWindow->EraseEOP() ; break ; case TTYM_FLUSH: pWindow->Flush() ; break ; case TTYM_KBHIT: return pWindow->Kbhit() ; case TTYM_GETCHAR: return pWindow->GetChar() ; case TTYM_GETWINDOWEVENT: return pWindow->GetWindowEvent() ; #ifdef DROPFILES /* 00.07.07 by sahf */ case TTYM_DROPFILES: return pWindow->GetDropFiles( (LPHANDLE) lParam ) ; #endif /* DROPFILES */ case TTYM_GETWH: return pWindow->GetWH() ; case TTYM_COMMAND: pWindow->Command(wParam, lParam); break; case TTYM_SETKEYBOARDLOCALE: pWindow->SetKeyboardLocale((DWORD)wParam); break; default: return DefWindowProc( hWnd, msg, wParam, lParam ) ; } return 0 ; } ng-1.5beta1/sys/win32/ttyctrl.h100644 1750 1750 14306 7204766554 15152 0ustar amurausers/* $Id: ttyctrl.h,v 1.4 2000/11/16 14:21:32 amura Exp $ */ /* OS dependent code used by Ng for WinCE. * Copyright (C) 1998 Eiichiro Ito * Modified for Ng for Win32 * Copyright (C) 1999,2000 Toru Imai * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * ree Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* * $Log: ttyctrl.h,v $ * Revision 1.4 2000/11/16 14:21:32 amura * merge Ng for win32 0.5 * * Revision 1.3 2000/10/23 16:52:51 amura * add GPL copyright to header * * Revision 1.2 2000/07/22 20:46:33 amura * support "Drag&Drop" * * Revision 1.1.1.1 2000/06/27 01:48:00 amura * import to CVS * */ #define CTRL_LINEEDIT TEXT("LINEEDIT") #define CTRL_TIMEEDIT TEXT("TIMEEDIT") #define CTRL_BIGLIST TEXT("BIGLIST") #define CTRL_LABEL TEXT("KLABEL") #define CTRL_FILEVIEW TEXT("FILEVIEW") #define CTRL_TTYVIEW TEXT("TTYVIEW") #define RBM_GETSJIS (WM_USER+0x100) #define RBM_SETSJIS (WM_USER+0x101) #define RBM_GETMODIFY (WM_USER+0x102) #define RBM_SETMODIFY (WM_USER+0x103) #define RBN_ENTER 0x0100 #define RBN_ESC 0x0101 #define RBN_TAB 0x0102 #define RBN_STAB 0x0103 #define RBN_CHANGE 0x0104 #define RBN_KEYDOWN 0x0105 #define RBN_KILLFOCUS 0x0106 #define TEM_GETTIMEVAL (WM_USER+0x100) #define TEM_SETTIMEVAL (WM_USER+0x101) #define TEM_GETMODIFY (WM_USER+0x102) #define TEM_SETMODIFY (WM_USER+0x103) #define TEN_ENTER 0x0100 #define TEN_ESC 0x0101 #define TEN_TAB 0x0102 #define TEN_STAB 0x0103 #define TEN_CHANGE 0x0104 #define TEN_KEYDOWN 0x0105 #define TEN_KILLFOCUS 0x0106 #define BLM_SETPROC (WM_USER+0x100) #define BLM_SETSPACEPROC (WM_USER+0x101) #define BLM_GETCURSEL (WM_USER+0x102) #define BLM_SETCURSEL (WM_USER+0x103) #define BLM_SETKEYMASK (WM_USER+0x104) #define BLM_FINDSTRING (WM_USER+0x105) #define BLM_SETDBLCLK (WM_USER+0x106) #define BLM_GETMAXLINE (WM_USER+0x107) #define BLN_ENTER 0x0100 #define BLN_ESC 0x0101 #define BLN_TAB 0x0102 #define BLN_STAB 0x0103 #define BLN_CHANGE 0x0104 #define BLN_CHAR 0x0105 #define BLN_KEYDOWN 0x0200 #define BL_MASK_RETURN 0x0001 #define BL_MASK_ESCAPE 0x0002 #define BL_MASK_TAB 0x0004 #define BL_MASK_HOME 0x0008 #define BL_MASK_END 0x0010 #define BL_MASK_UP 0x0020 #define BL_MASK_DOWN 0x0040 #define BL_MASK_LEFT 0x0080 #define BL_MASK_PRIOR 0x0100 #define BL_MASK_RIGHT 0x0200 #define BL_MASK_NEXT 0x0400 #define LAM_SETINVERT (WM_USER+0x100) #define LAM_SETCROSS (WM_USER+0x101) #define LAN_CLICK 0x100 /* CTRL_LINEEDIT related messages */ #define LEN_ENTER 0x0100 #define LEN_TAB 0x0102 #define LEN_STAB 0x0103 #define LEN_CHANGE 0x0104 #define LEN_KEYDOWN 0x0105 #define LEN_KILLFOCUS 0x0106 #define LEN_GOTFOCUS 0x0107 /* CTRL_FILEVIEW related message */ enum { FV_FUNC_NONE = 0, FV_FUNC_ENTER, FV_FUNC_ESC, FV_FUNC_UP, FV_FUNC_DOWN, FV_FUNC_PRIOR, FV_FUNC_NEXT, FV_FUNC_HOME, FV_FUNC_END, FV_FUNC_FIND, } ; typedef struct { WORD keyCode ; BYTE keyMode ; BYTE functionID ; } KeyMapInfo, *LPKeyMapInfo ; #define FVM_CLEAR (WM_USER+0x100) #define FVM_LOAD (WM_USER+0x101) #define FVM_RELOAD (WM_USER+0x102) #define FVM_OPEN (WM_USER+0x103) #define FVM_CLOSE (WM_USER+0x104) #define FVM_GETTOPLINE (WM_USER+0x105) #define FVM_SETTOPLINE (WM_USER+0x106) #define FVM_GETTOPPOS (WM_USER+0x107) #define FVM_SETTOPPOS (WM_USER+0x108) #define FVM_GETMAXLINE (WM_USER+0x109) #define FVM_SETTAB (WM_USER+0x10A) #define FVM_SETHMARGIN (WM_USER+0x10B) #define FVM_SETKEYMAP (WM_USER+0x10C) #define FVM_FINDSTRING (WM_USER+0x10D) #define FVN_ENTER 0x0100 #define FVN_ESC 0x0101 #define FVN_TAB 0x0102 #define FVN_STAB 0x0103 #define FVN_CHANGE 0x0104 #define FVN_CHAR 0x0105 #define FVN_KEYDOWN 0x0200 #define FV_MASK_RETURN 0x0001 #define FV_MASK_ESCAPE 0x0002 #define FV_MASK_TAB 0x0004 #define FV_MASK_HOME 0x0008 #define FV_MASK_END 0x0010 #define FV_MASK_UP 0x0020 #define FV_MASK_DOWN 0x0040 #define FV_MASK_LEFT 0x0080 #define FV_MASK_PRIOR 0x0100 #define FV_MASK_RIGHT 0x0200 #define FV_MASK_NEXT 0x0400 #define TTYM_SETTAB (WM_USER+0x100) #define TTYM_SETHMARGIN (WM_USER+0x101) #define TTYM_SETEVENT (WM_USER+0x102) #define TTYM_GOTOXY (WM_USER+0x103) #define TTYM_PUTCHAR (WM_USER+0x104) #define TTYM_PUTKCHAR (WM_USER+0x105) #define TTYM_PUTLINE (WM_USER+0x106) #define TTYM_ERASEEOL (WM_USER+0x107) #define TTYM_ERASEEOP (WM_USER+0x108) #define TTYM_FLUSH (WM_USER+0x109) #define TTYM_KBHIT (WM_USER+0x10A) #define TTYM_GETCHAR (WM_USER+0x10B) #define TTYM_GETWH (WM_USER+0x10C) #define TTYM_GETWINDOWEVENT (WM_USER+0x10D) #define TTYM_FONTCHANGED (WM_USER+0x10E) #ifdef DROPFILES /* 00.07.07 by sahf */ #define TTYM_DROPFILES (WM_USER+0x10F) #endif /* DROPFILES */ #define TTYM_COMMAND (WM_USER+0x110) #define TTYM_SETKEYBOARDLOCALE (WM_USER+0x111) #define IDM_FEPOK (41260) #define IDM_FEPACTIVE (41261) #define IDM_FEPKEY (41262) /* The following are window events from TTYCTRL. The maximum number of event id is 0x0f (decimal 15) */ #define TTY_WM_MASK 0x0f #define TTY_WM_MOUSE 1 #define TTY_WM_RESIZE 2 #ifdef DROPFILES /* 00.07.07 by sahf */ #define TTY_WM_DROPFILES 3 #endif /* DROPFILES */ #ifdef __cplusplus extern "C" { #endif BOOL LineEditRegisterClass( HINSTANCE hInst ) ; BOOL BigListRegisterClass( HINSTANCE hInst ) ; BOOL LabelRegisterClass( HINSTANCE hInst ) ; BOOL TimeEditRegisterClass( HINSTANCE hInst ) ; BOOL FileViewRegisterClass( HINSTANCE hInst ) ; BOOL TtyViewRegisterClass( HINSTANCE hInst ) ; void ShowSIP( BOOL bShow ) ; #ifdef __cplusplus } ; #endif ng-1.5beta1/sys/win32/ttyio.c100644 1750 1750 5747 7303500514 14557 0ustar amurausers/* $Id: ttyio.c,v 1.5 2001/05/25 15:59:08 amura Exp $ */ /* OS dependent code used by Ng for WinCE. * Copyright (C) 1998 Eiichiro Ito * Modified for Ng for Win32 * Copyright (C) 1999,2000 Toru Imai * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * ree Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* * TTY I/O routine for win32 */ /* * $Log: ttyio.c,v $ * Revision 1.5 2001/05/25 15:59:08 amura * WIN32 version support AUTOSAVE feature * * Revision 1.4 2001/01/20 15:48:47 amura * very big terminal supported * * Revision 1.3 2000/11/16 14:21:32 amura * merge Ng for win32 0.5 * * Revision 1.2 2000/10/23 16:52:51 amura * add GPL copyright to header * * Revision 1.1.1.1 2000/06/27 01:48:00 amura * import to CVS * */ #include #include "config.h" #include "def.h" #include "winmain.h" #include "tools.h" int nrow ; /* Terminal size, rows. */ int ncol ; /* Terminal size, columns. */ BOOL bLastChar = FALSE ; CHAR chLastChar = 0 ; int panic( char *s ) { TCHAR foo[256]; sjis2unicode(s, foo, sizeof(foo)); MessageBox( NULL, foo, TEXT(""), MB_ICONASTERISK|MB_OK ) ; return 0 ; } int ttopen() { GetWH( &ncol, &nrow ) ; if (NROW < nrow) { nrow = NROW; } if (NCOL < ncol) { ncol = NCOL; } return 0 ; } int ttclose() { return 0 ; } int ttflush() { Flush() ; return 0 ; } /* * typeahead returns TRUE if there are characters available to be read * in. */ int typeahead() { return Kbhit() ; } /* * Write character to the display without ^C check. */ int ttputc( int c ) { PutChar( (char) c ) ; return 0 ; } /* * Write character to the display without ^C check. */ int ttputkc( int c1, int c2 ) { PutKChar((char)c1, (char)c2); return 0; } /* * Read character from terminal without ^C check. * All 8 bits are returned, so that you can use * a multi-national terminal. */ int ttgetc() { if ( bLastChar ) { bLastChar = FALSE ; return chLastChar ; } #ifdef AUTOSAVE while (!KbhitSleep(1)) autosave_handler(); #endif return GetChar() ; } /* * Save pre-readed char to read again. */ int ttungetc( int c ) { bLastChar = TRUE ; chLastChar = c ; return 0 ; } /* * A program to return TRUE if we wait for 1 seconds without anything * happening, else return FALSE. */ int ttwait() { return !KbhitSleep( 1 ) ; } /* * set the tty size. Functionized for Win32 */ void setttysize() { GetWH(&ncol, &nrow); } ng-1.5beta1/sys/win32/winmain.c100644 1750 1750 144011 7242446615 15112 0ustar amurausers/* $Id: winmain.c,v 1.8 2001/02/14 09:19:09 amura Exp $ */ /* OS dependent code used by Ng for WinCE. * Copyright (C) 1998 Eiichiro Ito * Modified for Ng for Win32 * Copyright (C) 1999,2000 Toru Imai * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * ree Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* * NG : NG program main routine * * 1998/11/14:Eiichiroh Itoh * */ /* * $Log: winmain.c,v $ * Revision 1.8 2001/02/14 09:19:09 amura * code cleanup around putline() * * Revision 1.7 2001/01/20 15:47:23 amura * putline() support Hojo Kanji now * * Revision 1.6 2000/11/16 14:21:32 amura * merge Ng for win32 0.5 * * Revision 1.5 2000/10/23 16:52:52 amura * add GPL copyright to header * * Revision 1.4 2000/09/01 19:41:21 amura * fix for suppress buffer overrun * * Revision 1.3 2000/07/22 20:46:33 amura * support "Drag&Drop" * * Revision 1.2 2000/07/18 12:42:34 amura * support IME convertion on the spot * * Revision 1.1.1.1 2000/06/27 01:48:00 amura * import to CVS * */ #include #include #include #include #include "config.h" #include "def.h" #include "ttyctrl.h" #include "resource.h" #include "winmain.h" #include "tools.h" #ifdef KANJI #ifdef USE_KCTRL #include "kctrl.h" #include "cefep.h" #define VALID_KCTRL_VERSION 13 #else /* not USE_KCTRL */ #include #endif /* USE_KCTRL */ #endif /* KANJI */ #if defined(WIN32_PLATFORM_PSPC) && 300 <= _WIN32_WCE #define USE_SHMENU /* Define a macro to indicate using PocketPC menu */ #define POCKETPC_MENU_HEIGHT 26 /* Height of Menubar */ #else #define POCKETPC_MENU_HEIGHT 0 #endif /* #define MG_FOR_PPC This should be defined in the Makefile or dsp file */ #if defined(MG_FOR_PPC) || defined(__PsPC__) || 300 <= _WIN32_WCE #include #endif #ifdef COMMANDBANDS #if 200 <= _WIN32_WCE #define USE_COMMANDBANDS /* #define USE_BEGINTHREAD */ /* instead of CreateThread. Though I do not care... */ #endif #endif #if !defined(MG_FOR_PPC) && !defined(_WIN32_WCE_EMULATION) #ifndef USE_KCTRL #define MG_IME_CONTROL #endif /* USE_KCTRL */ #endif /* !defined(MG_FOR_PPC) && !defined(_WIN32_WCE_EMULATION) */ #define EXCEPTION_QUIT (1) #define IDM_START (1001) #define IDM_EXIT (1002) #define IDC_TTY (2001) #ifdef KANJI #define MGTITLE TEXT("Ng") #define MGCLASS TEXT("NG") #else #define MGTITLE TEXT("Mg") #define MGCLASS TEXT("MG") #endif HINSTANCE g_hInst ; HWND g_hwndMain ; HWND g_hwndTty ; HANDLE g_hevtGetChar = 0 ; HANDLE g_hThread = 0 ; BOOL g_bExit = FALSE ; TCHAR g_szTitleName[ MAX_PATH ] = MGTITLE; TCHAR g_szClassName[] = MGCLASS; DWORD g_dwAppVersion = 12 ; TCHAR MessageBuf[ MAX_PATH ] = TEXT("") ; CHAR g_szArgBuf[ 256 ] ; int g_dwArgc ; LPSTR g_szArgv[ 128 ] ; #if defined(COMMANDBANDS) && defined(USE_COMMANDBANDS) HIMAGELIST g_himlrebar; /* Image list for rebar bands */ #endif #ifdef CTRLMAP DWORD g_ctrlmap; #endif DWORD g_beepsound, g_keyboardlocale; TCHAR g_beepfile[128]; #if defined(KANJI) && defined(USE_KCTRL) DWORD g_dwDllVersion = 0 ; #endif #if (defined(COMMANDBANDS) && !defined(USE_SHMENU)) || !defined(_WIN32_WCE) #define USE_REGINFO #endif #ifdef USE_REGINFO /* Settings stored in registry */ struct reginfo { #if defined(COMMANDBANDS) && !defined(USE_SHMENU) BOOL showbands; #endif /* COMMANDBANDS */ #ifndef _WIN32_WCE BOOL maximized; RECT rect; /* rect for the window */ #else /* if _WIN32_WCE */ #if defined(COMMANDBANDS) && defined(USE_COMMANDBANDS) \ && !defined(USE_SHMENU) COMMANDBANDSRESTOREINFO cbinfo[2]; /* Info for Bands */ #endif #endif /* _WIN32_WCE */ BOOL valid; /* tell if stored info is valid */ }; static struct reginfo g_reginfo; #endif /* USE_REGINFO */ static BOOL init_application( void ) ; static BOOL init_instance( int nCmdShow ) ; LRESULT CALLBACK MainWndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) ; static void cmdline2args( LPSTR cmdline, int *argc, char **argv ) ; static void ThreadMain( void ) ; #ifdef CTRLMAP #define VK_EISU 0xf0 #define VK_SOMETHING 0xe5 static BOOL controlkey_swap(MSG *msg) { if (msg->message == WM_KEYDOWN || msg->message == WM_KEYUP) { if ((int)msg->wParam == VK_EISU) { if (msg->message == WM_KEYDOWN && !(msg->lParam & (1 << 30))) { /* key was up before this message */ keybd_event(VK_CONTROL, 0, 0, 0); } else if (msg->message == WM_KEYUP && (msg->lParam & (1 << 30))) { /* key was down before this message */ keybd_event(VK_CONTROL, 0, KEYEVENTF_KEYUP, 0); } return TRUE; } if ((int)msg->wParam == VK_SOMETHING) { /* What's this? */ /* Although I don't know the reason and details, some specific virtual code is generated according to a key press of Japanese mode-related keys such as EISU, HIRAGANA, HANKAKU and so on. Curiously, the virtual code is only generated for depressing while Japanese input mode is open. The following program detects the virtual code and treats as control key in case EISU is depressed. */ SHORT eisu_down; eisu_down = GetAsyncKeyState(VK_EISU); if (eisu_down) { if (msg->message == WM_KEYDOWN && !(msg->lParam & (1 << 30))) { /* key was up before this message */ keybd_event(VK_CONTROL, 0, 0, 0); } return TRUE; } } } return FALSE; } #endif /* CTRLMAP */ int WINAPI #ifdef _WIN32_WCE WinMain( HINSTANCE hThisInst, HINSTANCE hPrevInst, LPTSTR lpszArgs, int nWinMode ) #else /* _WIN32_WCE */ WinMain( HINSTANCE hThisInst, HINSTANCE hPrevInst, LPSTR lpszArgs, int nWinMode ) #endif /* _WIN32_WCE */ { MSG msg ; g_hInst = hThisInst ; #if defined(KANJI) && defined(USE_KCTRL) g_dwDllVersion = GetKVersion() ; if ( g_dwDllVersion < VALID_KCTRL_VERSION ) { wsprintf( MessageBuf, TEXT("Obsolete KCTRL.DLL used\r\nPlease use Ver%d.%02d or later"), VALID_KCTRL_VERSION / 100, VALID_KCTRL_VERSION % 100 ) ; MessageBox( NULL, MessageBuf, g_szTitleName, MB_OK|MB_ICONASTERISK ) ; return FALSE ; } if ( !InitFep() ) { MessageBox( NULL, TEXT("Can't initialize FEP."), g_szTitleName, MB_OK|MB_ICONASTERISK ) ; return FALSE ; } if ( !InitKanjiControls() ) { wsprintf( MessageBuf, TEXT("KCTRL.DLL Initialize error\r\nError=%x"), GetLastError() ) ; MessageBox( NULL, MessageBuf, g_szTitleName, MB_OK|MB_ICONASTERISK ) ; return FALSE ; } #endif /* define a TTY Window */ if ( !TtyViewRegisterClass( g_hInst ) ) { goto ExitMain ; } /* create an event for keyboard input notification */ g_hevtGetChar = CreateEvent( NULL, FALSE, FALSE, NULL ) ; if ( g_hevtGetChar == NULL ) { goto ExitMain ; } /* define a window class */ if ( !init_application() ) { goto ExitMain ; } /* create a window */ if ( !init_instance( nWinMode ) ) { goto ExitMain ; } { DWORD foo; /* read configuration for Ng for Win32 */ #ifdef CTRLMAP g_ctrlmap = RegQueryDWord(HKEY_CURRENT_USER, NGREGKEY, NGCTRLKEYMAPVAL) ? TRUE : FALSE; #endif g_beepsound = RegQueryDWord(HKEY_CURRENT_USER, NGREGKEY, NGBEEPSOUNDVAL); g_keyboardlocale = RegQueryDWord(HKEY_CURRENT_USER, NGREGKEY, NGKEYBOARDLOCALEVAL); if (g_keyboardlocale == 0) { #ifndef JAPANESE_KEYBOARD g_keyboardlocale = NGKEYBOARD_US; #else g_keyboardlocale = NGKEYBOARD_JP; #endif } SendMessage(g_hwndTty, TTYM_SETKEYBOARDLOCALE, (WPARAM)g_keyboardlocale, 0); foo = sizeof(g_beepfile); RegQueryString(HKEY_CURRENT_USER, NGREGKEY, NGBEEPFILEVAL, g_beepfile, &foo); } /* create a command line processing routine */ #ifdef _WIN32_WCE unicode2sjis( lpszArgs, g_szArgBuf, sizeof g_szArgBuf ) ; #else /* _WIN32_WCE */ strncpy(g_szArgBuf, lpszArgs, sizeof g_szArgBuf); g_szArgBuf[(sizeof g_szArgBuf)-1] = '\0'; #endif /* _WIN32_WCE */ cmdline2args( g_szArgBuf, &g_dwArgc, g_szArgv ) ; /* event loop */ while ( GetMessage( &msg, NULL, 0, 0 ) ) { #ifdef CTRLMAP if (!g_ctrlmap || !controlkey_swap(&msg)) { /* call controlkey_swap() if g_ctrlmap is TRUE */ TranslateMessage(&msg); DispatchMessage(&msg); } #else TranslateMessage(&msg); DispatchMessage(&msg); #endif } ExitMain: if ( g_hevtGetChar ) { /* close the event for keyboard input notification */ CloseHandle( g_hevtGetChar ) ; } #if defined(KANJI) && defined(USE_KCTRL) ReleaseKanjiControls() ; #endif return TRUE ; } /* * register the main window class */ static BOOL init_application( void ) { WNDCLASS wcl ; wcl.style = 0 ; wcl.lpfnWndProc = MainWndProc ; wcl.cbClsExtra = 0 ; wcl.cbWndExtra = 0 ; wcl.hInstance = g_hInst ; #ifdef _WIN32_WCE wcl.hIcon = NULL ; wcl.hCursor = NULL ; #else wcl.hIcon = LoadIcon (g_hInst, (LPCTSTR)MAKEINTRESOURCE(IDI_APPICON)); wcl.hCursor = LoadCursor(NULL, IDC_ARROW); #endif wcl.hbrBackground = (HBRUSH) GetStockObject( WHITE_BRUSH ) ; wcl.lpszMenuName = 0 ; wcl.lpszClassName = g_szClassName ; if ( !RegisterClass( &wcl ) ) { return FALSE ; } /* initialize common controls */ #if 200 <= _WIN32_WCE { INITCOMMONCONTROLSEX icex; icex.dwSize = sizeof(icex); icex.dwICC = ICC_BAR_CLASSES | ICC_COOL_CLASSES; InitCommonControlsEx(&icex); } #else InitCommonControls(); #endif return TRUE ; } #define RegQueryBinary(r, k, v, d, s) RegQueryString(r, k, v, (LPTSTR)d, s) #ifdef COMMANDBANDS static HWND g_hwndCB; #endif /* * create a main window */ static BOOL init_instance( int nCmdShow ) { RECT rect ; HMENU hMenu = NULL; int x, y, cx, cy; #ifdef USE_REGINFO DWORD foo; #endif #ifndef _WIN32_WCE hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_MAINMENU)); #endif /* _WIN32_WCE */ #ifdef USE_REGINFO /* get window position from registry */ foo = sizeof(g_reginfo); if (RegQueryBinary(HKEY_CURRENT_USER, NGREGKEY, NGPREVPOSVAL, &g_reginfo, &foo) == ERROR_SUCCESS) { #ifndef _WIN32_WCE #define MG_MIN_HEIGHT 120 #define MG_MIN_WIDTH 160 if (g_reginfo.rect.bottom - g_reginfo.rect.top < MG_MIN_HEIGHT) { g_reginfo.rect.bottom = g_reginfo.rect.top + MG_MIN_HEIGHT; } if (g_reginfo.rect.right - g_reginfo.rect.left < MG_MIN_WIDTH) { g_reginfo.rect.right = g_reginfo.rect.left + MG_MIN_WIDTH; } #endif /* _WIN32_WCE */ } else { g_reginfo.valid = FALSE; #ifndef _WIN32_WCE g_reginfo.rect.top = 0; g_reginfo.rect.bottom = 296; g_reginfo.rect.left = 0; g_reginfo.rect.right = 500; #endif /* _WIN32_WCE */ } #if defined(COMMANDBANDS) && !defined(USE_SHMENU) if (!g_reginfo.valid) { g_reginfo.showbands = TRUE; } #endif /* defined(COMMANDBANDS) && !defined(USE_SHMENU) */ #endif /* USE_REGINFO */ x = y = cx = cy = CW_USEDEFAULT; #if defined(WIN32_PLATFORM_PSPC) && 300 <= _WIN32_WCE { SIPINFO si; memset(&si, 0, sizeof(SIPINFO)); si.cbSize = sizeof(si); if (SHSipInfo(SPI_GETSIPINFO, 0, &si, 0)) { if (si.fdwFlags & SIPF_ON) { x = si.rcVisibleDesktop.left; y = si.rcVisibleDesktop.top; cx = si.rcVisibleDesktop.right - si.rcVisibleDesktop.left; cy = si.rcVisibleDesktop.bottom - si.rcVisibleDesktop.top + POCKETPC_MENU_HEIGHT; } } } #endif /* create a main window */ g_hwndMain = CreateWindowEx( 0, g_szClassName, g_szTitleName, #ifdef _WIN32_WCE x, y, cx, cy, #else /* _WIN32_WCE */ WS_OVERLAPPEDWINDOW | WS_VISIBLE, g_reginfo.rect.left, g_reginfo.rect.top, g_reginfo.rect.right - g_reginfo.rect.left, g_reginfo.rect.bottom - g_reginfo.rect.top, #endif /* _WIN32_WCE */ NULL, hMenu, g_hInst, NULL ) ; if ( !g_hwndMain ) { return FALSE; } GetClientRect( g_hwndMain, &rect ) ; #ifdef COMMANDBANDS { int nCommandHeight = 0; #ifdef _WIN32_WCE #ifndef USE_SHMENU #ifdef USE_COMMANDBANDS CommandBands_Show(g_hwndCB, g_reginfo.showbands); if (g_reginfo.showbands) { nCommandHeight = CommandBands_Height(g_hwndCB); } #else CommandBar_Show(g_hwndCB, g_reginfo.showbands); if (g_reginfo.showbands) { nCommandHeight = CommandBar_Height(g_hwndCB); } #endif /* USE_COMMANDBANDS */ #else /* if USE_SHMENU */ nCommandHeight = 0; #endif /* USE_SHMENU */ #endif /* _WIN32_WCE */ rect.top += nCommandHeight; } #endif /* COMMANDBANDS */ /* create a TTY window */ g_hwndTty = CreateWindowEx( 0, CTRL_TTYVIEW, TEXT(""), WS_VISIBLE|WS_CHILD, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, g_hwndMain, (HMENU) IDC_TTY, g_hInst, NULL ) ; if ( !g_hwndTty ) { return FALSE; } /* configure the event for keyboard input notification */ SendMessage( g_hwndTty, TTYM_SETEVENT, (WPARAM) g_hevtGetChar, 0 ) ; /* show the main window */ ShowWindow( g_hwndMain, nCmdShow ) ; UpdateWindow( g_hwndMain ) ; SetFocus( g_hwndTty ) ; /* send a message to commence a thread */ PostMessage( g_hwndMain, WM_COMMAND, IDM_START, 0 ) ; return TRUE ; } #ifdef COMMANDBANDS #if defined(USE_COMMANDBANDS) && !defined(USE_SHMENU) #define RB_ICON_CX 11 #define RB_ICON_CY 15 /* Initialize the images for rebar bands */ static HIMAGELIST InitRebarImageLists(HWND hwnd) { HBITMAP hbmp; HIMAGELIST res; /* Create the image list for the item pictures */ res = ImageList_Create(RB_ICON_CX, RB_ICON_CY, ILC_COLOR | ILC_MASK, 2, 0); /* Create two. No more will be added. */ if (res) { /* Add the bitmaps to the list */ hbmp = LoadBitmap(g_hInst, MAKEINTRESOURCE(IDB_REBAR)); if (hbmp) { if (ImageList_AddMasked(res, hbmp, RGB(255, 0, 0)) != -1) { /* Fail if not all the images were added */ if (3 <= ImageList_GetImageCount(res)) { /* All is fine. But this specific condition does not check anything. */ } } /* Clean up the GDI objects */ DeleteObject(hbmp); } else { ImageList_Destroy(res); res = (HIMAGELIST)NULL; } } return res; } #endif /* defined(USE_COMMANDBANDS) && !defined(USE_SHMENU) */ #ifndef USE_SHMENU /* It is very strange for me to define this by myself... */ #define NUM_STD_BITMAPS 15 #define TBSTATE_DISABLED 0 #define BTNID(x) ((x) - IDBN_MARK + NUM_STD_BITMAPS) /* Tool buttons */ static TBBUTTON MGButton[] = { #ifndef USE_COMMANDBANDS /* For a space */ {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0}, #endif {BTNID(IDBN_MARK), IDC_MARK, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, -1}, {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0}, {STD_CUT, IDC_CUT, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, -1}, {STD_COPY, IDC_COPY, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, -1}, {STD_PASTE, IDC_PASTE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, -1}, {0, 0, TBSTATE_ENABLED, TBSTYLE_SEP, 0, 0, 0}, {BTNID(IDBN_PRIOR), IDC_PRIOR, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, -1}, {BTNID(IDBN_NEXT), IDC_NEXT, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, -1}, }; /* Tool tips */ static int MGTips[] = { IDS_MARK, IDS_CUT, IDS_COPY, IDS_PASTE, IDS_PRIOR, IDS_NEXT, }; #define NUM_TIPS (sizeof(MGTips) / sizeof(int)) #define MAX_TIP_STRING 32 /* Max string length for tool tips */ static LPTSTR *g_tooltips; /* Create resource from Tool tip strings */ static LPTSTR * LoadToolTips(int *tips) { int *p, *ep; LPTSTR *res, *ps; TCHAR buf[MAX_TIP_STRING]; res = LocalAlloc(LPTR, sizeof(LPTSTR) * NUM_TIPS); if (res) { for (p = MGTips, ep = p + NUM_TIPS, ps = res ; p < ep ; p++, ps++) { LoadString(g_hInst, *p, buf, MAX_TIP_STRING); *ps = LocalAlloc(LPTR, sizeof(TCHAR) * (lstrlen(buf) + 1)); if (*ps) { lstrcpy(*ps, buf); } else { LPTSTR *q; for (q = res ; q < ps ; q++) { LocalFree(*q); } LocalFree(res); return NULL; } } } g_tooltips = res; return res; } /* Destroy Tool tip strings */ static void FreeToolTips(void) { if (g_tooltips) { LPTSTR *p, *ep; for (p = g_tooltips, ep = p + NUM_TIPS ; p < ep ; p++) { LocalFree(*p); } LocalFree(g_tooltips); g_tooltips = NULL; } } /* Create tool buttons */ static void CreateToolButtons(HWND hwnd) { #ifdef _WIN32_WCE /* Are there any macro for "16"? */ CommandBar_AddBitmap(hwnd, HINST_COMMCTRL, IDB_STD_SMALL_COLOR, NUM_STD_BITMAPS, 16, 16); CommandBar_AddBitmap(hwnd, g_hInst, IDB_BUTTONS, 3, 16, 16); CommandBar_AddButtons(hwnd, sizeof(MGButton)/sizeof(TBBUTTON), MGButton); if (LoadToolTips(MGTips)) { CommandBar_AddToolTips(hwnd, NUM_TIPS, g_tooltips); } #endif /* _WIN32_WCE */ } #endif /* !USE_SHMENU */ #define IDD_REBAR 901 /* ID used at message processing */ #define SF_RBMENU 902 #define SF_RBBUTTON 903 #endif /* COMMANDBANDS */ void MainWMCreate( HWND hWnd ) { HICON hIcon ; hIcon = (HICON) LoadImage( g_hInst, MAKEINTRESOURCE(IDI_APPICON), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR ) ; if ( hIcon ) { SendMessage( hWnd, WM_SETICON, FALSE, (LPARAM)hIcon ) ; } #ifdef _WIN32_WCE #ifdef COMMANDBANDS #ifndef USE_SHMENU #ifndef USE_COMMANDBANDS g_hwndCB = CommandBar_Create(g_hInst, hWnd, 1); CommandBar_InsertMenubar(g_hwndCB, g_hInst, IDR_MAINMENU, 0); CreateToolButtons(g_hwndCB); #ifndef MG_FOR_PPC /* add [X] Button */ CommandBar_AddAdornments(g_hwndCB, 0, 0); #endif #else /* if USE_COMMANDBANDS */ { HWND hwnd2; REBARBANDINFO arbbi[2]; /* Initialize images for Rebar bands */ g_himlrebar = InitRebarImageLists(hWnd); g_hwndCB = CommandBands_Create(g_hInst, hWnd, IDD_REBAR, RBS_VARHEIGHT | RBS_BANDBORDERS | RBS_SMARTLABELS, g_himlrebar); arbbi[0].cbSize = sizeof(REBARBANDINFO); arbbi[0].fMask = RBBIM_STYLE | RBBIM_SIZE | RBBIM_IMAGE | RBBIM_ID; arbbi[0].wID = SF_RBMENU; arbbi[0].iImage = 0; arbbi[0].fStyle = RBBS_NOGRIPPER; arbbi[0].cx = 62; arbbi[1].cbSize = sizeof(REBARBANDINFO); arbbi[1].fMask = RBBIM_STYLE | RBBIM_SIZE | RBBIM_IMAGE | RBBIM_ID; arbbi[1].wID = SF_RBBUTTON; arbbi[1].iImage = 1; arbbi[1].fStyle = 0; arbbi[1].cx = 300; if (g_reginfo.valid) { /* if valid info stored in registry */ arbbi[0].fStyle = g_reginfo.cbinfo[0].fStyle; arbbi[1].fStyle = g_reginfo.cbinfo[1].fStyle; arbbi[0].cx = g_reginfo.cbinfo[0].cxRestored; arbbi[1].cx = g_reginfo.cbinfo[1].cxRestored; } CommandBands_AddBands(g_hwndCB, g_hInst, 2, arbbi); /* Add Menu */ hwnd2 = CommandBands_GetCommandBar(g_hwndCB, 0); CommandBar_InsertMenubar(hwnd2, g_hInst, IDR_MAINMENU, 0); /* Add Buttons */ hwnd2 = CommandBands_GetCommandBar(g_hwndCB, 1); CreateToolButtons(hwnd2); #ifndef MG_FOR_PPC /* add [X] Button */ CommandBands_AddAdornments(g_hwndCB, g_hInst, 0, 0); #endif if (g_reginfo.valid) { /* if valid info stored in registry */ if (g_reginfo.cbinfo[0].fMaximized) { SendMessage(g_hwndCB, RB_MAXIMIZEBAND, (WPARAM)0, (LPARAM)0); } if (g_reginfo.cbinfo[1].fMaximized) { SendMessage(g_hwndCB, RB_MAXIMIZEBAND, (WPARAM)1, (LPARAM)0); } } } #endif /* USE_COMMANDBANDS */ #else /* USE_SHMENU */ { SHMENUBARINFO mbi; RECT rc; memset(&mbi, 0, sizeof(SHMENUBARINFO)); mbi.cbSize = sizeof(SHMENUBARINFO); mbi.hwndParent = hWnd; mbi.dwFlags = 0; mbi.nToolBarId = IDR_PPCMENU; mbi.hInstRes = g_hInst; mbi.nBmpId = IDB_BUTTONS; mbi.cBmpImages = 3; if (SHCreateMenuBar(&mbi)) { g_hwndCB = mbi.hwndMB; } else { g_hwndCB = (HWND)NULL; } GetWindowRect(hWnd, &rc); rc.bottom -= POCKETPC_MENU_HEIGHT; if (g_hwndCB) { MoveWindow(hWnd, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, FALSE); } } #endif /* USE_SHMENU */ #endif /* COMMANDBANDS */ #endif /* _WIN32_WCE */ } #ifdef SPI_GETSIPINFO static void AdjustAgainstSIP(HWND hWnd, UINT param) { SIPINFO sipinf; BOOL sipres; sipinf.cbSize = sizeof(sipinf); sipinf.dwImDataSize = 0; sipinf.pvImData = NULL; #if _WIN32_WCE >= 210 sipres = SipGetInfo(&sipinf); #else sipres = SHSipInfo(SPI_GETSIPINFO, param, &sipinf, 0); #endif if (sipres) { RECT winrect; GetWindowRect(hWnd, &winrect); if (!EqualRect(&winrect, &sipinf.rcVisibleDesktop)) { int shmenuheight = 0; #ifdef USE_SHMENU if (!(sipinf.fdwFlags & SIPF_ON)) { shmenuheight = POCKETPC_MENU_HEIGHT; } #endif /* USE_SHMENU */ MoveWindow(hWnd, sipinf.rcVisibleDesktop.left, sipinf.rcVisibleDesktop.top, sipinf.rcVisibleDesktop.right - sipinf.rcVisibleDesktop.left, sipinf.rcVisibleDesktop.bottom - sipinf.rcVisibleDesktop.top - shmenuheight, FALSE); } } } #endif /* SPI_GETSIPINFO */ static void AdjustPane(HWND hwnd) { RECT rect; #ifdef _WIN32_WCE #ifdef COMMANDBANDS int nCommandHeight; #endif /* COMMANDBANDS */ #endif /* _WIN32_WCE */ GetClientRect(g_hwndMain, &rect); #ifdef _WIN32_WCE #ifdef COMMANDBANDS #ifndef USE_SHMENU #ifndef USE_COMMANDBANDS if (CommandBar_IsVisible(g_hwndCB)) { nCommandHeight = CommandBar_Height(g_hwndCB); } #else /* if USE_COMMANDBANDS */ if (CommandBands_IsVisible(g_hwndCB)) { nCommandHeight = CommandBands_Height(g_hwndCB); } else { nCommandHeight = 0; } #endif /* USE_COMMANDBANDS */ #else /* if USE_SHMENU */ nCommandHeight = 0; #endif /* USE_SHMENU */ rect.top += nCommandHeight; #endif /* COMMANDBANDS */ #endif /* _WIN32_WCE */ MoveWindow(g_hwndTty, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, TRUE); } int ConfigStartupFilePath(int, int); /* * WinProc for main window */ LRESULT CALLBACK MainWndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) { #ifdef SPI_GETSIPINFO static BOOL SIPChanged = FALSE; #endif DWORD threadID ; switch ( message ) { case WM_CREATE: MainWMCreate( hWnd ) ; break ; case WM_CLOSE: SendMessage(g_hwndTty, TTYM_COMMAND, (WPARAM)IDC_CLOSE, (LPARAM)NULL); break ; case WM_DESTROY: #ifdef CTRLMAP if (g_ctrlmap) { /* send ctrl key `up' event in order to prevent ctrl key to be kept in a state of `depressed' */ keybd_event(VK_CONTROL, 0, KEYEVENTF_KEYUP, 0); } #endif #if defined(COMMANDBANDS) && !defined(USE_SHMENU) #ifdef _WIN32_WCE #ifdef USE_COMMANDBANDS g_reginfo.cbinfo[0].cbSize = sizeof(COMMANDBANDSRESTOREINFO); CommandBands_GetRestoreInformation(g_hwndCB, SendMessage(g_hwndCB, RB_IDTOINDEX, (WPARAM)SF_RBMENU, (LPARAM)0), g_reginfo.cbinfo); CommandBands_GetRestoreInformation(g_hwndCB, SendMessage(g_hwndCB, RB_IDTOINDEX, (WPARAM)SF_RBBUTTON, (LPARAM)0), g_reginfo.cbinfo + 1); /* Is "Destroy" necessary? No. Because there are no CommandBands_Destroy()!? */ #else /* if !USE_COMMANDBANDS */ CommandBar_Destroy(g_hwndCB); #endif /* !USE_COMMANDBANDS */ #endif /* _WIN32_WCE */ /* Free Tool Tip strings */ FreeToolTips(); #endif /* COMMANDBANDS && !USE_SHMENU */ #ifndef _WIN32_WCE if (!g_reginfo.maximized) GetWindowRect(g_hwndMain, &g_reginfo.rect); #endif /* _WIN32_WCE */ #ifdef USE_REGINFO /* Store settings to registry db */ g_reginfo.valid = TRUE; RegSetBinary(HKEY_CURRENT_USER, NGREGKEY, NGPREVPOSVAL, (LPBYTE)&g_reginfo, sizeof(g_reginfo)); #endif #ifdef _WIN32_WCE #if defined(COMMANDBANDS) && defined(USE_COMMANDBANDS) \ && !defined(USE_SHMENU) if (g_himlrebar) { /* Destroy Image List */ ImageList_Destroy(g_himlrebar); g_himlrebar = NULL; } #endif #else /* not _WIN32_WCE */ /* Destroy Menu */ if (GetMenu(hWnd)) { DestroyMenu(GetMenu(hWnd)); } #endif g_bExit = TRUE ; Sleep( 1000 ) ; PostQuitMessage( 0 ) ; break ; case WM_SETFOCUS: #ifdef SPI_GETSIPINFO AdjustAgainstSIP(hWnd, 0); SIPChanged = FALSE; #endif SetFocus( g_hwndTty ) ; break ; #if !defined(_WIN32_WCE) || 200 <= _WIN32_WCE case WM_SIZE: switch (wParam) { case SIZE_MAXIMIZED: case SIZE_RESTORED: AdjustPane(g_hwndMain); #ifndef _WIN32_WCE /* the following processing is intended to save the previous window position */ g_reginfo.maximized = (wParam == SIZE_MAXIMIZED); #endif break; default: break; } return 0; #endif case WM_COMMAND: switch ( GET_WM_COMMAND_ID( wParam, lParam ) ) { case IDM_START: g_hThread = CreateThread( NULL, 0, (LPTHREAD_START_ROUTINE) ThreadMain, 0, 0, &threadID ) ; if ( g_hThread != NULL ) { CloseHandle( g_hThread ) ; break ; } // case IDM_EXIT: DestroyWindow(hWnd); break ; case IDC_OPTION: ConfigStartupFilePath(0, 0); break; default: SendMessage(g_hwndTty, TTYM_COMMAND, wParam, lParam); break; } break ; #ifdef SPI_GETSIPINFO case WM_SETTINGCHANGE: switch (wParam) { case SPI_SETSIPINFO: case SPI_SETCURRENTIM: if (GetActiveWindow()) AdjustAgainstSIP(hWnd, (UINT)lParam); else SIPChanged = TRUE; break; #endif case WM_NOTIFY: switch(((LPNMHDR)lParam)->code) { #ifdef RBN_HEIGHTCHANGE /* The height of Rebar has changed */ case RBN_HEIGHTCHANGE: AdjustPane(hWnd); break; #endif } break; default: return DefWindowProc( hWnd, message, wParam, lParam ) ; } return 0 ; } int Kbhit( void ) { return SendMessage( g_hwndTty, TTYM_KBHIT, 0, 0 ) ? 1 : 0 ; } int KbhitSleep( DWORD sec ) { WaitForSingleObject( g_hevtGetChar, sec * 1000 ) ; if ( g_bExit ) { ExitThread( 0 ) ; return FALSE ; } return Kbhit() ; } int GetChar( void ) { int c ; while ( 1 ) { while (1) { extern VOID MouseEvent pro((int, int, int)); c = SendMessage(g_hwndTty, TTYM_GETWINDOWEVENT, 0, 0); if (c < 0) { break; } else { switch (c & TTY_WM_MASK) { case TTY_WM_MOUSE: MouseEvent(0, (c >> 4) & 0x3fff, (c >> 18) & 0x3fff); break; #if !defined(_WIN32_WCE) || 200 <= _WIN32_WCE case TTY_WM_RESIZE: { extern int refresh pro((int, int)); refresh(FFRAND, 0); /* Very easy way... */ } break; #endif #ifdef DROPFILES /* 00.07.07 by sahf */ case TTY_WM_DROPFILES: { HLOCAL hMemory; extern VOID DropEvent pro((const char *, int)); /* hMemory got filename buffer address... */ c = SendMessage( g_hwndTty, TTYM_DROPFILES, 0, (LPARAM)&hMemory ); if ( c == -1 ) { break ; } DropEvent((const char *)hMemory, c); LocalFree(hMemory); /* allocated in ttyctrl.cpp */ } break; #endif /* DROPFILES */ } } } c = SendMessage( g_hwndTty, TTYM_GETCHAR, 0, 0 ) ; if ( c != -1 ) { break ; } WaitForSingleObject( g_hevtGetChar, INFINITE ) ; if ( g_bExit ) { ExitThread( 0 ) ; break ; } } ResetEvent( g_hevtGetChar ) ; return c ; } void GotoXY( int x, int y ) { SendMessage( g_hwndTty, TTYM_GOTOXY, MAKEWPARAM( y, x ), 0 ) ; } void EraseEOL( void ) { SendMessage( g_hwndTty, TTYM_ERASEEOL, 0, 0 ) ; } void EraseEOP( void ) { SendMessage( g_hwndTty, TTYM_ERASEEOP, 0, 0 ) ; } void PutChar( char c ) { SendMessage( g_hwndTty, TTYM_PUTCHAR, (WPARAM) c, 0 ) ; } void PutKChar( char c1, char c2 ) { SendMessage(g_hwndTty, TTYM_PUTKCHAR, MAKEWPARAM(c2, c1), 0); } void PutLine( int y, unsigned char *sjis, short color ) { SendMessage( g_hwndTty, TTYM_PUTLINE, MAKEWPARAM( color, y ), (LPARAM) sjis ) ; } void Flush( void ) { SendMessage( g_hwndTty, TTYM_FLUSH, 0, 0 ) ; } void GetWH( int *w, int *h ) { DWORD ret ; ret = SendMessage( g_hwndTty, TTYM_GETWH, 0, 0 ) ; *w = HIWORD( ret ) ; *h = LOWORD( ret ) ; } void Exit( int code ) { RaiseException( EXCEPTION_QUIT, 0, 0, 0 ) ; } void MessageOut( LPCSTR buf ) { sjis2unicode( buf, MessageBuf, sizeof MessageBuf ) ; MessageBox( g_hwndMain, MessageBuf, MGTITLE, MB_OK ) ; } /* * Command line related procedure */ static void cmdline2args( LPSTR cmdline, int *argc, char **argv ) { CHAR c ; BOOL f_skip = TRUE, f_quote = FALSE ; argv[ 0 ] = "" ; *argc = 1 ; while ( c = *cmdline ) { if ( f_skip ) { if ( !(c == ' ' || c == '\t') ) { if ( c == '"' ) { f_quote = TRUE ; cmdline ++ ; } argv[ (*argc) ++ ] = cmdline ; f_skip = FALSE ; } } else { if ( f_quote ) { if ( c == '"' ) { f_quote = FALSE ; *cmdline = 0 ; f_skip = TRUE ; } } else if ( (c == ' ' || c == '\t') ) { *cmdline = 0 ; f_skip = TRUE ; } } cmdline ++ ; } } /* * main routine for a thread */ static void ThreadMain( void ) { __try { Main( g_dwArgc, g_szArgv ) ; } __except ( GetExceptionCode() == EXCEPTION_QUIT ) { // do nothing } SendMessage( g_hwndMain, WM_COMMAND, IDM_EXIT, 0 ) ; ExitThread( 0 ) ; } #ifdef FEPCTRL #define fep_init() /* nothing to do */ #define fep_term() /* nothing to do */ static int fepctrl = FALSE; /* FEP control enable flag */ static int fepmode = TRUE; /* now FEP mode */ static BOOL g_ime_prevopened; fepmode_on() { #ifndef USE_KCTRL if (fepctrl && !fepmode) { HIMC hIMC = ImmGetContext(g_hwndTty); if (hIMC) { ImmSetOpenStatus(hIMC, g_ime_prevopened); ImmReleaseContext(g_hwndTty, hIMC); } fepmode = TRUE; } #endif return 0; } /* The following fepmode_off() provides a doubled fepmode_off() feature. That is, the second call for the fepmode_off() is expected to change the previous fep mode as off, without doing any actual fep control since the fep mode has been already turned off by the first call of the function. So, the succeeding fepmode_on() will not turn on the fep mode even if the previous fep mode was on before the first call of fepmode_off(). By Tillanosoft, Mar 21, 1999 */ fepmode_off() { #ifndef USE_KCTRL if (fepctrl) { if (fepmode) { HIMC hIMC = ImmGetContext(g_hwndTty); if (hIMC) { g_ime_prevopened = ImmGetOpenStatus(hIMC); if (g_ime_prevopened) ImmSetOpenStatus(hIMC, FALSE); ImmReleaseContext(g_hwndTty, hIMC); } fepmode = FALSE; } else { g_ime_prevopened = FALSE; } } #endif return 0; } fepmode_set(f, n) { register int s; char buf[NFILEN]; /* extern int ereply(); *//* declared in def.h */ if (f & FFARG) { n = (n > 0); } else { if ((s = ereply("FEP Control: ", buf, NFILEN)) != TRUE) return (s); if (ISDIGIT(buf[0]) || buf[0] == '-') n = (atoi(buf) > 0); else if (buf[0] == 't' || buf[0] == 'T') n = TRUE; else /* if (buf[0] == 'n' || buf[0] == 'N') */ n = FALSE; } if (!fepctrl && n) { fepmode = TRUE; } else if (fepctrl && !n) { /* nothing to do */ } fepctrl = n; return TRUE; } fepmode_chg(f, n) { fepctrl = !fepctrl; if (fepctrl) { fepmode = TRUE; } return TRUE; } int fepmode_toggle( int f, int n ) { #ifdef USE_KCTRL Fep_Execute( g_hwndMain ) ; return TRUE ; #else /* if !USE_KCTRL */ HIMC hIMC = ImmGetContext(g_hwndTty); if (hIMC) { BOOL ime_open = ImmGetOpenStatus(hIMC); g_ime_prevopened = !ime_open; ImmSetOpenStatus(hIMC, !ime_open); ImmReleaseContext(g_hwndTty, hIMC); } return TRUE; #endif } #endif /* FEPCTRL */ #ifdef KANJI #define etos(c1, c2) \ {\ c1 &= 0x7f;\ c2 &= 0x7f;\ if(c1 >= 0x5f)\ c1 += 0x80;\ if((c1 % 2) == 0) {\ c1 = (c1 - 0x30) / 2 + 0x88;\ c2 += 0x7e;\ } else {\ if(c2 >= 0x60)\ c2 += 0x01;\ c1 = (c1 - 0x31) / 2 + 0x89;\ c2 += 0x1f;\ }\ c1 &= 0xff;\ c2 &= 0xff;\ } #endif void #ifdef SS_SUPPORT /* 92.11.21 by S.Sasaki */ putline( int row, int column, unsigned char *s, unsigned char *t, short color ) #else putline(int row, int column, unsigned char *s, short color) #endif { #ifdef KANJI int c1 = 0, c2; #ifdef SS_SUPPORT unsigned char *ccp1; #endif #endif int c; unsigned char sjis[ 256 ], *dst, *cp1, *cp2; dst = sjis ; cp1 = &s[0] ; cp2 = &s[ncol] ; #ifdef SS_SUPPORT ccp1 = &t[0] ; #endif while ( cp1 != cp2 ) { c = *cp1 ++ ; #ifdef KANJI #ifdef SS_SUPPORT c2 = *ccp1 ++ ; #endif if ( c1 ) { etos( c1, c ) ; *dst++ = c1 ; *dst++ = c ; c1 = 0 ; #ifdef HANKANA } else if (ISHANKANA(c) && c2 != 0 ) { *dst++ = c2 ; #endif #ifdef HOJO_KANJI } else if (ISHOJO(c) && c2 != 0 ) { *dst++ = c2 ; #endif } else if ( ISKANJI( c ) ) { c1 = c ; } else #endif *dst++ = c ; } *dst = 0 ; PutLine(row-1, sjis, (short)(color == CMODE ? 1 : 0)); } #if defined(COMMANDBANDS) && !defined(USE_SHMENU) static BOOL CALLBACK ViewProc(HWND hDlg, UINT message, UINT wParam, LONG lParam) { switch (message) { case WM_INITDIALOG: Button_SetCheck(GetDlgItem(hDlg, IDC_SHOWMENUBAR), g_reginfo.showbands); return 1; case WM_COMMAND: #if 0 switch (LOWORD(wParam)) { case IDC_SHOWMENUBAR: break; } #endif return 0; case WM_NOTIFY: switch (((LPNMHDR)lParam)->code) { case PSN_SETACTIVE: /* Visit this page */ SetWindowLong(hDlg, DWL_MSGRESULT, 0); return TRUE; case PSN_APPLY: { BOOL newvalue; newvalue = Button_GetCheck(GetDlgItem(hDlg, IDC_SHOWMENUBAR)); if (g_reginfo.showbands != newvalue) { g_reginfo.showbands = newvalue; #ifdef _WIN32_WCE #ifdef USE_COMMANDBANDS CommandBands_Show(g_hwndCB, newvalue); #else CommandBar_Show(g_hwndCB, newvalue); #endif AdjustPane(g_hwndMain); #endif } } SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_NOERROR); return TRUE; case PSN_KILLACTIVE: /* Go away from this page */ SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); return(TRUE); case PSN_RESET: /* CANCEL Button */ return TRUE; } default: return 0; } } #endif /* defined(COMMANDBANDS) && !defined(USE_SHMENU) */ #ifndef NO_STARTUP /* Dialog Proc to change the startup file path */ #define MAXFILENAMESIZE 160 #define INIFILEFILTER TEXT("INI file (*.ini)\0*.ini\0All files (*.*)\0*.*\0") static OPENFILENAME templateofn = { sizeof(OPENFILENAME), NULL, 0, INIFILEFILTER, NULL, 0, 0, NULL, 0, NULL, 0, NULL, TEXT("INI File"), OFN_HIDEREADONLY, 0, 0, NULL, 0, NULL, NULL}; static BOOL CALLBACK StartFileProc(HWND hDlg, UINT message, UINT wParam, LONG lParam) { TCHAR unicode[MAX_PATH]; DWORD foo = sizeof(unicode); switch (message) { case WM_INITDIALOG: if (RegQueryString(HKEY_CURRENT_USER, NGREGKEY, NGSTARTUPFILEVAL, unicode, &foo) == ERROR_SUCCESS) { SetDlgItemText(hDlg, IDC_STARTUPFILE, unicode); } return 1; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_FILEOPENDLG: { OPENFILENAME ofn; TCHAR filename[MAXFILENAMESIZE]; int stat; ofn = templateofn; ofn.lpstrFile = filename; ofn.nMaxFile = MAXFILENAMESIZE; ofn.lpstrFile[0] = (TCHAR)0; stat = GetOpenFileName(&ofn); if (stat) { SetDlgItemText(hDlg, IDC_STARTUPFILE, ofn.lpstrFile); } } break; #ifndef _WIN32_WCE case IDC_STARTUPFILE: switch (HIWORD(wParam)) { case EN_CHANGE: SendMessage(GetParent(hDlg), PSM_CHANGED, (WPARAM)(HWND)hDlg, 0L); break; } break; #endif } return 0; case WM_NOTIFY: switch (((LPNMHDR)lParam)->code) { case PSN_SETACTIVE: /* Visit this page */ SetWindowLong(hDlg, DWL_MSGRESULT, 0); return TRUE; case PSN_APPLY: GetDlgItemText(hDlg, IDC_STARTUPFILE, unicode, foo / sizeof(TCHAR)); RegSetString(HKEY_CURRENT_USER, NGREGKEY, NGSTARTUPFILEVAL, unicode); SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_NOERROR); return TRUE; case PSN_KILLACTIVE: /* Go away from this page */ SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); return(TRUE); case PSN_RESET: /* CANCEL Button */ return TRUE; } default: return 0; } } #endif #if defined(CTRLMAP) || defined(JAPANESE_KEYBOARD) static BOOL CALLBACK KeyMapProc(HWND hDlg, UINT message, UINT wParam, LONG lParam) { DWORD val; switch (message) { case WM_INITDIALOG: #ifdef CTRLMAP val = RegQueryDWord(HKEY_CURRENT_USER, NGREGKEY, NGCTRLKEYMAPVAL) ? TRUE : FALSE; Button_SetCheck(GetDlgItem(hDlg, IDC_CONTROLMAP), val); #else /* if !CTRLMAP */ EnableWindow(GetDlgItem(hDlg, IDC_CONTROLMAP), FALSE); #endif /* !CTRLMAP */ #ifdef JAPANESE_KEYBOARD val = RegQueryDWord(HKEY_CURRENT_USER, NGREGKEY, NGKEYBOARDLOCALEVAL); switch (val) { case NGKEYBOARD_US: val = BST_UNCHECKED; break; case NGKEYBOARD_JP: val = BST_CHECKED; break; default: case 0: val = BST_CHECKED; break; } Button_SetCheck(GetDlgItem(hDlg, IDC_KEYBOARDLOCALE), val); #else /* if !JAPANESE_KEYBOARD */ EnableWindow(GetDlgItem(hDlg, IDC_KEYBOARDLOCALE), FALSE); #endif /* !JAPANESE_KEYBOARD */ return 1; case WM_COMMAND: switch (LOWORD(wParam)) { #if 0 /* Did not work as I supposed. */ case IDC_ALT: alt = !alt; Button_SetState(GetDlgItem(hDlg, IDC_ALT), alt); if (alt) { keybd_event(VK_MENU, 0, 0, 0); } else { keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0); } break; #endif #if defined(CTRLMAP) && !defined(_WIN32_WCE) case IDC_CONTROLMAP: SendMessage(GetParent(hDlg), PSM_CHANGED, (WPARAM)(HWND)hDlg, 0L); break; #endif } return 0; case WM_NOTIFY: switch (((LPNMHDR)lParam)->code) { case PSN_SETACTIVE: /* Visit this page */ SetWindowLong(hDlg, DWL_MSGRESULT, 0); return TRUE; case PSN_APPLY: #ifdef CTRLMAP val = Button_GetCheck(GetDlgItem(hDlg, IDC_CONTROLMAP)); RegSetDWord(HKEY_CURRENT_USER, NGREGKEY, NGCTRLKEYMAPVAL, val); g_ctrlmap = val; #endif #ifdef JAPANESE_KEYBOARD val = Button_GetCheck(GetDlgItem(hDlg, IDC_KEYBOARDLOCALE)) ? NGKEYBOARD_JP : NGKEYBOARD_US; RegSetDWord(HKEY_CURRENT_USER, NGREGKEY, NGKEYBOARDLOCALEVAL, val); g_keyboardlocale = val; SendMessage(g_hwndTty, TTYM_SETKEYBOARDLOCALE, (WPARAM)val, 0); #endif SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_NOERROR); return TRUE; case PSN_KILLACTIVE: /* Go away from this page */ SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); return(TRUE); case PSN_RESET: /* CANCEL Button */ return TRUE; } default: return 0; } } #endif struct _beepsounds { UINT title; UINT val; } beepsounds[] = { {IDS_OK, MB_OK}, {IDS_ICONASTERISK, MB_ICONASTERISK}, {IDS_ICONEXCLAMATION, MB_ICONEXCLAMATION}, {IDS_ICONHAND, MB_ICONHAND}, {IDS_ICONQUESTION, MB_ICONQUESTION} }; #define NUMBEEPSOUNDS (sizeof(beepsounds) / sizeof(struct _beepsounds)) #define WAVFILEFILTER TEXT("Wave file (*.wav)\0*.wav\0All files (*.*)\0*.*\0") static OPENFILENAME templatewaveofn = { sizeof(OPENFILENAME), NULL, 0, WAVFILEFILTER, NULL, 0, 0, NULL, 0, NULL, 0, TEXT("\\Windows"), TEXT("Wave File"), OFN_HIDEREADONLY, 0, 0, NULL, 0, NULL, NULL}; static void SetBeepRadio(HWND hDlg, BOOL messagebeep) { EnableWindow(GetDlgItem(hDlg, IDC_MESSAGECOMBO), messagebeep); EnableWindow(GetDlgItem(hDlg, IDC_SOUNDFILE), !messagebeep); EnableWindow(GetDlgItem(hDlg, IDC_SOUNDBUTTON), !messagebeep); } static void SetBeepButtons(HWND hDlg, DWORD dobeep) { EnableWindow(GetDlgItem(hDlg, IDC_PLAY), dobeep); EnableWindow(GetDlgItem(hDlg, IDC_MESSAGEBEEP), dobeep); EnableWindow(GetDlgItem(hDlg, IDC_MESSAGECOMBO), dobeep); #ifdef TARGET_WCEVER_IS_100 EnableWindow(GetDlgItem(hDlg, IDC_PLAYSOUND), FALSE); EnableWindow(GetDlgItem(hDlg, IDC_SOUNDFILE), FALSE); EnableWindow(GetDlgItem(hDlg, IDC_SOUNDBUTTON), FALSE); #else EnableWindow(GetDlgItem(hDlg, IDC_PLAYSOUND), dobeep); EnableWindow(GetDlgItem(hDlg, IDC_SOUNDFILE), dobeep); EnableWindow(GetDlgItem(hDlg, IDC_SOUNDBUTTON), dobeep); #endif if (dobeep) { /* dobeep == 1 means to use sndPlaySound(), not to use MessageBeep() */ Button_SetCheck(GetDlgItem(hDlg, IDC_MESSAGEBEEP), dobeep != 1); Button_SetCheck(GetDlgItem(hDlg, IDC_PLAYSOUND), dobeep == 1); SetBeepRadio(hDlg, dobeep != 1); } } static void BeepGetButtons(HWND hDlg, DWORD *beep, LPTSTR beepfile, int len) { DWORD val; val = Button_GetCheck(GetDlgItem(hDlg, IDC_BEEP)); if (val) { if (Button_GetCheck(GetDlgItem(hDlg, IDC_PLAYSOUND))) { *beep = 1; } else { DWORD sel; sel = SendMessage(GetDlgItem(hDlg, IDC_MESSAGECOMBO), CB_GETCURSEL, (WPARAM)0, (LPARAM)0); if (sel != CB_ERR) { *beep = beepsounds[sel].val + NG_WAVE_OFFSET; } } } else { *beep = 0; } GetDlgItemText(hDlg, IDC_SOUNDFILE, beepfile, len); } static BOOL CALLBACK BeepProc(HWND hDlg, UINT message, UINT wParam, LONG lParam) { DWORD val; HWND hcb; struct _beepsounds *pb, *epb; TCHAR buf[128]; UINT cursound, nth = 0; switch (message) { case WM_INITDIALOG: /* initialize the combo box */ cursound = g_beepsound - NG_WAVE_OFFSET; hcb = GetDlgItem(hDlg, IDC_MESSAGECOMBO); SendMessage(hcb, CB_RESETCONTENT, 0, 0); for (pb = beepsounds, epb = pb + NUMBEEPSOUNDS ; pb < epb ; pb++) { if (cursound == pb->val) { nth = pb - beepsounds; } LoadString(g_hInst, pb->title, buf, sizeof(buf) / sizeof(TCHAR)); SendMessage(hcb, CB_ADDSTRING, 0, (LONG)buf); } SendMessage(hcb, CB_SETCURSEL, (WPARAM)nth, (LPARAM)0); /* initialize the edit box */ if (g_beepfile[0]) { SetDlgItemText(hDlg, IDC_SOUNDFILE, g_beepfile); } /* set the current configuration for beep sounds */ Button_SetCheck(GetDlgItem(hDlg, IDC_BEEP), g_beepsound); SetBeepButtons(hDlg, g_beepsound); return 1; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_MESSAGEBEEP: case IDC_PLAYSOUND: SetBeepRadio(hDlg, LOWORD(wParam) == IDC_MESSAGEBEEP); #ifndef _WIN32_WCE SendMessage(GetParent(hDlg), PSM_CHANGED, (WPARAM)(HWND)hDlg, 0L); #endif break; case IDC_BEEP: val = Button_GetCheck(GetDlgItem(hDlg, IDC_BEEP)); if (val) { val = Button_GetCheck(GetDlgItem(hDlg, IDC_PLAYSOUND)) ? 1 : 2; } SetBeepButtons(hDlg, val); #ifndef _WIN32_WCE SendMessage(GetParent(hDlg), PSM_CHANGED, (WPARAM)(HWND)hDlg, 0L); #endif break; case IDC_SOUNDBUTTON: { OPENFILENAME ofn; TCHAR filename[MAXFILENAMESIZE]; int stat; ofn = templatewaveofn; ofn.lpstrFile = filename; ofn.nMaxFile = MAXFILENAMESIZE; ofn.lpstrFile[0] = (TCHAR)0; #ifndef _WIN32_WCE #define MEDIA_FOLDER TEXT("\\Media") #define MEDIA_FOLDER_LEN (sizeof(MEDIA_FOLDER) / sizeof(TCHAR)) { TCHAR initialdir[MAX_PATH]; int len = GetWindowsDirectory(initialdir, MAX_PATH); if (0 < len) { if (len < MAX_PATH - MEDIA_FOLDER_LEN) { lstrcat(initialdir, MEDIA_FOLDER); } ofn.lpstrInitialDir = initialdir; } } #endif stat = GetOpenFileName(&ofn); if (stat) { SetDlgItemText(hDlg, IDC_SOUNDFILE, ofn.lpstrFile); #ifndef _WIN32_WCE SendMessage(GetParent(hDlg), PSM_CHANGED, (WPARAM)(HWND)hDlg, 0L); #endif } } break; case IDC_PLAY: val = g_beepsound; lstrcpy(buf, g_beepfile); BeepGetButtons(hDlg, &g_beepsound, g_beepfile, sizeof(g_beepfile) / sizeof(TCHAR)); ttbeep(); g_beepsound = val; lstrcpy(g_beepfile, buf); break; #ifndef _WIN32_WCE case IDC_MESSAGECOMBO: SendMessage(GetParent(hDlg), PSM_CHANGED, (WPARAM)(HWND)hDlg, 0L); break; case IDC_SOUNDFILE: switch (HIWORD(wParam)) { case EN_CHANGE: SendMessage(GetParent(hDlg), PSM_CHANGED, (WPARAM)(HWND)hDlg, 0L); break; } break; #endif } return 0; case WM_NOTIFY: switch (((LPNMHDR)lParam)->code) { case PSN_SETACTIVE: /* Visit this page */ SetWindowLong(hDlg, DWL_MSGRESULT, 0); return TRUE; case PSN_APPLY: BeepGetButtons(hDlg, &g_beepsound, g_beepfile, sizeof(g_beepfile) / sizeof(TCHAR)); RegSetDWord(HKEY_CURRENT_USER, NGREGKEY, NGBEEPSOUNDVAL, g_beepsound); RegSetString(HKEY_CURRENT_USER, NGREGKEY, NGBEEPFILEVAL, g_beepfile); SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_NOERROR); return TRUE; case PSN_KILLACTIVE: /* Go away from this page */ SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); return(TRUE); case PSN_RESET: /* CANCEL Button */ return TRUE; } default: return 0; } } #ifndef USE_KCTRL /* font configuration is not made functional for KCTRL */ #define CONFIG_FONT #endif #ifdef CONFIG_FONT #ifdef KANJI #define REQUIRED_CHARSET SHIFTJIS_CHARSET #ifndef _WIN32_WCE #define REQUIRED_PITCH FIXED_PITCH #endif #else /* !KANJI */ #define REQUIRED_PITCH FIXED_PITCH #endif /* !KANJI */ static int CALLBACK SetFontNames(CONST LOGFONT *lpelf, CONST TEXTMETRIC *lpntm, DWORD FontType, LPARAM lParam) { HWND hDlg = (HWND)lParam, hcb = GetDlgItem(hDlg, IDC_FONTNAME); if ((lpelf->lfPitchAndFamily & (FF_ROMAN | FF_SWISS | FF_MODERN | FF_SCRIPT | FF_DECORATIVE)) == FF_MODERN #ifdef REQUIRED_CHARSET && lpelf->lfCharSet == REQUIRED_CHARSET #endif #ifdef REQUIRED_PITCH && (lpelf->lfPitchAndFamily & REQUIRED_PITCH) #endif ) { SendMessage(hcb, CB_ADDSTRING, 0, (LONG)lpelf->lfFaceName); } return 1; } static LPTSTR fontpoints[] = { TEXT("8"), TEXT("9"), TEXT("10"), TEXT("11"), TEXT("12"), TEXT("14"), TEXT("16"), TEXT("18"), TEXT("20"), TEXT("22"), TEXT("24"), TEXT("28"), TEXT("32") }; #define NUMPOINTS (sizeof(fontpoints) / sizeof(int)) #define MAX_LINESPACE 32 static void SetFontEntries(HWND hDlg) { HDC hdc; HWND hSpin; LPTSTR *p, *ep; TCHAR fontname[LF_FACESIZE]; DWORD val; hdc = GetDC(g_hwndTty); SendMessage(GetDlgItem(hDlg, IDC_FONTNAME), CB_RESETCONTENT, 0, 0); EnumFontFamilies(hdc, NULL, SetFontNames, (LPARAM)hDlg); ReleaseDC(g_hwndTty, hdc); SendMessage(GetDlgItem(hDlg, IDC_POINT), CB_RESETCONTENT, 0, 0); for (p = fontpoints, ep = p + NUMPOINTS ; p < ep ; p++) { SendMessage(GetDlgItem(hDlg, IDC_POINT), CB_ADDSTRING, 0, (LONG)*p); } /* Do something for spin (up-down) control */ hSpin = GetDlgItem(hDlg, IDC_SPIN); SendMessage(hSpin, UDM_SETRANGE, (WPARAM)0, (LPARAM)MAKELONG((short)MAX_LINESPACE, (short)0)); SendMessage(hSpin, UDM_SETPOS, (WPARAM)0, (LPARAM)MAKELONG((short)0, 0)); /* line space after (short) */ /* set the current configurations */ val = sizeof(fontname); if (RegQueryString(HKEY_CURRENT_USER, NGREGKEY, NGFONTNAMEVAL, fontname, &val) == ERROR_SUCCESS) { SendMessage(GetDlgItem(hDlg, IDC_FONTNAME), CB_SELECTSTRING, (WPARAM)-1, (LPARAM)fontname); val = RegQueryDWord(HKEY_CURRENT_USER, NGREGKEY, NGFONTSIZEVAL); if (val > 0) { SetDlgItemInt(hDlg, IDC_POINT, val, FALSE); val = RegQueryDWord(HKEY_CURRENT_USER, NGREGKEY, NGLINESPACEVAL); SetDlgItemInt(hDlg, IDC_LINESPACE, val, FALSE); Button_SetCheck(GetDlgItem(hDlg, IDC_SPECIFY), TRUE); return; } } Button_SetCheck(GetDlgItem(hDlg, IDC_NOSPECIFY), TRUE); } static void ApplyFontEntries(HWND hDlg) { DWORD point, linespace; TCHAR fontname[LF_FACESIZE]; if (Button_GetCheck(GetDlgItem(hDlg, IDC_SPECIFY))) { point = GetDlgItemInt(hDlg, IDC_POINT, NULL, FALSE); linespace = GetDlgItemInt(hDlg, IDC_LINESPACE, NULL, FALSE); GetDlgItemText(hDlg, IDC_FONTNAME, fontname, LF_FACESIZE); RegSetString(HKEY_CURRENT_USER, NGREGKEY, NGFONTNAMEVAL, fontname); RegSetDWord(HKEY_CURRENT_USER, NGREGKEY, NGFONTSIZEVAL, point); RegSetDWord(HKEY_CURRENT_USER, NGREGKEY, NGLINESPACEVAL, linespace); } else { RegRemoveValue(HKEY_CURRENT_USER, NGREGKEY, NGFONTNAMEVAL); RegRemoveValue(HKEY_CURRENT_USER, NGREGKEY, NGFONTSIZEVAL); RegRemoveValue(HKEY_CURRENT_USER, NGREGKEY, NGLINESPACEVAL); } /* To force the screen to be refreshed. */ nrow = 4; /* This number (4) of rows may not be used... */ /* Then, notify the change to TTYCTRL */ SendMessage(g_hwndTty, TTYM_FONTCHANGED, (WPARAM)0, (LPARAM)0); } static BOOL CALLBACK FontProc(HWND hDlg, UINT message, UINT wParam, LONG lParam) { switch (message) { case WM_INITDIALOG: SetFontEntries(hDlg); return 1; case WM_COMMAND: switch (LOWORD(wParam)) { #ifndef _WIN32_WCE case IDC_NOSPECIFY: case IDC_SPECIFY: case IDC_FONTNAME: case IDC_POINT: case IDC_LINESPACE: SendMessage(GetParent(hDlg), PSM_CHANGED, (WPARAM)(HWND)hDlg, 0L); break; #endif default: break; } return 0; case WM_NOTIFY: switch (((LPNMHDR)lParam)->code) { case PSN_SETACTIVE: /* Visit this page */ SetWindowLong(hDlg, DWL_MSGRESULT, 0); return TRUE; case PSN_APPLY: ApplyFontEntries(hDlg); SetWindowLong(hDlg, DWL_MSGRESULT, PSNRET_NOERROR); return TRUE; case PSN_KILLACTIVE: /* Go away from this page */ SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); return(TRUE); case PSN_RESET: /* CANCEL Button */ return TRUE; } default: return 0; } } #endif /* CONFIG_FONT */ #define MAX_PAGES 5 /* Add one property sheet page. */ static void AddPage(LPPROPSHEETHEADER ppsh, UINT id, DLGPROC pfn) { if (ppsh->nPages < MAX_PAGES) { PROPSHEETPAGE psp; psp.dwSize = sizeof(psp); psp.dwFlags = PSP_DEFAULT; psp.hInstance = ppsh->hInstance; #ifdef __BORLANDC__ psp.DUMMYUNIONNAME.pszTemplate = MAKEINTRESOURCE(id); #else psp.pszTemplate = MAKEINTRESOURCE(id); #endif psp.pfnDlgProc = pfn; psp.lParam = 0; #ifdef __BORLANDC__ ppsh->DUMMYUNIONNAME3.phpage[ppsh->nPages] = CreatePropertySheetPage(&psp); if (ppsh->DUMMYUNIONNAME3.phpage[ppsh->nPages]) { #else ppsh->phpage[ppsh->nPages] = CreatePropertySheetPage(&psp); if (ppsh->phpage[ppsh->nPages]) { #endif ppsh->nPages++; } } } /* CreatePropertySheet creates a property sheet. */ static void CreatePropertySheet(HINSTANCE hInstance, HWND hwnd) { PROPSHEETHEADER psh; HPROPSHEETPAGE rPages[MAX_PAGES]; psh.hwndParent = hwnd; psh.dwSize = sizeof(psh); psh.dwFlags = 0; psh.hInstance = hInstance; #ifdef __BORLANDC__ psh.DUMMYUNIONNAME.hIcon = NULL; #else psh.hIcon = NULL; #endif psh.pszCaption = MAKEINTRESOURCE(IDS_CONFIGNAME); psh.nPages = 0; #ifdef __BORLANDC__ psh.DUMMYUNIONNAME2.nStartPage = 0; psh.DUMMYUNIONNAME3.phpage = rPages; #else psh.nStartPage = 0; psh.phpage = rPages; #endif psh.pfnCallback = NULL; #if defined(_WIN32_WCE) && defined(COMMANDBANDS) && !defined(USE_SHMENU) AddPage(&psh, IDD_VIEW, ViewProc); #endif #ifndef NO_STARTUP AddPage(&psh, IDD_STARTUPFILE, StartFileProc); #endif #if defined(CTRLMAP) || defined(JAPANESE_KEYBOARD) AddPage(&psh, IDD_KEY, KeyMapProc); #endif AddPage(&psh, IDD_BEEP, BeepProc); #ifdef CONFIG_FONT AddPage(&psh, IDD_FONT, FontProc); #endif PropertySheet(&psh); } /* change the path to store the path into the registry database of Win32 */ int ConfigStartupFilePath(int f, int n) { CreatePropertySheet(g_hInst, g_hwndTty); return TRUE; } ng-1.5beta1/sys/win32/winmain.h100644 1750 1750 2765 7175066344 15072 0ustar amurausers/* $Id: winmain.h,v 1.2 2000/10/23 16:52:52 amura Exp $ */ /* OS dependent code used by Ng for WinCE. * Copyright (C) 1998 Eiichiro Ito * Modified for Ng for Win32 * Copyright (C) 1999,2000 Toru Imai * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * ree Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* * $Log: winmain.h,v $ * Revision 1.2 2000/10/23 16:52:52 amura * add GPL copyright to header * * Revision 1.1.1.1 2000/06/27 01:48:00 amura * import to CVS * */ #ifdef __cplusplus extern "C" { #endif int Main( int argc, char *argv[] ) ; int Kbhit( void ) ; int KbhitSleep( DWORD sec ) ; int GetChar( void ) ; void GotoXY( int x, int y ) ; void EraseEOL( void ) ; void EraseEOP( void ) ; void PutChar( char c ) ; void PutKChar( char c1, char c2 ) ; void Flush( void ) ; void Exit( int code ) ; void GetWH( int *w, int *h ) ; #ifdef __cplusplus } ; #endif ng-1.5beta1/COPYING100644 1750 1750 17076 7155200410 12531 0ustar amurausers GNU EMACS GENERAL PUBLIC LICENSE (Clarified 11 Feb 1988) Copyright (C) 1985, 1987, 1988 Richard M. Stallman Everyone is permitted to copy and distribute verbatim copies of this license, but changing it is not allowed. You can also use this wording to make the terms for other programs. The license agreements of most software companies keep you at the mercy of those companies. By contrast, our general public license is intended to give everyone the right to share GNU Emacs. To make sure that you get the rights we want you to have, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. Hence this license agreement. Specifically, we want to make sure that you have the right to give away copies of Emacs, that you receive source code or else can get it if you want it, that you can change Emacs or use pieces of it in new free programs, and that you know you can do these things. To make sure that everyone has such rights, we have to forbid you to deprive anyone else of these rights. For example, if you distribute copies of Emacs, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. Also, for our own protection, we must make certain that everyone finds out that there is no warranty for GNU Emacs. If Emacs is modified by someone else and passed on, we want its recipients to know that what they have is not what we distributed, so that any problems introduced by others will not reflect on our reputation. Therefore we (Richard Stallman and the Free Software Fundation, Inc.) make the following terms which say what you must do to be allowed to distribute or change GNU Emacs. COPYING POLICIES 1. You may copy and distribute verbatim copies of GNU Emacs source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy a valid copyright notice "Copyright (C) 1988 Free Software Foundation, Inc." (or with whatever year is appropriate); keep intact the notices on all files that refer to this License Agreement and to the absence of any warranty; and give any other recipients of the GNU Emacs program a copy of this License Agreement along with the program. You may charge a distribution fee for the physical act of transferring a copy. 2. You may modify your copy or copies of GNU Emacs source code or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains or is a derivative of GNU Emacs or any part thereof, to be licensed at no charge to all third parties on terms identical to those contained in this License Agreement (except that you may choose to grant more extensive warranty protection to some or all third parties, at your option). c) if the modified program serves as a text editor, cause it when started running in the simplest and usual way, to print an announcement including a valid copyright notice "Copyright (C) 1988 Free Software Foundation, Inc." (or with the year that is appropriate), saying that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License Agreement. d) You may charge a distribution fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another unrelated program with this program (or its derivative) on a volume of a storage or distribution medium does not bring the other program under the scope of these terms. 3. You may copy and distribute GNU Emacs (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal shipping charge) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs. 4. You may not copy, sublicense, distribute or transfer GNU Emacs except as expressly provided under this License Agreement. Any attempt otherwise to copy, sublicense, distribute or transfer GNU Emacs is void and your rights to use GNU Emacs under this License agreement shall be automatically terminated. However, parties who have received computer software programs from you with this License Agreement will not have their licenses terminated so long as such parties remain in full compliance. 5. If you wish to incorporate parts of GNU Emacs into other free programs whose distribution conditions are different, write to the Free Software Foundation. We have not yet worked out a simple rule that can be stated here, but we will often permit this. We will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software. Your comments and suggestions about our licensing policies and our software are welcome! Please contact the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, or call (617) 876-3296. NO WARRANTY BECAUSE GNU EMACS IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY NO WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING, FREE SOFTWARE FOUNDATION, INC, RICHARD M. STALLMAN AND/OR OTHER PARTIES PROVIDE GNU EMACS "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE GNU EMACS PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL FREE SOFTWARE FOUNDATION, INC., RICHARD M. STALLMAN, AND/OR ANY OTHER PARTY WHO MAY MODIFY AND REDISTRIBUTE GNU EMACS AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY LOST PROFITS, LOST MONIES, OR OTHER SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH PROGRAMS NOT DISTRIBUTED BY FREE SOFTWARE FOUNDATION, INC.) THE PROGRAM, EVEN IF YOU HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY. ng-1.5beta1/LICENSE100644 1750 1750 2356 7626227137 12500 0ustar amurausersEmacs like micro editor "Ng" -- based on mg2a Copyright (c) 1990, 1991 Shigeki Yoshida Copyright (c) 2000, 2001, 2002, 2003 MURAMATSU Atsushi Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following condition is met: Redistributions of any form (source code and/or binary) must reproduce the above copyright notice, this condition and the following disclaimer in source code and/or the documentation provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ng-1.5beta1/MANIFEST100644 1750 1750 14323 7252201021 12614 0ustar amurausers# $Id: MANIFEST,v 1.7 2001/03/09 16:17:21 amura Exp $ File Name Description ----------------------------------------------------------- COPYING GNU GENERAL PUBLIC LICENSE LICENSE Ng LICENSE (BSD-style) MANIFEST このファイル autosave.c 共通部分ソース basic.c 〃 buffer.c 〃 cmode.c 〃 complt.c 〃 complt.h 〃 config.h 〃 def.h 〃 dir.c 〃 dired.c 〃 display.c 〃 docs ドキュメントディレクトリ docs/CHANGES.doc Ng チェンジノート(1.3L以前) docs/CHANGES.new Ng チェンジノート(1.4beta1以降) docs/CHANGES.Ami Ng AMIGA 版チェンジノート docs/CHANGES.W32 Ng Win32 版チェンジノート docs/Ng.FAQ Ng Frequently Asked Question 集 docs/Ng.doc Ng 機能説明 docs/Ng.ref Ng レファレンスガイド docs/Ng.tut Ng 入門編 docs/README Mg 2a 説明 docs/README.Ami Ng AMIGA 版説明 docs/README.DOS Ng MS-DOS 版説明 docs/README.H68 Ng X68000 Human68k 版説明 docs/README.Ng Ng 1.4 説明 docs/README.SKG Simple Kanji Generator 説明 docs/README.W32 Ng Win32 版説明 docs/fepctrl.doc (MS-DOS/Human68K) FEP 自動制御ライブラリ説明 docs/mg2a.change Mg チェンジノート docs/mgidx.tex Mg リファレンスマニュアル Index (TeX テキスト) docs/mgprog.doc Mg プログラム説明書 docs/mg.tex Mg リファレンスマニュアル (TeX テキスト) docs/supdoc.w32 Ng 1.3 for win32 補足説明 dot.ng Ng 初期設定サンプルファイル echo.c 共通部分ソース extend.c 〃 file.c 〃 help.c 〃 jump.c 〃 kanji.c 〃 kanji_.c 〃 kanji_.h 〃 kbd.c 〃 kbd.h 〃 key.h 〃 keymap.c 〃 kinit.h 〃 kinsoku.c 〃 line.c 〃 macro.c 〃 macro.h 〃 main.c 〃 match.c 〃 modes.c 〃 paragraph.c 〃 random.c 〃 re_search.c 〃 regex_e.c 〃 regex_e.h 〃 regex_j.c 〃 regex_j.h 〃 region.c 〃 search.c 〃 shell.c 〃 skg.c 〃 sys OS 依存部ディレクトリ sys/amiga AMIGA 用ディレクトリ sys/amiga/DMakefile DICE 用の DMakefile sys/amiga/KgMenus.c AMIGA 依存部分ソース sys/amiga/KgMenus.h 〃 sys/amiga/Kgremotemenus.c 〃 sys/amiga/Makefile Manx 用の Makefile (sample/untested) sys/amiga/Makefile.SAS6 SAS C v6 用の Makefile (sample/untested) sys/amiga/Makefile.gcc GeekGadgets 用の Makefile sys/amiga/Ng-startup Ng 初期設定サンプルファイル sys/amiga/alloca.asm alloca() がないコンパイラ用のアセンブラソース sys/amiga/amiga_maps.c AMIGA 依存部分ソース sys/amiga/clipboard.c 〃 sys/amiga/console.c 〃 sys/amiga/dirio.c 〃 sys/amiga/fileio.c 〃 sys/amiga/iconify.c 〃 sys/amiga/iconify.h 〃 sys/amiga/menumap.h 〃 sys/amiga/offset.c 〃 sys/amiga/sleep.c 〃 sys/amiga/spawn.c 〃 sys/amiga/sysdef.h 〃 sys/amiga/sysinit.c 〃 sys/amiga/tty.c 〃 sys/amiga/ttydef.h 〃 sys/amiga/ttyicon.c 〃 sys/amiga/ttyio.c 〃 sys/amiga/ttykbd.c 〃 sys/amiga/ttymenu.c 〃 sys/amiga/ttymouse.c 〃 sys/amiga/varargs.h ローカルな varargs.h を使う場合のヘッダ (Amiga) sys/amiga/zz_pointer.c AMIGA 依存部分ソース sys/amiga/zz_pointer.h 〃 sys/bsd BSD 用ディレクトリ sys/bsd/Makefile BSD 用 Makefile sys/bsd/fileio.c BSD 依存部分ソース sys/bsd/spawn.c 〃 sys/bsd/sysdef.h 〃 sys/bsd/ttyio.c 〃 sys/default 低レベル共通部分ディレクトリ sys/default/README Mg の termcap に関する注意 sys/default/alloca.c alloca() がない機種用の C ソース sys/default/canna.c canna 対応部分ソース sys/default/chrdef.h 低レベル共通部分ソース sys/default/cinfo.c 〃 sys/default/termcap.c termcap ライブラリがない機種用の C ソース sys/default/tty.c 低レベル共通部分ソース sys/default/ttydef.h 〃 sys/default/ttykbd.c 〃 sys/default/varargs.h ローカルな varargs.h を使う場合のヘッダ sys/human68k Human68k 用ディレクトリ sys/human68k/GNUmakefile GNU make 用 Makefile sys/human68k/Makefile Human68k 用 Makefile sys/human68k/dosutil.c Human68k 依存部分ソース sys/human68k/fepctrl.c 〃 sys/human68k/fepctrl.h 〃 sys/human68k/fileio.c 〃 sys/human68k/h68kfncmp.c 〃 sys/human68k/hentrap.s 〃 sys/human68k/objlist リンク用オブジェクトリスト sys/human68k/spawn.c Human68k 依存部分ソース sys/human68k/sysdef.h 〃 sys/human68k/sysinit.c 〃 sys/human68k/termcap X68000 用 termcap ファイル sys/human68k/ttydef.h Human68k 依存部分ソース sys/human68k/ttyio.c 〃 sys/msdos MS-DOS 用ディレクトリ sys/msdos/alloca.asm alloca() がないコンパイラ用のアセンブラソース sys/msdos/dosutil.c MS-DOS 依存部分ソース sys/msdos/fepctrl.c 〃 sys/msdos/fepctrl.h MS-DOS 依存部分ソース sys/msdos/fileio.c 〃 sys/msdos/linkfile MS-C 用リンクオブジェクトリスト sys/msdos/linkfile.tc Trubo-C 用リンクオブジェクトリスト sys/msdos/makefile MS-C 6.0 付属 nmake 用 Makefile sys/msdos/makefile.msc MS-C 5.1 付属 make 用 Makefile sys/msdos/makefile.tc Trubo-C 用 Makefile sys/msdos/ng.ini Ng 初期設定サンプルファイル sys/msdos/proto.h MS-DOS 依存部分ソース sys/msdos/putline.c 〃 sys/msdos/rawgetc.asm 〃 sys/msdos/spawn.c 〃 sys/msdos/sysdef.h 〃 sys/msdos/termcap MS-DOS 用 termcap ファイル sys/msdos/tty.c MS-DOS 依存部分ソース sys/msdos/ttyio.c 〃 sys/sysv System V 用ディレクトリ sys/sysv/Makefile System V 用 Makefile sys/sysv/fileio.c System V 依存部分ソース sys/sysv/spawn.c 〃 sys/sysv/sysdef.h 〃 sys/sysv/ttyio.c 〃 sys/unix Unix 用ディレクトリ sys/unix/Makefile Unix 用 Makefile sys/unix/fileio.c Unix 依存部分ソース sys/unix/spawn.c 〃 sys/unix/sysdef.h 〃 sys/unix/ttyio.c 〃 sys/win32 Win32 用ディレクトリ sys/win32/appicon.ico Win32 用アイコン sys/win32/ce1appicon.ico Win32 用アイコン (白黒) sys/win32/ce2appicon.ico Win32 用アイコン sys/win32/fileio.c Win32 依存部分ソース sys/win32/ng.dsp Visual C++ 用プロジェクトファイル sys/win32/ng.dsw Visual C++ 用ワークファイル sys/win32/ng.ini Ng 初期設定サンプルファイル sys/win32/ng.rc Win32 依存部分ソース sys/win32/ngbc.mak Borland C++ 用メイクファイル sys/win32/ng.ini Ng 初期設定サンプルファイル (英語版) sys/win32/ng.rc Win32 依存部分ソース (英語版) sys/win32/resource.h Win32 依存部分ソース sys/win32/spawn.c 〃 sys/win32/sysdef.h 〃 sys/win32/tools.c 〃 sys/win32/tools.h 〃 sys/win32/tty.c 〃 sys/win32/ttyctrl.cpp 〃 sys/win32/ttyctrl.h 〃 sys/win32/ttyio.c 〃 sys/win32/winmain.c 〃 sys/win32/winmain.h 〃 undo.c 共通部分ソース undo.h 〃 version.c 〃 window.c 〃 word.c 〃 ng-1.5beta1/autosave.c100644 1750 1750 5205 7247657200 13457 0ustar amurausers/* $Id: autosave.c,v 1.3 2001/03/02 08:49:04 amura Exp $ */ /* Auto save support code programed by M.Suzuki Ver 1.0.0 1997/01/07 Create */ /* * $Log: autosave.c,v $ * Revision 1.3 2001/03/02 08:49:04 amura * now AUTOSAVE feature implemented almost all (except for WIN32 * * Revision 1.2 2001/02/18 19:27:35 amura * fix del_autosave_file() * * Revision 1.1 2001/02/18 17:07:23 amura * append AUTOSAVE feature (but NOW not work) * */ #include "config.h" #ifdef AUTOSAVE #include "def.h" #include time_t autosave_interval = 10*60;/* Auto save interval time.(sec) */ int autosave_flag = FALSE; int autosaved = FALSE; extern int getnum pro((char *prompt, int *num)); /* this is port dependent */ extern VOID autosave_name pro((char *buff, char *name, int buflen)); #ifdef ITIMER extern VOID itimer pro((VOID (*func)(void), time_t sec)); #else static time_t check_time; #endif VOID autosave_check(flag) { if (flag && autosave_interval!=0) { autosave_flag = TRUE; autosaved = FALSE; #ifdef ITIMER itimer(autosave_handler, autosave_interval); #else check_time = time(NULL); #endif } else { autosave_flag = FALSE; #ifdef ITIMER itimer(NULL, 0); #endif } } VOID autosave_handler() { BUFFER *bp; int currow; int curcol; #ifdef ITIMER itimer(NULL, 0); #else /* not ITIMER */ time_t now_time; if (!autosave_flag || autosaved) return; now_time = time(NULL); if ((now_time - check_time) < autosave_interval) return; #endif /* ITIMER */ autosaved = TRUE; currow = ttrow; /* save cursor position */ curcol = ttcol; bp = bheadp; /* For all buffers */ while (bp != NULL) { if( bp->b_bname[0] != '*' ){ /* Not internal buffer */ if( bp->b_flag & BFACHG ){ /* modified ? */ char fname[NFILEN]; autosave_name(fname, bp->b_fname, NFILEN); writeout(bp, fname); bp->b_flag &= ~BFACHG; } } bp = bp->b_bufp; } /* end of while */ ewprintf("autosave...done"); ttmove(currow,curcol); ttflush(); } VOID del_autosave_file(name) char* name; { char fname[NFILEN]; if (name!=NULL && name[0] != '*' ){ /* Not internal buffer ? */ autosave_name(fname, name, NFILEN); unlink(fname); /* ewprintf("Unlink ... [%s]",fname); */ } } VOID clean_autosave_file() { BUFFER *bp; for (bp=bheadp; bp!=NULL; bp=bp->b_bufp) del_autosave_file(bp->b_fname); } /* * COMMAND: set-auto-save-interval */ /*ARGSUSED*/ as_set_interval(f, n) { if ((f & FFARG) == 0) { if (getnum("auto-save-interval", &n) == FALSE) return (FALSE); } autosave_interval = n; if (n == 0) autosave_flag = FALSE; return (TRUE); } #endif /* AUTO_SAVE */ ng-1.5beta1/basic.c100644 1750 1750 37022 7632242733 12732 0ustar amurausers/* $Id: basic.c,v 1.6.2.1 2003/03/08 01:22:35 amura Exp $ */ /* * Basic cursor motion commands. * * The routines in this file are the basic * command functions for moving the cursor around on * the screen, setting mark, and swapping dot with * mark. Only moves between lines, which might make the * current buffer framing bad, are hard. */ /* * $Log: basic.c,v $ * Revision 1.6.2.1 2003/03/08 01:22:35 amura * NOTAB is always enabled * * Revision 1.6 2001/05/25 15:36:51 amura * now buffers have only one mark (before windows have one mark) * * Revision 1.5 2001/04/28 18:54:26 amura * support line-number-mode (based on MATSUURA's patch ) * * Revision 1.4 2001/02/18 17:07:23 amura * append AUTOSAVE feature (but NOW not work) * * Revision 1.3 2001/01/05 14:06:59 amura * first implementation of Hojo Kanji support * * Revision 1.2 2000/12/14 18:06:23 amura * filename length become flexible * * Revision 1.1.1.1 2000/06/27 01:47:55 amura * import to CVS * */ /* 90.01.29 Modified for Ng 1.0 by S.Yoshida */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include "def.h" VOID setgoal(); /* * Go to beginning of line. */ /*ARGSUSED*/ gotobol(f, n) { curwp->w_doto = 0; return (TRUE); } /* * Move cursor backwards. Do the * right thing if the count is less than * 0. Error if you try to move back from * the beginning of the buffer. #ifdef KANJI * (91.01.01 Add comment by S.Yoshida) * When after moving "n" bytes, here is KANJI 2nd byte, * go to the KANJI 1st byte of that char. #endif */ /*ARGSUSED*/ backchar(f, n) register int n; { register LINE *lp; #ifdef KANJI /* 90.01.29 by S.Yoshida */ register int kanji2nd = 0; /* Now on a KANJI 2nd byte. */ #endif /* KANJI */ if (n < 0) return forwchar(f, -n); while (n--) { if (curwp->w_doto == 0) { if ((lp=lback(curwp->w_dotp)) == curbp->b_linep) { if (!(f & FFRAND)) ewprintf("Beginning of buffer"); return (FALSE); } curwp->w_dotp = lp; curwp->w_doto = llength(lp); curwp->w_flag |= WFMOVE; } else { #ifdef KANJI /* 90.01.29 by S.Yoshida */ if (kanji2nd) { kanji2nd--; } else if (ISKANJI(lgetc(curwp->w_dotp, curwp->w_doto - 1))) { #ifdef HOJO_KANJI if (ISHOJO(lgetc(curwp->w_dotp, curwp->w_doto - 2))) kanji2nd = 2; else #endif /* HOJO_KANJI */ kanji2nd = 1; } #endif /* KANJI */ curwp->w_doto--; } } #ifdef KANJI /* 90.01.29 by S.Yoshida */ if (kanji2nd) { /* When stop at KANJI 2nd byte. */ if ( #ifdef HOJO_KANJI (kanji2nd==2 && curwp->w_doto == 1) || #endif curwp->w_doto == 0) { /* This is illegal, but... */ if ((lp=lback(curwp->w_dotp)) == curbp->b_linep) { if (!(f & FFRAND)) ewprintf("Beginning of buffer"); return (FALSE); } curwp->w_dotp = lp; curwp->w_doto = llength(lp); curwp->w_flag |= WFMOVE; } else { /* Go back KANJI 1st byte. */ curwp->w_doto -= kanji2nd; } } #endif /* KANJI */ return TRUE; } /* * Go to end of line. */ /*ARGSUSED*/ gotoeol(f, n) { curwp->w_doto = llength(curwp->w_dotp); return (TRUE); } /* * Move cursor forwards. Do the * right thing if the count is less than * 0. Error if you try to move forward * from the end of the buffer. #ifdef KANJI * (91.01.01 Add comment by S.Yoshida) * When after moving "n" bytes, here is KANJI 2nd byte, * if "n" is 1 byte, go to next char, other go back to * the KANJI 1st byte of that char. #endif */ /*ARGSUSED*/ forwchar(f, n) register int n; { #ifdef KANJI /* 90.01.29 by S.Yoshida */ register int kanji2nd = 0; /* Now on a KANJI 2nd byte. */ register int oldn = n; #endif /* KANJI */ if (n < 0) return backchar(f, -n); while (n--) { if (curwp->w_doto == llength(curwp->w_dotp)) { curwp->w_dotp = lforw(curwp->w_dotp); if (curwp->w_dotp == curbp->b_linep) { curwp->w_dotp = lback(curwp->w_dotp); if (!(f & FFRAND)) ewprintf("End of buffer"); return FALSE; } curwp->w_doto = 0; curwp->w_flag |= WFMOVE; } else { #ifdef KANJI /* 90.01.29 by S.Yoshida */ if (kanji2nd) { kanji2nd--; #ifdef HOJO_KANJI } else if (ISHOJO(lgetc(curwp->w_dotp, curwp->w_doto))) { kanji2nd = 2; #endif /* HOJO_KANJI */ } else if (ISKANJI(lgetc(curwp->w_dotp, curwp->w_doto))) { kanji2nd = 1; } #endif /* KANJI */ curwp->w_doto++; } } #ifdef KANJI /* 90.01.29 by S.Yoshida */ if (kanji2nd) { /* When stop at KANJI 2nd byte. */ if (oldn == 1) { /* Special case. Go to next char. */ curwp->w_doto += kanji2nd; } else { /* Go back KANJI 1st byte. */ curwp->w_doto--; #ifdef HOJO_KANJI if (ISHOJO(lgetc(curwp->w_dotp, curwp->w_doto))) curwp->w_doto--; #endif } } #endif /* KANJI */ return TRUE; } /* * Go to the beginning of the * buffer. Setting WFHARD is conservative, * but almost always the case. */ gotobob(f, n) { (VOID) setmark(f, n) ; curwp->w_dotp = lforw(curbp->b_linep); curwp->w_doto = 0; curwp->w_flag |= WFHARD; return TRUE; } /* * Go to the end of the buffer. * Setting WFHARD is conservative, but * almost always the case. */ gotoeob(f, n) { (VOID) setmark(f, n) ; curwp->w_dotp = lback(curbp->b_linep); curwp->w_doto = llength(curwp->w_dotp); curwp->w_flag |= WFHARD; return TRUE; } #ifdef NEXTLINE /* * COMMAND: next-line-add-newlines */ static int flag_nextline = NEXTLINE; /*ARGSUSED*/ nextline(f, n) { register int s; char buf[NINPUT]; if ((f & FFARG) == 0) { if ((s = ereply("next-line-add-newlines : ", buf, sizeof(buf))) != TRUE) return (s); if (ISDIGIT(buf[0]) || buf[0] == '-') n = atoi(buf) > 0; else if (buf[0] == 't' || buf[0] == 'T') n = TRUE; else n = FALSE; } flag_nextline = n; return (TRUE); } #endif /* NEXTLINE */ #ifdef ADDFUNC int line_number_mode = FALSE; linenumbermode(f, n) { register int s; register WINDOW *wp; char buf[NINPUT]; if ((f & FFARG) == 0) { if ((s = ereply("line-number-mode : ", buf, sizeof(buf))) != TRUE) return (s); if (ISDIGIT(buf[0]) || buf[0] == '-') n = (atoi(buf) > 0); else if (buf[0] == 't' || buf[0] == 'T') n = TRUE; else n = FALSE; } line_number_mode = n; for (wp=wheadp; wp!=NULL; wp=wp->w_wndp) wp->w_flag |= WFMODE; return (TRUE); } #endif /* * Move forward by full lines. * If the number of lines to move is less * than zero, call the backward line function to * actually do it. The last command controls how * the goal column is set. */ /*ARGSUSED*/ forwline(f, n) { register LINE *dlp; if (n < 0) return backline(f|FFRAND, -n); if ((lastflag&CFCPCN) == 0) /* Fix goal. */ setgoal(); thisflag |= CFCPCN; if (n == 0) return TRUE; dlp = curwp->w_dotp; #ifdef BUGFIX /* amura */ while (lforw(dlp)!=curbp->b_linep && n--) #else while (dlp!=curbp->b_linep && n--) #endif dlp = lforw(dlp); curwp->w_flag |= WFMOVE; #ifdef BUGFIX /* amura */ if(n > 0) /* ^N at end of buffer creates lines (like gnu) */ #else if(dlp==curbp->b_linep) /* ^N at end of buffer creates lines (like gnu) */ #endif { #ifdef NEXTLINE /* amura */ if (! flag_nextline) { dlp = lback(curbp->b_linep); curwp->w_dotp = dlp; curwp->w_doto = getgoal(dlp); } else #endif #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ } else { #endif /* READONLY */ #ifdef AUTOSAVE /* 96.12.25 by M.Suzuki */ curbp->b_flag |= BFACHG; #endif /* AUTOSAVE */ if(!(curbp->b_flag&BFCHG)) { /* first change */ curbp->b_flag |= BFCHG; curwp->w_flag |= WFMODE; } #ifdef BUGFIX /* amura */ curwp->w_doto = llength(curwp->w_dotp); while(n-- > 0) lnewline(); #else curwp->w_doto = 0; while(n-- >= 0) { if((dlp = lallocx(0)) == NULL) return FALSE; dlp->l_fp = curbp->b_linep; dlp->l_bp = lback(dlp->l_fp); dlp->l_bp->l_fp = dlp->l_fp->l_bp = dlp; } curwp->w_dotp = lback(curbp->b_linep); #endif #ifdef READONLY /* 91.01.05 by S.Yoshida */ } #endif /* READONLY */ } else { curwp->w_dotp = dlp; curwp->w_doto = getgoal(dlp); } #ifdef ADDFUNC /* amura */ if (line_number_mode) curwp->w_flag |= WFHARD; # ifdef BUGFIX return n>0 ? FALSE : TRUE; # else return n>=0 ? FALSE : TRUE; # endif #else return TRUE; #endif } /* * This function is like "forwline", but * goes backwards. The scheme is exactly the same. * Check for arguments that are less than zero and * call your alternate. Figure out the new line and * call "movedot" to perform the motion. */ /*ARGSUSED*/ backline(f, n) { register LINE *dlp; if (n < 0) return forwline(f|FFRAND, -n); if ((lastflag&CFCPCN) == 0) /* Fix goal. */ setgoal(); thisflag |= CFCPCN; dlp = curwp->w_dotp; while (n-- && lback(dlp)!=curbp->b_linep) dlp = lback(dlp); curwp->w_dotp = dlp; curwp->w_doto = getgoal(dlp); curwp->w_flag |= WFMOVE; #ifdef ADDFUNC /* amura */ if (line_number_mode) curwp->w_flag |= WFHARD; return n >= 0 ? FALSE : TRUE; #else return TRUE; #endif } /* * Set the current goal column, * which is saved in the external variable "curgoal", * to the current cursor column. The column is never off * the edge of the screen; it's more like display then * show position. */ VOID setgoal() { curgoal = getcolpos() - 1; /* Get the position. */ /* we can now display past end of display, don't chop! */ } /* * This routine looks at a line (pointed * to by the LINE pointer "dlp") and the current * vertical motion goal column (set by the "setgoal" * routine above) and returns the best offset to use * when a vertical motion is made into the line. */ getgoal(dlp) register LINE *dlp; { register int c; register int col; register int newcol; register int dbo; #ifdef KANJI /* 90.01.29 by S.Yoshida */ register int kanji2nd = FALSE; /* Now on a KANJI 2nd byte. */ #endif /* KANJI */ #ifdef VARIABLE_TAB int tab = curbp->b_tabwidth; #endif /* VARIABLE_TAB */ col = 0; dbo = 0; while (dbo != llength(dlp)) { c = lgetc(dlp, dbo); newcol = col; #ifdef HOJO_KANJI if (ISHOJO(c) && !kanji2nd) { dbo++; continue; } #endif /* HOJO_KANJI */ if (c == '\t' && !(curbp->b_flag & BFNOTAB)) #ifdef VARIABLE_TAB newcol = (newcol/tab + 1)*tab -1; #else newcol |= 0x07; #endif else if (ISCTRL(c) != FALSE) ++newcol; #ifdef HANKANA /* 92.11.21 by S.Sasaki */ else if (ISHANKANA(c) && !kanji2nd) --newcol; #endif /* HANKANA */ ++newcol; if (newcol > curgoal) break; col = newcol; ++dbo; #ifdef KANJI /* 90.01.29 by S.Yoshida */ if (kanji2nd) { kanji2nd = FALSE; } else if (ISKANJI(c)) { kanji2nd = TRUE; } } if (kanji2nd) { /* When stop at KANJI 2nd byte, */ dbo--; /* go back KANJI 1st byte. */ #endif /* KANJI */ } return (dbo); } /* * Scroll forward by a specified number * of lines, or by a full page if no argument. * The "2" is the window overlap (this is the default * value from ITS EMACS). Because the top line in * the window is zapped, we have to do a hard * update and get it back. */ /*ARGSUSED*/ forwpage(f, n) register int n; { register LINE *lp; if (!(f & FFARG)) { n = curwp->w_ntrows - 2; /* Default scroll. */ if (n <= 0) /* Forget the overlap */ n = 1; /* if tiny window. */ } else if (n < 0) return backpage(f|FFRAND, -n); #ifdef CVMVAS else /* Convert from pages */ n *= curwp->w_ntrows; /* to lines. */ #endif lp = curwp->w_linep; n += curwp->w_lines; while (n>0 && lforw(lp)!=curbp->b_linep) { n -= countlines(lp); if (n < 0) break; lp = lforw(lp); } if (n > 0) n = countlines(lp) - 1; /* LAST row */ if (n < 0) n = countlines(lp) + n; curwp->w_linep = lp; curwp->w_lines = n; curwp->w_flag |= WFHARD; /* if in current window, don't move dot */ for(n = curwp->w_ntrows; n>=0 && lp!=curbp->b_linep; lp = lforw(lp)) { int x,y; if(lp==curwp->w_dotp && colrow(lp, curwp->w_doto, &x, &y) < n) return TRUE; n -= countlines(lp); } curwp->w_dotp = curwp->w_linep; curwp->w_doto = skipline(curwp->w_linep, curwp->w_lines); return TRUE; } /* * This command is like "forwpage", * but it goes backwards. The "2", like above, * is the overlap between the two windows. The * value is from the ITS EMACS manual. The * hard update is done because the top line in * the window is zapped. */ /*ARGSUSED*/ backpage(f, n) register int n; { register LINE *lp; if (!(f & FFARG)) { n = curwp->w_ntrows - 2; /* Default scroll. */ if (n <= 0) /* Don't blow up if the */ n = 1; /* window is tiny. */ } else if (n < 0) return forwpage(f|FFRAND, -n); #ifdef CVMVAS else /* Convert from pages */ n *= curwp->w_ntrows; /* to lines. */ #endif lp = curwp->w_linep; n -= curwp->w_lines; while (n>0 && lback(lp)!=curbp->b_linep) { lp = lback(lp); n -= countlines(lp); } if (n > 0) n = 0; if (n < 0) n = -n; curwp->w_linep = lp; curwp->w_lines = n; curwp->w_flag |= WFHARD; /* if in current window, don't move dot */ for(n = curwp->w_ntrows; n>=0 && lp!=curbp->b_linep; lp = lforw(lp)) { int x,y; if(lp==curwp->w_dotp && colrow(lp, curwp->w_doto, &x, &y) < n) return TRUE; n -= countlines(lp); } curwp->w_dotp = curwp->w_linep; curwp->w_doto = skipline(curwp->w_linep, curwp->w_lines); return TRUE; } /* These functions are provided for compatibility with Gosling's Emacs. * They are used to scroll the display up (or down) one line at a time. */ #ifdef GOSMACS forw1page(f, n) int f, n; { if (!(f & FFARG)) { n = 1; f = FFUNIV; } forwpage(f|FFRAND, n); } back1page(f, n) int f, n; { if (!(f & FFARG)) { n = 1; f = FFUNIV; } backpage(f|FFRAND, n); } #endif /* * Page the other window. Check to make sure it exists, then * nextwind, forwpage and restore window pointers. */ pagenext(f, n) { register WINDOW *wp; if (wheadp->w_wndp == NULL) { ewprintf("No other window"); return FALSE; } wp = curwp; (VOID) nextwind(f, n); (VOID) forwpage(f, n); curwp = wp; curbp = wp->w_bufp; return TRUE; } /* * Internal set mark routine, used by other functions (daveb). */ VOID isetmark() { curwp->w_bufp->b_markp = curwp->w_dotp; curwp->w_bufp->b_marko = curwp->w_doto; } /* * Set the mark in the current window * to the value of dot. A message is written to * the echo line. (ewprintf knows about macros) */ /*ARGSUSED*/ setmark(f, n) { isetmark(); ewprintf("Mark set"); return TRUE; } /* * Swap the values of "dot" and "mark" in * the current window. This is pretty easy, because * all of the hard work gets done by the standard routine * that moves the mark about. The only possible * error is "no mark". */ /*ARGSUSED*/ swapmark(f, n) { register LINE *odotp; register int odoto; BUFFER *bp = curwp->w_bufp; if (bp->b_markp == NULL) { ewprintf("No mark in this buffer"); return FALSE; } odotp = curwp->w_dotp; odoto = curwp->w_doto; curwp->w_dotp = bp->b_markp; curwp->w_doto = bp->b_marko; bp->b_markp = odotp; bp->b_marko = odoto; curwp->w_flag |= WFMOVE; return TRUE; } /* * Go to a specific line, mostly for * looking up errors in C programs, which give the * error a line number. If an argument is present, then * it is the line number, else prompt for a line number * to use. */ /*ARGSUSED*/ gotoline(f, n) register int n; { register LINE *clp; register int s; char buf[NINPUT]; if (!(f & FFARG)) { if ((s=ereply("Goto line: ", buf, sizeof(buf))) != TRUE) return s; n = atoi(buf); } if (n > 0) { clp = lforw(curbp->b_linep); /* "clp" is first line */ while (--n > 0) { if (lforw(clp) == curbp->b_linep) break; clp = lforw(clp); } } else { clp = lback(curbp->b_linep); /* clp is last line */ while (n < 0) { if (lback(clp) == curbp->b_linep) break; clp = lback(clp); n++; } } curwp->w_dotp = clp; curwp->w_doto = 0; curwp->w_flag |= WFMOVE; return TRUE; } ng-1.5beta1/buffer.c100644 1750 1750 53432 7303476024 13122 0ustar amurausers/* $Id: buffer.c,v 1.16 2001/05/25 15:36:52 amura Exp $ */ /* * Buffer handling. */ /* * $Log: buffer.c,v $ * Revision 1.16 2001/05/25 15:36:52 amura * now buffers have only one mark (before windows have one mark) * * Revision 1.15 2001/05/08 17:52:43 amura * display buffer size in bufferlist * * Revision 1.14 2001/03/02 08:49:04 amura * now AUTOSAVE feature implemented almost all (except for WIN32 * * Revision 1.13 2001/02/28 17:06:05 amura * buffer size to use eread() is more secure * * Revision 1.12 2001/02/18 19:26:41 amura * remove malloc() prototype * * Revision 1.11 2001/02/18 17:07:23 amura * append AUTOSAVE feature (but NOW not work) * * Revision 1.10 2001/01/05 14:06:59 amura * first implementation of Hojo Kanji support * * -- snip -- * * Revision 1.1 1999/05/19 03:47:59 amura * Initial revision * */ /* 90.01.29 Modified for Ng 1.0 by S.Yoshida */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include "def.h" #include "kbd.h" /* needed for modes */ #ifdef UNDO #include "undo.h" #endif #ifdef VARIABLE_TAB int defb_tab = 8; int cmode_tab = 0; #endif /* VARIABLE_TAB */ #define GETNUMLEN 6 static BUFFER *makelist pro((void)); static long buffersize pro((BUFFER*)); #ifdef MOVE_BUFFER /* 95.08.29 by M.Suzuki */ /* Move to the next buffer */ nextbuffer(f,n) { register BUFFER *bp; /* Get buffer to use from user */ if ((curbp->b_altb == NULL) && ((curbp->b_altb = bfind("*scratch*", TRUE)) == NULL)) return FALSE; bp = bheadp; while (bp != NULL) { if (fncmp(curbp->b_bname, bp->b_bname) == 0){ bp = bp->b_bufp; break; } bp = bp->b_bufp; } if ( bp == NULL){ bp = bheadp; } /* and put it in current window */ curbp = bp; return showbuffer(bp, curwp, WFFORCE|WFHARD); } /* Move to the previous buffer */ prevbuffer(f,n) { register BUFFER *bp,*bp1; if ((curbp->b_altb == NULL) && ((curbp->b_altb = bfind("*scratch*", TRUE)) == NULL)) return FALSE; bp1 = bp = bheadp; while (bp != NULL) { if (fncmp(curbp->b_bname, bp->b_bname) == 0){ if( bp == bp1 ){ /* abnomal found */ while( bp != NULL ){ /* last search */ bp1 = bp; bp = bp->b_bufp; } } break; } bp1 = bp; bp = bp->b_bufp; } /* and put it in current window */ curbp = bp1; return showbuffer(bp1, curwp, WFFORCE|WFHARD); } #endif /* MOVE_BUFFER */ /* * Attach a buffer to a window. The values of dot and mark come * from the buffer if the use count is 0. Otherwise, they come * from some other window. *scratch* is the default alternate * buffer. */ /*ARGSUSED*/ usebuffer(f, n) { register BUFFER *bp; register int s; char bufn[NBUFN]; /* Get buffer to use from user */ if ((curbp->b_altb == NULL) && ((curbp->b_altb = bfind("*scratch*", TRUE)) == NULL)) s=eread("Switch to buffer: ", bufn, sizeof(bufn), EFNEW|EFBUF); else s=eread("Switch to buffer: (default %s) ", bufn, sizeof(bufn), EFNEW|EFBUF, curbp->b_altb->b_bname); if (s == ABORT) return s; if (s == FALSE && curbp->b_altb != NULL) bp = curbp->b_altb ; else if ((bp=bfind(bufn, TRUE)) == NULL) return FALSE; /* and put it in current window */ curbp = bp; return showbuffer(bp, curwp, WFFORCE|WFHARD); } /* * pop to buffer asked for by the user. */ /*ARGSUSED*/ poptobuffer(f, n) { register BUFFER *bp; register WINDOW *wp; register int s; char bufn[NBUFN]; WINDOW *popbuf(); /* Get buffer to use from user */ if ((curbp->b_altb == NULL) && ((curbp->b_altb = bfind("*scratch*", TRUE)) == NULL)) s=eread("Switch to buffer in other window: ", bufn, sizeof(bufn), EFNEW|EFBUF); else s=eread("Switch to buffer in other window: (default %s) ", bufn, sizeof(bufn), EFNEW|EFBUF, curbp->b_altb->b_bname); if (s == ABORT) return s; if (s == FALSE && curbp->b_altb != NULL) bp = curbp->b_altb ; else if ((bp=bfind(bufn, TRUE)) == NULL) return FALSE; /* and put it in a new window */ if ((wp = popbuf(bp)) == NULL) return FALSE; curbp = bp; curwp = wp; return TRUE; } /* * Dispose of a buffer, by name. * Ask for the name. Look it up (don't get too * upset if it isn't there at all!). Clear the buffer (ask * if the buffer has been changed). Then free the header * line and the buffer header. Bound to "C-X K". */ /*ARGSUSED*/ killbuffer(f, n) { register BUFFER *bp; register BUFFER *bp1; register BUFFER *bp2; WINDOW *wp; register int s; char bufn[NBUFN]; if ((s=eread("Kill buffer: (default %s) ", bufn, sizeof(bufn), EFNEW|EFBUF, curbp->b_bname)) == ABORT) return (s); else if (s == FALSE) bp = curbp; else if ((bp=bfind(bufn, FALSE)) == NULL) return FALSE; /* find some other buffer to display. try the alternate buffer, * then the first different buffer in the buffer list. if * there's only one buffer, create buffer *scratch* and make * it the alternate buffer. return if *scratch* is only buffer */ #ifdef BUGFIX /* 90.02.22 by S.Yoshida */ if ((bp1 = bp->b_altb) == NULL || bp1 == bp) { #else /* ORIGINAL */ if ((bp1 = bp->b_altb) == NULL) { #endif /* BUGFIX */ bp1 = (bp == bheadp) ? bp->b_bufp : bheadp; if (bp1 == NULL) { /* only one buffer. see if it's *scratch* */ if (bp == bfind("*scratch*",FALSE)) return FALSE; /* create *scratch* for alternate buffer */ if ((bp1 = bfind("*scratch*",TRUE)) == NULL) return FALSE; } } if (bp->b_fname == NULL) { /* Do not ask for saving if the buffer is not associated with a file. by Tillanosoft */ bp->b_flag &= ~BFCHG; } if (bclear(bp) != TRUE) return FALSE; for (wp = wheadp; bp->b_nwnd > 0; wp = wp->w_wndp) { if (wp->w_bufp == bp) { bp2 = bp1->b_altb; /* save alternate buffer */ if(showbuffer(bp1, wp, WFMODE|WFFORCE|WFHARD) != FALSE) bp1->b_altb = bp2; else bp1 = bp2; } } if (bp == curbp) curbp = bp1; free((char *) bp->b_linep); /* Release header line. */ bp2 = NULL; /* Find the header. */ bp1 = bheadp; while (bp1 != bp) { if (bp1->b_altb == bp) bp1->b_altb = (bp->b_altb == bp1) ? NULL : bp->b_altb; bp2 = bp1; bp1 = bp1->b_bufp; } bp1 = bp1->b_bufp; /* Next one in chain. */ if (bp2 == NULL) /* Unlink it. */ bheadp = bp1; else bp2->b_bufp = bp1; while (bp1 != NULL) { /* Finish with altb's */ if (bp1->b_altb == bp) bp1->b_altb = (bp->b_altb == bp1) ? NULL : bp->b_altb; bp1 = bp1->b_bufp; } if (bp->b_fname != NULL) /* Release filename block */ free(bp->b_fname); #ifdef EXTD_DIR if (bp->b_cwd != NULL) /* Release pathname block */ free(bp->b_cwd); #endif free(bp->b_bname); /* Release name block */ #ifdef UNDO undo_clean(bp); /* Release undo data */ #endif free((char *) bp); /* Release buffer block */ return TRUE; } /* * Save some buffers - just call anycb with the arg flag. */ /*ARGSUSED*/ savebuffers(f, n) { if (anycb(f) == ABORT) return ABORT; return TRUE; } /* * Display the buffer list. This is done * in two parts. The "makelist" routine figures out * the text, and puts it in a buffer. "popbuf" * then pops the data onto the screen. Bound to * "C-X C-B". */ /*ARGSUSED*/ listbuffers(f, n) { register BUFFER *bp; register WINDOW *wp; BUFFER *makelist(); WINDOW *popbuf(); if ((bp=makelist()) == NULL || (wp=popbuf(bp)) == NULL) return FALSE; wp->w_dotp = bp->b_dotp; /* fix up if window already on screen */ wp->w_doto = bp->b_doto; #ifdef BUFFER_MODE bp->b_modes[0] = name_mode("Buffer Menu"); if (bp->b_modes[0] == NULL) { bp->b_modes[0] = &map_table[0]; ewprintf("Could not find \"Buffer Menu\" mode"); } else { bp->b_nmodes = 0; } #endif return TRUE; } /* * This routine rebuilds the text for the * list buffers command. Return TRUE if * everything works. Return FALSE if there * is an error (if there is no memory). */ BUFFER * makelist() { register char *cp1; register char *cp2; register int c; register BUFFER *bp; LINE *lp; BUFFER *blp; char b[6+1]; char line[4+NBUFN+7+NFILEN+4]; #ifdef HANKANA int nhankana; #endif if ((blp = bfind("*Buffer List*", TRUE)) == NULL) return NULL; if (bclear(blp) != TRUE) return NULL; #ifdef AUTOSAVE /* 96.12.24 by M.Suzuki */ blp->b_flag &= ~(BFCHG|BFACHG); /* Blow away old. */ #else blp->b_flag &= ~BFCHG; /* Blow away old. */ #endif /* AUTOSAVE */ (VOID) strcpy(line, " MR Buffer"); cp1 = line + 10; while(cp1 < line + 4 + NBUFN + 1) *cp1++ = ' '; (VOID) strcpy(cp1, "Size File"); if (addline(blp, line) == FALSE) return NULL; (VOID) strcpy(line, " -- ------"); cp1 = line + 10; while(cp1 < line + 4 + NBUFN + 1) *cp1++ = ' '; (VOID) strcpy(cp1, "---- ----"); if (addline(blp, line) == FALSE) return NULL; bp = bheadp; /* For all buffers */ while (bp != NULL) { sprintf(line,"%c%c%c %-30.30s %7ld %s", (bp == curbp) ? '.' : ' ', (bp->b_flag & BFCHG) ? '*' : ' ', #ifdef READONLY /* 91.01.05 by S.Yoshida */ (bp->b_flag & BFRONLY) ? '%' : ' ', #else ' ', #endif bp->b_bname, buffersize(bp), (bp->b_fname != NULL) ? bp->b_fname : "" ); if (addline(blp, line) == FALSE) return NULL; bp = bp->b_bufp; } blp->b_dotp = lforw(blp->b_linep); /* put dot at beginning of buffer */ blp->b_doto = 0; #ifdef READONLY /* 91.02.06 by N.Kamei */ blp->b_flag |= BFRONLY; #endif /* READONLY */ return blp; /* All done */ } /* * Calculate buffer size */ static long buffersize(bp) BUFFER *bp; { long size = 0; LINE *line; line = bp->b_linep; line = lforw(line); while (line != bp->b_linep) { size += llength(line); size++; line = lforw(line); } return size; } /* * The argument "text" points to * a string. Append this line to the * buffer. Handcraft the EOL * on the end. Return TRUE if it worked and * FALSE if you ran out of room. */ addline(bp, text) register BUFFER *bp; char *text; { register LINE *lp; register int i; register int ntext; ntext = strlen(text); if ((lp=lalloc(ntext)) == NULL) return FALSE; for (i=0; ib_linep->l_bp->l_fp = lp; /* Hook onto the end */ lp->l_bp = bp->b_linep->l_bp; bp->b_linep->l_bp = lp; lp->l_fp = bp->b_linep; #ifdef CANTHAPPEN if (bp->b_dotp == bp->b_linep) /* If "." is at the end */ bp->b_dotp = lp; /* move it to new line */ if (bp->b_markp == bp->b_linep) /* ditto for mark */ bp->b_markp = lp; #endif return TRUE; } /* * Look through the list of buffers, giving the user * a chance to save them. Return TRUE if there are * any changed buffers afterwards. Buffers that don't * have an associated file don't count. Return FALSE * if there are no changed buffers. */ anycb(f) { register BUFFER *bp; register int s = FALSE, save = FALSE; char *prompt; VOID upmodes(); for (bp = bheadp; bp != NULL; bp = bp->b_bufp) { if (bp->b_fname != NULL && (bp->b_flag&BFCHG) != 0) { prompt = alloca(10 + strlen(bp->b_fname) + 1); if (prompt != NULL) { (VOID) strcpy(prompt, "Save file "); (VOID) strcpy(prompt + 10, bp->b_fname); } else { prompt = "Save file "; } if ((f == TRUE || (save = eyorn(prompt)) == TRUE) && buffsave(bp) == TRUE) { #ifdef AUTOSAVE /* 96.12.24 by M.Suzuki */ bp->b_flag &= ~(BFCHG|BFACHG); #else bp->b_flag &= ~BFCHG; #endif /* AUTOSAVE */ upmodes(bp); } else s = TRUE; if (save == ABORT) return (save); save = TRUE; } } if (save == FALSE /* && kbdmop == NULL */ ) /* experimental */ ewprintf("(No files need saving)"); return s; } /* * Search for a buffer, by name. * If not found, and the "cflag" is TRUE, * create a buffer and put it in the list of * all buffers. Return pointer to the BUFFER * block for the buffer. */ BUFFER * bfind(bname, cflag) register char *bname; { register BUFFER *bp; register LINE *lp; int i; extern int defb_nmodes; extern MAPS *defb_modes[PBMODES]; extern int defb_flag; extern int defb_tab; bp = bheadp; while (bp != NULL) { if (fncmp(bname, bp->b_bname) == 0) return bp; bp = bp->b_bufp; } if (cflag!=TRUE) return NULL; /*NOSTRICT*/ if ((bp=(BUFFER *)malloc(sizeof(BUFFER))) == NULL) { ewprintf("Can't get %d bytes", sizeof(BUFFER)); return NULL; } if ((bp->b_bname=malloc((unsigned)(strlen(bname)+1))) == NULL) { ewprintf("Can't get %d bytes", strlen(bname)+1); free((char *) bp); return NULL; } if ((lp = lalloc(0)) == NULL) { free(bp->b_bname); free((char *) bp); return NULL; } #ifdef UNDO bzero(bp->b_ustack, sizeof(UNDO_DATA *)*(UNDOSIZE+1)); undo_reset(bp); #endif bp->b_altb = bp->b_bufp = NULL; bp->b_dotp = lp; bp->b_doto = 0; bp->b_markp = NULL; bp->b_marko = 0; bp->b_flag = defb_flag; bp->b_nwnd = 0; bp->b_linep = lp; bp->b_nmodes = defb_nmodes; #ifdef KANJI /* 90.01.29 by S.Yoshida */ bp->b_kfio = NIL; /* changed by amura */ /* set in fileio.c */ #endif /* KANJI */ #ifdef VARIABLE_TAB bp->b_tabwidth = defb_tab; #endif /* VARIABLE_TAB */ i = 0; do { bp->b_modes[i] = defb_modes[i]; } while(i++ < defb_nmodes); bp->b_fname = NULL; #ifdef EXTD_DIR bp->b_cwd = NULL; if (curbp) { if (curbp->b_cwd == NULL) { extern void storecwd pro((BUFFER *bp)); storecwd(curbp); } if (curbp->b_cwd != NULL && (bp->b_cwd=malloc(strlen(curbp->b_cwd)+1)) != NULL) strcpy(bp->b_cwd, curbp->b_cwd); } #endif (VOID) strcpy(bp->b_bname, bname); lp->l_fp = lp; lp->l_bp = lp; bp->b_bufp = bheadp; bheadp = bp; return bp; } /* * This routine blows away all of the text * in a buffer. If the buffer is marked as changed * then we ask if it is ok to blow it away; this is * to save the user the grief of losing text. The * window chain is nearly always wrong if this gets * called; the caller must arrange for the updates * that are required. Return TRUE if everything * looks good. */ bclear(bp) register BUFFER *bp; { register LINE *lp; register int s; VOID lfree(); if ((bp->b_flag&BFCHG) != 0 /* Changed. */ && (s=eyesno("Buffer modified; kill anyway")) != TRUE) return (s); #ifdef AUTOSAVE /* 96.12.25 by M.Suzuki */ if (bp->b_bname && bp->b_bname[0] != '*' ){/* file buffer only */ del_autosave_file(bp->b_fname); } bp->b_flag &= ~(BFCHG|BFACHG); /* Not changed */ #else bp->b_flag &= ~BFCHG; /* Not changed */ #endif /* AUTOSAVE */ while ((lp=lforw(bp->b_linep)) != bp->b_linep) lfree(lp); bp->b_dotp = bp->b_linep; /* Fix "." */ bp->b_doto = 0; bp->b_markp = NULL; /* Invalidate "mark" */ bp->b_marko = 0; return TRUE; } /* * Display the given buffer in the given window. Flags indicated * action on redisplay. */ showbuffer(bp, wp, flags) register BUFFER *bp; register WINDOW *wp; { register BUFFER *obp; WINDOW *owp; if (wp->w_bufp == bp) { /* Easy case! */ wp->w_flag |= flags; return TRUE; } /* First, dettach the old buffer from the window */ if ((bp->b_altb = obp = wp->w_bufp) != NULL) { if (--obp->b_nwnd == 0) { obp->b_dotp = wp->w_dotp; obp->b_doto = wp->w_doto; } } /* Now, attach the new buffer to the window */ wp->w_bufp = bp; if (bp->b_nwnd++ == 0) { /* First use. */ wp->w_dotp = bp->b_dotp; wp->w_doto = bp->b_doto; } else /* already on screen, steal values from other window */ #ifdef BUGFIX /* ? 90.12.08 Sawayanagi Yosirou */ for (owp = wheadp; owp != NULL; owp = owp->w_wndp) if (owp->w_bufp == bp && owp != wp) { #else /* ORIGINAL */ for (owp = wheadp; owp != NULL; owp = wp->w_wndp) if (wp->w_bufp == bp && owp != wp) { #endif /* BUGFIX */ wp->w_dotp = owp->w_dotp; wp->w_doto = owp->w_doto; break; } wp->w_flag |= WFMODE|flags; return TRUE; } /* * Pop the buffer we got passed onto the screen. * Returns a status. */ WINDOW * popbuf(bp) register BUFFER *bp; { register WINDOW *wp; if (bp->b_nwnd == 0) { /* Not on screen yet. */ if ((wp=wpopup()) == NULL) return NULL; } else for (wp = wheadp; wp != NULL; wp = wp->w_wndp) if (wp->w_bufp == bp) { wp->w_flag |= WFHARD|WFFORCE; return wp ; } if (showbuffer(bp, wp, WFHARD) != TRUE) return NULL; return wp; } /* * Insert another buffer at dot. Very useful. */ /*ARGSUSED*/ bufferinsert(f, n) { register BUFFER *bp; register LINE *clp; register int clo; register int nline; int s; char bufn[NBUFN]; #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ /* Get buffer to use from user */ if (curbp->b_altb != NULL) s=eread("Insert buffer: (default %s) ", bufn, sizeof(bufn), #ifdef BUGFIX /* 91.01.04 by S.Yoshida */ EFNEW|EFBUF, curbp->b_altb->b_bname); else s=eread("Insert buffer: ", bufn, sizeof(bufn), EFNEW|EFBUF); #else /* ORIGINAL */ EFNEW|EFBUF, &(curbp->b_altb->b_bname), (char *) NULL) ; else s=eread("Insert buffer: ", bufn, sizeof(bufn), EFNEW|EFBUF, (char *) NULL) ; #endif /* BUGFIX */ if (s == ABORT) return (s); if (s == FALSE && curbp->b_altb != NULL) bp = curbp->b_altb; else if ((bp=bfind(bufn, FALSE)) == NULL) return FALSE; if (bp==curbp) { ewprintf("Cannot insert buffer into self"); return FALSE; } /* insert the buffer */ nline = 0; clp = lforw(bp->b_linep); for(;;) { for (clo = 0; clo < llength(clp); clo++) if (linsert(1, lgetc(clp, clo)) == FALSE) return FALSE; if((clp = lforw(clp)) == bp->b_linep) break; if (newline(FFRAND, 1) == FALSE) /* fake newline */ return FALSE; nline++; } if (nline == 1) ewprintf("[Inserted 1 line]"); else ewprintf("[Inserted %d lines]", nline); clp = curwp->w_linep; /* cosmetic adjustment */ if (curwp->w_dotp == clp) { /* for offscreen insert */ while (nline > 0 && lback(clp)!=curbp->b_linep) { clp = lback(clp); nline --; } curwp->w_linep = clp; /* adjust framing. */ curwp->w_lines = 0; curwp->w_flag |= WFHARD; } return (TRUE); } /* * Turn off the dirty bit on this buffer. */ /*ARGSUSED*/ notmodified(f, n) { register WINDOW *wp; #ifdef AUTOSAVE /* 96.12.24 by M.Suzuki */ curbp->b_flag &= ~(BFCHG|BFACHG); #else curbp->b_flag &= ~BFCHG; #endif /* AUTOSAVE */ wp = wheadp; /* Update mode lines. */ while (wp != NULL) { if (wp->w_bufp == curbp) wp->w_flag |= WFMODE; wp = wp->w_wndp; } ewprintf("Modification-flag cleared"); return TRUE; } #ifdef READONLY /* 91.01.05 by S.Yoshida */ /* * Toggle the read-only bit on this buffer. */ /*ARGSUSED*/ togglereadonly(f, n) { register WINDOW *wp; curbp->b_flag ^= BFRONLY; /* Toggle read-only bit. */ wp = wheadp; /* Update mode lines. */ while (wp != NULL) { if (wp->w_bufp == curbp) wp->w_flag |= WFMODE; wp = wp->w_wndp; } return TRUE; } /* * Display warning message. */ VOID warnreadonly() { ewprintf("Buffer is read-only: #", curbp->b_bname); ttbeep(); /* 91.02.06 Add beep. by S.Yoshida */ } #endif /* READONLY */ #ifndef NO_HELP /* * Popbuf and set all windows to top of buffer. Currently only used by * help functions. */ popbuftop(bp) register BUFFER *bp; { register WINDOW *wp; bp->b_dotp = lforw(bp->b_linep); bp->b_doto = 0; if(bp->b_nwnd != 0) { for(wp = wheadp; wp!=NULL; wp = wp->w_wndp) if(wp->w_bufp == bp) { wp->w_dotp = bp->b_dotp; wp->w_doto = 0; wp->w_flag |= WFHARD; } } return popbuf(bp) != NULL; } #endif #if defined(CMODE)||defined(VARIABLE_TAB)||defined(AUTOSAVE) #define USING_GETNUM 1 #endif #ifdef USING_GETNUM getnum(prompt, num) char *prompt; int *num; { char numstr[GETNUMLEN]; if (ereply("%s : ", numstr, GETNUMLEN, prompt) == FALSE) return (FALSE); *num = atoi(numstr); return (TRUE); } #undef USING_GETNUM #endif /* USING_GETNUM */ #ifdef VARIABLE_TAB set_default_tabwidth(f, n) int f, n; { if ((f & FFARG) == 0) { if (getnum("default-tab-width", &n) == FALSE) return (FALSE); } if (n>64 || n<=2) return (FALSE); defb_tab = n; return (TRUE); } set_tabwidth(f, n) int f, n; { extern int refresh(); if ((f & FFARG) == 0) { if (getnum("tab-width", &n) == FALSE) return (FALSE); } if (n == 0) n = defb_tab; else if (n>64 || n<=2) return (FALSE); curbp->b_tabwidth = n; if (f >= 0) refresh(0, 0); return (TRUE); } set_cmode_tabwidth(f, n) int f, n; { if ((f & FFARG) == 0) { if (getnum("c-tab-width", &n) == FALSE) return (FALSE); } if (n>64 || n<=2) return (FALSE); cmode_tab = n; return (TRUE); } #endif /* VARIABLE_TAB */ #ifdef BUFFER_MODE #define BUFNAME_START_COL 4 static int b_makename(lp, buf, len) LINE *lp; char *buf; int len; { if (BUFNAME_START_COL < llength(lp)) { char *p = lp->l_text + BUFNAME_START_COL, *q = buf, *ep = p + NBUFN; while (*ep == ' ') { ep--; } ep++; while (p < ep) { *q++ = *p++; } *q = '\0'; return TRUE; } return FALSE; } /*ARGSUSED*/ b_thiswin(f, n) int f, n; { char bufname[NBUFN]; register BUFFER *bp; LINE *lp = curwp->w_dotp; int s; s = b_makename(lp, bufname, NBUFN); if (s) { bp = bfind(bufname, FALSE); if (bp != NULL) { /* put it in current window */ curbp = bp; return showbuffer(bp, curwp, WFFORCE|WFHARD); } else { ewprintf("No buffer named \"%s\"", bufname); } } return FALSE; } /*ARGSUSED*/ static b_delundel(ch) int ch; { LINE *lp = curwp->w_dotp; if (lback(lp) != curbp->b_linep && lback(lback(lp)) != curbp->b_linep) { if (llength(lp) > 0) { lputc(lp, 0, ch); } if (lforw(lp) != curbp->b_linep) { curwp->w_dotp = lforw(lp); } curwp->w_flag |= WFEDIT | WFMOVE; curwp->w_doto = 0; return TRUE; } return FALSE; } /*ARGSUSED*/ b_del(f, n) int f, n; { return b_delundel((int)'D'); } /*ARGSUSED*/ b_undel(f, n) int f, n; { return b_delundel((int)' '); } /*ARGSUSED*/ b_expunge(f, n) int f, n; { char bufname[NBUFN]; register LINE *lp, *nlp; VOID lfree(); for (lp = lforw(curbp->b_linep) ; lp != curbp->b_linep ; lp = nlp) { nlp = lforw(lp); if (0 < llength(lp) && lgetc(lp, 0) == 'D') { switch (b_makename(lp, bufname, NBUFN)) { case FALSE: break; case TRUE: eargset(bufname); if (killbuffer(f, n)) { lfree(lp); curwp->w_flag |= WFHARD; } break; } } } return TRUE; } #endif /* BUFFER_MODE */ ng-1.5beta1/cmode.c100644 1750 1750 50266 7632242733 12745 0ustar amurausers/* $Id: cmode.c,v 1.4.2.1 2003/03/08 01:22:35 amura Exp $ */ /* * C code editing commands * There are only used when C_MODE is #defined. * * Coded by Kazuhiro Takano */ /* * $Log: cmode.c,v $ * Revision 1.4.2.1 2003/03/08 01:22:35 amura * NOTAB is always enabled * * Revision 1.4 2001/05/25 17:53:33 amura * change LABEL: check routine * * Revision 1.3 2000/12/14 18:12:13 amura * use alloca() and more memory secure * * Revision 1.2 2000/09/18 10:19:52 amura * calc_indent() is fixed * * Revision 1.1.1.1 2000/06/27 01:47:56 amura * import to CVS * * Revision 1.2 2000/03/10 21:25:51 amura * Almost Rewrite calc_indent. * * Revision 1.1 1999/05/14 22:43:36 amura * Initial revision * */ /* 90.07.24 Created by K.Takano */ /* #define CMODE_DEBUG */ #include "config.h" /* 90.12.20 by S.Yoshida */ #ifdef C_MODE #include "def.h" #ifdef UNDO #include "undo.h" #endif static int indent_level = 2; /* Indentation of C statements with respect to * * containing block. */ static int brace_imaginary_offset = 0; /* Imagined indentation of a C open brace that * * actually follows a statement */ static int brace_offset = 0; /* Extra indentation for braces, compared with * * other text in same context. */ static int argdecl_indent = 5; /* not support yet */ /* Indentation level of declarations of * * C function arguments. */ static int label_offset = -2; /* Offset of C label lines and case statements * * relative to usual indentation. */ static int continued_statement_offset = 2; /* Extra indent for lines not starting new * * statements. */ static int continued_brace_offset = 0; /* Extra indent for substatements that start * * with open-braces. This is in addition to * * c-continued-statement-offset. */ static int auto_newline = FALSE; /* not support yet */ /* Non-nil means automatically newline before * * and after braces, and after colons and * * semicolons, inserted in C code. * * Here, FALSE mean nil. (91.01.15 by S.Yoshida) */ static int tab_always_indent = TRUE; /* Non-nil means TAB in C mode should always * * reindent the current line, regardless of * * where in the line point is when the TAB * * command is used. * * Here, TRUE mean t. (91.01.15 by S.Yoshida) */ /* 91.02.06 Add static declaration for some compiler. by S.Yoshida */ static int calc_indent(); static int adjust_spc(); static int check_bal(); static int count_column(); extern int getnum(); extern int blinkmatch(); static int do_cm_brace(); /* Nov 1991. bsh */ /* * COMMAND: use-c-mode */ int flag_use_c_mode = TRUE; /*ARGSUSED*/ cm_use_c_mode(f, n) { register int s; char buf[NINPUT]; if ((f & FFARG) == 0) { if ((s = ereply("use-c-mode : ", buf, sizeof(buf))) != TRUE) return (s); if (ISDIGIT(buf[0]) || buf[0] == '-') n = (atoi(buf) > 0); else if (buf[0] == 't' || buf[0] == 'T') n = TRUE; else n = FALSE; } flag_use_c_mode = n; return (TRUE); } /* * COMMAND: electric-c-brace */ /*ARGSUSED*/ cm_brace(f, n) { return do_cm_brace(f,n,0); } /* * COMMAND: electric-c-brace-blink * Nov 1991. Added by bsh. */ /*ARGSUSED*/ cm_brace_blink(f, n) { return do_cm_brace(f,n,1); } static int do_cm_brace(f, n, blink) { #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) /* If this buffer is read-only, */ { warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ if (n < 0) return (FALSE); while( n-- > 0 ) { if(!selfinsert(f|FFRAND,1)) return FALSE; cm_indent(FFRAND,1); if( blink ) blinkmatch( curwp->w_dotp, curwp->w_doto-1 ); } return TRUE; } /* * COMMAND: electric-c-semi */ /*ARGSUSED*/ cm_semi(f, n) { #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) /* If this buffer is read-only, */ { warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ if (auto_newline) return (cm_term(FFRAND, n)); else return (selfinsert(FFRAND, n)); } /* * COMMAND: electric-c-terminator */ /*ARGSUSED*/ cm_term(f, n) { int c,i; #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) /* If this buffer is read-only, */ { warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ if (n == ';') { for (i = curwp->w_doto - 1; i >= 0; i--) { c = lgetc(curwp->w_dotp, i); if (c != ' ' && c != '\t') break; } i++; curwp->w_doto = i; } if (selfinsert(FFRAND, n) == FALSE) return (FALSE); if (cm_indent(FFRAND, n) == FALSE) return (FALSE); if (!auto_newline) return (TRUE); return newline(FFRAND, n); } /* * COMMAND: c-indent-command */ /*ARGSUSED*/ cm_indent(f, n) { int i; char c; #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ if ((f & (FFRAND | FFARG)) == 0 && tab_always_indent == FALSE) { for (i = curwp->w_doto - 1; i >= 0; i--) { c = lgetc(curwp->w_dotp, i); if (c != ' ' && c != '\t') break; } if (i >= 0) return (selfinsert(FFRAND, n)); } i = calc_indent(); if (i < 0 && !(f&FFRAND)) return (selfinsert(FFRAND, n)); else if (i < 0) return (TRUE); return (adjust_spc(i)); } /* * COMMAND: c-newline-and-indent */ /*ARGSUSED*/ cm_lfindent(f, n) { register int i; register unsigned char c; #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ if (n < 0) return (FALSE); for (i = curwp->w_doto - 1; i >= 0; i--) { c = lgetc(curwp->w_dotp, i); if (c != ' ' && c != '\t') break; } i++; curwp->w_doto = i; if (newline(FFRAND, n) == FALSE) return (FALSE); return (cm_indent(FFRAND, 1)); } static calc_indent() { register LINE *lp; register int bo; unsigned char bal1, bal2, c; LINE *tlp; int tbo, cbo; int s; int depth; int in_paren = FALSE; int in_comment = FALSE; int null_line = TRUE; int has_semi = FALSE; int firstcheck = TRUE; int in_strings = FALSE; /* 91.01.13 by S.Yoshida */ int numesc = 0; /* 91.01.13 by S.Yoshida */ char termchar; /* 91.01.13 by S.Yoshida */ int indent = 0; int with_colon = FALSE; /* 00.02.16 by amura */ #ifdef VARIABLE_TAB int tab = curwp->w_bufp->b_tabwidth; #endif /* VARIABLE_TAB */ #ifdef CMODE_DEBUG char state[] = " "; #endif /*-- Beggining of line check --*/ lp = curwp->w_dotp; c = '\0'; for (cbo = 0; cbo < llength(lp); cbo++) { c = lgetc(lp, cbo); if (c != ' ' && c != '\t') break; } #ifdef CMODE_DEBUG ewprintf(""); #endif if (c == '#') /* for pre-processer line */ return (-1); /* no indent */ /*-- Label check --*/ c = lgetc(lp, cbo); if (ISWORD(c) || c == '_' || c == '-') { for (bo = cbo+1; bo < llength(lp); bo++) { /* 91.01.13 Modify to consider strings by S.Yoshida */ c = lgetc(lp, bo); if (c == ':') { with_colon = TRUE; break; } if (c == '<' || c == '>' || c == '=' || c == '[' || c == ']' || c == '\\') break; } } /*-- Search before left palentheis --*/ bo = 0; bal1 = bal2 = '\0'; in_strings = FALSE; /* 91.01.13 by S.Yoshida */ numesc = 0; /* 91.01.13 by S.Yoshida */ termchar = '\0'; /* 91.01.13 by S.Yoshida */ for (;;) { if (bo == 0) /* beginning of line */ { if (firstcheck && !null_line) { if (in_paren && bal1 != '{') ; else if (!has_semi) { with_colon = FALSE; indent += continued_statement_offset; #ifdef CMODE_DEBUG if (state[1]=='C' || state[1]=='2') state[1] = '2'; else state[1] = 'C'; #endif if (lgetc(curwp->w_dotp, cbo) == '{') { indent += continued_brace_offset; #ifdef CMODE_DEBUG state[2] = '{'; #endif } } else firstcheck = FALSE; } null_line = TRUE; lp = lback(lp); if (lp == curbp->b_linep) /* beginning of buffer */ break; bo = llength(lp); for (s = 0; s < bo; s++) /* skip preprocess line */ { c = lgetc(lp, s); if (c == '#') { bo = 0; continue; } else if (c != ' ' || c != '\t') break; } c = lgetc(lp, 0); for (s = 0; s < bo-1; s++) /* skip B style comment */ if (c == '/' && (c = lgetc(lp, s+1)) =='/') { bo = s; break; } if (bo == 0) /* skip null line */ continue; } bo--; c = lgetc(lp, bo); /* somewhere in middle */ if (c == ' ' || c == '\t') /* skip space */ continue; if (!in_strings && c == '*' && bo > 0 && lgetc(lp, bo-1) == '/') { /* comment start mark */ if (in_comment) { bo--; in_comment = FALSE; continue; } #ifdef CMODE_DEBUG ewprintf("in comment"); #endif return (count_column(lp, bo)); } if (in_comment) /* skip comment */ continue; if (!in_strings && c == '/' && bo > 0 && lgetc(lp, bo-1) == '*') { /* comment end mark */ bo--; in_comment = TRUE; continue; } null_line = FALSE; /* 91.01.13 Add to consider strings. by S.Yoshida */ if (in_strings) { if (c == termchar) { if (bo==0 || lgetc(lp,bo-1)!='\\') in_strings = FALSE; else bo--; } continue; } if (c == '"' || c == '\'') /* Not in strings. */ { in_strings = TRUE; termchar = c; continue; } if (in_paren) { if (bal2 == '{') has_semi = TRUE; if (c == bal2) /* left parenthesis */ { if (--depth == 0) in_paren = FALSE; } else if (c == bal1) /* right parenthesis */ depth++; continue; } if (c == ';' || c == ':') { has_semi = TRUE; continue; } bal1 = bal2 = c; s = check_bal(&bal2); if (s < 0) /* right parenthesis */ { if (c == '}') has_semi = TRUE; depth = 1; in_paren = TRUE; /* search match paren */ continue; } if (s > 0) /* left parenthesis */ break; } tlp = lp; tbo = bo; if (lp == curbp->b_linep) /* line is at top level */ { #ifdef CMODE_DEBUG ewprintf("at top-level"); #endif return (0); } if (bal1 != '{') /* line is expression */ { #ifdef CMODE_DEBUG ewprintf("before is express parlentheis"); #endif return (count_column(tlp, tbo)+1); } /*-- Check brace imaginary offset --*/ for (bo--; bo >= 0; bo--) { c = lgetc(lp, bo); if (c != ' ' && c != '\t') { indent += brace_imaginary_offset; break; } } /*-- Before left parrenthesis columns --*/ s = 0; for (bo = 0; bo <= tbo; bo++) { c = lgetc(tlp, bo); if (c != ' ' && c != '\t') break; if (c == '\t') #ifdef VARIABLE_TAB s = (s/tab + 1)*tab -1; #else s |= 0x07; #endif s++; } if (s < 0) s = 0; in_strings = FALSE; /* 91.01.13 by S.Yoshida */ numesc = 0; /* 91.01.13 by S.Yoshida */ termchar = '\0'; /* 91.01.13 by S.Yoshida */ lp = curwp->w_dotp; if (lgetc(lp, cbo) == '{') /* left brace on line-top */ { with_colon = FALSE; indent += brace_offset + indent_level; } indent += indent_level; for (bo = cbo; bo < llength(lp); bo++) { depth = 0; c = lgetc(lp, bo); /* 91.01.13 Modify & add to consider strings. by S.Yoshida */ if (c == '}' && !in_strings) { if (depth == 0) /* include close parenthesis */ { indent = 0; break; } depth--; } else if (c == '{' && !in_strings) depth++; else if (in_strings) { if (c == '"' || c == '\'') { if (c == termchar && (numesc % 2) == 0) in_strings = FALSE; else numesc = 0; } else if (c == '\\') numesc++; else numesc = 0; } else if (c == '"' || c == '\'') /* Not in_strings. */ { in_strings = TRUE; termchar = c; numesc = 0; } } if (with_colon) { indent += label_offset; #ifdef CMODE_DEBUG state[0] = 'L'; #endif } #ifdef CMODE_DEBUG ewprintf("%s before:%d append:%d '%c'", state, s, indent, lgetc(tlp, tbo)); #endif return (s+indent)>=0 ? (s+indent) : 0; } static adjust_spc(nicol) int nicol; { register int i; register unsigned char c; int cbo; #ifdef VARIABLE_TAB int tab = curbp->b_tabwidth; #endif /* VARIABLE_TAB */ cbo = curwp->w_doto; for (i = 0; i < llength(curwp->w_dotp); i++) { c = lgetc(curwp->w_dotp, i); if (c != ' ' && c != '\t') break; } if ((cbo -= i) < 0) cbo = 0; curwp->w_doto = 0; /* delete heading space */ if (i != 0 && ldelete((RSIZE)i, KNONE) == FALSE) return (FALSE); #ifdef UNDO if (undoptr!=NULL && *undoptr!=NULL) (*undoptr)->u_type = UDNONE; /* insert space (and/or tab) */ if ((curbp->b_flag & BFNOTAB) ? (cbo += nicol, linsert(nicol, ' ') == FALSE) : #ifdef VARIABLE_TAB ((i = nicol / tab)!=0 && (cbo += i, linsert(i, '\t') == FALSE)) || ((i = nicol % tab)!=0 && (undoptr = undobefore, cbo += i, linsert(i, ' ' ) == FALSE))) #else ((i = nicol / 8) != 0 && (cbo += i, linsert(i, '\t') == FALSE)) || ((i = nicol % 8) != 0 && (undoptr = undobefore, cbo += i, linsert(i, ' ' ) == FALSE))) #endif return (FALSE); #else /* NOT UNDO */ /* insert space (and/or tab) */ if ((curbp->b_flag & BFNOTAB) ? (cbo += nicol, linsert(nicol, ' ') == FALSE) : #ifdef VARIABLE_TAB ((i = nicol / tab)!=0 && (cbo += i, linsert(i, '\t') == FALSE)) || ((i = nicol % tab)!=0 && (cbo += i, linsert(i, ' ' ) == FALSE))) #else ((i = nicol / 8) != 0 && (cbo += i, linsert(i, '\t') == FALSE)) || ((i = nicol % 8) != 0 && (cbo += i, linsert(i, ' ' ) == FALSE))) #endif return (FALSE); #endif /* UNDO */ curwp->w_doto = cbo; return (TRUE); } static check_bal(balc) unsigned char *balc; { static struct { unsigned char left, right; } bal[] = { { '(', ')' }, { '[', ']' }, { '{', '}' }, { '\0','\0'} }; register int i; for (i = 0; bal[i].right != '\0'; i++) { if (bal[i].right == *balc) { *balc = bal[i].left; return (-1); } if (bal[i].left == *balc) { *balc = bal[i].right; return (1); } } return (0); } static count_column(lp, bo) LINE *lp; int bo; { register int i; register int col; #ifdef VARIABLE_TAB int tab = curwp->w_bufp->b_tabwidth; #endif /* VARIABLE_TAB */ col = 0; for (i = 0; i < bo; i++) { if (lgetc(lp, i) == '\t') #ifdef VARIABLE_TAB col = (col/tab + 1)*tab -1; #else col |= 7; #endif col++; } return (col); } /* * Set and Display variables */ /* * COMMAND: set-c-indent-level */ /*ARGSUSED*/ cm_set_indent(f, n) { if ((f & FFARG) == 0) { if (getnum("c-indent-level", &n) == FALSE) return (FALSE); } indent_level = n; return (TRUE); } /* * COMMAND: set-c-brace-imaginary-offset */ /*ARGSUSED*/ cm_set_imagin(f, n) { if ((f & FFARG) == 0) { if (getnum("c-brace_imaginary-offset", &n) == FALSE) return (FALSE); } brace_imaginary_offset = n; return (TRUE); } /* * COMMAND: set-c-brace-offset */ /*ARGSUSED*/ cm_set_brace(f, n) { if ((f & FFARG) == 0) { if (getnum("c-brace-offset", &n) == FALSE) return (FALSE); } brace_offset = n; return (TRUE); } /* * COMMAND: set-c-argdecl-indent */ /*ARGSUSED*/ cm_set_arg(f, n) { if ((f & FFARG) == 0) { if (getnum("c-argdecl-indent", &n) == FALSE) return (FALSE); } argdecl_indent = n; return (TRUE); } /* * COMMAND: set-c-label-offset */ /*ARGSUSED*/ cm_set_label(f, n) { if ((f & FFARG) == 0) { if (getnum("c-label-offset", &n) == FALSE) return (FALSE); } label_offset = n; return (TRUE); } /* * COMMAND: set-c-continued-statement-offset */ /*ARGSUSED*/ cm_set_cstat(f, n) { if ((f & FFARG) == 0) { if (getnum("c-continued-statement-offset", &n) == FALSE) return (FALSE); } continued_statement_offset = n; return (TRUE); } /* * COMMAND: set-c-continued-brace-offset */ /*ARGSUSED*/ cm_set_cbrace(f, n) { if ((f & FFARG) == 0) { if (getnum("c-continued-brace-offset", &n) == FALSE) return (FALSE); } continued_brace_offset = n; return (TRUE); } /* * COMMAND: set-c-auto-newline * 91.01.15 Modified by S.Yoshida * Add routine to consider "t" and "nil" argument. */ /*ARGSUSED*/ cm_set_newl(f, n) { register int s; char buf[NINPUT]; if ((f & FFARG) == 0) { if ((s = ereply("c-auto-newline : ", buf, sizeof(buf))) != TRUE) return (s); if (ISDIGIT(buf[0]) || buf[0] == '-') n = (atoi(buf) > 0); else if (buf[0] == 't' || buf[0] == 'T') n = TRUE; else /* if (buf[0] == 'n' || buf[0] == 'N') */ n = FALSE; } auto_newline = n; return (TRUE); } /* * COMMAND: set-c-tab-always-indent * 91.01.15 Modified by S.Yoshida * Add routine to consider "t" and "nil" argument. */ /*ARGSUSED*/ cm_set_tab(f, n) { register int s; char buf[NINPUT]; if ((f & FFARG) == 0) { if ((s = ereply("c-tab-always-indent : ", buf, sizeof(buf))) != TRUE) return (s); if (ISDIGIT(buf[0]) || buf[0] == '-') n = (atoi(buf) > 0); else if (buf[0] == 't' || buf[0] == 'T') n = TRUE; else /* if (buf[0] == 'n' || buf[0] == 'N') */ n = FALSE; } tab_always_indent = n; return (TRUE); } /* * COMMAND: list-c-mode-variables */ /*ARGSUSED*/ cm_list_var(f, n) { register BUFFER *bp; register WINDOW *wp; char line[80]; if ((bp = bfind("*C Mode Variables*", TRUE)) == NULL) return FALSE; bp->b_flag &= ~BFCHG; /* Blow away old. */ if (bclear(bp) != TRUE) return FALSE; strcpy(line, "* List of variables controlling indentation style *"); if (addline(bp, line) == FALSE) return FALSE; sprintf(line, "\tc-indent-level : %d", indent_level); if (addline(bp, line) == FALSE) return FALSE; sprintf(line, "\tc-brace-imaginary-offset : %d", brace_imaginary_offset); if (addline(bp, line) == FALSE) return FALSE; sprintf(line, "\tc-brace-offset : %d", brace_offset); if (addline(bp, line) == FALSE) return FALSE; sprintf(line, "\tc-argdecl-indent : %d", argdecl_indent); if (addline(bp, line) == FALSE) return FALSE; sprintf(line, "\tc-label-offset : %d", label_offset); if (addline(bp, line) == FALSE) return FALSE; sprintf(line, "\tc-continued-statement-offset : %d", continued_statement_offset); if (addline(bp, line) == FALSE) return FALSE; sprintf(line, "\tc-continued-brace-offset : %d", continued_brace_offset); if (addline(bp, line) == FALSE) return FALSE; sprintf(line, "\tc-auto-newline : %s", auto_newline ? "T" : "NIL"); if (addline(bp, line) == FALSE) return FALSE; sprintf(line, "\tc-tab-always-indent : %s", tab_always_indent ? "T" : "NIL"); if (addline(bp, line) == FALSE) return FALSE; if ((wp = popbuf(bp)) == NULL) return FALSE; bp->b_dotp = lforw(bp->b_linep); /* put dot at beginning of buffer */ bp->b_doto = 0; wp->w_dotp = bp->b_dotp; /* fix up if window already on screen */ wp->w_doto = bp->b_doto; return TRUE; } /* * COMMAND: c-indent-region * 91.09.14 Modified by Y.Koyanagi * re-indent region. */ /*ARGSUSED*/ cm_indentregion(f, n) { register LINE *startp,*endp; register int loffs; register int c, cbo; register int s; REGION region; enum { WHITELINE, COMMENT, OTHERS } type; #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ if ((s=getregion(®ion)) != TRUE) return s; startp = endp = region.r_linep; loffs = region.r_offset; while (region.r_size--) { if (loffs == llength(endp)) { endp = lforw(endp); loffs = 0; } else { ++loffs; } } curwp->w_dotp = startp; curwp->w_doto = 0; curwp->w_flag |= WFMOVE; while (curwp->w_dotp != endp) { type = WHITELINE; for (cbo = 0; cbo < llength(curwp->w_dotp); cbo++) { c = lgetc(curwp->w_dotp, cbo); if (c == '\t' || c == ' ') { continue; } else if (c == '/') { if ((cbo+1) < llength(curwp->w_dotp) && lgetc(curwp->w_dotp, cbo+1) == '*') { type = COMMENT; } else { type = OTHERS; } break; } else { type = OTHERS; break; } } if (type == OTHERS) { if (cm_indent(FFRAND,1) != TRUE) return FALSE; } if (forwline(FFRAND,1) != TRUE) return FALSE; } return TRUE; } #endif /* C_MODE */ ng-1.5beta1/complt.c100644 1750 1750 31414 7327055056 13147 0ustar amurausers/* $Id: complt.c,v 1.9 2001/07/23 17:09:02 amura Exp $ */ /* * Complete completion functions. */ /* * $Log: complt.c,v $ * Revision 1.9 2001/07/23 17:09:02 amura * fix raise segmentation fault when completion after shell-command * * Revision 1.8 2001/05/25 15:36:52 amura * now buffers have only one mark (before windows have one mark) * * Revision 1.7 2001/02/18 17:07:24 amura * append AUTOSAVE feature (but NOW not work) * * Revision 1.6 2001/01/05 14:07:00 amura * first implementation of Hojo Kanji support * * Revision 1.5 2000/11/04 13:43:30 amura * estrlen definition is changed to K&R style * * Revision 1.4 2000/09/05 01:04:54 amura * support HANKANA file and buffer * * Revision 1.3 2000/06/27 01:49:42 amura * import to CVS * * Revision 1.2 2000/06/01 05:24:14 amura * More robust * * Revision 1.1 1999/05/21 02:05:34 amura * Initial revision * */ /* 90.12.10 Created by Sawayanagi Yosirou */ #include "config.h" #ifdef NEW_COMPLETE #include "def.h" #include "kbd.h" #include "complt.h" #define LIST_COL 35 static BUFFER *bp = NULL; static BUFFER *prev_bp = NULL; static WINDOW *prev_wp = NULL; static WINDOW prev_window; static int complete_funcname pro((char *)); static int complete_buffername pro((char *)); static int complete_filename pro((char *)); static int complete_list_funcnames pro((char *, BUFFER *)); static int complete_list_buffernames pro((char *, BUFFER *)); static int complete_list_filenames pro((char *, BUFFER *)); #ifdef SS_SUPPORT static int estrlen pro((char *)); #endif /* * do some completion. */ int complete (buf, flags) char *buf; int flags; { int res; switch (flags & EFAUTO) { case EFFUNC: res = complete_funcname (buf); break; case EFBUF: res = complete_buffername (buf); break; case EFFILE: res = complete_filename (buf); break; default: res = 0; /* dummy to prevent compile time warning */ panic ("broken complete call: flags"); } return (res); } char * complete_message (matchnum) int matchnum; { char *msg; switch (matchnum) { case COMPLT_NOT_UNIQUE: msg = " [Complete, but not unique]"; break; case COMPLT_AMBIGUOUS: msg = " [Ambiguous]"; break; case COMPLT_SOLE: /* msg = "";*/ msg = " [Sole completion]"; break; case COMPLT_NO_MATCH: msg = " [No match]"; break; default: msg = " [Internal error]"; } return (msg); } /* complete function name */ static int complete_funcname (name) char *name; { int fnlen; int minlen = 0; int matchnum; int res; int i, j; char *cand; fnlen = strlen (name); /* compare names and make the common string of them */ matchnum = 0; for (i = name_fent(name, TRUE); i < nfunct; i++) { cand = functnames[i].n_name; j = strncmp (cand, name, fnlen); if (j < 0) continue; else if (j > 0) break; /* because functnames[] are in dictionary order */ if (matchnum == 0) { for (j = fnlen; cand[j] != '\0'; j++) name[j] = cand[j]; name[j] = '\0'; minlen = j; } else { for (j = fnlen; name[j] != '\0'; j++) { if (cand[j] != name[j]) break; } name[j] = '\0'; if (cand[j] == '\0') minlen = j; } matchnum++; } if (matchnum > 1) res = (minlen == (int) strlen (name)) ? COMPLT_NOT_UNIQUE : COMPLT_AMBIGUOUS; else if (matchnum == 1) res = COMPLT_SOLE; else if (matchnum == 0) res = COMPLT_NO_MATCH; else res = -1; return (res); } static int complete_buffername (name) char *name; { int fnlen; int minlen = 0; int matchnum; int res; int j; char *cand; LIST *lh; fnlen = strlen (name); /* compare names and make the common string of them */ matchnum = 0; for (lh = &(bheadp->b_list); lh != NULL; lh = lh->l_next) { cand = lh->l_name; if (strncmp (cand, name, fnlen) != 0) continue; if (matchnum == 0) { for (j = fnlen; cand[j] != '\0'; j++) name[j] = cand[j]; name[j] = '\0'; minlen = j; } else { for (j = fnlen; name[j] != '\0'; j++) { if (cand[j] != name[j]) break; } name[j] = '\0'; if (cand[j] == '\0') minlen = j; } matchnum++; } if (matchnum > 1) res = (minlen == (int) strlen (name)) ? COMPLT_NOT_UNIQUE : COMPLT_AMBIGUOUS; else if (matchnum == 1) res = COMPLT_SOLE; else if (matchnum == 0) res = COMPLT_NO_MATCH; else res = -1; return (res); } #ifndef NO_FILECOMP static int complete_filename (name) char *name; { int fnlen; int minlen = 0; int matchnum; int res; int i, j; int fnnum; char *cand; char *filenames; int fffiles (); fnlen = strlen (name); if ((fnnum = fffiles (name, &filenames)) == -1) return (-1); /* error */ /* compare names and make a common string of them */ matchnum = 0; cand = filenames; for (i = 0; i < fnnum; i++) { if (matchnum == 0) { for (j = fnlen; cand[j] != '\0'; j++) name[j] = cand[j]; name[j] = '\0'; minlen = j; } else { for (j = fnlen; name[j] != '\0'; j++) { if (cand[j] != name[j]) break; } name[j] = '\0'; if (cand[j] == '\0') minlen = j; } matchnum++; cand += (strlen (cand) + 1); } free (filenames); if (matchnum > 1) res = (minlen == strlen (name)) ? COMPLT_NOT_UNIQUE : COMPLT_AMBIGUOUS; else if (matchnum == 1) res = COMPLT_SOLE; else if (matchnum == 0) res = COMPLT_NO_MATCH; else res = -1; return (res); } #endif /* NO_FILECOMP */ int complete_list_names (buf, flags) char *buf; int flags; { int res; int cur_row; int cur_col; WINDOW *wp; if ((bp = bfind ("*Completions*", TRUE)) == NULL) return (FALSE); #ifdef AUTOSAVE /* 96.12.24 by M.Suzuki */ bp->b_flag &= ~(BFCHG|BFACHG); /* avoid recursive veread */ #else bp->b_flag &= ~BFCHG; /* avoid recursive veread */ #endif /* AUTOSAVE */ if (bclear (bp) != TRUE) return (FALSE); if (addline(bp, "Possible completions are:") == FALSE) return (FALSE); switch (flags & EFAUTO) { case EFFUNC: res = complete_list_funcnames (buf, bp); break; case EFBUF: res = complete_list_buffernames (buf, bp); break; case EFFILE: res = complete_list_filenames (buf, bp); break; default: panic ("broken complete_list_names call: flags"); } cur_row = ttrow; cur_col = ttcol; bp->b_dotp = lforw (bp->b_linep); /* put dot at beginning of buffer */ bp->b_doto = 0; /* setup window */ if (curwp->w_bufp != bp) { if (wheadp->w_wndp == NULL) { if (splitwind (FFRAND, 0) == FALSE) return (FALSE); prev_wp = wheadp; curwp = wheadp->w_wndp; prev_bp = NULL; } else { for (wp = wheadp; wp->w_wndp != NULL; wp = wp->w_wndp) ; prev_wp = curwp; curwp = wp; prev_bp = curwp->w_bufp; prev_window.w_dotp = curwp->w_dotp; prev_window.w_doto = curwp->w_doto; if (prev_window.w_bufp) { prev_window.w_bufp->b_markp = prev_bp->b_markp; prev_window.w_bufp->b_marko = prev_bp->b_marko; } } } for (wp = wheadp; wp != NULL; wp = wp->w_wndp) { if (wp->w_bufp == bp) { wp->w_flag |= WFMODE | WFFORCE | WFHARD; wp->w_dotp = bp->b_dotp; wp->w_doto = bp->b_doto; } } curbp = bp; if (showbuffer (bp, curwp, WFFORCE | WFHARD) == FALSE) return (FALSE); update (); ttmove (cur_row, cur_col); return (TRUE); } static int complete_list_funcnames (name, bp) char *name; BUFFER *bp; { int fnlen; int i, j; char *cand; char line[NFILEN]; fnlen = strlen (name); line[0] = '\0'; for (i = name_fent(name, TRUE); i < nfunct; i++) { cand = functnames[i].n_name; j = strncmp (cand, name, fnlen); if (j < 0) continue; else if (j > 0) break; /* because functnames[] are in dictionary order */ if (line[0] == '\0') { if (strlen (cand) < LIST_COL) strcpy (line, cand); else addline (bp, cand); } else { if (strlen (cand) < LIST_COL) { for (j = strlen (line); j < LIST_COL; j++) line[j] = ' '; line[j] = '\0'; strcat (line, cand); addline (bp, line); } else { addline (bp, line); addline (bp, cand); } line[0] = '\0'; } } if (line[0] != '\0') addline (bp, line); return (TRUE); } static int complete_list_buffernames (name, bp) char *name; BUFFER *bp; { int fnlen; int j; char *cand; char line[NFILEN]; LIST *lh; fnlen = strlen (name); line[0] = '\0'; for (lh = &(bheadp->b_list); lh != NULL; lh = lh->l_next) { cand = lh->l_name; if (strncmp (cand, name, fnlen) != 0) continue; if (line[0] == '\0') { #ifdef SS_SUPPORT if (estrlen (cand) < LIST_COL) #else if (strlen (cand) < LIST_COL) #endif strcpy (line, cand); else addline (bp, cand); } else { #ifdef SS_SUPPORT if (estrlen (cand) < LIST_COL) { int k = estrlen(line); for (j = strlen (line); k < LIST_COL; j++, k++) #else if (strlen (cand) < LIST_COL) { for (j = strlen (line); j < LIST_COL; j++) #endif line[j] = ' '; line[j] = '\0'; strcat (line, cand); addline (bp, line); } else { addline (bp, line); addline (bp, cand); } line[0] = '\0'; } } if (line[0] != '\0') addline (bp, line); return (TRUE); } static int complete_list_filenames (name, bp) char *name; BUFFER *bp; { int dnlen; int i, j; int fnnum; char *cand; char line[NFILEN]; char *filenames; int fffiles (); char *file_name_part (); dnlen = file_name_part (name) - name; if ((fnnum = fffiles (name, &filenames)) == -1) return (FALSE); /* error */ line[0] = '\0'; cand = filenames; for (i = 0; i < fnnum; i++) { cand += dnlen; if (line[0] == '\0') { #ifdef SS_SUPPORT if (estrlen (cand) < LIST_COL) #else if (strlen (cand) < LIST_COL) #endif strcpy (line, cand); else addline (bp, cand); } else { #ifdef SS_SUPPORT if (estrlen (cand) < LIST_COL) { int k = estrlen(line); for (j = strlen (line); k < LIST_COL; j++, k++) #else if (strlen (cand) < LIST_COL) { for (j = strlen (line); j < LIST_COL; j++) #endif line[j] = ' '; line[j] = '\0'; strcat (line, cand); addline (bp, line); } else { addline (bp, line); addline (bp, cand); } line[0] = '\0'; } cand += (strlen (cand) + 1); } if (line[0] != '\0') addline (bp, line); free (filenames); return (TRUE); } int complete_del_list () { int cur_row; int cur_col; if (bp == NULL) return (FALSE); cur_row = ttrow; cur_col = ttcol; if (prev_bp == NULL) { if (wheadp->w_wndp != NULL) delwind (FFRAND, 0); } else { curbp = prev_bp; showbuffer (prev_bp, curwp, WFFORCE | WFHARD); curwp->w_dotp = prev_window.w_dotp; curwp->w_doto = prev_window.w_doto; curwp->w_flag |= WFMOVE; curwp = prev_wp; curbp = curwp->w_bufp; if (prev_window.w_bufp) { curbp->b_markp = prev_window.w_bufp->b_markp; curbp->b_marko = prev_window.w_bufp->b_marko; } } bp = NULL; prev_wp = NULL; prev_bp = NULL; update (); ttmove (cur_row, cur_col); /* 91.01.17 Add to delete *Completions* buffer. by S.Yoshida */ eargset("*Completions*"); killbuffer(0, 1); return (TRUE); } int complete_scroll_up () { int cur_row; int cur_col; if (bp == NULL) return (FALSE); cur_row = ttrow; cur_col = ttcol; backpage (FFRAND, 0); update (); ttmove (cur_row, cur_col); return (TRUE); } int complete_scroll_down () { int cur_row; int cur_col; if (bp == NULL) return (FALSE); cur_row = ttrow; cur_col = ttcol; forwpage (FFRAND, 0); update (); ttmove (cur_row, cur_col); return (TRUE); } #ifdef SS_SUPPORT static int estrlen(str) char *str; { int i = 0; while (*str) { #ifdef HANKANA if (ISHANKANA(*str)) ; else #endif #ifdef HOJO_KANJI if (ISHOJO(*str)) ; else #endif i++; str++; } return i; } #endif /* SS_SUPPORT */ #endif /* NEW_COMPLETE */ ng-1.5beta1/complt.h100644 1750 1750 541 7126003713 13077 0ustar amurausers/* $Id: complt.h,v 1.1.1.1 2000/06/27 01:47:55 amura Exp $ */ /* * $Log: complt.h,v $ * Revision 1.1.1.1 2000/06/27 01:47:55 amura * import to CVS * */ #define COMPLT_NO_MATCH 0 #define COMPLT_SOLE 1 #define COMPLT_AMBIGUOUS 2 #define COMPLT_NOT_UNIQUE 3 extern int complete (); extern char *complete_message (); ng-1.5beta1/config.h100644 1750 1750 25730 7632241525 13124 0ustar amurausers/* $Id: config.h,v 1.12.2.1 2003/03/08 01:11:49 amura Exp $ */ /* * config.h - defines compile time options. */ /* 90.12.20 Created by S.Yoshida */ /*----------------------------------------------------------------------*/ /* Features removeable to save space. */ /*----------------------------------------------------------------------*/ #undef NO_BACKUP /* Disable backup files when writing. */ #undef NO_DIR /* Disable dir change functions. */ /* If defined, NO_STARTUP must be also. */ #undef NO_DIRED /* Disable "dired" mode. */ /* If not defined, ADDFUNC must be also.*/ #undef NO_DPROMPT /* Disable delayed prompt on multi-key sequences. */ #undef NO_FILECOMP /* Disable file name completion. */ #undef NO_HELP /* Disable help, descibe-bindings, */ /* describe-key-briefly, apropos */ #undef NO_MACRO /* Disable keyboard macros. */ /* If defined, NO_STARTUP must be also. */ #undef NO_SHELL /* Disable shell-command function. */ #undef NO_STARTUP /* Disable startup files, load, etc. */ #define DO_METAKEY /* Enable META key input. */ #define REGEX /* Enable regular expression functions. */ #define PREFIXREGION /* Enable function "prefix-region". */ #define C_MODE /* Enable c-mode functions. */ #define FILLPREFIX /* Enable fill prefix function. */ #define READONLY /* Enable read-only buffer mode. */ #define NEW_COMPLETE /* Enable new version completion. */ /* If defined, ADDFUNC must be also. */ #define VARIABLE_TAB /* Enable buffer-local tabwidth (by amura) */ #define BUFFER_MODE /* Enable "Buffer Menu" mode for list-buffer. */ /* (by Tillanosoft) */ #define EXTD_DIR /* buffer local current directly */ /* (by Tillanosoft, amura) */ #define ADDOPT /* Enable some commandline option */ /* (by Gen KUROKI, amura) */ #define IS_ENHANCE /* Incremantal search enhancement (by bsh) */ #define GOMATCH /* goto matching fence (by bsh) */ #define ZAPTOCHAR /* zap to char (by bsh) */ #undef ZAPTOC_A /* zap to char (GNU Emacs compatible) (by bsh) */ #define JUMPERR /* jump to error function (by bsh) */ /* If defined, ADDFUNC must be also. */ #define MINIBUF_EDIT /* minibuffer edit like GNU emacs (by Kakugawa) */ #define NEXTLINE 1 /* next-line-add-newlines (by S.Yoshida) */ #define EMACS_QUERY_KEYS /* isearch/query-replace key bindings compatible */ /* with GNU Emacs 19 and later (by Shimbo)*/ #define UNDO /* enable buffer undo */ #define AUTOSAVE /* enable autosaver (ported form M.Suziki's work) */ /*----------------------------------------------------------------------*/ /* Features for Ng/KANgee (KANJI version Mg2a). */ /*----------------------------------------------------------------------*/ #define KANJI /* Create KANJI handling version. */ #define HANKANA /* Create Hankaku KANA handling version. */ #undef HOJO_KANJI /* Create Hojo KANJI handling version. */ #define CURSOR_POS /* Cursor locates on next CHR after POINT */ #define KINSOKU /* Create KINSOKU handling version. If defined, */ /* KANJI must be also. */ #define BUGFIX /* Fix bugs in the original Mg2a. */ #define ADDFUNC /* Create additional misc functions. */ #define REGEX_JAPANESE /* Enable Japanese regular expression. */ /* (by amura, Selow) */ #define INCLUDE_SKG /* Enable SKG(Simple Kanji Generator System) */ /* (by H.Konishi) */ #define JISFIX /* JIS code input fix (by Gen.KUROKI) */ #define VTCURSOR /* Use DEC vt cursor key on JIS input mode */ /* (by Gen.KUROKI) */ /*----------------------------------------------------------------------*/ /* SystemV / BSD machine dependent features. */ /*----------------------------------------------------------------------*/ /*................................................*/ #ifdef HAVE_CONFIG_H /* Do not edit this line. */ #include "sysconfig.h" /* Do not edit this line. */ #else /* Do not edit this line. */ #if defined(_WIN32)&&!defined(__CYGWIN__)&&!defined(WIN32) #define WIN32 /* Do not edit this line. */ #endif /* Do not edit this line. */ #ifndef MSDOS /* Do not edit this line. */ #ifndef HUMAN68K /* Do not edit this line. */ #ifndef AMIGA /* Do not edit this line. */ #ifndef WIN32 /* Do not edit this line. */ /*................................................*/ #undef SVR2 /* System V is Release 2. */ #undef SVR3 /* System V is Release 3.x. */ #define SVR4 /* System V is Release 4.x. (or linux) */ #define POSIXTTY /* System V has POSIX termios */ #define XKEYS /* use numelic keypad (by Gen.KUROKI) */ /*#define CANNA /* use CANNA kana-kanji server (by Endo) */ /*................................................*/ #endif /* Do not edit this line. */ #endif /* Do not edit this line. */ #endif /* Do not edit this line. */ #endif /* Do not edit this line. */ #endif /* Do not edit this line. */ /*................................................*/ /*----------------------------------------------------------------------*/ /* MS-DOS machine dependent features. */ /*----------------------------------------------------------------------*/ /*................................................*/ #ifdef MSDOS /* Do not edit this line. */ /*................................................*/ /*#undef TCCONIO /* Use Turbo C console IO (by amura) */ /*#undef IBMPC /* Create Ng for IBM PC compatible */ /* (include Toshiba J-3100) */ /*#undef PC9801 /* Create Ng for NEC PC-9801 series. */ #define BACKSLASH /* Display backslash instead of \ (PC-9801 only) */ #define HOMEDIR /* Home directory support for MSDOS (by amura) */ #define FEPCTRL /* Enable FEP auto control. */ /*................................................*/ #endif /* Do not edit this line. */ /*................................................*/ /*----------------------------------------------------------------------*/ /* Win32 machine dependent features. by Eiichirou ITO,Tillanosoft */ /*----------------------------------------------------------------------*/ /*................................................*/ #ifdef WIN32 /* Do not edit this line. */ /*................................................*/ #define JAPANESE_KEYBOARD /* keyboard layout is Japanese one */ #define FEPCTRL /* Enable FEP auto control. */ #define CLIPBOARD /* Enable Clipboard cut & paste */ #define DROPFILES /* Drag'n Drop file open */ /* If defined, ADDFUNC must be also. */ #define HOMEDIR /* Home directory support */ #define EMACS_BACKUP_STYLE /* Backup files like as GNU Emacs */ /* If you use Win9x, this shold not set */ #undef COMMANDBANDS /* COMMANDBAND for WinCE */ /*................................................*/ #endif /* Do not edit this line. */ /*................................................*/ /*----------------------------------------------------------------------*/ /* Human68k machine dependent features. */ /*----------------------------------------------------------------------*/ /*................................................*/ #ifdef HUMAN68K /* Do not edit this line. */ /*................................................*/ #define FEPCTRL /* Enable FEP auto control. */ #define HOMEDIR /* Home directory support */ #define EMACS_BACKUP_STYLE /* Backup files like as GNU Emacs */ /*................................................*/ #endif /* Do not edit this line. */ /*................................................*/ /*----------------------------------------------------------------------*/ /* AmigaDos dependent features. Dec.18,1992 Add by H.Ohkubo */ /*----------------------------------------------------------------------*/ /*................................................*/ #ifdef AMIGA /* Do not edit this line. */ /*................................................*/ #undef V11 /* No Ver1.1 AmigaDOS */ #define V2 /* Don't support AmigaDOS 1.x (by amura) */ #define DO_MENU /* Enable Menu selection */ #define MOUSE /* Enable mouse */ #define FKEYS /* Enable to use function key */ #define DO_ICONIFY /* Enable iconify */ #define CHANGE_COLOR /* Enable color setting */ #define CHANGE_FONT /* Enable font setting */ #undef USE_ARP /* Enable ARP Library */ /* Undefined by H.Konishi for SAS */ #define LAMIGA_META /* Assume Left Amiga to META key (by amura) */ #undef MODE_RENDITION /* Set Default */ #undef TEXT_RENDITION /* Set Default */ #undef TEXT_FG /* Set Default */ #undef TEXT_BG /* Set Default */ #undef MODE_FG /* Set Default */ #undef MODE_BG /* Set Default */ #define ASL /* Enable ASL Requester (by H.Konishi) */ #undef AMIGA_STDIO /* Using ANSI-Standard FILE IO library (by amura) */ #define CLIPBOARD /* AMIGA Clipboard support (by amura) */ /*................................................*/ #endif /* Do not edit this line. */ /*................................................*/ /************************************************************************/ /* Do not edit following lines. */ /************************************************************************/ #ifdef KANJI # ifdef NO_KANJI /* in order to use same source for Ng and MG, Tillanosoft */ # undef KANJI # endif #else /* not KANJI */ # ifdef HANKANA # undef HANKANA # endif # ifdef HOJO_KANJI # undef HOJO_KANJI # endif #endif #ifdef HANKANA # ifndef SS_SUPPORT # define SS_SUPPORT # endif #endif #ifdef HOJO_KANJI # ifndef SS_SUPPORT # define SS_SUPPORT # endif #endif #ifndef KANJI # ifdef JAPANESE_KEYBOARD # undef JAPANESE_KEYBOARD # endif #endif #ifdef CURSOR_POS # ifndef KANJI # undef CURSOR_POS # endif #endif #ifdef NO_DIR # ifndef NO_STARTUP # define NO_STARTUP # endif # ifdef EXTD_DIR # undef EXTD_DIR # endif #endif #ifdef NO_MACRO # ifndef NO_STARTUP # define NO_STARTUP # endif #endif #ifdef KINSOKU # ifndef KANJI # undef KINSOKU # endif #endif #ifdef FEPCTRL # ifndef KANJI # undef FEPCTRL # endif #endif #ifdef NEW_COMPLETE # ifndef ADDFUNC # define ADDFUNC # endif #endif #ifndef NO_DIRED # ifndef ADDFUNC # define ADDFUNC # endif #endif #ifdef JUMPERR # ifndef ADDFUNC # define ADDFUNC # endif #endif #ifdef DROPFILES # ifndef ADDFUNC # define ADDFUNC # endif #endif #ifdef MSDOS # ifdef J3100 # ifdef PC9801 # undef PC9801 # endif # endif #endif #ifdef DO_ICONIFY # ifdef SAS6 # undef DO_ICONIFY # endif #endif #ifdef USE_ARP # ifdef SAS6 # undef USE_ARP # endif #endif #ifdef BROWSER # ifndef DO_MENU # define DO_MENU # endif #endif #ifdef REGEX_JAPANESE # ifndef REGEX # define REGEX # endif # ifndef KANJI # undef REGEX_JAPANESE # endif #endif #ifndef SUPPORT_ANSI # ifdef __STDC__ # define SUPPORT_ANSI # endif # ifdef WIN32 # define SUPPORT_ANSI # endif #endif #ifdef WIN32 #define MOUSE #endif #ifdef CLIPBOARD # ifndef WIN32 # ifndef AMIGA # undef CLIPBOARD # endif # endif #endif #ifdef V2 # ifdef V11 # undef V11 # endif #endif #ifdef ASL # ifndef V2 # undef ASL # else # ifndef DO_MENU # undef ASL # endif # endif #endif #ifdef SVR2 # ifdef SVR3 # undef SVR3 # endif # ifdef SVR4 # undef SVR4 # endif #endif #ifdef SVR3 # ifdef SVR4 # undef SVR4 # endif #endif #ifdef SVR4 # ifndef POSIXTTY # define POSIXTTY # endif #endif ng-1.5beta1/configure100755 1750 1750 254023 7626150662 13440 0ustar amurausers#! /bin/sh # From configure.in Revision: 1.7.2.1 # Guess values for system-dependent variables and create Makefiles. # Generated automatically using autoconf version 2.13 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # Defaults: ac_help= ac_default_prefix=/usr/local # Any additions from configure.in: ac_help="$ac_help --with-terminfo Build with terminfo library." ac_help="$ac_help --with-termcap Build with termcap library. (default)" ac_help="$ac_help --enable-canna[=DIR] Build a canna version." # Initialize some variables set by options. # The variables have the same names as the options, with # dashes changed to underlines. build=NONE cache_file=./config.cache exec_prefix=NONE host=NONE no_create= nonopt=NONE no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= target=NONE verbose= x_includes=NONE x_libraries=NONE bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' # Initialize some other variables. subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. ac_max_here_lines=12 ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi case "$ac_option" in -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) ac_optarg= ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case "$ac_option" in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir="$ac_optarg" ;; -build | --build | --buil | --bui | --bu) ac_prev=build ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build="$ac_optarg" ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file="$ac_optarg" ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir="$ac_optarg" ;; -disable-* | --disable-*) ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } fi ac_feature=`echo $ac_feature| sed 's/-/_/g'` eval "enable_${ac_feature}=no" ;; -enable-* | --enable-*) ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } fi ac_feature=`echo $ac_feature| sed 's/-/_/g'` case "$ac_option" in *=*) ;; *) ac_optarg=yes ;; esac eval "enable_${ac_feature}='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix="$ac_optarg" ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he) # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat << EOF Usage: configure [options] [host] Options: [defaults in brackets after descriptions] Configuration: --cache-file=FILE cache test results in FILE --help print this message --no-create do not create output files --quiet, --silent do not print \`checking...' messages --version print the version of autoconf that created configure Directory and file names: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [same as prefix] --bindir=DIR user executables in DIR [EPREFIX/bin] --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] --libexecdir=DIR program executables in DIR [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data in DIR [PREFIX/share] --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data in DIR [PREFIX/com] --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] --libdir=DIR object code libraries in DIR [EPREFIX/lib] --includedir=DIR C header files in DIR [PREFIX/include] --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] --infodir=DIR info documentation in DIR [PREFIX/info] --mandir=DIR man documentation in DIR [PREFIX/man] --srcdir=DIR find the sources in DIR [configure dir or ..] --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names EOF cat << EOF Host type: --build=BUILD configure for building on BUILD [BUILD=HOST] --host=HOST configure for HOST [guessed] --target=TARGET configure for TARGET [TARGET=HOST] Features and packages: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR EOF if test -n "$ac_help"; then echo "--enable and --with options recognized:$ac_help" fi exit 0 ;; -host | --host | --hos | --ho) ac_prev=host ;; -host=* | --host=* | --hos=* | --ho=*) host="$ac_optarg" ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir="$ac_optarg" ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir="$ac_optarg" ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir="$ac_optarg" ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir="$ac_optarg" ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir="$ac_optarg" ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir="$ac_optarg" ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir="$ac_optarg" ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix="$ac_optarg" ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix="$ac_optarg" ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix="$ac_optarg" ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name="$ac_optarg" ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir="$ac_optarg" ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir="$ac_optarg" ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site="$ac_optarg" ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir="$ac_optarg" ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir="$ac_optarg" ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target="$ac_optarg" ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers) echo "configure generated by autoconf version 2.13" exit 0 ;; -with-* | --with-*) ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } fi ac_package=`echo $ac_package| sed 's/-/_/g'` case "$ac_option" in *=*) ;; *) ac_optarg=yes ;; esac eval "with_${ac_package}='$ac_optarg'" ;; -without-* | --without-*) ac_package=`echo $ac_option|sed -e 's/-*without-//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } fi ac_package=`echo $ac_package| sed 's/-/_/g'` eval "with_${ac_package}=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes="$ac_optarg" ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries="$ac_optarg" ;; -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } ;; *) if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then echo "configure: warning: $ac_option: invalid host type" 1>&2 fi if test "x$nonopt" != xNONE; then { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } fi nonopt="$ac_option" ;; esac done if test -n "$ac_prev"; then { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } fi trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 # File descriptor usage: # 0 standard input # 1 file creation # 2 errors and warnings # 3 some systems may open it to /dev/tty # 4 used on the Kubota Titan # 6 checking for... messages and results # 5 compiler messages saved in config.log if test "$silent" = yes; then exec 6>/dev/null else exec 6>&1 fi exec 5>./config.log echo "\ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. " 1>&5 # Strip out --no-create and --no-recursion so they do not pile up. # Also quote any args containing shell metacharacters. ac_configure_args= for ac_arg do case "$ac_arg" in -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c) ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) ac_configure_args="$ac_configure_args '$ac_arg'" ;; *) ac_configure_args="$ac_configure_args $ac_arg" ;; esac done # NLS nuisances. # Only set these to C if already set. These must not be set unconditionally # because not all systems understand e.g. LANG=C (notably SCO). # Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! # Non-C LC_CTYPE values break the ctype check. if test "${LANG+set}" = set; then LANG=C; export LANG; fi if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo > confdefs.h # A filename unique to this package, relative to the directory that # configure is in, which we can look for to find out if srcdir is correct. ac_unique_file=basic.c # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_prog=$0 ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } else { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } fi fi srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then echo "loading site script $ac_site_file" . "$ac_site_file" fi done if test -r "$cache_file"; then echo "loading cache $cache_file" . $cache_file else echo "creating cache $cache_file" > $cache_file fi ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross ac_exeext= ac_objext=o if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then ac_n= ac_c=' ' ac_t=' ' else ac_n=-n ac_c= ac_t= fi else ac_n= ac_c='\c' ac_t= fi ac_aux_dir= for ac_dir in sys/unix $srcdir/sys/unix; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break fi done if test -z "$ac_aux_dir"; then { echo "configure: error: can not find install-sh or install.sh in sys/unix $srcdir/sys/unix" 1>&2; exit 1; } fi ac_config_guess=$ac_aux_dir/config.guess ac_config_sub=$ac_aux_dir/config.sub ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # Make sure we can run config.sub. if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 echo "configure:560: checking host system type" >&5 host_alias=$host case "$host_alias" in NONE) case $nonopt in NONE) if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } fi ;; *) host_alias=$nonopt ;; esac ;; esac host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 USER_CFLAGS=$CFLAGS # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:584: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_CC="gcc" break fi done IFS="$ac_save_ifs" fi fi CC="$ac_cv_prog_CC" if test -n "$CC"; then echo "$ac_t""$CC" 1>&6 else echo "$ac_t""no" 1>&6 fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:614: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_prog_rejected=no ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" break fi done IFS="$ac_save_ifs" if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# -gt 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift set dummy "$ac_dir/$ac_word" "$@" shift ac_cv_prog_CC="$@" fi fi fi fi CC="$ac_cv_prog_CC" if test -n "$CC"; then echo "$ac_t""$CC" 1>&6 else echo "$ac_t""no" 1>&6 fi if test -z "$CC"; then case "`uname -s`" in *win32* | *WIN32*) # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:665: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_CC="cl" break fi done IFS="$ac_save_ifs" fi fi CC="$ac_cv_prog_CC" if test -n "$CC"; then echo "$ac_t""$CC" 1>&6 else echo "$ac_t""no" 1>&6 fi ;; esac fi test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 echo "configure:697: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF #line 708 "configure" #include "confdefs.h" main(){return(0);} EOF if { (eval echo configure:713: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then ac_cv_prog_cc_cross=no else ac_cv_prog_cc_cross=yes fi else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_prog_cc_works=no fi rm -fr conftest* ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 echo "configure:739: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 echo "configure:744: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no fi fi echo "$ac_t""$ac_cv_prog_gcc" 1>&6 if test $ac_cv_prog_gcc = yes; then GCC=yes else GCC= fi ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 echo "configure:772: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else echo 'void f(){}' > conftest.c if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then ac_cv_prog_cc_g=yes else ac_cv_prog_cc_g=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 if test "$ac_test_CFLAGS" = set; then CFLAGS="$ac_save_CFLAGS" elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 echo "configure:815: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" for ac_dir in $PATH; do # Account for people who put trailing slashes in PATH elements. case "$ac_dir/" in /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do if test -f $ac_dir/$ac_prog; then if test $ac_prog = install && grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : else ac_cv_path_install="$ac_dir/$ac_prog -c" break 2 fi fi done ;; esac done IFS="$ac_save_IFS" fi if test "${ac_cv_path_install+set}" = set; then INSTALL="$ac_cv_path_install" else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL="$ac_install_sh" fi fi echo "$ac_t""$INSTALL" 1>&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:871: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_STRIP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_STRIP="strip" break fi done IFS="$ac_save_ifs" test -z "$ac_cv_prog_STRIP" && ac_cv_prog_STRIP=":" fi fi STRIP="$ac_cv_prog_STRIP" if test -n "$STRIP"; then echo "$ac_t""$STRIP" 1>&6 else echo "$ac_t""no" 1>&6 fi if test -z "$USER_CFLAGS"; then CFLAGS="-O" test "$GCC" = yes && CFLAGS="-O2" else CFLAGS=$USER_CFLAGS fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 echo "configure:907: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else # This must be in double quotes, not single quotes, because CPP may get # substituted into the Makefile and "${CC-cc}" will confuse make. CPP="${CC-cc} -E" # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:928: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:945: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:962: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPP=/lib/cpp fi rm -f conftest* fi rm -f conftest* fi rm -f conftest* ac_cv_prog_CPP="$CPP" fi CPP="$ac_cv_prog_CPP" else ac_cv_prog_CPP="$CPP" fi echo "$ac_t""$CPP" 1>&6 ac_safe=`echo "minix/config.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for minix/config.h""... $ac_c" 1>&6 echo "configure:988: checking for minix/config.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:998: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* eval "ac_cv_header_$ac_safe=yes" else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_header_$ac_safe=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 MINIX=yes else echo "$ac_t""no" 1>&6 MINIX= fi if test "$MINIX" = yes; then cat >> confdefs.h <<\EOF #define _POSIX_SOURCE 1 EOF cat >> confdefs.h <<\EOF #define _POSIX_1_SOURCE 2 EOF cat >> confdefs.h <<\EOF #define _MINIX 1 EOF fi # Check whether --with-terminfo or --without-terminfo was given. if test "${with_terminfo+set}" = set; then withval="$with_terminfo" ts_with_terminfo="yes" else ts_with_terminfo="no" fi # Check whether --with-termcap or --without-termcap was given. if test "${with_termcap+set}" = set; then withval="$with_termcap" ts_with_terminfo="no" fi if test "$ts_with_terminfo" = "yes"; then echo $ac_n "checking for library containing tgetstr""... $ac_c" 1>&6 echo "configure:1053: checking for library containing tgetstr" >&5 if eval "test \"`echo '$''{'ac_cv_search_tgetstr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_func_search_save_LIBS="$LIBS" ac_cv_search_tgetstr="no" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_tgetstr="none required" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest* test "$ac_cv_search_tgetstr" = "no" && for i in curses ncurses termlib; do LIBS="-l$i $ac_func_search_save_LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_tgetstr="-l$i" break else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest* done LIBS="$ac_func_search_save_LIBS" fi echo "$ac_t""$ac_cv_search_tgetstr" 1>&6 if test "$ac_cv_search_tgetstr" != "no"; then test "$ac_cv_search_tgetstr" = "none required" || LIBS="$ac_cv_search_tgetstr $LIBS" else : fi else echo $ac_n "checking for library containing tgetstr""... $ac_c" 1>&6 echo "configure:1116: checking for library containing tgetstr" >&5 if eval "test \"`echo '$''{'ac_cv_search_tgetstr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_func_search_save_LIBS="$LIBS" ac_cv_search_tgetstr="no" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_tgetstr="none required" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest* test "$ac_cv_search_tgetstr" = "no" && for i in termcap curses ncurses; do LIBS="-l$i $ac_func_search_save_LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_tgetstr="-l$i" break else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest* done LIBS="$ac_func_search_save_LIBS" fi echo "$ac_t""$ac_cv_search_tgetstr" 1>&6 if test "$ac_cv_search_tgetstr" != "no"; then test "$ac_cv_search_tgetstr" = "none required" || LIBS="$ac_cv_search_tgetstr $LIBS" else : fi fi ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 echo "configure:1183: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include <$ac_hdr> int main() { DIR *dirp = 0; ; return 0; } EOF if { (eval echo configure:1196: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` cat >> confdefs.h <&6 fi done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 echo "configure:1221: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 LIBS="$LIBS -ldir" else echo "$ac_t""no" 1>&6 fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 echo "configure:1262: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 LIBS="$LIBS -lx" else echo "$ac_t""no" 1>&6 fi fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 echo "configure:1304: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include #include #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:1317: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* ac_cv_header_stdc=yes else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "memchr" >/dev/null 2>&1; then : else rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "free" >/dev/null 2>&1; then : else rm -rf conftest* ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF if { (eval echo configure:1384: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* ac_cv_header_stdc=no fi rm -fr conftest* fi fi fi echo "$ac_t""$ac_cv_header_stdc" 1>&6 if test $ac_cv_header_stdc = yes; then cat >> confdefs.h <<\EOF #define STDC_HEADERS 1 EOF fi echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 echo "configure:1408: checking for sys/wait.h that is POSIX.1 compatible" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include #ifndef WEXITSTATUS #define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) #endif #ifndef WIFEXITED #define WIFEXITED(stat_val) (((stat_val) & 255) == 0) #endif int main() { int s; wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF if { (eval echo configure:1429: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_header_sys_wait_h=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6 if test $ac_cv_header_sys_wait_h = yes; then cat >> confdefs.h <<\EOF #define HAVE_SYS_WAIT_H 1 EOF fi for ac_hdr in fcntl.h sys/file.h sys/ioctl.h sys/time.h termio.h termios.h sgtty.h unistd.h sys/param.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 echo "configure:1453: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:1463: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* eval "ac_cv_header_$ac_safe=yes" else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_header_$ac_safe=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` cat >> confdefs.h <&6 fi done echo $ac_n "checking for working const""... $ac_c" 1>&6 echo "configure:1491: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; } ; return 0; } EOF if { (eval echo configure:1545: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_c_const=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_c_const" 1>&6 if test $ac_cv_c_const = no; then cat >> confdefs.h <<\EOF #define const EOF fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 echo "configure:1566: checking for pid_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS #include #include #endif EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then rm -rf conftest* ac_cv_type_pid_t=yes else rm -rf conftest* ac_cv_type_pid_t=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_type_pid_t" 1>&6 if test $ac_cv_type_pid_t = no; then cat >> confdefs.h <<\EOF #define pid_t int EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 echo "configure:1599: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS #include #include #endif EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then rm -rf conftest* ac_cv_type_size_t=yes else rm -rf conftest* ac_cv_type_size_t=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_type_size_t" 1>&6 if test $ac_cv_type_size_t = no; then cat >> confdefs.h <<\EOF #define size_t unsigned EOF fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 echo "configure:1632: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include #include int main() { struct tm *tp; ; return 0; } EOF if { (eval echo configure:1646: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_header_time=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_header_time" 1>&6 if test $ac_cv_header_time = yes; then cat >> confdefs.h <<\EOF #define TIME_WITH_SYS_TIME 1 EOF fi if test "$host_os" != "cygwin"; then echo $ac_n "checking for fd_set""... $ac_c" 1>&6 echo "configure:1669: checking for fd_set" >&5 if eval "test \"`echo '$''{'ac_cv_type_fd_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS #include #include #endif EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "(^|[^a-zA-Z_0-9])fd_set[^a-zA-Z_0-9]" >/dev/null 2>&1; then rm -rf conftest* ac_cv_type_fd_set=yes else rm -rf conftest* ac_cv_type_fd_set=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_type_fd_set" 1>&6 if test $ac_cv_type_fd_set = no; then cat >> confdefs.h <<\EOF #define fd_set int EOF fi fi case "$host" in *-*-minix*) cat >> confdefs.h <<\EOF #define UNDEF_SIGTSTP 1 EOF ;; esac # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 echo "configure:1713: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF if { (eval echo configure:1725: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_header_alloca_h=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_header_alloca_h" 1>&6 if test $ac_cv_header_alloca_h = yes; then cat >> confdefs.h <<\EOF #define HAVE_ALLOCA_H 1 EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 echo "configure:1746: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < # define alloca _alloca # else # if HAVE_ALLOCA_H # include # else # ifdef _AIX #pragma alloca # else # ifndef alloca /* predefined by HP cc +Olibcalls */ char *alloca (); # endif # endif # endif # endif #endif int main() { char *p = (char *) alloca(1); ; return 0; } EOF if { (eval echo configure:1779: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_func_alloca_works=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_func_alloca_works" 1>&6 if test $ac_cv_func_alloca_works = yes; then cat >> confdefs.h <<\EOF #define HAVE_ALLOCA 1 EOF fi if test $ac_cv_func_alloca_works = no; then # The SVR3 libPW and SVR4 libucb both contain incompatible functions # that cause trouble. Some versions do not even contain alloca or # contain a buggy version. If you still want to use their alloca, # use ar to extract alloca.o from them instead of compiling alloca.c. ALLOCA=alloca.${ac_objext} cat >> confdefs.h <<\EOF #define C_ALLOCA 1 EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 echo "configure:1811: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5 | egrep "webecray" >/dev/null 2>&1; then rm -rf conftest* ac_cv_os_cray=yes else rm -rf conftest* ac_cv_os_cray=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_os_cray" 1>&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:1841: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else $ac_func(); #endif ; return 0; } EOF if { (eval echo configure:1869: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 cat >> confdefs.h <&6 fi done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 echo "configure:1896: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext < addr) ? 1 : -1; } main () { exit (find_stack_direction() < 0); } EOF if { (eval echo configure:1923: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* ac_cv_c_stack_direction=-1 fi rm -fr conftest* fi fi echo "$ac_t""$ac_cv_c_stack_direction" 1>&6 cat >> confdefs.h <&6 echo "configure:1946: checking whether ${CC-cc} needs -traditional" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_pattern="Autoconf.*'x'" cat > conftest.$ac_ext < Autoconf TIOCGETP EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "$ac_pattern" >/dev/null 2>&1; then rm -rf conftest* ac_cv_prog_gcc_traditional=yes else rm -rf conftest* ac_cv_prog_gcc_traditional=no fi rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext < Autoconf TCGETA EOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | egrep "$ac_pattern" >/dev/null 2>&1; then rm -rf conftest* ac_cv_prog_gcc_traditional=yes fi rm -f conftest* fi fi echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6 if test $ac_cv_prog_gcc_traditional = yes; then CC="$CC -traditional" fi fi echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6 echo "configure:1992: checking for 8-bit clean memcmp" >&5 if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then ac_cv_func_memcmp_clean=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_memcmp_clean=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* ac_cv_func_memcmp_clean=no fi rm -fr conftest* fi fi echo "$ac_t""$ac_cv_func_memcmp_clean" 1>&6 test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}" echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 echo "configure:2028: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include #ifdef signal #undef signal #endif #ifdef __cplusplus extern "C" void (*signal (int, void (*)(int)))(int); #else void (*signal ()) (); #endif int main() { int i; ; return 0; } EOF if { (eval echo configure:2050: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_type_signal=int fi rm -f conftest* fi echo "$ac_t""$ac_cv_type_signal" 1>&6 cat >> confdefs.h <&6 echo "configure:2070: checking for vfork.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:2080: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* eval "ac_cv_header_$ac_safe=yes" else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_header_$ac_safe=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define HAVE_VFORK_H 1 EOF else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking for working vfork""... $ac_c" 1>&6 echo "configure:2105: checking for working vfork" >&5 if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then echo $ac_n "checking for vfork""... $ac_c" 1>&6 echo "configure:2111: checking for vfork" >&5 if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char vfork(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_vfork) || defined (__stub___vfork) choke me #else vfork(); #endif ; return 0; } EOF if { (eval echo configure:2139: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_vfork=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_vfork=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'vfork`\" = yes"; then echo "$ac_t""yes" 1>&6 : else echo "$ac_t""no" 1>&6 fi ac_cv_func_vfork_works=$ac_cv_func_vfork else cat > conftest.$ac_ext < #include #include #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_VFORK_H #include #endif /* On some sparc systems, changes by the child to local and incoming argument registers are propagated back to the parent. The compiler is told about this with #include , but some compilers (e.g. gcc -O) don't grok . Test for this by using a static variable whose address is put into a register that is clobbered by the vfork. */ static #ifdef __cplusplus sparc_address_test (int arg) #else sparc_address_test (arg) int arg; #endif { static pid_t child; if (!child) { child = vfork (); if (child < 0) { perror ("vfork"); _exit(2); } if (!child) { arg = getpid(); write(-1, "", 0); _exit (arg); } } } main() { pid_t parent = getpid (); pid_t child; sparc_address_test (); child = vfork (); if (child == 0) { /* Here is another test for sparc vfork register problems. This test uses lots of local variables, at least as many local variables as main has allocated so far including compiler temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should reuse the register of parent for one of the local variables, since it will think that parent can't possibly be used any more in this routine. Assigning to the local variable will thus munge parent in the parent process. */ pid_t p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); /* Convince the compiler that p..p7 are live; otherwise, it might use the same hardware register for all 8 local variables. */ if (p != p1 || p != p2 || p != p3 || p != p4 || p != p5 || p != p6 || p != p7) _exit(1); /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent from child file descriptors. If the child closes a descriptor before it execs or exits, this munges the parent's descriptor as well. Test for this by closing stdout in the child. */ _exit(close(fileno(stdout)) != 0); } else { int status; struct stat st; while (wait(&status) != child) ; exit( /* Was there some problem with vforking? */ child < 0 /* Did the child fail? (This shouldn't happen.) */ || status /* Did the vfork/compiler bug occur? */ || parent != getpid() /* Did the file descriptor bug occur? */ || fstat(fileno(stdout), &st) != 0 ); } } EOF if { (eval echo configure:2256: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_vfork_works=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* ac_cv_func_vfork_works=no fi rm -fr conftest* fi fi echo "$ac_t""$ac_cv_func_vfork_works" 1>&6 if test $ac_cv_func_vfork_works = no; then cat >> confdefs.h <<\EOF #define vfork fork EOF fi for ac_func in getcwd rmdir rename opendir select mkstemp bcopy bzero bcmp do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:2281: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else $ac_func(); #endif ; return 0; } EOF if { (eval echo configure:2309: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` cat >> confdefs.h <&6 fi done for ac_func in rindex symlink dup2 sigprocmask getgroups do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:2336: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else $ac_func(); #endif ; return 0; } EOF if { (eval echo configure:2364: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` cat >> confdefs.h <&6 fi done # Extract the first word of "cp", so it can be a program name with args. set dummy cp; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:2392: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_cp_cmd'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else case "$cp_cmd" in /*) ac_cv_path_cp_cmd="$cp_cmd" # Let the user override the test with a path. ;; ?:/*) ac_cv_path_cp_cmd="$cp_cmd" # Let the user override the test with a dos path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_cp_cmd="$ac_dir/$ac_word" break fi done IFS="$ac_save_ifs" ;; esac fi cp_cmd="$ac_cv_path_cp_cmd" if test -n "$cp_cmd"; then echo "$ac_t""$cp_cmd" 1>&6 else echo "$ac_t""no" 1>&6 fi cat >> confdefs.h <&6 echo "configure:2431: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_mv_cmd'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else case "$mv_cmd" in /*) ac_cv_path_mv_cmd="$mv_cmd" # Let the user override the test with a path. ;; ?:/*) ac_cv_path_mv_cmd="$mv_cmd" # Let the user override the test with a dos path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_mv_cmd="$ac_dir/$ac_word" break fi done IFS="$ac_save_ifs" ;; esac fi mv_cmd="$ac_cv_path_mv_cmd" if test -n "$mv_cmd"; then echo "$ac_t""$mv_cmd" 1>&6 else echo "$ac_t""no" 1>&6 fi cat >> confdefs.h <&6 echo "configure:2470: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_ls_cmd'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else case "$ls_cmd" in /*) ac_cv_path_ls_cmd="$ls_cmd" # Let the user override the test with a path. ;; ?:/*) ac_cv_path_ls_cmd="$ls_cmd" # Let the user override the test with a dos path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_ls_cmd="$ac_dir/$ac_word" break fi done IFS="$ac_save_ifs" ;; esac fi ls_cmd="$ac_cv_path_ls_cmd" if test -n "$ls_cmd"; then echo "$ac_t""$ls_cmd" 1>&6 else echo "$ac_t""no" 1>&6 fi cat >> confdefs.h <&6 echo "configure:2509: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_rmdir_cmd'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else case "$rmdir_cmd" in /*) ac_cv_path_rmdir_cmd="$rmdir_cmd" # Let the user override the test with a path. ;; ?:/*) ac_cv_path_rmdir_cmd="$rmdir_cmd" # Let the user override the test with a dos path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_path_rmdir_cmd="$ac_dir/$ac_word" break fi done IFS="$ac_save_ifs" ;; esac fi rmdir_cmd="$ac_cv_path_rmdir_cmd" if test -n "$rmdir_cmd"; then echo "$ac_t""$rmdir_cmd" 1>&6 else echo "$ac_t""no" 1>&6 fi cat >> confdefs.h <&6 echo "configure:2547: checking if --enable-canna option specified" >&5 # Check whether --enable-canna or --disable-canna was given. if test "${enable_canna+set}" = set; then enableval="$enable_canna" cv_canna="yes"; cannapath=$enableval else cv_canna="no" fi echo "$ac_t""$cv_canna" 1>&6 if test "$cv_canna" = "yes"; then if test "$cannapath" = "yes"; then case "$host_os" in bsdi2.1) cannapath="/usr/contrib/canna";; netbsd*) cannapath="/usr/pkg";; freebsd2.2*) cannapath="/usr/local";; freebsd2*) cannapath="/usr/local/canna";; freebsd*) cannapath="/usr/local";; *) cannapath="/usr/local/canna";; esac fi if test "$cannapath" != "yes"; then CFLAGS="-I$cannapath/include $CFLAGS" LDFLAGS="-L$cannapath/lib $LDFLAGS" fi echo $ac_n "checking for canna/jrkanji.h""... $ac_c" 1>&6 echo "configure:2582: checking for canna/jrkanji.h" >&5 if eval "test \"`echo '$''{'ac_cv_cannahdrcheck'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { jrKanjiStatus ks; ; return 0; } EOF if { (eval echo configure:2594: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cannahdrcheck="yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_cannahdrcheck="no" fi rm -f conftest* fi echo "$ac_t""$ac_cv_cannahdrcheck" 1>&6 if test "$cannahdrcheck" = "no"; then echo -n "Fatal error: no canna header in suggested path" if test "$cannapath" != "yes"; then echo ", $cannapath/include." else echo "." fi exit 1 fi echo $ac_n "checking for jrKanjiControl in -lcanna""... $ac_c" 1>&6 echo "configure:2618: checking for jrKanjiControl in -lcanna" >&5 ac_lib_var=`echo canna'_'jrKanjiControl | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lcanna $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 cv_cannalibcheck="yes" else echo "$ac_t""no" 1>&6 cv_cannalibcheck="no" fi if test "$cannalibcheck" = "no"; then echo "Fatal error: no canna library in suggested path" if test "$cannapath" != "yes"; then echo ", $cannapath/lib." else echo "." fi exit 1 fi LIBS="-lcanna $LIBS" cat >> confdefs.h <<\EOF #define CANNA 1 EOF fi trap '' 1 2 15 cat > confcache <<\EOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs. It is not useful on other systems. # If it contains results you don't want to keep, you may remove or edit it. # # By default, configure uses ./config.cache as the cache file, # creating it if it does not exist already. You can give configure # the --cache-file=FILE option to use a different cache file; that is # what configure does when it calls configure scripts in # subdirectories, so they share the cache. # Giving --cache-file=/dev/null disables caching, for debugging configure. # config.status only pays attention to the cache file if you give it the # --recheck option to rerun configure. # EOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote substitution # turns \\\\ into \\, and sed turns \\ into \). sed -n \ -e "s/'/'\\\\''/g" \ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' ;; esac >> confcache if cmp -s $cache_file confcache; then : else if test -w $cache_file; then echo "updating cache $cache_file" cat confcache > $cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Any assignment to VPATH causes Sun make to only execute # the first set of double-colon rules, so remove it if not needed. # If there is a colon in the path, we need to keep it. if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' fi trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 DEFS=-DHAVE_CONFIG_H # Without the "./", some shells look in PATH for config.status. : ${CONFIG_STATUS=./config.status} echo creating $CONFIG_STATUS rm -f $CONFIG_STATUS cat > $CONFIG_STATUS </dev/null | sed 1q`: # # $0 $ac_configure_args # # Compiler output produced by configure, useful for debugging # configure, is in ./config.log if it exists. ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" for ac_option do case "\$ac_option" in -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) echo "$CONFIG_STATUS generated by autoconf version 2.13" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; *) echo "\$ac_cs_usage"; exit 1 ;; esac done ac_given_srcdir=$srcdir ac_given_INSTALL="$INSTALL" trap 'rm -fr `echo "Makefile:sys/unix/Makefile.in sysconfig.h:sys/unix/sysconfig.h.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF $ac_vpsub $extrasub s%@SHELL@%$SHELL%g s%@CFLAGS@%$CFLAGS%g s%@CPPFLAGS@%$CPPFLAGS%g s%@CXXFLAGS@%$CXXFLAGS%g s%@FFLAGS@%$FFLAGS%g s%@DEFS@%$DEFS%g s%@LDFLAGS@%$LDFLAGS%g s%@LIBS@%$LIBS%g s%@exec_prefix@%$exec_prefix%g s%@prefix@%$prefix%g s%@program_transform_name@%$program_transform_name%g s%@bindir@%$bindir%g s%@sbindir@%$sbindir%g s%@libexecdir@%$libexecdir%g s%@datadir@%$datadir%g s%@sysconfdir@%$sysconfdir%g s%@sharedstatedir@%$sharedstatedir%g s%@localstatedir@%$localstatedir%g s%@libdir@%$libdir%g s%@includedir@%$includedir%g s%@oldincludedir@%$oldincludedir%g s%@infodir@%$infodir%g s%@mandir@%$mandir%g s%@host@%$host%g s%@host_alias@%$host_alias%g s%@host_cpu@%$host_cpu%g s%@host_vendor@%$host_vendor%g s%@host_os@%$host_os%g s%@CC@%$CC%g s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g s%@INSTALL_DATA@%$INSTALL_DATA%g s%@STRIP@%$STRIP%g s%@CPP@%$CPP%g s%@ALLOCA@%$ALLOCA%g s%@LIBOBJS@%$LIBOBJS%g s%@cp_cmd@%$cp_cmd%g s%@mv_cmd@%$mv_cmd%g s%@ls_cmd@%$ls_cmd%g s%@rmdir_cmd@%$rmdir_cmd%g CEOF EOF cat >> $CONFIG_STATUS <<\EOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. ac_file=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_cmds # Line after last line for current file. ac_more_lines=: ac_sed_cmds="" while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file else sed "${ac_end}q" conftest.subs > conftest.s$ac_file fi if test ! -s conftest.s$ac_file; then ac_more_lines=false rm -f conftest.s$ac_file else if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f conftest.s$ac_file" else ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" fi ac_file=`expr $ac_file + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_cmds` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. # Remove last slash and all that follows it. Not all systems have dirname. ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then # The file is in a subdirectory. test ! -d "$ac_dir" && mkdir "$ac_dir" ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" # A "../" for each directory in $ac_dir_suffix. ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` else ac_dir_suffix= ac_dots= fi case "$ac_given_srcdir" in .) srcdir=. if test -z "$ac_dots"; then top_srcdir=. else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; *) # Relative path. srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" top_srcdir="$ac_dots$ac_given_srcdir" ;; esac case "$ac_given_INSTALL" in [/$]*) INSTALL="$ac_given_INSTALL" ;; *) INSTALL="$ac_dots$ac_given_INSTALL" ;; esac echo creating "$ac_file" rm -f "$ac_file" configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." case "$ac_file" in *Makefile*) ac_comsub="1i\\ # $configure_input" ;; *) ac_comsub= ;; esac ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` sed -e "$ac_comsub s%@configure_input@%$configure_input%g s%@srcdir@%$srcdir%g s%@top_srcdir@%$top_srcdir%g s%@INSTALL@%$INSTALL%g " $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file fi; done rm -f conftest.s* # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' ac_dC='\3' ac_dD='%g' # ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='\([ ]\)%\1#\2define\3' ac_uC=' ' ac_uD='\4%g' # ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_eB='$%\1#\2define\3' ac_eC=' ' ac_eD='%g' if test "${CONFIG_HEADERS+set}" != set; then EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF fi for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac echo creating $ac_file rm -f conftest.frag conftest.in conftest.out ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` cat $ac_file_inputs > conftest.in EOF # Transform confdefs.h into a sed script conftest.vals that substitutes # the proper values into config.h.in to produce config.h. And first: # Protect against being on the right side of a sed subst in config.status. # Protect against being in an unquoted here document in config.status. rm -f conftest.vals cat > conftest.hdr <<\EOF s/[\\&%]/\\&/g s%[\\$`]%\\&%g s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp s%ac_d%ac_u%gp s%ac_u%ac_e%gp EOF sed -n -f conftest.hdr confdefs.h > conftest.vals rm -f conftest.hdr # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >> conftest.vals <<\EOF s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% EOF # Break up conftest.vals because some shells have a limit on # the size of here documents, and old seds have small limits too. rm -f conftest.tail while : do ac_lines=`grep -c . conftest.vals` # grep -c gives empty output for an empty file on some AIX systems. if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi # Write a limited-size here document to conftest.frag. echo ' cat > conftest.frag <> $CONFIG_STATUS sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS echo 'CEOF sed -f conftest.frag conftest.in > conftest.out rm -f conftest.in mv conftest.out conftest.in ' >> $CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail rm -f conftest.vals mv conftest.tail conftest.vals done rm -f conftest.vals cat >> $CONFIG_STATUS <<\EOF rm -f conftest.frag conftest.h echo "/* $ac_file. Generated automatically by configure. */" > conftest.h cat conftest.in >> conftest.h rm -f conftest.in if cmp -s $ac_file conftest.h 2>/dev/null; then echo "$ac_file is unchanged" rm -f conftest.h else # Remove last slash and all that follows it. Not all systems have dirname. ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then # The file is in a subdirectory. test ! -d "$ac_dir" && mkdir "$ac_dir" fi rm -f $ac_file mv conftest.h $ac_file fi fi; done EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF exit 0 EOF chmod +x $CONFIG_STATUS rm -fr confdefs* $ac_clean_files test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 ng-1.5beta1/def.h100644 1750 1750 47643 7632242733 12426 0ustar amurausers/* $Id: def.h,v 1.15.2.2 2003/03/08 01:22:35 amura Exp $ */ /* * This file is the general header file for all parts * of the MicroEMACS display editor. It contains all of the * general definitions and macros. It also contains some * conditional compilation flags. All of the per-system and * per-terminal definitions are in special header files. * The most common reason to edit this file would be to zap * the definition of CVMVAS or BACKUP. */ /* * $Log: def.h,v $ * Revision 1.15.2.2 2003/03/08 01:22:35 amura * NOTAB is always enabled * * Revision 1.15.2.1 2003/03/08 00:17:23 amura * fix query-replace bug, too * * Revision 1.15 2001/05/25 15:36:52 amura * now buffers have only one mark (before windows have one mark) * * Revision 1.14 2001/02/18 17:07:27 amura * append AUTOSAVE feature (but NOW not work) * * Revision 1.13 2001/02/11 15:40:24 amura * some function are changed to static for speed/size * * Revision 1.12 2001/02/01 16:30:39 amura * add vtsetsize() definition and change NFILEN size for amiga * * Revision 1.11 2001/01/17 18:33:14 amura * add prototype of ishojo() and some change for WIN32 * * Revision 1.10 2001/01/05 14:07:00 amura * first implementation of Hojo Kanji support * * Revision 1.9 2000/12/27 16:56:00 amura * change d_makename() params for conservative reason, and bugfix in dires_() * * Revision 1.8 2000/12/14 18:12:13 amura * use alloca() and more memory secure * * Revision 1.7 2000/09/21 17:28:29 amura * replace macro _WIN32 to WIN32 for Cygwin * * Revision 1.6 2000/07/22 20:50:54 amura * redefine NFILEN macro * * Revision 1.5 2000/07/20 12:45:17 amura * support undo with auto-fill mode * * Revision 1.4 2000/06/27 01:49:42 amura * import to CVS * * Revision 1.3 2000/06/01 05:25:06 amura * Undo support * * Revision 1.2 2000/05/01 23:04:38 amura * undo test version * * Revision 1.1 1999/05/19 03:52:32 amura * Initial revision * */ /* 90.01.29 Modified for Ng 1.0 by S.Yoshida */ #include #include #include "sysdef.h" /* Order is critical. */ #include "ttydef.h" #include "chrdef.h" /* * If your system and/or compiler does not support the "void" type * then define NO_VOID_TYPE in sysdef.h. In the absence of some * other definition for VOID, the default in that case will be to * turn it into an int, which works with most compilers that don't * support void. In the absence of any definition of VOID or * NO_VOID_TYPE, the default is to assume void is supported, which * should be the case for most modern C compilers. */ #ifdef NO_VOID_TYPE # undef VOID # define VOID int /* Default for no void is int */ # define VOIDptr char* #else #ifndef VOID # define VOID void /* Just use normal void */ # define VOIDptr void* #endif /* VOID */ #endif /* NO_VOID_TYPE */ #ifdef NO_MACRO #ifndef NO_STARTUP #define NO_STARTUP /* NO_MACRO implies NO_STARTUP */ #endif #endif #ifdef SUPPORT_ANSI #define pro(x) x #else #define pro(x) () #endif typedef int (*PF) pro((int, int)); /* generaly useful type */ /* * Table sizes, etc. */ #if defined(MSDOS) #define NFILEN 80 /* Length, file name. */ #elif defined(HUMAN68K) #define NFILEN 128 /* Length, file name. */ #elif defined(AMIGA) #define NFILEN 256 /* Length, file name. */ #else /* Maybe Win32 or UN*X */ #define NFILEN 1024 /* Length, file name. */ #endif #define NBUFN 32 /* Length, buffer name. */ #define NLINE 256 /* Length, line. */ #define NINPUT 32 /* Length, small minibuf input */ #define PBMODES 8 /* modes per buffer */ #define NKBDM 256 /* Length, keyboard macro. */ #define NPAT 80 /* Length, pattern. */ #define HUGE 1000 /* A rather large number. */ #define NSRCH 128 /* Undoable search commands. */ #define NXNAME 64 /* Length, extended command. */ #define NKNAME 20 /* Length, key names */ #define UNDOSIZE 10 /* Undo buffer size */ /* * Universal. */ #define FALSE 0 /* False, no, bad, etc. */ #define TRUE 1 /* True, yes, good, etc. */ #define ABORT 2 /* Death, ^G, abort, etc. */ #define KPROMPT 2 /* keyboard prompt */ /* * These flag bits keep track of * some aspects of the last command. The CFCPCN * flag controls goal column setting. The CFKILL * flag controls the clearing versus appending * of data in the kill buffer. */ #define CFCPCN 0x0001 /* Last command was C-P, C-N */ #define CFKILL 0x0002 /* Last command was a kill */ #define CFINS 0x0004 /* Last command was self-insert */ #define CFINS2 0x0008 /* Last command was insert */ /* * File I/O. */ #define FIOSUC 0 /* Success. */ #define FIOFNF 1 /* File not found. */ #define FIOEOF 2 /* End of file. */ #define FIOERR 3 /* Error. */ #define FIOLONG 4 /* long line partially read */ /* * Directory I/O. */ #define DIOSUC 0 /* Success. */ #define DIOEOF 1 /* End of file. */ #define DIOERR 2 /* Error. */ /* * Display colors. */ #define CNONE 0 /* Unknown color. */ #define CTEXT 1 /* Text color. */ #define CMODE 2 /* Mode line color. */ /* Flags for keyboard involked functions */ #define FFUNIV 1 /* universal argument */ #define FFNEGARG 2 /* negitive only argument */ #define FFOTHARG 4 /* other argument */ #define FFARG 7 /* any argument */ #define FFRAND 8 /* Called by other function */ /* * Flags for "eread". */ #define EFFUNC 0x0001 /* Autocomplete functions. */ #define EFBUF 0x0002 /* Autocomplete buffers. */ #define EFFILE 0x0004 /* " files (maybe someday) */ #define EFAUTO 0x0007 /* Some autocompleteion on */ #define EFNEW 0x0008 /* New prompt. */ #define EFCR 0x0010 /* Echo CR at end; last read. */ /* * Flags for "ldelete"/"kinsert" */ #define KNONE 0 #define KFORW 1 #define KBACK 2 #ifdef KANJI #define KNOKANJI 0x80 #define KFLAGS(n) ((n) & 0x0f) #endif /* * All text is kept in circularly linked * lists of "LINE" structures. These begin at the * header line (which is the blank line beyond the * end of the buffer). This line is pointed to by * the "BUFFER". Each line contains a the number of * bytes in the line (the "used" size), the size * of the text array, and the text. The end of line * is not stored as a byte; it's implied. Future * additions will include update hints, and a * list of marks into the line. */ typedef struct LINE { struct LINE *l_fp; /* Link to the next line */ struct LINE *l_bp; /* Link to the previous line */ short l_size; /* Allocated size */ short l_used; /* Used size */ #ifndef ZEROARRAY char l_text[1]; /* A bunch of characters. */ #else char l_text[]; /* A bunch of characters. */ #endif } LINE; /* * The rationale behind these macros is that you * could (with some editing, like changing the type of a line * link from a "LINE *" to a "REFLINE", and fixing the commands * like file reading that break the rules) change the actual * storage representation of lines to use something fancy on * machines with small address spaces. */ #define lforw(lp) ((lp)->l_fp) #define lback(lp) ((lp)->l_bp) #define lgetc(lp, n) (CHARMASK((lp)->l_text[(n)])) #define lputc(lp, n, c) ((lp)->l_text[(n)]=(c)) #define llength(lp) ((lp)->l_used) #define ltext(lp) ((lp)->l_text) /* * All repeated structures are kept as linked lists of structures. * All of these start with a LIST structure (except lines, which * have their own abstraction). This will allow for * later conversion to generic list manipulation routines should * I decide to do that. it does mean that there are four extra * bytes per window. I feel that this is an acceptable price, * considering that there are usually only one or two windows. */ typedef struct LIST { union { struct WINDOW *l_wp; struct BUFFER *x_bp; /* l_bp is used by LINE */ struct LIST *l_nxt; } l_p; char *l_name; } LIST; /* * Usual hack - to keep from uglifying the code with lotsa * references through the union, we #define something for it. */ #define l_next l_p.l_nxt /* * There is a window structure allocated for * every active display window. The windows are kept in a * big list, in top to bottom screen order, with the listhead at * "wheadp". Each window contains its own value of dot. * The flag field contains some bits that are set by commands * to guide redisplay; although this is a bit of a compromise in * terms of decoupling, the full blown redisplay is just too * expensive to run for every input character. */ typedef struct WINDOW { LIST w_list; /* List header */ struct BUFFER *w_bufp; /* Buffer displayed in window */ struct LINE *w_linep; /* Top line in the window */ struct LINE *w_dotp; /* Line containing "." */ short w_lines; /* Top line displayed line number */ short w_doto; /* Byte offset for "." */ char w_toprow; /* Origin 0 top row of window */ char w_ntrows; /* # of rows of text in window */ char w_force; /* If NZ, forcing row. */ char w_flag; /* Flags. */ char w_dotlines; /* line containing "." on tty lines */ } WINDOW; #define w_wndp w_list.l_p.l_wp #define w_name w_list.l_name /* * Window flags are set by command processors to * tell the display system what has happened to the buffer * mapped by the window. Setting "WFHARD" is always a safe thing * to do, but it may do more work than is necessary. Always try * to set the simplest action that achieves the required update. * Because commands set bits in the "w_flag", update will see * all change flags, and do the most general one. */ #define WFFORCE 0x01 /* Force reframe. */ #define WFMOVE 0x02 /* Movement from line to line. */ #define WFEDIT 0x04 /* Editing within a line. */ #define WFHARD 0x08 /* Better to a full display. */ #define WFMODE 0x10 /* Update mode line. */ /* * Text is kept in buffers. A buffer header, described * below, exists for every buffer in the system. The buffers are * kept in a big list, so that commands that search for a buffer by * name can find the buffer header. There is a safe store for the * dot and mark in the header, but this is only valid if the buffer * is not being displayed (that is, if "b_nwnd" is 0). The text for * the buffer is kept in a circularly linked list of lines, with * a pointer to the header line in "b_linep". */ typedef struct BUFFER { LIST b_list; /* buffer list pointer */ struct BUFFER *b_altb; /* Link to alternate buffer */ struct LINE *b_dotp; /* Link to "." LINE structure */ struct LINE *b_markp; /* ditto for mark */ struct LINE *b_linep; /* Link to the header LINE */ struct MAPS_S *b_modes[PBMODES]; /* buffer modes */ short b_doto; /* Offset of "." in above LINE */ short b_marko; /* ditto for the "mark" */ short b_nmodes; /* number of non-fundamental modes */ char b_nwnd; /* Count of windows on buffer */ char b_flag; /* Flags */ char *b_fname; /* File name */ #ifdef EXTD_DIR char *b_cwd; /* Current working directory for this buffer. By Tillanosoft */ #endif #ifdef KANJI /* 90.01.29 by S.Yoshida */ char b_kfio; /* Local KANJI file I/O code. */ #endif /* KANJI */ #ifdef VARIABLE_TAB char b_tabwidth; /* Local TAB width */ #endif /* VARIABLE_TAB */ #ifdef UNDO struct UNDO_DATA *b_ustack[UNDOSIZE+1]; /* Undo stack data */ short b_utop; /* Undo stack top */ short b_ubottom; /* Undo stack bottom */ struct UNDO_DATA **b_ulast; /* Last edited undo data */ #endif /* UNDO */ } BUFFER; #define b_bufp b_list.l_p.x_bp #define b_bname b_list.l_name #define BFCHG 0x01 /* Changed. */ #define BFBAK 0x02 /* Need to make a backup. */ #define BFNOTAB 0x04 /* no tab mode */ #define BFOVERWRITE 0x08 /* overwrite mode */ #ifdef KANJI /* 90.01.29 by S.Yoshida */ #define BFAUTOFILL 0x10 /* autofill mode with KANJI. */ #define NOCONV 0 /* No KANJI conversion. */ #define SJIS 1 /* KANJI code is Shift-JIS. */ #define JIS 2 /* KANJI code is JIS. */ #define EUC 3 /* KANJI code is EUC. */ #define NIL 4 /* Not decided. */ #define T 5 /* Guess. */ #endif /* KANJI */ #ifdef READONLY /* 91.01.05 by S.Yoshida */ #define BFRONLY 0x20 /* Read only mode. */ #endif /* READONLY */ #ifdef CANNA #define BFCANNA 0x40 #endif #ifdef AUTOSAVE /* 96.12.24 by M.Suzuki */ #define BFACHG 0x80 /* Auto save after changed. */ #endif /* AUTOSAVE */ #ifdef ADDFUNC #define MG_RATIO_ALL -1 /* used at dotpos() to return value */ #define MG_RATIO_TOP -2 /* used at dotpos() to return value */ #define MG_RATIO_BOT -3 /* used at dotpos() to return value */ #endif /* * This structure holds the starting position * (as a line/offset pair) and the number of characters in a * region of a buffer. This makes passing the specification * of a region around a little bit easier. */ typedef struct { struct LINE *r_linep; /* Origin LINE address. */ short r_offset; /* Origin LINE offset. */ RSIZE r_size; /* Length in characters. */ } REGION; /* * Externals. */ extern int thisflag; extern int lastflag; extern int curgoal; extern int epresf; extern int sgarbf; extern int mode; extern WINDOW *curwp; extern BUFFER *curbp; extern WINDOW *wheadp; extern BUFFER *bheadp; extern char pat[]; extern BUFFER *bfind(); extern WINDOW *popbuf(); extern WINDOW *wpopup(); extern LINE *lalloc(); extern LINE *lallocx(); #ifdef SUPPORT_ANSI extern VOID ewprintf pro((char *fp, ... )); #else extern VOID ewprintf pro((va_alist)); #endif extern VOID eerase(); extern int nrow; extern int ncol; extern int ttrow; extern int ttcol; extern int tceeol; extern int tcinsl; extern int tcdell; extern char cinfo[]; extern char *keystrings[]; extern VOID update(); extern char *keyname(); extern char *adjustname(); extern VOID kdelete(); extern VOID lchange(); /* Should the 'ifdef' be applied for the following function declarations. For example, kttputc() should be declared only if the KANJI macro is defined. */ extern int forwchar pro((int, int)); extern int setmark pro((int, int)); extern int backline pro((int, int)); extern VOID warnreadonly pro((void)); extern int getgoal pro((LINE *)); extern int backpage pro((int, int)); extern int countlines pro((LINE *)); extern int colrow pro((LINE *, short, int *, int *)); extern short skipline pro((LINE *, int)); extern int nextwind pro((int, int)); #ifdef SUPPORT_ANSI extern int ereply pro((char *, char *, int , ... )); extern int eread pro((char *, char *, int, int, ...)); #else extern int ereply pro((va_alist)); extern int eread pro((va_alist)); #endif extern int getcolpos pro((void)); extern int showbuffer pro((BUFFER *, WINDOW *, int)); extern int bclear pro((BUFFER *)); extern int anycb pro((int)); extern int addline pro((BUFFER *, char *)); extern int eyorn pro((char *)); extern int eyesno pro((char *)); extern int buffsave pro((BUFFER *)); extern VOID ksetbufcode pro((BUFFER *)); extern int newline pro((int, int)); extern int selfinsert pro((int, int)); extern int cm_indent pro((int, int)); extern int cm_term pro((int, int)); extern int linsert pro((int, int)); extern int ldelete pro((RSIZE, int)); extern int lnewline pro((void)); extern int panic pro((char *)); extern int name_fent pro((char *, int)); extern int splitwind pro((int, int)); extern int delwind pro((int, int)); extern int ttmove pro((int, int)); extern VOID eargset pro((char *)); extern int killbuffer pro((int, int)); extern int forwpage pro((int, int)); extern int d_undelbak pro((int, int)); extern int d_makename pro((LINE *, char *, int)); extern int readin pro((char *)); extern int fchkreadonly pro((char *)); #ifdef WIN32 extern int unlink pro((const char *)); extern int rmdir pro((const char *)); extern int rename pro((const char *, const char *)); #endif extern int copy pro((char *, char *)); extern int ttopen pro((void)); extern int ttinit pro((void)); extern int ttcolor pro((int)); extern int ttnowindow pro((void)); extern int tteeol pro((void)); extern int tttidy pro((void)); extern int ttflush pro((void)); extern int ttclose pro((void)); extern int typeahead pro((void)); extern int tteeop pro((void)); #ifdef HANKANA extern VOID putline pro((int, int, unsigned char *, unsigned char *, short)); #else extern VOID putline pro((int, int, unsigned char *, short)); #endif extern int vtputs pro((char *)); extern int kdispbufcode pro((BUFFER *)); extern int ttinsl pro((int, int, int)); extern int ttdell pro((int, int, int)); extern int fepmode_off pro((void)); extern int getkey pro((int)); extern VOID ungetkey pro((int)); extern int ctrlg pro((int, int)); extern int complete_del_list pro((void)); extern int complete_scroll_down pro((void)); extern int complete_scroll_up pro((void)); extern int complete_list_names pro((char *, int)); extern int ttputc pro((int)); extern int kttputc pro((int)); extern int excline pro((char *)); extern int load pro((char *)); extern int ffropen pro((char *)); extern VOID ksetfincode pro((BUFFER *)); extern int ffgetline pro((char *, int, int *)); extern int kcodeconv pro((char *, int, BUFFER *)); extern int ffclose pro((void)); extern int insertfile pro((char *, char *)); extern int ffisdir pro((char *)); extern int dired pro((int, int)); extern int cmode pro((int, int)); extern int kcodecount pro((char *, int)); extern int ldelnewline pro((void)); extern int writeout pro((BUFFER *, char *)); extern int fgetfilemode pro((char *)); extern int fbackupfile pro((char *)); extern int ffwopen pro((char *)); extern int ffputbuf pro((BUFFER *)); extern int popbuftop pro((BUFFER *)); extern VOID upmodes pro((BUFFER *)); extern VOID vtputc pro((int)); extern int ttgetc pro((void)); extern int ttungetc pro((int)); extern int bufjtoe pro((char *, int)); extern int bufstoe pro((char *, int)); extern VOID bufetos pro((char *, int)); extern int charcategory pro((int, int)); extern VOID PutLine pro((int, unsigned char *, short)); extern VOID kgetkeyflush pro((void)); extern VOID kdselectcode pro((int)); extern VOID kfselectcode pro((FILE *, int)); extern VOID initcategory pro((int)); extern int ttwait pro((void)); extern int kgetkey pro((void)); extern int fepmode_on pro((void)); extern int negative_argument pro((int, int)); extern int digit_argument pro((int, int)); extern int fillword pro((int, int)); extern int kcinsert pro((unsigned short *, unsigned short, int)); extern int kcdelete pro((unsigned short *, unsigned short, int)); extern int kinsert pro((int, int)); extern int kgrow pro((int)); extern int backchar pro((int, int)); extern int printversion pro((void)); extern VOID Exit pro((int)); extern int printoptions pro((void)); extern VOID dirinit pro((void)); extern VOID dirend pro((void)); extern int doin pro((void)); extern int ttbeep pro((void)); extern int gotoeop pro((int, int)); extern int inword pro((void)); extern int isbolkchar pro((int, int)); extern int iseolkchar pro((int, int)); extern int killregion pro((int, int)); extern int delwhite pro((int, int)); extern int backdel pro((int, int)); extern int receive_clipboard pro((void)); extern int kremove pro((int)); extern int re_readpattern pro((char *)); extern int re_forwsrch pro((void)); extern int re_backsrch pro((void)); extern int re_doreplace pro((RSIZE, char *, int)); extern int lreplace pro((RSIZE, char *, int)); extern int killmatches pro((int)); extern int countmatches pro((int)); extern int getregion pro((REGION *)); extern int setprefix pro((int, int)); extern int forwline pro((int, int)); extern int readpattern pro((char *)); extern int forwsrch pro((void)); extern int backsrch pro((void)); extern int isearch pro((int)); extern VOID vtsetsize pro((int, int)); extern int ttresize pro((void)); extern int shrinkwind pro((int, int)); extern int forwword pro((int, int)); extern int incategory pro((void)); extern int iskanji pro((void)); #ifdef HOJO_KANJI extern int ishojo pro((void)); #endif extern int iskword pro((int, int)); extern int gotobol pro((int, int)); #ifdef EXTD_DIR extern VOID ensurecwd pro((void)); extern VOID edefset pro((char *)); #endif extern int rescan pro((int, int)); #ifdef AUTOSAVE extern VOID autosave_check pro((int)); extern VOID autosave_handler pro((void)); extern VOID autosave_name pro((char*, char*, int)); extern VOID del_autosave_file pro((char*)); extern VOID clean_autosave_file pro((void)); #endif /* * Standard I/O. */ #ifndef SUPPORT_ANSI extern VOIDptr malloc(); extern VOIDptr realloc(); #endif #ifdef CANNA VOID canna_init(); VOID canna_end(); #endif ng-1.5beta1/dir.c100600 1750 1750 12000 7244021231 12367 0ustar amurausers/* $Id: dir.c,v 1.13 2001/02/18 19:29:29 amura Exp $ */ /* * Name: MG 2a * Directory management functions * Created: Ron Flax (ron@vsedev.vse.com) * Modified for MG 2a by Mic Kaczmarczik 03-Aug-1987 */ /* * $Log: dir.c,v $ * Revision 1.13 2001/02/18 19:29:29 amura * split dir.c to port depend/independ * * Revision 1.12 2000/12/22 19:54:35 amura * fix some bug in filename handling * * Revision 1.11 2000/12/14 18:06:23 amura * filename length become flexible * * Revision 1.10 2000/09/21 17:28:29 amura * replace macro _WIN32 to WIN32 for Cygwin * * Revision 1.9 2000/07/22 17:54:09 amura * fix typo bug * * Revision 1.8 2000/07/18 20:30:34 amura * rewrite some description (for Win32) * * Revision 1.7 2000/07/18 12:40:34 amura * for Win32, enable to handle japanese directory * * Revision 1.6 2000/06/27 01:49:42 amura * import to CVS * * Revision 1.5 2000/06/04 05:42:59 amura * win32 drive support * * Revision 1.4 2000/06/01 05:22:25 amura * More robust * * Revision 1.3 2000/03/28 02:37:46 amura * Added startdir. * * Revision 1.2 2000/03/10 21:26:50 amura * Merge Ng for win32 0.4 * * Revision 1.1 1999/05/21 02:20:08 amura * Initial revision * */ /* 90.01.29 Modified for Ng 1.0 MS-DOS ver. by S.Yoshida */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include "def.h" #ifndef NO_DIR #ifdef EXTD_DIR extern VOID makepath pro((char *dname, char *fname, int len)); /* file.c */ #endif char *startdir = NULL; char *wdir; #ifdef EXTD_DIR /* * Store the current working directory with refering filename for the * specified buffer. * * By Tillanosoft, Mar 22, 1999. * Modified by amura, Dec 1, 2000. */ VOID storecwd(bp) BUFFER *bp; { char path[NFILEN]; int lastchar; if (bp) { if (bp->b_fname != NULL) makepath(path, bp->b_fname, NFILEN); if (startdir != NULL && (bp->b_fname == NULL || path[0] == '\0')) { strncpy(path, startdir, NFILEN); path[NFILEN-1] = '\0'; lastchar = strlen(path)-1; if (path[lastchar] != BDC1 #ifdef BDC2 && path[lastchar] != BDC2 #endif ) { if (lastchar+2 >= NFILEN) lastchar = NFILEN-2; path[lastchar+1] = BDC1; path[lastchar+2] = '\0'; } } if (bp->b_cwd != NULL) free(bp->b_cwd); if ((bp->b_cwd=malloc(strlen(path)+1)) == NULL) return; strcpy(bp->b_cwd, path); } } VOID vchdir(newdir) char *newdir; { if (curbp) { if (curbp->b_cwd != NULL) free(curbp->b_cwd); if ((curbp->b_cwd=malloc(strlen(newdir)+1)) == NULL) return; strcpy(curbp->b_cwd, newdir); } } VOID ensurecwd pro((VOID)) { if (curbp) { if (curbp->b_cwd == NULL) { storecwd(curbp); } if (curbp->b_cwd != NULL) { rchdir(curbp->b_cwd); /* ensure we are in the current dir */ } } } /* * Change current working directory */ /*ARGSUSED*/ changedir(f, n) { register int s; int len; char bufc[NPAT]; ensurecwd(); edefset(curbp->b_cwd); #ifndef NO_FILECOMP /* 90.04.04 by K.Maeda */ if ((s=eread("Change default directory: ", bufc, NPAT, EFNEW|EFFILE|EFCR)) != TRUE) #else /* NO_FILECOMP */ if ((s=ereply("Change default directory: ", bufc, NPAT)) != TRUE) #endif /* NO_FILECOMP */ return(s); strcpy(bufc, adjustname(bufc)); if (rchdir(bufc) < 0) { ewprintf("Can't change dir to %s", bufc); } else { ewprintf("Current directory is now %s", bufc); len = strlen(bufc); if (len=0; s--) if (bufc[s] == ':') break; if (bufc[s] != ':') bufc[len] = ':'; #endif } vchdir(bufc); } return TRUE; } #else /* EXTD_DIR */ /* * Change current working directory */ /*ARGSUSED*/ changedir(f, n) { register int s; char bufc[NFILEN]; #ifndef NO_FILECOMP /* 90.04.04 by K.Maeda */ if ((s=eread("Change default directory: ", bufc, NFILEN, EFNEW|EFFILE|EFCR)) != TRUE) #else /* NO_FILECOMP */ if ((s=ereply("Change default directory: ", bufc, NFILEN)) != TRUE) #endif /* NO_FILECOMP */ return(s); if (bufc[0] == '\0') (VOID) strcpy(bufc, wdir); if (rchdir(bufc) == -1) { ewprintf("Can't change dir to %s", bufc); return(FALSE); } dirinit(); return(TRUE); } #endif /* EXTD_DIR */ /* * Show current directory */ /*ARGSUSED*/ showcwdir(f, n) { #ifdef EXTD_DIR char dirname[NFILEN]; int len; if (curbp) { if (curbp->b_cwd == NULL) { storecwd(curbp); } if (curbp->b_cwd == NULL) dirname[0] = '\0'; else { (VOID)strcpy(dirname, curbp->b_cwd); len = strlen(dirname) - 1; if (len >= 0) { #ifdef BDC2 # ifdef AMIGA if (dirname[len]==BDC2) # else if (dirname[len]==BDC1 || dirname[len]==BDC2) # endif #else if (dirname[len] == BDC1) #endif dirname[len] = '\0'; } } ewprintf("Current directory: %s", dirname); } #else /* !EXTD_DIR */ dirinit(); ewprintf("Current directory: %s", wdir); #endif /* EXTD_DIR */ return(TRUE); } #endif /* NO_DIR */ ng-1.5beta1/dired.c100644 1750 1750 25124 7244021231 12723 0ustar amurausers/* $Id: dired.c,v 1.8 2001/02/18 19:29:29 amura Exp $ */ /* dired module for mg 2a */ /* by Robert A. Larson */ /* * $Log: dired.c,v $ * Revision 1.8 2001/02/18 19:29:29 amura * split dir.c to port depend/independ * * Revision 1.7 2001/02/18 17:07:24 amura * append AUTOSAVE feature (but NOW not work) * * Revision 1.6 2000/12/27 16:56:01 amura * change d_makename() params for conservative reason, and bugfix in dires_() * * Revision 1.5 2000/12/14 18:06:24 amura * filename length become flexible * * Revision 1.4 2000/09/21 17:28:29 amura * replace macro _WIN32 to WIN32 for Cygwin * * Revision 1.3 2000/07/22 17:54:09 amura * fix typo bug * * Revision 1.2 2000/06/27 01:49:42 amura * import to CVS * * Revision 1.1 1999/05/21 02:45:06 amura * Initial revision * */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include "def.h" #ifndef NO_DIRED BUFFER *dired_(); #ifndef strncpy extern char* strncpy(); #endif #ifdef CHGMISC /* 99.8.11 by M.Suzuki */ static int SearchDir(dirname) char* dirname; { LINE *llp; for (llp=curbp->b_linep; lforw(llp)!=curbp->b_linep; llp=lforw(llp)){ #ifndef max #define max(a,b) (((a)<(b))?(b):(a)) #endif if (strncmp(dirname, llp->l_text, max(strlen(dirname),llength(llp))) == 0 ){ curwp->w_dotp = llp; curwp->w_flag |= WFEDIT | WFMOVE; curwp->w_doto = llength(llp); return TRUE; } } return FALSE; } #endif /* CHGMISC */ /*ARGSUSED*/ dired(f, n) int f, n; { char dirname[NFILEN]; BUFFER *bp; #ifdef CHGMISC /* 1999.8.17 by M.Suzuki */ char *fname; #endif /* CHGMISC */ #ifdef EXTD_DIR int i; ensurecwd(); edefset(curbp->b_cwd); #endif dirname[0] = '\0'; #ifndef NO_FILECOMP /* 90.04.04 by K.Maeda */ if(eread("Dired: ", dirname, NFILEN, EFNEW | EFCR | EFFILE) == ABORT) #else /* NO_FILECOMP */ if(eread("Dired: ", dirname, NFILEN, EFNEW | EFCR) == ABORT) #endif /* NO_FILECOMP */ return ABORT; #ifdef CHGMISC /* 1999.8.17 by M.Suzuki */ if((fname = adjustname(dirname)) == NULL) { ewprintf("Bad directory name"); return FALSE; } if( !ffisdir(fname) ){ return filevisit_(fname,f,n); } if((bp = dired_(fname)) == NULL) return FALSE; #else if((bp = dired_(dirname)) == NULL) return FALSE; #endif /* CHGMISC */ curbp = bp; #ifdef EXTD_DIR i = strlen(dirname); if (curbp->b_cwd != NULL) free(curbp->b_cwd); if ((curbp->b_cwd=malloc(i+2)) == NULL) return FALSE; strcpy(curbp->b_cwd, dirname); if (i >= 1) { if (curbp->b_cwd[i-1] != BDC1 #ifdef BDC2 && curbp->b_cwd[i-1] != BDC2 #endif ) { curbp->b_cwd[i] = BDC1; curbp->b_cwd[i+1] = '\0'; } } #endif /* EXTD_DIR */ #ifdef READONLY /* 91.01.15 by K.Maeda */ curbp->b_flag |= BFRONLY; #endif /* READONLY */ #ifdef FEPCTRL /* The following fepmode_off() is only effective if the provided fepcontrol supports a doubled fepmode_off() feature. That is, the second call for the fepmode_off() is expected to change the previous fep mode as off, without doing any actual fep control since the fep mode has been already turned off by the first call of the function. So, the succeeding fepmode_on() will not turn on the fep mode even if the previous fep mode was on before the first call of fepmode_off(). If this feature is not provided, entering dired does not affect the fep mode. By Tillanosoft, Mar 21, 1999 */ fepmode_off(); #endif return showbuffer(bp, curwp, WFHARD | WFMODE); } /*ARGSUSED*/ d_otherwindow(f, n) int f, n; { char dirname[NFILEN]; BUFFER *bp; WINDOW *wp; #ifdef EXTD_DIR ensurecwd(); edefset(curbp->b_cwd); #endif dirname[0] = '\0'; #ifndef NO_FILECOMP /* 90.04.04 by K.Maeda */ if(eread("Dired other window: ", dirname, NFILEN, EFNEW | EFCR | EFFILE) == ABORT) #else /* NO_FILECOMP */ if(eread("Dired other window: ", dirname, NFILEN, EFNEW | EFCR) == ABORT) #endif /* NO_FILECOMP */ return ABORT; #ifdef CHGMISC /* 99.6.18 by M.Suzuki */ if((bp = dired_(dirname)) == NULL) return FALSE; #else if((bp = dired_(dirname)) == NULL) return FALSE; #endif /* CHGMISC */ #ifdef READONLY /* 91.01.15 by K.Maeda */ bp->b_flag |= BFRONLY; #endif /* READONLY */ if((wp = popbuf(bp)) == NULL) return FALSE; curbp = bp; curwp = wp; return TRUE; } /*ARGSUSED*/ d_del(f, n) int f, n; { if(n < 0) return FALSE; while(n--) { if(llength(curwp->w_dotp) > 0) #ifdef CHGMISC /* 99.6.18 by M.Suzuki */ if(lgetc(curwp->w_dotp,0) != '/' && strncmp(curwp->w_dotp->l_text, " total", 7) ) #endif /* CHGMISC */ lputc(curwp->w_dotp, 0, 'D'); if(lforw(curwp->w_dotp) != curbp->b_linep) curwp->w_dotp = lforw(curwp->w_dotp); } curwp->w_flag |= WFEDIT | WFMOVE; curwp->w_doto = 0; return TRUE; } /*ARGSUSED*/ d_undel(f, n) int f, n; { if(n < 0) return d_undelbak(f, -n); while(n--) { if(llength(curwp->w_dotp) > 0) #ifdef CHGMISC /* 99.6.18 by M.Suzuki */ if( lgetc(curwp->w_dotp,0) != '/' && strncmp(curwp->w_dotp->l_text," total",7) ) #endif /* CHGMISC */ lputc(curwp->w_dotp, 0, ' '); if(lforw(curwp->w_dotp) != curbp->b_linep) curwp->w_dotp = lforw(curwp->w_dotp); } curwp->w_flag |= WFEDIT | WFMOVE; curwp->w_doto = 0; return TRUE; } /*ARGSUSED*/ d_undelbak(f, n) int f, n; { if(n < 0) return d_undel(f, -n); while(n--) { if(llength(curwp->w_dotp) > 0) lputc(curwp->w_dotp, 0, ' '); if(lback(curwp->w_dotp) != curbp->b_linep) curwp->w_dotp = lback(curwp->w_dotp); } curwp->w_doto = 0; curwp->w_flag |= WFEDIT | WFMOVE; return TRUE; } /*ARGSUSED*/ d_flag(f, n) int f, n; { struct LINE *lp; char flag = (f & FFARG) ? ' ' : 'D'; int nflags = 0, len; lp = curbp->b_linep; do { len = llength(lp); if (len > 0 && lgetc(lp, len - 1) == '~') { lputc(lp, 0, flag); nflags++; } lp = lforw(lp); } while (lp != curbp->b_linep); curwp->w_flag |= WFEDIT | WFMOVE; ewprintf(flag == 'D' ? "%d backup file%s flagged." : "%d backup file%s unmarked.", nflags, nflags == 1 ? "" : "s"); return TRUE; } /* * unified routine for d_findfile and d_ffotherwindow */ static d_fileopen(f, n, popup) int f, n, popup; { char fname[NFILEN]; register BUFFER *bp; register int s; register WINDOW *wp; BUFFER *findbuffer(); if ((s = d_makename(curwp->w_dotp, fname, sizeof(fname))) == ABORT) return FALSE; if ((bp = (s ? dired_(fname) : findbuffer(fname))) == NULL) return FALSE; #ifdef READONLY /* 91.01.16 by S.Yoshida */ if (s) { /* If dired buffer, */ bp->b_flag |= BFRONLY; /* mark as read-only. */ } #endif /* READONLY */ if (popup) { if ((wp = popbuf(bp)) == NULL) return FALSE; curbp = bp; curwp = wp; } else { curbp = bp; if (showbuffer(bp, curwp, WFHARD) != TRUE) return FALSE; } if (bp->b_fname != NULL) return TRUE; s = readin(fname); #ifdef READONLY /* 91.01.16 by S.Yoshida */ if (fchkreadonly(bp->b_fname)) { /* If no write permission, */ bp->b_flag |= BFRONLY; /* mark as read-only. */ ewprintf("File is write protected"); } #endif /* READONLY */ return s; } /*ARGSUSED*/ d_findfile(f, n) int f, n; { return d_fileopen(f, n, FALSE); } #ifdef READONLY /*ARGSUSED*/ int d_viewfile(f, n) int f, n; { int res; res = d_findfile(f, n); if (res) { curbp->b_flag |= BFRONLY; /* set read-only bit. */ } return res; } #endif /*ARGSUSED*/ d_ffotherwindow(f, n) int f, n; { return d_fileopen(f, n, TRUE); } /*ARGSUSED*/ d_expunge(f, n) int f, n; { register LINE *lp, *nlp; char fname[NFILEN]; VOID lfree(); #ifdef EXTD_DIR ensurecwd(); #endif for(lp = lforw(curbp->b_linep); lp != curbp->b_linep; lp = nlp) { nlp = lforw(lp); if(llength(lp) && lgetc(lp, 0) == 'D') { switch(d_makename(lp, fname, sizeof(fname))) { case ABORT: ewprintf("Bad line in dired buffer"); return FALSE; case FALSE: if(unlink(fname) < 0) { ewprintf("Could not delete '%s'", fname); return FALSE; } break; case TRUE: if(unlinkdir(fname) < 0) { ewprintf("Could not delete directory '%s'", fname); return FALSE; } break; } lfree(lp); curwp->w_flag |= WFHARD; } } return TRUE; } static char * filename(path) char *path; { char *cp1; cp1 = path; while (*cp1 != 0) { ++cp1; } --cp1; /* insure at least 1 character ! */ while (cp1!= path && cp1[-1] != BDC1 #ifdef BDC2 && cp1[-1] != BDC2 #endif ) { --cp1; } return cp1; } /*ARGSUSED*/ d_copy(f, n) int f, n; { char frname[NFILEN], toname[NFILEN], *fr; int stat; #ifdef EXTD_DIR ensurecwd(); #endif switch (d_makename(curwp->w_dotp, frname, sizeof(frname))) { case TRUE: ewprintf("Not a file"); return FALSE; case ABORT: return FALSE; case FALSE: /* nothing to do */ break; } fr = filename(frname); #ifdef EXTD_DIR edefset(curbp->b_cwd); #endif #ifndef NO_FILECOMP /* 90.04.04 by K.Maeda */ if((stat = eread("Copy %s to: ", toname, NFILEN, EFNEW | EFCR | EFFILE, fr)) #else /* NO_FILECOMP */ if((stat = eread("Copy %s to: ", toname, NFILEN, EFNEW | EFCR, fr)) #endif /* NO_FILECOMP */ != TRUE) { return stat; } stat = (copy(frname, toname) >= 0); return stat; } /*ARGSUSED*/ d_rename(f, n) int f, n; { char frname[NFILEN], toname[NFILEN], *fr; int stat; #ifdef EXTD_DIR ensurecwd(); #endif switch (d_makename(curwp->w_dotp, frname, sizeof(frname))) { case TRUE: ewprintf("Not a file"); return FALSE; case ABORT: return FALSE; case FALSE: /* nothing to do */ break; } fr = filename(frname); #ifdef EXTD_DIR edefset(curbp->b_cwd); #endif #ifndef NO_FILECOMP /* 90.04.04 by K.Maeda */ if((stat = eread("Rename %s to: ", toname, NFILEN, EFNEW | EFCR | EFFILE, fr)) #else /* NO_FILECOMP */ if((stat = eread("Rename %s to: ", toname, NFILEN, EFNEW | EFCR, fr)) #endif /* NO_FILECOMP */ != TRUE) { return stat; } stat = (rename(frname, toname) >= 0); return stat; } /*ARGSUSED*/ int d_execute(f, n) int f, n; { #ifdef WIN32 char fname[NFILEN]; register int s; extern void WinExecute(char *); s = d_makename(curwp->w_dotp, fname, sizeof(fname)); if (s == ABORT) { return FALSE; } else if (s) { /* that is, fname points to a directory */ #if !defined(_WIN32_WCE) || 200 <= _WIN32_WCE goto noproblem; #endif return FALSE; } else { noproblem: WinExecute(fname); return TRUE; } #else /* not WIN32 */ return TRUE; #endif /* WIN32 */ } #endif /* NO_DIRED */ ng-1.5beta1/display.c100600 1750 1750 126307 7632242733 13333 0ustar amurausers/* $Id: display.c,v 1.14.2.1 2003/03/08 01:22:35 amura Exp $ */ /* * The functions in this file handle redisplay. The * redisplay system knows almost nothing about the editing * process; the editing functions do, however, set some * hints to eliminate a lot of the grinding. There is more * that can be done; the "vtputc" interface is a real * pig. Two conditional compilation flags; the GOSLING * flag enables dynamic programming redisplay, using the * algorithm published by Jim Gosling in SIGOA. The MEMMAP * changes things around for memory mapped video. With * both off, the terminal is a VT52. */ /* * $Log: display.c,v $ * Revision 1.14.2.1 2003/03/08 01:22:35 amura * NOTAB is always enabled * * Revision 1.14 2001/04/28 18:54:27 amura * support line-number-mode (based on MATSUURA's patch ) * * Revision 1.13 2001/02/18 17:07:24 amura * append AUTOSAVE feature (but NOW not work) * * Revision 1.12 2001/02/14 09:18:55 amura * code cleanup around putline() * * Revision 1.11 2001/02/11 15:40:24 amura * some function are changed to static for speed/size * * Revision 1.10 2001/02/01 16:29:32 amura * fix terminal buffer size check * * Revision 1.9 2001/01/20 18:16:20 amura * fix vtsetsize() bug, and make alignment VIDEO buffer * * Revision 1.8 2001/01/20 15:48:45 amura * very big terminal supported * * Revision 1.7 2001/01/05 14:07:01 amura * first implementation of Hojo Kanji support * * Revision 1.6 2000/11/16 14:31:12 amura * fix some typos which cause compile error when using * strict ANSI-C compiler (ex ACK, gcc-1.x) * * Revision 1.5 2000/10/02 16:24:42 amura * bugfix by Tillanosoft(Ng for Win32) * * Revision 1.4 2000/09/21 17:28:29 amura * replace macro _WIN32 to WIN32 for Cygwin * * Revision 1.3 2000/06/27 01:49:43 amura * import to CVS * * Revision 1.2 2000/06/01 18:29:12 amura * support VARIABLE_TAB * * Revision 1.1 1999/05/19 04:25:31 amura * Initial revision * */ /* 90.01.29 Modified for Ng 1.0 by S.Yoshida */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include "def.h" #include "kbd.h" /* * You can change these back to the types * implied by the name if you get tight for space. If you * make both of them "int" you get better code on the VAX. * They do nothing if this is not Gosling redisplay, except * for change the size of a structure that isn't used. * A bit of a cheat. */ /* These defines really belong in sysdef.h */ #ifndef XCHAR # define XCHAR int # define XSHORT int #endif #ifdef STANDOUT_GLITCH # ifdef TCCONIO # undef STANDOUT_GLITCH # else extern int SG; /* number of standout glitches */ # endif /* TCCONIO */ #endif /* STANDOUT_GLITCH */ #ifdef GOSLING # undef GOSLING /* GOSLING too slow? */ #endif /* * A video structure always holds * an array of characters whose length is equal to * the longest line possible. Only some of this is * used if "ncol" isn't the same as "NCOL". */ typedef struct { short v_hash; /* Hash code, for compares. */ short v_flag; /* Flag word. */ short v_color; /* Color of the line. */ XSHORT v_cost; /* Cost of display. */ #ifndef ZEROARRAY char v_text[1]; /* The actual characters. */ #else char v_text[]; /* The actual characters. */ #endif } VIDEO; #define MEM_ROUND(n) (((n)+7)&~7) /* Memory round bound for 8 bytes*/ #ifdef SS_SUPPORT #define SIZEOF_VIDEO MEM_ROUND(sizeof(VIDEO) + vncol*2) #define v_sub(n) v_text[(n)+vncol] /* 2nd Character of HANKANA */ #else /* SS_SUPPORT */ #define SIZEOF_VIDEO MEM_ROUND(sizeof(VIDEO) + vncol) #endif #define VFCHG 0x0001 /* Changed. */ #define VFHBAD 0x0002 /* Hash and cost are bad. */ #define VFEXT 0x0004 /* extended line (beond ncol) */ /* * SCORE structures hold the optimal * trace trajectory, and the cost of redisplay, when * the dynamic programming redisplay code is used. * If no fancy redisplay, this isn't used. The trace index * fields can be "char", and the score a "short", but * this makes the code worse on the VAX. */ typedef struct { XCHAR s_itrace; /* "i" index for track back. */ XCHAR s_jtrace; /* "j" index for trace back. */ XSHORT s_cost; /* Display cost. */ } SCORE; int sgarbf = TRUE; /* TRUE if screen is garbage. */ static int vtrow = 0; /* Virtual cursor row. */ static int vtcol = 0; /* Virtual cursor column. */ int tthue = CNONE; /* Current color. */ int ttrow = HUGE; /* Physical cursor row. */ int ttcol = HUGE; /* Physical cursor column. */ int tttop = HUGE; /* Top of scroll region. */ int ttbot = HUGE; /* Bottom of scroll region. */ extern int ncol; extern int nrow; static int vncol = 0; static int vnrow = 0; static VIDEO **vscreen = NULL; /* Edge vector, virtual. */ static VIDEO **pscreen = NULL; /* Edge vector, physical. */ static VIDEO *video = NULL; /* Actual screen data. */ static VIDEO *blanks = NULL; /* Blank line image. */ #ifdef KANJI /* 90.01.29 by S.Yoshida */ #define ASCII 0 #define K1ST 1 #define K2ND 2 #define HAN1ST 3 #define HOJO1ST 4 #define HOJO2ND 5 int vtkattr = ASCII; #endif /* KANJI */ /* * Some predeclerations to make ANSI compilers happy */ VOID vtinit(); VOID vttidy(); VOID vtputc(); VOID update(); static VOID vtmove(); static VOID vtmarkyen(); static VOID vteeol(); static VOID ucopy(); static VOID uline(); static VOID modeline(); #ifdef ADDFUNC static VOID moderatio(); #endif #ifdef GOSLING /* * This matrix is written as an array because * we do funny things in the "setscores" routine, which * is very compute intensive, to make the subscripts go away. * It would be "SCORE score[vnrow][vnrow]" in old speak. * Look at "setscores" to understand what is up. */ static VOID hash(); static VOID setscores(); static VOID traceback(); static SCORE *score = NULL; #endif VOID vtsetsize(col, row) { register VIDEO *vp; register int i; if (col<=vncol && row<=vnrow) return; vncol = col; vnrow = row; if (vscreen != NULL) free(vscreen); if (pscreen != NULL) free(pscreen); if (video != NULL) free(video); if (blanks != NULL) free(blanks); vscreen = malloc(sizeof(VIDEO*)*(vnrow-1)); pscreen = malloc(sizeof(VIDEO*)*(vnrow-1)); video = malloc(SIZEOF_VIDEO*2*(vnrow-1)); blanks = malloc(SIZEOF_VIDEO); if (vscreen==NULL || pscreen==NULL || video==NULL || blanks==NULL) panic("Cannot allocate video buffer"); bzero(video, SIZEOF_VIDEO*2*(vnrow-1)); bzero(blanks, SIZEOF_VIDEO); #ifdef GOSLING if (score != NULL) free(score); score = malloc(sizeof(SCORE)*vnrow*vnrow); if (score == NULL) panic("Cannot allocate video buffer"); bzero(score, sizeof(SCORE)*vnrow*vnrow); #endif vp = video; for (i=0; iv_color = CTEXT; for (i=0; iv_sub(i) = 0; #endif /* SS_SUPPORT */ blanks->v_text[i] = ' '; } } /* * Initialize the data structures used * by the display code. The edge vectors used * to access the screens are set up. The operating * system's terminal I/O channel is set up. Fill the * "blanks" array with ASCII blanks. The rest is done * at compile time. The original window is marked * as needing full update, and the physical screen * is marked as garbage, so all the right stuff happens * on the first call to redisplay. */ VOID vtinit() { int col, row; ttopen(); ttinit(); col = ncol; row = nrow; if (col < NCOL) col = NCOL; if (row < NROW) row = NROW; vtsetsize(col, row); } /* * Tidy up the virtual display system * in anticipation of a return back to the host * operating system. Right now all we do is position * the cursor to the last line, erase the line, and * close the terminal channel. */ VOID vttidy() { ttcolor(CTEXT); ttnowindow(); /* No scroll window. */ ttmove(nrow-1, 0); /* Echo line. */ tteeol(); tttidy(); ttflush(); ttclose(); } /* * Move the virtual cursor to an origin * 0 spot on the virtual display screen. I could * store the column as a character pointer to the spot * on the line, which would make "vtputc" a little bit * more efficient. No checking for errors. */ static VOID vtmove(row, col) { vtrow = row; vtcol = col; #ifdef KANJI /* 90.01.29 by S.Yoshida */ vtkattr = ASCII; #endif /* KANJI */ } /* * Write a character to the virtual display, * dealing with long lines and the display of unprintable * things like control characters. Also expand tabs every 8 * columns. This code only puts printing characters into * the virtual display image. Special care must be taken when * expanding tabs. On a screen whose width is not a multiple * of 8, it is possible for the virtual cursor to hit the * right margin before the next tab stop is reached. This * makes the tab code loop if you are not careful. * Three guesses how we found this. */ VOID vtputc(c) register int c; { register VIDEO *vp; #ifdef VARIABLE_TAB int tab = curwp->w_bufp->b_tabwidth; #endif /* vtrow sometimes over-runs the vnrow -1. In the case, vp at following line becomes an uninitialized pointer. Then core dump or system error may occur. To avoid the error. Some range confirmation should be needed. By Tillanosoft Sep 9, 2000. */ if (vnrow - 1 <= vtrow) { return; } vp = vscreen[vtrow]; if (c == '\t' && !(curwp->w_bufp->b_flag & BFNOTAB)) { if ( #ifdef VARIABLE_TAB (vtcol/tab +1)*tab #else (vtcol | 0x07) + 1 #endif <= ncol - 1 ) { do { vtputc(' '); } while (vtcolv_text[ncol-1]='\\'; vtcol=0; vtrow++; } } else if (ISCTRL(c)) { vtputc('^'); vtputc(CCHR(c)); #ifdef HANKANA /* 92.11.21 by S.Sasaki */ } else if (vtkattr == HAN1ST) { vp->v_sub(vtcol-1) = c; vtkattr = ASCII; #endif /* HANKANA */ #ifdef HOJO_KANJI } else if (vtkattr == HOJO1ST) { vp->v_sub(vtcol-1) = c; vtkattr = HOJO2ND; } else if (vtkattr == HOJO2ND) { vp->v_text[vtcol++] = SS3; vp->v_sub(vtcol) = c; vtkattr = ASCII; #endif /* HOJO_KANJI */ } else { #ifdef SS_SUPPORT /* 92.11.21 by S.Sasaki */ vp->v_sub(vtcol) = 0; #endif vp->v_text[vtcol++] = c; #ifdef KANJI /* 90.01.29 by S.Yoshida */ if (vtkattr == K1ST) { vtkattr = K2ND; } else if (ISKANJI(c)) { #ifdef HANKANA /* 92.11.21 by S.Sasaki */ if (ISHANKANA(c)) vtkattr = HAN1ST; else #endif #ifdef HOJO_KANJI if (ISHOJO(c)) vtkattr = HOJO1ST; else #endif vtkattr = K1ST; } else { vtkattr = ASCII; } #endif /* KANJI */ } if (vtcol >= ncol-1 #ifdef HANKANA && vtkattr != HAN1ST #endif #ifdef HOJO_KANJI && vtkattr != HOJO1ST #endif ) { vp->v_text[ncol-1] = '\\'; vtcol=0; vtrow++; #ifdef KANJI /* 90.01.29 by S.Yoshida */ if (vtkattr == K1ST #ifdef HOJO_KANJI || vtkattr == HOJO2ND #endif ) { vtkattr = ASCII; vtputc(vp->v_text[ncol-2]); vp->v_text[ncol - 2] = '\\'; } #endif /* KANJI */ } } #if defined(MEMMAP)&&(!defined(PC9801))&&(!defined(WIN32)) static VOID #ifdef SS_SUPPORT putline(row, col, s, t, color) unsigned char *s; unsigned char *t; short color; /* this is dummy */ #else putline(row, col, s, color) unsigned char *s; short color; /* this is dummy */ #endif { register int i; unsigned char c; #ifdef SS_SUPPORT unsigned char c1; #endif int oldrow = vtrow; int oldcol = vtcol; vtrow = row; vtcol = col; for (i=row; i<=MAXROW; i++) { c = *s++; #ifdef SS_SUPPORT if (vtkattr == ASCII) { c1 = *t++; #ifdef HANKANA if (ISHANKANA(c) && c1!=0) { vtkattr = HAN1ST; c = c1; } #endif #ifdef HOJO_KANJI if (ISHOJO(c) && c1!=0) { vtkattr = HOJO1ST; c = c1; } #endif } #endif vtputc(c); } vtrow = oldrow; vtcol = oldcol; } #endif /* MEMMAP && !PC9801 && !WIN32 */ /* Mark '\\' end of line * whether curcol is not on the top of line. */ static VOID vtmarkyen(fillchar) char fillchar; { register VIDEO *vp; vp = vscreen[vtrow]; if (vtcol > 0) { while (vtcol < ncol) { #ifdef SS_SUPPORT /* 92.11.21 by S.Sasaki */ vp->v_sub(vtcol)=0; #endif /* SS_SUPPORT */ vp->v_text[vtcol++] = fillchar; } } } /* Erase from the end of the * software cursor to the end of the * line on which the software cursor is * located. The display routines will decide * if a hardware erase to end of line command * should be used to display this. */ static VOID vteeol() { register VIDEO *vp; vp = vscreen[vtrow]; while (vtcol < ncol) { #ifdef SS_SUPPORT /* 92.11.21 by S.Sasaki */ vp->v_sub(vtcol)=0; #endif /* SS_SUPPORT */ vp->v_text[vtcol++] = ' '; } } /* Calculate offset to col and row */ int #ifdef SUPPORT_ANSI /* for strict compiler */ colrow(LINE *lp, short offset, int *curcol, int *lines) #else colrow(lp, offset, curcol, lines) LINE *lp; short offset; int *curcol; int *lines; #endif { register int i; register char c; register int c1; #ifdef VARIABLE_TAB int tab = curbp->b_tabwidth; #endif c1=0; *curcol = 0; *lines = 0; for (i=0; ib_flag & BFNOTAB) ) { #ifdef VARIABLE_TAB *curcol = ((*curcol)/tab +1)*tab -1; #else *curcol |= 0x07; #endif if (*curcol >= ncol -2) { *curcol = -1; (*lines)++; } } else if (ISCTRL(c) != FALSE) ++(*curcol); ++(*curcol); if (*curcol >= ncol-1) { #ifdef KANJI if (c1 == 1) *curcol=1; else *curcol = *curcol - ncol + 1; #else /* not KANJI */ *curcol = *curcol - ncol + 1; #endif /* KANJI */ ++(*lines); } } #ifdef CURSOR_POS #ifdef KANJI if (*curcol == ncol -2 && i < llength(lp)) { c=lgetc(lp, i); if (ISKANJI(c) #ifdef HANKANA && ISHANKANA(c) #endif ) { ++(*lines); *curcol = 0; } } #endif #endif /* CURSOR_POS */ return (short)*lines; } /* Returns offset of specified location. This will be mainly used to respond to a mouse click on a screen. In case the specified location does not exist within the `lp', negative value will be returned. The absolute value of the negative result is the number of rows left. This will return an offset right neighbor to the position, if the character at the position is a wide character ,that is, the width of the character is more than or equal to a double width character, and the position is at the right half of the character. By Tillanosoft, March 21, 1999. */ int rowcol2offset(lp, row, col) LINE *lp; int row, col; { register int i; register int curcol; register char c; register int width, skipbytes; #ifdef VARIABLE_TAB int tab = curbp->b_tabwidth; #endif /* VARIABLE_TAB */ curcol = 0; for (i=0; ib_flag & BFNOTAB) ) { #ifdef VARIABLE_TAB width = (curcol/tab + 1)*tab - curcol; #else width = (curcol | 0x07) - curcol + 1; #endif /* I should pay more care for the above line. In case, wrapping arround occurs, where should I put the curcol in the next line? By Tillanosoft Mar 21, 1999 */ } else if (ISCTRL(c) != FALSE) { width = 2; } if (row == 0 && col < curcol + (width + 1) / 2) { return i; } curcol += width; if (curcol >= ncol-1 #ifdef KANJI || (ISKANJI(c) && curcol >= ncol-2) #endif ) { curcol= ISCTRL(c) ? (curcol - ncol + 1) : 0; --row; } } if (row <= 0) { return i; } else { return -row; } } /* Return offset of #th lines */ short skipline(lp, lines) LINE *lp; int lines; { register int i; register int curcol; register char c; register int c1; #ifdef VARIABLE_TAB int tab = curbp->b_tabwidth; #endif /* VARIABLE_TAB */ c1=0; curcol = 0; for (i=0; ib_flag & BFNOTAB)) { #ifdef VARIABLE_TAB curcol = (curcol/tab + 1)*tab - 1; #else curcol |= 0x07; #endif if (curcol >= ncol -2) { curcol = -1; --lines; } } else if (ISCTRL(c) != FALSE) ++curcol; ++curcol; if (curcol >= ncol-1) { #ifdef KANJI if (c1==1) curcol=1; else curcol=0; #else /* not KANJI */ curcol=0; #endif /* KANJI */ --lines; } } if (lines == 0) return i - curcol; ewprintf("Bug: skipline %d lines left",lines); return FALSE; } /* Count number of displayed lines on tty. * the line which is longer than ncol * returns value more than 2 lines */ int countlines(lp) LINE *lp; { register int i; register int curcol; register int lines; register char c; register int c1; #ifdef VARIABLE_TAB int tab = curbp->b_tabwidth; #endif /* VARIABLE_TAB */ c1=0; curcol = 0; lines=0; for (i=0; ib_flag & BFNOTAB) ) { #ifdef VARIABLE_TAB curcol = (curcol/tab + 1)*tab - 1; #else curcol |= 0x07; #endif if (curcol >= ncol -2) { curcol = -1; lines++; } } else if (ISCTRL(c) != FALSE) ++curcol; ++curcol; if (curcol >= ncol-1) { #ifdef KANJI if (c1==1) curcol=1; else curcol=0; #else /* not KANJI */ curcol=0; #endif /* KANJI */ ++lines; } } return lines+1; } #if 0 static VOID vtpute(c) int c; { register VIDEO *vp; vp = vscreen[vtrow]; if (vtcol >= ncol) { #ifdef KANJI /* 90.01.29 by S.Yoshida */ if (vtkattr == K2ND) { vp->v_text[ncol - 2] = '$'; } #endif /* KANJI */ vp->v_text[ncol - 1] = '$'; } else if (c == '\t' && !(curbp->b_flag & BFNOTAB) ) { do { vtpute(' '); } #ifdef TABWIDTH /* 95.08.29 by M.Suzuki */ while (((vtcol + lbound)%tabWidth) != 0 && vtcol < ncol); #else while (((vtcol + lbound)&0x07) != 0 && vtcol < ncol); #endif /* TABWIDTH */ } else if (ISCTRL(c) != FALSE) { vtpute('^'); vtpute(CCHR(c)); } else { if (vtcol >= 0) vp->v_text[vtcol] = c; ++vtcol; #ifdef KANJI /* 90.01.29 by S.Yoshida */ if (vtkattr == K1ST) { vtkattr = K2ND; } else if (ISKANJI(c)) { /* FIXME : unsupported kana */ vtkattr = K1ST; } else { vtkattr = ASCII; } if (vtcol == 1 && vtkattr == K1ST) { vtcol--; lbound++; } #endif /* KANJI */ } } #endif /* * Make sure that the display is * right. This is a three part process. First, * scan through all of the windows looking for dirty * ones. Check the framing, and refresh the screen. * Second, make sure that "currow" and "curcol" are * correct for the current window. Third, make the * virtual and physical screens the same. */ /* Changed 98/01/23 by amura for Variable Tab handling */ VOID update() { register LINE *lp; WINDOW *old_curwp; register WINDOW *wp; register VIDEO *vp1; VIDEO *vp2; register int i; register int j; register int hflag; register int currow; register int curcol; register int offs; register int size; int x,y; int lines; VOID traceback (); VOID uline (); #ifdef KANJI /* 90.01.29 by S.Yoshida */ extern int no_k2nd; /* Defined at kbd.c */ #endif /* KANJI */ if (typeahead()) return; if (sgarbf) { /* must update everything */ wp = wheadp; while(wp != NULL) { wp->w_flag |= WFMODE | WFHARD; wp = wp->w_wndp; } #ifdef KANJI /* 90.01.29 by S.Yoshida */ no_k2nd = FALSE; /* Reset KANJI input condition. */ } else if (no_k2nd) { /* We don't have KANJI 2nd byte. */ return; #endif /* KANJI */ } old_curwp = curwp; hflag = FALSE; /* Not hard. */ wp = wheadp; while (wp != NULL) { if (wp == curwp && wp->w_flag == 0) { lp = wp->w_linep; /* Cursor location. */ i = -wp->w_lines; while (lp != wp->w_dotp) { i += countlines(lp); lp = lforw(lp); } i += colrow(lp, wp->w_doto, &x, &y); if ( i < 0 || i >= wp->w_ntrows ) wp->w_flag |= WFFORCE; } if (wp->w_flag != 0) { /* Need update. */ if (wp->w_dotlines != countlines(wp->w_dotp)) wp->w_flag |= WFHARD; if ((wp->w_flag&WFFORCE) == 0) { lp = wp->w_linep; for (i = -wp->w_lines; i < wp->w_ntrows && lp != wp->w_bufp->b_linep; ) { if (lp == wp->w_dotp) { i += colrow(lp, wp->w_doto, &x, &y); if (i>=0 && iw_ntrows) goto out; else break; } i += countlines(lp); lp = lforw(lp); } } i = wp->w_force; /* Reframe this one. */ if (i > 0) { --i; if (i >= wp->w_ntrows) i = wp->w_ntrows-1; } else if (i < 0) { i += wp->w_ntrows; if (i < 0) i = 0; } else i = wp->w_ntrows/2; lp = wp->w_dotp; i -= colrow(lp, wp->w_doto, &x, &y); while (i>0 && lback(lp)!=wp->w_bufp->b_linep) { lp = lback(lp); i -= countlines(lp); } if (i>0) i=0; if (i<0) i = -i; wp->w_linep = lp; wp->w_lines = i; wp->w_flag |= WFHARD; /* Force full. */ out: lp = wp->w_linep; /* Try reduced update. */ i = wp->w_toprow - wp->w_lines; if ((wp->w_flag&~WFMODE) == WFEDIT) { while (lp != wp->w_dotp) { i += countlines(lp); lp = lforw(lp); } j = i + countlines(lp); if (j > wp->w_toprow + wp->w_ntrows) { y = skipline(lp, wp->w_toprow + wp->w_ntrows - i); j = wp->w_toprow + wp->w_ntrows; } else y = llength(lp); if (i < wp->w_toprow) { x = skipline(lp, wp->w_toprow - i); i = wp->w_toprow; } else x = 0; for (lines=i; linesv_color = CTEXT; vscreen[lines]->v_flag |= (VFCHG|VFHBAD); } vtmove(i, 0); for (j=x; jw_flag&(WFEDIT|WFHARD)) != 0) { hflag = TRUE; while (i < wp->w_toprow + wp->w_ntrows) { if (lp == wp->w_bufp->b_linep) { vtmove(i, 0); vscreen[i]->v_color =CTEXT; vscreen[i]->v_flag |= (VFCHG|VFHBAD); vteeol(); i++; continue; } j = i + countlines(lp); if (j > wp->w_toprow + wp->w_ntrows){ y = skipline(lp, wp->w_toprow + wp->w_ntrows - i); j = wp->w_toprow + wp->w_ntrows; } else y = llength(lp); if (i < wp->w_toprow) { x = skipline(lp, wp->w_toprow - i); i = wp->w_toprow; } else x = 0; for (lines=i; linesv_color =CTEXT; vscreen[lines]->v_flag |= (VFCHG|VFHBAD); } vtmove(i, 0); curwp = wp; /* for variable tab */ for (j=x; j= wp->w_toprow + wp->w_ntrows) wp->w_flag |= WFMODE; } if ((wp->w_flag&WFMODE) != 0) modeline(wp); #ifdef ADDFUNC else if ((wp->w_flag & WFHARD) != 0) /* to display the ratio in mode line */ moderatio(wp); #endif wp->w_flag = 0; wp->w_force = 0; wp->w_dotlines = countlines(wp->w_dotp); } wp = wp->w_wndp; } lp = curwp->w_linep; /* Cursor location. */ currow = curwp->w_toprow - curwp->w_lines; while (lp != curwp->w_dotp) { currow += countlines(lp); lp = lforw(lp); } currow += colrow(lp, curwp->w_doto, &x, &y); curcol = x; /* make sure no lines need to be de-extended because the cursor is no longer on them */ wp = wheadp; while (wp != NULL) { /* if garbaged then fix up mode lines */ if (sgarbf != FALSE) vscreen[wp->w_toprow+wp->w_ntrows]->v_flag |= VFCHG; /* and onward to the next window */ wp = wp->w_wndp; } if (sgarbf != FALSE) { /* Screen is garbage. */ sgarbf = FALSE; /* Erase-page clears */ epresf = FALSE; /* the message area. */ tttop = HUGE; /* Forget where you set */ ttbot = HUGE; /* scroll region. */ tthue = CNONE; /* Color unknown. */ ttmove(0, 0); tteeop(); for (i=0; iv_color != vp2->v_color || vp1->v_hash != vp2->v_hash) break; uline(offs, vp1, vp2); ucopy(vp1, vp2); ++offs; } if (offs == nrow-1) { /* Might get it all. */ ttmove(currow, curcol); ttflush(); return; } size = nrow-1; /* Get bottom match. */ while (size != offs) { vp1 = vscreen[size-1]; vp2 = pscreen[size-1]; if (vp1->v_color != vp2->v_color || vp1->v_hash != vp2->v_hash) break; uline(size-1, vp1, vp2); ucopy(vp1, vp2); --size; } if ((size -= offs) == 0) /* Get screen size. */ panic("Illegal screen size in update"); setscores(offs, size); /* Do hard update. */ traceback(offs, size, size, size); for (i=0; iv_flag&VFCHG) != 0) { uline(i, vp1, vp2); ucopy(vp1, vp2); } } ttmove(currow, curcol); ttflush(); } /* * Update a saved copy of a line, * kept in a VIDEO structure. The "vvp" is * the one in the "vscreen". The "pvp" is the one * in the "pscreen". This is called to make the * virtual and physical screens the same when * display has done an update. */ static VOID ucopy(vvp, pvp) register VIDEO *vvp; register VIDEO *pvp; { vvp->v_flag &= ~VFCHG; /* Changes done. */ pvp->v_flag = vvp->v_flag; /* Update model. */ pvp->v_hash = vvp->v_hash; pvp->v_cost = vvp->v_cost; pvp->v_color = vvp->v_color; bcopy(vvp->v_text, pvp->v_text, ncol); #ifdef SS_SUPPORT bcopy(&vvp->v_sub(0), &pvp->v_sub(0), ncol); #endif } #if 0 /* updext: update the extended line which the cursor is currently * on at a column greater than the terminal width. The line * will be scrolled right or left to let the user see where * the cursor is */ static VOID updext(currow, curcol) int currow, curcol; { register LINE *lp; /* pointer to current line */ register int j; /* index into line */ /* calculate what column the left bound should be */ /* (force cursor into middle half of screen) */ lbound = curcol - (curcol % (ncol>>1)) - (ncol>>2); /* scan through the line outputing characters to the virtual screen */ /* once we reach the left edge */ vtmove(currow, -lbound); /* start scanning offscreen */ lp = curwp->w_dotp; /* line to output */ for (j=0; jv_text[0] = '$'; /* and put a '$' in column 1 */ } #endif /* * Update a single line. This routine only * uses basic functionality (no insert and delete character, * but erase to end of line). The "vvp" points at the VIDEO * structure for the line on the virtual screen, and the "pvp" * is the same for the physical screen. Avoid erase to end of * line when updating CMODE color lines, because of the way that * reverse video works on most terminals. */ static VOID uline(row, vvp, pvp) VIDEO *vvp; VIDEO *pvp; { #ifdef MEMMAP ttflush(); /* 90.06.09 by A.Shirahashi */ #ifdef SS_SUPPORT /* 92.11.21 by S.Sasaki */ putline(row+1, 1, &vvp->v_text[0], &vvp->v_sub(0), vvp->v_color); #else putline(row+1, 1, &vvp->v_text[0], vvp->v_color); #endif #else /* not MEMMAP */ register char *cp1; register char *cp2; register char *cp3; char *cp4; char *cp5; register int nbflag; #ifdef KANJI /* 90.01.29 by S.Yoshida */ register int kselect = FALSE; #ifdef SS_SUPPORT /* 92.11.21 by S.Sasaki */ char *ccp1, *ccp2, *ccp3, *ccp4; #endif /* SS_SUPPORT */ #endif /* KANJI */ if (vvp->v_color != pvp->v_color) { /* Wrong color, do a */ ttmove(row, 0); /* full redraw. */ #ifdef STANDOUT_GLITCH if (pvp->v_color != CTEXT && SG >= 0) tteeol(); #endif ttcolor(vvp->v_color); #ifdef STANDOUT_GLITCH cp1 = &vvp->v_text[SG > 0 ? SG : 0]; #ifdef SS_SUPPORT /* 92.11.21 by S.Sasaki */ ccp1 = &vvp->v_sub(SG > 0 ? SG : 0); #endif /* SS_SUPPORT */ /* the odd code for SG==0 is to avoid putting the invisable * glitch character on the next line. * (Hazeltine executive 80 model 30) */ cp2 = &vvp->v_text[ncol - (SG >= 0 ? (SG!=0 ? SG : 1) : 0)]; #else /* not STANDOUT_GLITCH */ cp1 = &vvp->v_text[0]; cp2 = &vvp->v_text[ncol]; #ifdef SS_SUPPORT /* 92.11.21 by S.Sasaki */ ccp1 = &vvp->v_sub(0); #endif /* SS_SUPPORT */ #endif /* STANDOUT_GLITCH */ while (cp1 != cp2) { #ifdef KANJI /* 90.01.29 by S.Yoshida */ kttputc(*cp1); #ifdef HANKANA /* 92.11.21 by S.Sasaki */ if ( ISHANKANA(*cp1) && *ccp1 != 0) kttputc(*ccp1); #endif #ifdef HOJO_KANJI if ( ISHOJO(cp1[0]) && ISHOJO(cp1[1]) && (cp1+1) != cp2 && ccp1[0] != 0 && ccp1[1] != 0) { kttputc(*ccp1); ++ccp1; ++cp1; ++ttcol; kttputc(*ccp1); } #endif #ifdef SS_SUPPORT ++ccp1; #endif /* SS_SUPPORT */ ++cp1; #else /* NOT KANJI */ ttputc(*cp1++); #endif /* KANJI */ ++ttcol; } #ifdef KANJI /* 90.01.29 by S.Yoshida */ kdselectcode(FALSE); #endif /* KANJI */ #ifndef MOVE_STANDOUT ttcolor(CTEXT); #endif ttflush(); /* 90.06.09 by A.Shirahashi */ return; } cp1 = &vvp->v_text[0]; /* Compute left match. */ cp2 = &pvp->v_text[0]; #ifdef SS_SUPPORT /* 92.11.21 by S.Sasaki */ ccp1 = &vvp->v_sub(0); ccp2 = &pvp->v_sub(0); #endif /* SS_SUPPORT */ while (cp1!=&vvp->v_text[ncol] && cp1[0]==cp2[0]) { #ifdef KANJI /* 90.01.29 by S.Yoshida */ if (!ISKANJI(cp1[0])) { /* Same ASCII char. */ ++cp1; ++cp2; #ifdef SS_SUPPORT /* 92.11.21 by S.Sasaki */ ++ccp1; ++ccp2; #endif /* SS_SUPPORT */ #ifdef SS_SUPPORT /* 92.11.21 by S.Sasaki */ } else if (( #ifdef HANKANA ISHANKANA(cp1[0]) || #endif #ifdef HOJO_KANJI ISHOJO(cp1[0]) || #endif 0) && ccp1[0] != 0 ) { if ( ccp1[0]==ccp2[0] ) { ++cp1; ++ccp1; ++cp2; ++ccp2; } else break; #endif /* SS_SUPPORT */ } else if (cp1[1] == cp2[1]) { /* Same KANJI char. */ #ifdef SS_SUPPORT /* 92.11.21 by S.Sasaki */ ccp1 += 2; ccp2 += 2; #endif /* SS_SUPPORT */ cp1 += 2; cp2 += 2; } else { /* Not same KANJI char. */ break; } #else /* NOT KANJI */ ++cp1; ++cp2; #endif /* KANJI */ } if (cp1 == &vvp->v_text[ncol]) { /* All equal. */ ttflush(); /* 90.06.09 by A.Shirahashi */ return; } nbflag = FALSE; cp3 = &vvp->v_text[ncol]; /* Compute right match. */ cp4 = &pvp->v_text[ncol]; #ifdef SS_SUPPORT /* 1999.09.07 by M.Suzuki */ ccp3 = cp3; ccp4 = cp4; #endif while (cp3[-1] == cp4[-1]) { #ifdef KANJI /* 90.01.29 by S.Yoshida */ if (!ISKANJI(cp3[-1])) { /* Same ASCII char. */ --cp3; --cp4; kselect = FALSE; #ifdef SS_SUPPORT /* 92.11.21 by S.Sasaki */ } else if (( #ifdef HANKANA ISHANKANA(cp3[-1]) || #endif #ifdef HOJO_KANJI ISHOJO(cp3[-1]) || #endif 0) && ccp3[-1] != 0 ) { if (ccp3[-1] == ccp4[-1]) { cp3--; ccp3--; cp4--; ccp4--; } else break; #endif /* SS_SUPPORT */ } else if (cp3[-2] == cp4[-2]) { /* Same KANJI char. */ #ifdef SS_SUPPORT /* 92.11.21 by S.Sasaki */ ccp3 -= 2; ccp4 -= 2; #endif /* SS_SUPPORT */ cp3 -= 2; cp4 -= 2; kselect = TRUE; } else { /* Not same KANJI char. */ break; } #else /* NOT KANJI */ --cp3; --cp4; #endif /* KANJI */ if (cp3[0] != ' ') /* Note non-blanks in */ nbflag = TRUE; /* the right match. */ } cp5 = cp3; /* Is erase good? */ if (nbflag==FALSE && vvp->v_color==CTEXT) { while (cp5!=cp1 && cp5[-1]==' ') --cp5; /* Alcyon hack */ if ((int)(cp3-cp5) <= tceeol) cp5 = cp3; } /* Alcyon hack */ ttmove(row, (int)(cp1-&vvp->v_text[0])); #ifdef STANDOUT_GLITCH if (vvp->v_color != CTEXT && SG > 0) { #ifdef SS_SUPPORT /* 92.11.21 by S.Sasaki */ if(cp1 < &vvp->v_text[SG]) { cp1 = &vvp->v_text[SG]; ccp1 = &vvp->v_sub(SG); } #else /* not SS_SUPPORT */ if(cp1 < &vvp->v_text[SG]) cp1 = &vvp->v_text[SG]; #endif /* SS_SUPPORT */ if(cp5 > &vvp->v_text[ncol-SG]) cp5 = &vvp->v_text[ncol-SG]; } else if (SG < 0) #endif ttcolor(vvp->v_color); while (cp1 != cp5) { #ifdef KANJI /* 90.01.29 by S.Yoshida */ kttputc(*cp1); #ifdef HANKANA /* 92.11.21 by S.Sasaki */ if (ISHANKANA(*cp1) && *ccp1 != 0) kttputc(*ccp1); #endif /* HANKANA */ #ifdef HOJO_KANJI if ( ISHOJO(cp1[0]) && ISHOJO(cp1[1]) && (cp1+1) != cp5 && ccp1[0] != 0 && ccp1[1] != 0) { kttputc(*ccp1); ++ccp1; ++cp1; ++ttcol; kttputc(*ccp1); } #endif #ifdef SS_SUPPORT ++ccp1; #endif /* SS_SUPPORT */ ++cp1; #else /* NOT KANJI */ ttputc(*cp1++); #endif /* KANJI */ ++ttcol; } #ifdef KANJI /* 90.01.29 by S.Yoshida */ kdselectcode(kselect); #endif /* KANJI */ if (cp5 != cp3) /* Do erase. */ tteeol(); #ifndef MOVE_STANDOUT /* 90.03.21 by S.Yoshida */ ttcolor(CTEXT); #endif ttflush(); /* 90.06.09 by A.Shirahashi */ #endif /* MEMMAP */ } /* * Redisplay the mode line for * the window pointed to by the "wp". * This is the only routine that has any idea * of how the modeline is formatted. You can * change the modeline format by hacking at * this routine. Called by "update" any time * there is a dirty window. * Note that if STANDOUT_GLITCH is defined, first and last SG characters * may never be seen. */ static VOID modeline(wp) register WINDOW *wp; { register int n; register BUFFER *bp; int mode; #ifdef CANNA extern char currentMode[]; extern char origMode[]; #endif n = wp->w_toprow+wp->w_ntrows; /* Location. */ vscreen[n]->v_color = CMODE; /* Mode line color. */ vscreen[n]->v_flag |= (VFCHG|VFHBAD); /* Recompute, display. */ vtmove(n, 0); /* Seek to right line. */ bp = wp->w_bufp; #ifdef CANNA if(bp->b_flag & BFCANNA){ if(bp == curbp) n += vtputs(currentMode); else n += vtputs(origMode); } else n += vtputs("[ -- ]"); #endif vtputc('-'); vtputc('-'); #ifdef READONLY /* 91.01.05 by S.Yoshida */ if ((bp->b_flag&BFRONLY) != 0) { /* "%" if read-only. */ vtputc('%'); vtputc('%'); } else #endif /* READONLY */ if ((bp->b_flag&BFCHG) != 0) { /* "*" if changed. */ vtputc('*'); vtputc('*'); } else { vtputc('-'); vtputc('-'); } vtputc('-'); n = 5; #ifdef KANJI /* 90.01.29 by S.Yoshida */ n += vtputs("Ng: "); #else /* NOT KANJI */ n += vtputs("Mg: "); #endif /* KANJI */ if (bp->b_bname[0] != '\0') n += vtputs(&(bp->b_bname[0])); while (n < 42) { /* Pad out with blanks */ vtputc(' '); ++n; } vtputc('('); ++n; #ifdef KANJI /* 90.01.29 by S.Yoshida */ /* 90.12.28 Move to here like as Nemacs 3.3. by S.Yoshida */ n += kdispbufcode(bp); /* Show KANJI code. */ #endif /* KANJI */ for (mode=0;;) { n += vtputs(bp->b_modes[mode]->p_name); if(++mode > bp->b_nmodes) break; vtputc('-'); ++n; } vtputc(')'); #ifdef ADDFUNC vtputc('-'); vtputc('-'); moderatio(wp); #endif vtmarkyen('-'); /* Pad out. */ } /* * Redisplay the mode line "raito" ONLY for * the window pointed to by the "wp". * This is the only routine that has any idea * of how the modeline is formatted. You can * change the modeline format by hacking at * this routine. Called by "update" any time * there is a dirty window. * Note that if STANDOUT_GLITCH is defined, first and last SG characters * may never be seen. */ static VOID moderatio(wp) register WINDOW *wp; { register int n; register BUFFER *bp; int mode, l; extern int line_number_mode; /* Defined in basic.c */ l = wp->w_toprow+wp->w_ntrows; /* Location. */ vscreen[l]->v_color = CMODE; /* Mode line color. */ vscreen[l]->v_flag |= (VFCHG|VFHBAD); /* Recompute, display. */ bp = wp->w_bufp; #ifdef CANNA n = 46 + 6; #else n = 46; #endif #ifdef KANJI /* 90.01.29 by S.Yoshida */ /* 90.12.28 Move to here like as Nemacs 3.3. by S.Yoshida */ n += 4; /* Show KANJI code. */ #endif /* KANJI */ for (mode=0;;) { /* skip mode names */ n += strlen(bp->b_modes[mode]->p_name); if (++mode > bp->b_nmodes) break; ++n; } vtmove(l, n); /* Seek to right line. */ if (line_number_mode) { extern int get_lineno pro((BUFFER*, LINE*)); char linestr[NINPUT]; /* XXX now, support only 32bit int */ sprintf(linestr, "L%d", get_lineno(bp, wp->w_dotp)+1); vtputs(linestr); } { extern int windowpos pro((WINDOW *)); int ratio = windowpos(wp); vtputc('-'); vtputc('-'); switch (ratio) { case MG_RATIO_ALL: vtputs("All"); break; case MG_RATIO_TOP: vtputs("Top"); break; case MG_RATIO_BOT: vtputs("Bot"); break; default: if ((ratio / 10) == 0) { vtputc(' '); } else { vtputc('0' + (ratio / 10)); } vtputc('0' + (ratio % 10)); vtputc('%'); } vtputc('-');vtputc('-'); } } /* * output a string to the mode line, report how long it was. */ vtputs(s) register char *s; { register int n = 0; while (*s != '\0') { vtputc(*s++); ++n; } return n; } #ifdef GOSLING /* * Compute the hash code for * the line pointed to by the "vp". Recompute * it if necessary. Also set the approximate redisplay * cost. The validity of the hash code is marked by * a flag bit. The cost understand the advantages * of erase to end of line. Tuned for the VAX * by Bob McNamara; better than it used to be on * just about any machine. */ static VOID hash(vp) register VIDEO *vp; { register int i; register int n; register char *s; if ((vp->v_flag&VFHBAD) != 0) { /* Hash bad. */ s = &vp->v_text[ncol-1]; for (i=ncol; i!=0; --i, --s) if (*s != ' ') break; n = ncol-i; /* Erase cheaper? */ if (n > tceeol) n = tceeol; vp->v_cost = i+n; /* Bytes + blanks. */ for (n=0; i!=0; --i, --s) n = (n<<5) + n + *s; vp->v_hash = n; /* Hash code. */ vp->v_flag &= ~VFHBAD; /* Flag as all done. */ } } /* * Compute the Insert-Delete * cost matrix. The dynamic programming algorithm * described by James Gosling is used. This code assumes * that the line above the echo line is the last line involved * in the scroll region. This is easy to arrange on the VT100 * because of the scrolling region. The "offs" is the origin 0 * offset of the first row in the virtual/physical screen that * is being updated; the "size" is the length of the chunk of * screen being updated. For a full screen update, use offs=0 * and size=nrow-1. * * Older versions of this code implemented the score matrix by * a two dimensional array of SCORE nodes. This put all kinds of * multiply instructions in the code! This version is written to * use a linear array and pointers, and contains no multiplication * at all. The code has been carefully looked at on the VAX, with * only marginal checking on other machines for efficiency. In * fact, this has been tuned twice! Bob McNamara tuned it even * more for the VAX, which is a big issue for him because of * the 66 line X displays. * * On some machines, replacing the "for (i=1; i<=size; ++i)" with * i = 1; do { } while (++i <=size)" will make the code quite a * bit better; but it looks ugly. */ static VOID setscores(offs, size) { register SCORE *sp; SCORE *sp1; register int tempcost; register int bestcost; register int j; register int i; register VIDEO **vp; VIDEO **pp, **vbase, **pbase; vbase = &vscreen[offs-1]; /* By hand CSE's. */ pbase = &pscreen[offs-1]; score[0].s_itrace = 0; /* [0, 0] */ score[0].s_jtrace = 0; score[0].s_cost = 0; sp = &score[1]; /* Row 0, inserts. */ tempcost = 0; vp = &vbase[1]; for (j=1; j<=size; ++j) { sp->s_itrace = 0; sp->s_jtrace = j-1; tempcost += tcinsl; tempcost += (*vp)->v_cost; sp->s_cost = tempcost; ++vp; ++sp; } sp = &score[vnrow]; /* Column 0, deletes. */ tempcost = 0; for (i=1; i<=size; ++i) { sp->s_itrace = i-1; sp->s_jtrace = 0; tempcost += tcdell; sp->s_cost = tempcost; sp += vnrow; } sp1 = &score[vnrow+1]; /* [1, 1]. */ pp = &pbase[1]; for (i=1; i<=size; ++i) { sp = sp1; vp = &vbase[1]; for (j=1; j<=size; ++j) { sp->s_itrace = i-1; sp->s_jtrace = j; bestcost = (sp-vnrow)->s_cost; if (j != size) /* Cd(A[i])=0 @ Dis. */ bestcost += tcdell; tempcost = (sp-1)->s_cost; tempcost += (*vp)->v_cost; if (i != size) /* Ci(B[j])=0 @ Dsj. */ tempcost += tcinsl; if (tempcost < bestcost) { sp->s_itrace = i; sp->s_jtrace = j-1; bestcost = tempcost; } tempcost = (sp-vnrow-1)->s_cost; if ((*pp)->v_color != (*vp)->v_color || (*pp)->v_hash != (*vp)->v_hash) tempcost += (*vp)->v_cost; if (tempcost < bestcost) { sp->s_itrace = i-1; sp->s_jtrace = j-1; bestcost = tempcost; } sp->s_cost = bestcost; ++sp; /* Next column. */ ++vp; } ++pp; sp1 += vnrow; /* Next row. */ } } /* * Trace back through the dynamic programming cost * matrix, and update the screen using an optimal sequence * of redraws, insert lines, and delete lines. The "offs" is * the origin 0 offset of the chunk of the screen we are about to * update. The "i" and "j" are always started in the lower right * corner of the matrix, and imply the size of the screen. * A full screen traceback is called with offs=0 and i=j=nrow-1. * There is some do-it-yourself double subscripting here, * which is acceptable because this routine is much less compute * intensive then the code that builds the score matrix! */ static VOID traceback(offs, size, i, j) { register int itrace; register int jtrace; register int k; register int ninsl; register int ndraw; register int ndell; if (i==0 && j==0) /* End of update. */ return; itrace = score[(vnrow*i) + j].s_itrace; jtrace = score[(vnrow*i) + j].s_jtrace; if (itrace == i) { /* [i, j-1] */ ninsl = 0; /* Collect inserts. */ if (i != size) ninsl = 1; ndraw = 1; while (itrace!=0 || jtrace!=0) { if (score[(vnrow*itrace) + jtrace].s_itrace != itrace) break; jtrace = score[(vnrow*itrace) + jtrace].s_jtrace; if (i != size) ++ninsl; ++ndraw; } traceback(offs, size, itrace, jtrace); if (ninsl != 0) { ttcolor(CTEXT); ttinsl(offs+j-ninsl, offs+size-1, ninsl); } do { /* B[j], A[j] blank. */ k = offs+j-ndraw; uline(k, vscreen[k], blanks); } while (--ndraw); return; } if (jtrace == j) { /* [i-1, j] */ ndell = 0; /* Collect deletes. */ if (j != size) ndell = 1; while (itrace!=0 || jtrace!=0) { if (score[(nrow*itrace) + jtrace].s_jtrace != jtrace) break; itrace = score[(vnrow*itrace) + jtrace].s_itrace; if (j != size) ++ndell; } if (ndell != 0) { ttcolor(CTEXT); ttdell(offs+i-ndell, offs+size-1, ndell); } traceback(offs, size, itrace, jtrace); return; } traceback(offs, size, itrace, jtrace); k = offs+j-1; uline(k, vscreen[k], pscreen[offs+i-1]); } #endif ng-1.5beta1/dot.ng100644 1750 1750 3100 7126003715 12560 0ustar amurausers; $Id: dot.ng,v 1.1.1.1 2000/06/27 01:47:57 amura Exp $ ; ; Ng startup file by H.Ohkubo ; ; 矢印キーでカーソル移動できるようにする ;(global-unset-key "\^[[" 'backward-paragraph) ;(global-set-key "\^[[A" 'previous-line) ;(global-set-key "\^[[B" 'next-line) ;(global-set-key "\^[[C" 'forward-char) ;(global-set-key "\^[[D" 'backward-char) ; 矢印キーでカーソル移動できるようにする (global-set-key "\^[OA" 'previous-line) (global-set-key "\^[OB" 'next-line) (global-set-key "\^[OC" 'forward-char) (global-set-key "\^[OD" 'backward-char) ; ; for No Backup files ;(make-backup-files nil) ; backspace <-> ^H (bsmap-mode) ; set-mark-command to ^\ ;(global-set-key "\^\\" 'set-mark-command) ; set-fep-toggle to ^\ ;(global-set-key "\^\\" 'fep-toggle) ; ;漢字コード自動認識、デフォルトはEUC (set-kanji-expected-code nil) (set-default-fileio-code 'euc) ;(set-kanji-fileio-code 'euc) ; ; c-mode setting (set-c-argdecl-indent 0) (set-c-continued-statement-offset 4) (set-c-continued-brace-offset -4) (set-c-brace-offset -4) (set-c-brace-imaginary-offset 0) (set-c-indent-level 4) (set-c-label-offset -2) (set-c-tab-always-indent t) ; ; set regular-exp. re-search (global-set-key "\^[\^s" 're-search-forward) (global-set-key "\^[\^r" 're-search-backward) ; ; setting for SKG ;(set-skg-roman-dictionary "/home/anonymous/etc/SKG-ROMAN") ;(set-skg-kanji-dictionary "/home/anonymous/etc/SKG-JISYO") ; ; other setting (global-set-key "\^[g" 'goto-line) (set-fill-column 66) (global-set-key ")" 'blink-matching-paren-hack) (global-set-key "}" 'blink-matching-paren-hack) (global-set-key "]" 'blink-matching-paren-hack) ng-1.5beta1/echo.c100600 1750 1750 172105 7630421541 12573 0ustar amurausers/* $Id: echo.c,v 1.8.2.1 2003/03/02 15:29:37 amura Exp $ */ /* * Echo line reading and writing. * * Common routines for reading * and writing characters in the echo line area * of the display screen. Used by the entire * known universe. */ /* * The varargs lint directive comments are 0 an attempt to get lint to shup * up about CORRECT usage of varargs.h. It won't. */ /* * $Log: echo.c,v $ * Revision 1.8.2.1 2003/03/02 15:29:37 amura * add minibuffer history (thanks to kakugawa) * * Revision 1.8 2001/01/05 14:07:01 amura * first implementation of Hojo Kanji support * * Revision 1.7 2000/11/19 18:15:11 amura * rename sput?() functions because HP-UX have sputl() function * in its library * * Revision 1.6 2000/07/18 12:38:56 amura * remove some compile warning * * Revision 1.5 2000/06/27 01:49:43 amura * import to CVS * * Revision 1.4 2000/06/04 06:21:47 amura * To be able to compile without KANJI * * Revision 1.3 2000/06/01 05:26:18 amura * Debug CANNA support * * Revision 1.2 2000/03/28 02:38:37 amura * CANNA support. * , * * Revision 1.1 2000/03/10 21:32:52 amura * Initial revision * */ /* 90.01.29 Modified for Ng 1.0 by S.Yoshida */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include "def.h" #include "key.h" #ifdef SUPPORT_ANSI # include #else /* !SUPPPORT_ANSI */ # ifdef LOCAL_VARARGS # include "varargs.h" # else # include # endif #endif /* SUPPORT_ANSI */ #ifndef NO_MACRO # include "macro.h" #endif static int veread(); #ifdef SUPPORT_ANSI VOID ewprintf(char *fp, ...); int message(char *fp,...); #else VOID ewprintf(); int message(); #endif static VOID eformat pro((register char *fp, register va_list *ap)); static VOID eputi(); static VOID eputl(); static VOID eputs(); static VOID eputc(); #ifndef NEW_COMPLETE /* 90.12.10 Sawayanagi Yosirou */ static int complt(); #endif /* NEW_COMPLETE */ #ifdef ADDFUNC /* 91.01.16 by S.Yoshida */ int earg_exist = FALSE; /* Extra argument existing flag. */ char *earg_text; /* Extra argument text body. */ /* * Set extra argument using in veread(). */ VOID eargset(earg) char *earg; { earg_exist = TRUE; earg_text = earg; } #endif /* ADDFUNC */ #ifdef EXTD_DIR static char *edef_text; /* Default argument text body */ /* * Set extra argument using in veread(). */ VOID edefset(earg) char *earg; { edef_text = earg; } #endif /* EXTD_DIR */ int epresf = FALSE; /* Stuff in echo line flag. */ /* * Erase the echo line. */ VOID eerase() { ttcolor(CTEXT); ttmove(nrow-1, 0); tteeol(); ttflush(); epresf = FALSE; } /* * Ask "yes" or "no" question. * Return ABORT if the user answers the question * with the abort ("^G") character. Return FALSE * for "no" and TRUE for "yes". No formatting * services are available. No newline required. */ eyorn(sp) char *sp; { register int s; #ifndef NO_MACRO if(inmacro) return TRUE; #endif ewprintf("%s? (y or n) ", sp); #ifdef FEPCTRL /* 90.11.26 by K.Takano */ fepmode_off(); #endif for (;;) { s = getkey(FALSE); if (s == 'y' || s == 'Y') return TRUE; if (s == 'n' || s == 'N') return FALSE; if (s == CCHR('[') || s == CCHR('G')) return ctrlg(FFRAND, 1); ewprintf("Please answer y or n. %s? (y or n) ", sp); } /*NOTREACHED*/ } /* * Like eyorn, but for more important question. User must type either all of * "yes" or "no", and the trainling newline. */ eyesno(sp) char *sp; { register int s; char buf[64]; #ifndef NO_MACRO if(inmacro) return TRUE; #endif s = ereply("%s? (yes or no) ", buf, sizeof(buf), sp); for (;;) { if (s == ABORT) return ABORT; if (s != FALSE) { #ifndef NO_MACRO if (macrodef) { LINE *lp = maclcur; maclcur = lp->l_bp; maclcur->l_fp = lp->l_fp; free((char *)lp); } #endif if ((buf[0] == 'y' || buf[0] == 'Y') && (buf[1] == 'e' || buf[1] == 'E') && (buf[2] == 's' || buf[2] == 'S') && (buf[3] == '\0')) return TRUE; if ((buf[0] == 'n' || buf[0] == 'N') && (buf[1] == 'o' || buf[0] == 'O') && (buf[2] == '\0')) return FALSE; } #ifdef notyet message("Please answer yes or no."); ttwait(); s = ereply("%s? (yes or no) ", buf, sizeof(buf), sp); #else s = ereply("Please answer yes or no. %s? (yes or no) ", buf, sizeof(buf), sp); #endif } /*NOTREACHED*/ } /* * Write out a prompt, and read back a * reply. The prompt is now written out with full "ewprintf" * formatting, although the arguments are in a rather strange * place. This is always a new message, there is no auto * completion, and the return is echoed as such. */ /*VARARGS 0*/ #ifdef SUPPORT_ANSI int ereply(char *fp, char *buf, int nbuf, ... ) { int i; va_list pvar; va_start(pvar, nbuf) ; i = veread(fp, buf, nbuf, EFNEW|EFCR, &pvar) ; va_end(pvar) ; return i; } #else /* SUPPORT_ANSI */ ereply(va_alist) va_dcl { va_list pvar; register char *fp, *buf; register int nbuf; register int i; va_start(pvar); fp = va_arg(pvar, char *); buf = va_arg(pvar, char *); nbuf = va_arg(pvar, int); i = veread(fp, buf, nbuf, EFNEW|EFCR, &pvar); va_end(pvar); return i; } #endif /* SUPPORT_ANSI */ /* * This is the general "read input from the * echo line" routine. The basic idea is that the prompt * string "prompt" is written to the echo line, and a one * line reply is read back into the supplied "buf" (with * maximum length "len"). The "flag" contains EFNEW (a * new prompt), an EFFUNC (autocomplete), or EFCR (echo * the carriage return as CR). */ /* VARARGS 0 */ #ifdef SUPPORT_ANSI int eread(char *fp, char *buf, int nbuf, int flag, ...) { int i; va_list pvar; va_start(pvar, flag); i = veread(fp, buf, nbuf, flag, &pvar); va_end(pvar) ; return i; } #else /* SUPPORT_ANSI */ eread(va_alist) va_dcl { va_list pvar; char *fp, *buf; int nbuf, flag, i; va_start(pvar); fp = va_arg(pvar, char *); buf = va_arg(pvar, char *); nbuf = va_arg(pvar, int); flag = va_arg(pvar, int); i = veread(fp, buf, nbuf, flag, &pvar); va_end(pvar); return i; } #endif /* SUPPORT_ANSI */ #ifdef NEW_COMPLETE /* 90.12.10 Sawayanagi Yosirou */ #include "complt.h" #ifdef MINIBUF_EDIT /* Minibuffer hack from NGSCM by H.Kakugawa */ #define MB_NHISTS 10 #define MB_HIST_FUNC 0 #define MB_HIST_BUF 1 #define MB_HIST_FILE 2 #define MB_HIST_MISC 3 #define MB_HIST_NTYPES 4 /* Note: mb_hist_buf[*][0] plays a special role. */ static char *mb_hist_buf[MB_HIST_NTYPES][MB_NHISTS+1]; #define mb_get_hist_buf(flag) \ (((flag)&EFFUNC) ? mb_hist_buf[MB_HIST_FUNC] : \ (((flag)&EFBUF) ? mb_hist_buf[MB_HIST_BUF] : \ (((flag)&EFFILE) ? mb_hist_buf[MB_HIST_FILE] : \ mb_hist_buf[MB_HIST_MISC]))) \ extern int refresh(); static int mb_init(); static int mb_get_buffer(); static int mb_bufsize(); static int mb_pointchar(); static int mb_pointoverwrite(); static int mb_point(); static int mb_iseol(); static int mb_isbol(); static int mb_isword(); static int mb_gotochar(); static int mb2_gotochar(); static int mb_insert(); static int mb2_insert(); static int mb_insertstr(); static VOID mb_insertcmplmsg(); static int mb2_insertcmplmsg(); static int mb_delcmplmsg(); static int mb_appenddiff(); static int mb2_appenddiff(); static int mb_delc(); static int mb2_delc(); static int mb_erasec(); static int mb2_erasec(); static int mb_killw(); static int mb_delw(); static int mb_forwc(); static int mb_backwc(); static int mb2_forwc(); static int mb2_backwc(); static int mb_forww(); static int mb_backww(); static int mb_begl(); static int mb_endl(); static int mb_upw(); static int mb_downw(); static int mb_cancel(); static int mb2_cancel(); static int mb_kill(); static int mb_yank(); static int mb_trans(); static int mb_matchparen(); static int mb_col(); static int mb_putchar(); static VOID mb_move(); static VOID mb_movech(); static int mb_fixlines(); static VOID mb_redisplay(); static VOID mb_refresh(); static VOID mb_flush(); static VOID mb_hist_save(); static char* sformat(); static int s_put_i(); static int s_put_l(); static int s_put_s(); static int s_put_c(); static VOID chsize(); static VOID chsize2(); #ifdef CANNA #include #define CANBUF 1024 extern jrKanjiStatus ks; static int mb_henkan(); char mbMode[CANBUF]; int mb_cannamode; #endif #ifdef CLIPBOARD extern int send_clipboard(); extern int receive_clipboard(); #endif static int veread_complete(); static int veread(fp, buf, nbuf, flag, ap) char *fp; char *buf; int nbuf; int flag; va_list *ap; { int MetaPrefix, CtluPrefix, nargs, cmp_msg_len, sign, ctluf; int c; char **hist_buf; int hist_idx; #ifdef ADDFUNC /* If an extra argument exists, use it. */ /* This is a very easy way of not getting an argument from */ /* the keyboard. */ if(earg_exist) { strcpy(buf, earg_text); earg_exist = FALSE; #ifdef EXTD_DIR edef_text = NULL; #endif return (TRUE); } #endif /* ADDFUNC */ #ifndef NO_MACRO if(inmacro) { bcopy (maclcur->l_text, buf, maclcur->l_used); buf[maclcur->l_used] = '\0'; maclcur = maclcur->l_fp; #ifdef EXTD_DIR edef_text = NULL; #endif return (TRUE); } #endif mb_init(nbuf, fp, ap); cmp_msg_len = 0; MetaPrefix = 0; CtluPrefix = 0; nargs = 1; sign = 1; ctluf = 0; #ifdef CANNA mb_cannamode = FALSE; mbMode[0] = '\0'; #endif hist_buf = mb_get_hist_buf(flag); hist_buf[0] = buf; hist_idx = 0; for (;;){ ttflush(); lastflag = thisflag; thisflag = 0; c = getkey(FALSE); #ifdef CANNA if(mb_cannamode && (ks.length != 0 || !(c==' '||ISCTRL(c)||ISKANJI(c))) ){ if (mb_henkan(c)) continue; } #endif if (CtluPrefix == 1){ switch (c){ case CCHR('G'): nargs = 1; sign = 1; ctluf = 0; CtluPrefix = 0; thisflag = lastflag; continue; break; case CCHR('U'): if (ctluf == 0){ ctluf = 1; nargs = 4; sign = 1; } else nargs *= 4; break; case '0':case '1':case '2':case '3':case '4': case '5':case '6':case '7':case '8':case '9': if (ctluf == 1){ nargs = (c - '0'); ctluf = 0; } else { nargs = (10*nargs + (c - '0')); } break; case '-': if (ctluf == 1){ sign = -1; ctluf = 0; nargs = 0; break; } else { hist_buf[0] = NULL; /* reset top of history */ return (ABORT); } default: goto Cmd; } thisflag = lastflag; continue; } Cmd: nargs = sign * nargs; CtluPrefix = 0; if (MetaPrefix == 1){ switch (c){ case CCHR('G'): /* Espace from Meta prefix */ break; case '<': /* Beginning of Line */ mb_begl(); break; case '>': /* End of Line */ mb_endl(); break; case 'B': case 'b': /* Backword word */ mb_backww(nargs); break; case 'F': case 'f': /* Forward word */ mb_forww(nargs); break; case 'D': case 'd': /* Delete word */ if ((lastflag&CFKILL) == 0) kdelete(); thisflag |= CFKILL; mb_delw(nargs); break; case 'u': case 'U': /* Upcase word */ mb_upw(nargs); break; case 'l': case 'L': /* Downcase word */ mb_downw(nargs); break; case CCHR('V'): /* Scroll down completion window */ if (nargs > 0) while (nargs-- > 0) complete_scroll_down(); else while (nargs++ < 0) complete_scroll_up(); break; case 'p': case 'P': /* History, prev */ if (hist_idx < MB_NHISTS && hist_buf[hist_idx+1] != NULL) { if (hist_idx == 0) mb_get_buffer(buf, nbuf); hist_idx++; mb_begl(); mb_kill(); mb_insertstr(hist_buf[hist_idx]); mb_begl(); } else { message("Beginning of history; no preceding item"); ttwait(); } mb_redisplay(); break; case 'n': case 'N': /* History, next */ if (hist_buf[1] == NULL) { message("End of history; no default available"); ttwait(); } else if (hist_idx == 0) { message("End of history; no next item"); ttwait(); } else { hist_idx--; mb_begl(); mb_kill(); mb_insertstr(hist_buf[hist_idx]); mb_begl(); } mb_redisplay(); break; default: ttbeep(); } MetaPrefix = 0; } else { switch (c){ case CCHR('['): /* META prefix */ MetaPrefix = 1; thisflag = lastflag; continue; case CCHR('U'): /* Ctl-U prefix */ CtluPrefix = 1; nargs = 4; ctluf = 1; sign = 1; thisflag = lastflag; continue; case ' ': case CCHR('I'): /* SPC/TAB, or completion */ if (flag & EFAUTO) cmp_msg_len = veread_complete(buf, nbuf, c, flag); else mb_insert(1, (char) c); break; case CCHR('J'): /* End of input */ c = CCHR('M'); case CCHR('M'): /* Return, done. */ mb_get_buffer(buf, nbuf); if (flag & EFFUNC){ int matchnum; matchnum = complete(buf, flag); if (matchnum != COMPLT_SOLE && matchnum != COMPLT_NOT_UNIQUE){ /* complete() will be called again, but i don't mind it */ cmp_msg_len = veread_complete(buf, nbuf, (int)CCHR('I'), flag); break; } } complete_del_list(); if (flag & EFCR){ ttputc(CCHR('M')); ttflush (); } hist_buf[0] = NULL; /* reset top of history */ #ifndef NO_MACRO if (macrodef){ LINE *lp; if((lp = lalloc(mb_bufsize())) == NULL) return FALSE; lp->l_fp = maclcur->l_fp; maclcur->l_fp = lp; lp->l_bp = maclcur; maclcur = lp; bcopy(buf, lp->l_text, mb_bufsize()); } #endif if (mb_bufsize() == 0) return FALSE; mb_hist_save(hist_buf, buf); return TRUE; case CCHR('G'): /* Abort */ (VOID) ctrlg(FFRAND, 0); mb_flush(); complete_del_list(); hist_buf[0] = NULL; /* reset top of history */ return (ABORT); case CCHR('A'): /* Beginning of line */ mb_begl(); break; case CCHR('B'): /* Backword char */ mb_backwc(nargs); break; case CCHR('D'): /* Delete */ mb_delc(nargs); break; case CCHR('E'): /* End of line */ mb_endl(); break; case CCHR('F'): /* Forward char */ mb_forwc(nargs); break; case CCHR('H'): case CCHR('?'): /* Rubout, erase */ mb_erasec(nargs); break; case CCHR('K'): /* Kill after point */ if ((lastflag&CFKILL) == 0) kdelete(); thisflag |= CFKILL; mb_kill(); break; case CCHR('L'): /* redraw */ refresh(FFRAND, 0); update(); mb_redisplay(); break; case CCHR('N'): /* Scroll down completion window */ if (nargs > 0) while (nargs-- > 0) complete_scroll_down(); else while (nargs++ < 0) complete_scroll_up(); break; case CCHR('P'): /* Scroll up completion window */ if (nargs > 0) while (nargs-- > 0) complete_scroll_up(); else while (nargs++ < 0) complete_scroll_down(); break; case CCHR('T'): /* Transpose char */ mb_trans(nargs); break; case CCHR('W'): /* Kill a word around point */ mb_killw(nargs); break; case CCHR('X'): /* Kill line */ mb_cancel(); break; case CCHR('Y'): /* Yank */ mb_yank(nargs); break; case ')': mb_matchparen(nargs, '(', ')'); break; case ']': mb_matchparen(nargs, '[', ']'); break; case '}': mb_matchparen(nargs, '{', '}'); break; case CCHR('\\'): #ifdef CANNA case CCHR('O'): mb_cannamode = mb_cannamode ? FALSE : TRUE; if (!mb_cannamode) mbMode[0] = '\0'; break; #endif case CCHR('Q'): /* Quote next */ c = getkey(FALSE); default: /* All the rest */ if (mb_insert(nargs, (char) c) < 0) break; } } nargs = 1; ctluf = 0; sign = 1; } } static int veread_complete(buf, nbuf, c, flag) char *buf; int nbuf, c, flag; { int matchnum, wflag; mb_endl(); wflag = (c == ' '); if (wflag){ mb2_insert(1, ' '); mb_get_buffer(buf, nbuf); if (complete(buf, flag) == COMPLT_NO_MATCH){ mb2_erasec(1); } else { mb_appenddiff(buf); return 0; } } mb_get_buffer(buf, nbuf); matchnum = complete(buf, flag); mb_appenddiff(buf); if (wflag){ if (matchnum == COMPLT_AMBIGUOUS || matchnum == COMPLT_NOT_UNIQUE) complete_list_names(buf, flag); else if (matchnum == COMPLT_NO_MATCH) { mb_insertcmplmsg(complete_message(matchnum)); ttwait(); mb_delcmplmsg(); } } else { if (matchnum == COMPLT_AMBIGUOUS) complete_list_names(buf, flag); else { mb_insertcmplmsg(complete_message(matchnum)); ttwait(); mb_delcmplmsg(); } } return 0; } /*VARARGS 0*/ #ifdef SUPPORT_ANSI int message(char *fp,...) { va_list pvar; va_start(pvar, fp); ewprintf(fp); va_end(pvar); return 0; } #else int message(va_alist) va_dcl { va_list pvar; register char *fp; va_start(pvar); fp = va_arg(pvar, char *); ewprintf(fp); va_end(pvar); return 0; } #endif /* SUPPORT_ANSI */ struct _Line { int idx; int lno; struct _Line *prev; struct _Line *next; }; static int _mb_ccol; static int _mb_crow; static char *_mb_buf = NULL; static int _mb_size = 0; static int _mb_point = 0; static int _mb_gapend = 0; static int _mb_prompt = 0; static int _mb_bufsize = 0; struct _Line Line = {0, 0, NULL, NULL}; struct _Line *CLine; static int mb_init(nbuf, fp, ap) int nbuf; register char *fp; register va_list *ap; { char *prompt; struct _Line *lp, *lp2; char *sformat(); prompt = sformat(fp, ap); if (_mb_buf == NULL){ _mb_size = nbuf + strlen(prompt) + 10; if ((_mb_buf = malloc(_mb_size)) == NULL) return -1; } if (ttrow != nrow - 1){ ttcolor(CTEXT); epresf = TRUE; } _mb_ccol = 0; _mb_crow = nrow-1; _mb_prompt = 0; _mb_point = 0; _mb_gapend = _mb_size; _mb_bufsize = 0; if (Line.next != NULL){ lp = Line.next; while (lp != &Line){ lp2 = lp->next; free(lp); lp = lp2; } Line.prev = NULL; Line.next = NULL; } if ((lp = (struct _Line*) malloc(sizeof(struct _Line))) == NULL) return 0; Line.prev = lp; Line.next = lp; lp->idx = 0; lp->lno = 1; lp->prev = &Line; lp->next = &Line; CLine = lp; mb_insertstr(prompt); _mb_prompt = strlen(prompt); free(prompt); #ifdef EXTD_DIR if (edef_text) { mb_insertstr(edef_text); edef_text = NULL; } #endif return 0; } static int mb_get_buffer(buf, nbuf) char *buf; int nbuf; { register int i, j; j = 0; for (i = _mb_prompt; i < _mb_point;){ if (j >= nbuf-1){ #ifdef KANJI if (ISKANJI(_mb_buf[i])) { #ifdef HOJO_KANJI if (i>=1 && ISHOJO(_mb_buf[i-1])) buf[j-2] = '\0'; else #endif buf[j-1] = '\0'; } else #endif /* KANJI */ buf[j] = '\0'; return 0; } buf[j++] = _mb_buf[i++]; } for (i = _mb_gapend; i < _mb_size;){ if (j >= nbuf-1){ #ifdef KANJI if (ISKANJI(_mb_buf[i])) { #ifdef HOJO_KANJI if (i>=1 && ISHOJO(_mb_buf[i-1])) buf[j-2] = '\0'; else #endif buf[j-1] = '\0'; } else #endif buf[j] = '\0'; return 0; } buf[j++] = _mb_buf[i++]; } buf[j] = '\0'; return mb_bufsize(); } static int mb_bufsize() { return _mb_bufsize-_mb_prompt; } static int mb_pointchar() { unsigned int ch; ch = _mb_buf[_mb_point-1]; return ch; } static int mb_pointoverwrite(ch) unsigned int ch; { _mb_buf[_mb_point-1] = ch; return ch; } static int mb_point() { return _mb_point; } static int mb_iseol() { return (_mb_gapend == _mb_size); } static int mb_isbol() { return (_mb_point == _mb_prompt); } static int mb_isword() { return ISWORD(_mb_buf[_mb_gapend]); } static int mb_gotochar(i) int i; { int col, pt, ocol, opt; struct _Line *lp; if (i == _mb_point) return mb_point(); ocol = _mb_ccol; opt = _mb_point; lp = CLine; mb2_gotochar(i); if (i < opt) mb_fixlines(0, Line.next, 0, &col, &pt); else mb_fixlines(ocol, lp, opt, &col, &pt); if (lp == CLine) ttmove(_mb_crow, _mb_ccol); else mb_refresh(col, pt); return mb_point(); } static int mb2_gotochar(i) int i; { if (i != _mb_point) mb_move(i-_mb_point); return mb_point(); } static int mb_insert(n, c) int n; char c; { int col, pt, ocol, opt; #ifdef KANJI static int k1 = 0, nnn; #ifdef HOJO_KANJI static int k2 = 0; #endif #endif struct _Line *lp; #ifndef KANJI if (n < 0) return -1; ocol = _mb_ccol; opt = _mb_point; lp = CLine; mb2_insert(n, c); mb_fixlines(ocol, lp, opt, &col, &pt); mb_refresh(col, pt); #else /* KANJI is TRUE */ if (k1 == 0){ if (n < 0) return -1; if (ISKANJI(c)){ k1 = c; nnn = n; } else { ocol = _mb_ccol; opt = _mb_point; lp = CLine; mb2_insert(n, c); mb_fixlines(ocol, lp, opt, &col, &pt); mb_refresh(col, pt); } #ifdef HOJO_KANJI } else if (ISHOJO(k1) && k2 == 0) { if (ISKANJI(c)) { k2 = c; nnn = n; } else { ocol = _mb_ccol; opt = _mb_point; lp = CLine; mb2_insert(n, c); mb_fixlines(ocol, lp, opt, &col, &pt); mb_refresh(col, pt); } #endif /* HOJO_KANJI */ } else { ocol = _mb_ccol; opt = _mb_point; lp = CLine; while (nnn-- > 0){ mb2_insert(1, k1); #ifdef HOJO_KANJI if (k2 != 0) mb2_insert(1, k2); #endif mb2_insert(1, c); } mb_fixlines(ocol, lp, opt, &col, &pt); mb_refresh(col, pt); k1 = 0; #ifdef HOJO_KANJI k2 = 0; #endif } #endif /* NOT KANJI */ return 0; } static int mb2_insert(n, c) int n; char c; { if (n < 0) return -1; while (n-- > 0) mb_putchar(c); return mb_point(); } static int mb_insertstr(s) char *s; { int col, pt, ocol, opt; struct _Line *lp; if (*s == '\0') return 0; ocol = _mb_ccol; opt = _mb_point; lp = CLine; while (*s != '\0') mb_putchar(*(s++)); if (mb_fixlines(ocol, lp, opt, &col, &pt) == 0) mb_refresh(ocol, opt); else mb_refresh(col, pt); return mb_point(); } static _mb_cmpl_msg_len = 0; static VOID mb_insertcmplmsg(s) char *s; { int pt, col; mb2_insertcmplmsg(s); mb_fixlines(_mb_ccol, CLine, _mb_point, &col, &pt); mb_refresh(_mb_ccol, _mb_point); } static int mb2_insertcmplmsg(s) char *s; { int pt; _mb_cmpl_msg_len = strlen(s); pt = mb_point(); while (*s != '\0') mb_putchar(*(s++)); mb2_gotochar(pt); return pt; } static int mb_delcmplmsg() { int col, pt; struct _Line *lp; if (_mb_cmpl_msg_len == 0) return 0; _mb_gapend += _mb_cmpl_msg_len; _mb_bufsize -= _mb_cmpl_msg_len; _mb_cmpl_msg_len = 0; lp = CLine; mb_fixlines(_mb_ccol, CLine, _mb_point, &col, &pt); if (lp == CLine) tteeol(); else mb_refresh(col, pt); _mb_cmpl_msg_len = 0; return mb_point(); } static int mb_appenddiff(buf) char *buf; { int ocol, opt, col, pt; struct _Line *lp; ocol = _mb_ccol; opt = _mb_point; lp = CLine; mb2_appenddiff(buf); if (mb_fixlines(ocol, lp, opt, &col, &pt) == 0) mb_refresh(ocol, opt); else mb_redisplay(); return mb_point(); } static int mb2_appenddiff(buf) char *buf; { int p2; char *p1; for (p1 = buf, p2 = _mb_prompt; p2 < _mb_point; p1++, p2++) ; while (*p1 != '\0') mb_putchar(*(p1++)); return mb_point(); } static int mb_delc(n) int n; { int col, pt; if (n < 0) return -1; if (mb2_delc(n) < 0) return -1; mb_fixlines(_mb_ccol, CLine, _mb_point, &col, &pt); mb_refresh(col, pt); return mb_point(); } static int mb2_delc(n) int n; { int v, m; while (n-- > 0){ if (_mb_gapend == _mb_size) break; chsize(&_mb_buf[_mb_gapend], &v, &m); _mb_gapend += m; _mb_bufsize -= m; } return mb_point(); } static int mb_erasec(n) int n; { int col, pt; struct _Line *lp; lp = CLine; mb2_erasec(n); mb_fixlines(0, Line.next, 0, &col, &pt); if (lp == CLine) mb_refresh(_mb_ccol, _mb_point); else mb_redisplay(); return mb_point(); } static int mb2_erasec(n) int n; { if (n < 0) return -1; while (n-- > 0){ if (_mb_point <= _mb_prompt) return -1; if (mb2_backwc(1) < 0) return -1; if (mb2_delc(1) < 0) return -1; } return mb_point(); } static int mb_killw(n) int n; { int col, pt; struct _Line *lp; if (n < 0) return -1; lp = CLine; while (n-- > 0){ if (!mb_iseol()) mb2_forwc(1); while (!mb_iseol() && mb_isword()) mb2_delc(1); if (!mb_isbol()) mb2_backwc(1); while (!mb_isbol() && !mb_isword()){ mb2_delc(1); mb2_backwc(1); } while (!mb_isbol() && mb_isword()){ mb2_delc(1); mb2_backwc(1); } if (mb_isbol()) mb2_delc(1); } mb_fixlines(0, Line.next, 0, &col, &pt); if (CLine != lp) mb_refresh(_mb_ccol, _mb_point); else mb_refresh(col, pt); return mb_point(); } static int mb_delw(n) int n; { int v, m, ocol, opt, col, pt, i; struct _Line *lp; if (n <= 0) return mb_point(); ocol = _mb_ccol; opt = _mb_point; lp = CLine; while (n-- > 0){ if (_mb_gapend == _mb_size) goto End; if (!mb_isword()){ while (!mb_iseol() && !mb_isword()){ chsize(&_mb_buf[_mb_gapend], &v, &m); for (i = 0; i < m; i++) if (kinsert(_mb_buf[_mb_gapend+i], KFORW) < 0) break; _mb_gapend += m; _mb_bufsize -= m; if (_mb_gapend == _mb_size) goto End; } } while (!mb_iseol() && mb_isword()){ chsize(&_mb_buf[_mb_gapend], &v, &m); for (i = 0; i < m; i++) if (kinsert(_mb_buf[_mb_gapend+i], KFORW) < 0) break; _mb_gapend += m; _mb_bufsize -= m; if (_mb_gapend == _mb_size) goto End; } } End: #ifdef CLIPBOARD send_clipboard(); #endif mb_fixlines(_mb_ccol, CLine, _mb_point, &col, &pt); mb_refresh(col, pt); return mb_point(); } static int mb_forwc(n) int n; { int ocol, opt, col, pt; struct _Line *lp; if (n < 0) return mb_backwc(-n); ocol = _mb_ccol; opt = _mb_point; lp = CLine; mb2_forwc(n); if (mb_fixlines(ocol, lp, opt, &col, &pt) == 0) ttmove(_mb_crow, _mb_ccol); else mb_refresh(col, pt); return mb_point(); } static int mb_backwc(n) int n; { int col, pt; struct _Line *lp; if (n < 0) return mb_forwc(-n); lp = CLine; mb2_backwc(n); mb_fixlines(0, Line.next, 0, &col, &pt); if (lp == CLine) ttmove(_mb_crow, _mb_ccol); else mb_refresh(col, pt); return mb_point(); } static int mb2_forwc(n) int n; { int v, m; if (_mb_gapend == _mb_size) return mb_point(); while ((n-- > 0) && (_mb_gapend < _mb_size)){ chsize(&_mb_buf[_mb_gapend], &v, &m); mb_move(m); } return mb_point(); } static int mb2_backwc(n) int n; { int m, v; if (_mb_point == _mb_prompt) return mb_point(); while ((n-- > 0) && (_mb_point > _mb_prompt)){ chsize2(&_mb_buf[_mb_point-1], &v, &m); mb_move(-m); } return mb_point(); } static int mb_forww(n) int n; { int ocol, opt, col, pt; struct _Line *lp; if (n < 0) return mb_backww(-n); ocol = _mb_ccol; opt = _mb_point; lp = CLine; while (n-- > 0){ /** if (!mb_iseol()) mb2_forwc(1); **/ if (!mb_isword()){ while (!mb_iseol() && !mb_isword()) mb2_forwc(1); } while (!mb_iseol() && mb_isword()) mb2_forwc(1); } if (mb_fixlines(ocol, lp, opt, &col, &pt) == 0) ttmove(_mb_crow, _mb_ccol); else mb_refresh(col, pt); return mb_point(); } static int mb_backww(n) int n; { int ocol, opt, col, pt; struct _Line *lp; if (n < 0) return mb_forww(-n); ocol = _mb_ccol; opt = _mb_point; lp = CLine; while (n-- > 0){ if (!mb_isbol()) mb2_backwc(1); if (!mb_isword()){ while (!mb_isbol() && !mb_isword()) mb2_backwc(1); } while (!mb_isbol() && mb_isword()) mb2_backwc(1); if (!mb_isbol()) mb2_forwc(1); } mb_fixlines(0, Line.next, 0, &col, &pt); if (lp == CLine) ttmove(_mb_crow, _mb_ccol); else mb_refresh(col, pt); return mb_point(); } static int mb_begl() { return mb_gotochar(_mb_prompt); } static int mb_endl() { return mb_gotochar(_mb_bufsize); } static int mb_upw(n) int n; { int ocol, opt, col, pt; struct _Line *lp; if (n <= 0) return mb_point(); ocol = _mb_ccol; opt = _mb_point; lp = CLine; while (n-- > 0){ if (!mb_isword()){ while (!mb_iseol() && !mb_isword()) mb2_forwc(1); } while (!mb_iseol() && mb_isword()){ mb2_forwc(1); if (ISLOWER(mb_pointchar())) mb_pointoverwrite(TOUPPER(mb_pointchar())); } } if (mb_fixlines(ocol, lp, opt, &col, &pt) == 0) mb_refresh(ocol, opt); else mb_redisplay(); return mb_point(); } static int mb_downw(n) int n; { int ocol, opt, col, pt; struct _Line *lp; if (n <= 0) return mb_point(); ocol = _mb_ccol; opt = _mb_point; lp = CLine; while (n-- > 0){ if (!mb_isword()){ while (!mb_iseol() && !mb_isword()) mb2_forwc(1); } while (!mb_iseol() && mb_isword()){ mb2_forwc(1); if (ISUPPER(mb_pointchar())) mb_pointoverwrite(TOLOWER(mb_pointchar())); } } if (mb_fixlines(ocol, lp, opt, &col, &pt) == 0) mb_refresh(ocol, opt); else mb_redisplay(); return mb_point(); } static int mb_cancel() { struct _Line *lp; lp = CLine; mb2_cancel(); if (lp == CLine){ ttmove(_mb_crow, _mb_ccol); tteeol(); } else mb_redisplay(); return mb_point(); } static int mb2_cancel() { int col, pt; _mb_point = _mb_prompt; _mb_gapend = _mb_size; _mb_bufsize = _mb_prompt; mb_fixlines(0, Line.next, 0, &col, &pt); return mb_point(); } static int mb_kill() { int col, pt; while (_mb_gapend < _mb_size){ if (kinsert(_mb_buf[_mb_gapend], KFORW) < 0) break; _mb_gapend++; _mb_bufsize--; } #ifdef CLIPBOARD send_clipboard(); #endif if (mb_fixlines(_mb_ccol, CLine, _mb_point, &col, &pt) == 0) tteeol(); else mb_refresh(col, pt); return mb_point(); } static int mb_yank(n) int n; { int col, pt, ocol, opt, i; int ch; struct _Line *lp; if (n < 0) return -1; ocol = _mb_ccol; opt = _mb_point; lp = CLine; #ifdef CLIPBOARD receive_clipboard(); #endif while (n-- > 0){ i = 0; while ((ch=kremove(i++)) >= 0){ mb_putchar(ch); } } mb_fixlines(ocol, lp, opt, &col, &pt); if (lp == CLine) mb_refresh(ocol, opt); else mb_redisplay(); return mb_point(); } static int mb_trans(n) int n; { int ocol, opt, col, pt, v1, m1, v2, m2, i; struct _Line *lp; char s[2]; if (n > 0){ ocol = 0; opt = _mb_point; lp = CLine; while (n-- > 0){ if (CLine == Line.next){ lp = CLine; opt = 0; } else { lp = CLine->prev; opt = lp->idx; } if (mb_isbol()) break; if (mb_iseol()){ mb2_backwc(1); if (mb_isbol()){ mb2_forwc(1); break; } } chsize2(&_mb_buf[_mb_point-1], &v1, &m1); for (i = m1-1; i >= 0; i--) s[i] = _mb_buf[--_mb_point]; chsize(&_mb_buf[_mb_gapend], &v2, &m2); for (i = 0; i < m2; i++) _mb_buf[_mb_point++] = _mb_buf[_mb_gapend++]; for (i = 0; i < m1; i++) _mb_buf[--_mb_gapend] = s[m1-i-1]; if (mb_iseol()) break; mb2_forwc(1); } if (mb_fixlines(ocol, lp, opt, &col, &pt) == 0) mb_refresh(ocol, opt); else mb_redisplay(); } else if (n < 0){ while (n++ < 0){ if (mb_isbol()) break; if (mb_iseol()){ mb2_backwc(1); if (mb_isbol()){ mb2_forwc(1); break; } } chsize2(&_mb_buf[_mb_point-1], &v1, &m1); for (i = m1-1; i >= 0; i--) s[i] = _mb_buf[--_mb_point]; chsize(&_mb_buf[_mb_gapend], &v2, &m2); for (i = 0; i < m2; i++) _mb_buf[_mb_point++] = _mb_buf[_mb_gapend++]; for (i = 0; i < m1; i++) _mb_buf[--_mb_gapend] = s[m1-i-1]; if (mb_isbol()) break; mb2_backwc(1); } if (mb_fixlines(0, Line.next, 0, &col, &pt) == 0) mb_refresh(col, pt); else mb_redisplay(); } return mb_point(); } static int mb_matchparen(n, opar, cpar) int n; char opar, cpar; { int i, dep, dep2, instr, oinstr, point, v, m; int col, ocol, pt, opt, red, match, on; struct _Line *clp, *dlp, *lp; if (n <= 0) return mb_point(); instr = 0; for (i = _mb_prompt; i < _mb_point; i++){ if (_mb_buf[i] == '"'){ if (instr == 0) instr = 1; else instr = 0; } else if (_mb_buf[i] == '\\') i++; } oinstr = instr; on = n; match = 0; red = 0; ocol = _mb_ccol; opt = _mb_point; lp = CLine; clp = dlp = CLine; while (n-- > 0){ clp = CLine; point = _mb_point; mb_putchar(cpar); mb_fixlines(ocol, lp, opt, &col, &pt); if (clp != CLine){ red = 1; col = _mb_ccol-1; } clp = CLine; if (red == 0){ mb_refresh(col, pt); dlp = clp; } dep = 0; dep2 = 0; while (point >= _mb_prompt){ if (instr == 0){ if (_mb_buf[point] == '"'){ if ((point > _mb_prompt) && (_mb_buf[point-1] == '\\')) point--; else { instr = 1; dep2 = dep; } } else if ((_mb_buf[point] == cpar) && (oinstr == 0)){ dep++; } else if ((_mb_buf[point] == opar) && (oinstr == 0)){ if (--dep == 0){ match++; if (dlp != clp){ dlp = clp; red = 1; _mb_ccol = mb_col(clp, point); mb_refresh(0, clp->idx); } else ttmove(_mb_crow, mb_col(clp, point)); ttflush(); ttwait(); break; } } } else { if (_mb_buf[point] == '"'){ if ((point > _mb_prompt) && (_mb_buf[point-1] == '\\')) point--; else { instr = 0; dep = dep2; } } else if ((_mb_buf[point] == cpar) && (oinstr == 1)){ dep++; } else if ((_mb_buf[point] == opar) && (oinstr == 1)){ if (--dep == 0){ match++; if (dlp != clp){ dlp = clp; red = 1; _mb_ccol = mb_col(clp, point); mb_refresh(0, clp->idx); } else ttmove(_mb_crow, mb_col(clp, point)); ttflush(); ttwait(); break; } } } chsize2(&_mb_buf[point], &v, &m); if (point == clp->idx) clp = clp->prev; point -= m; } } if (red == 1){ mb_fixlines(ocol, lp, opt, NULL, NULL); mb_redisplay(); } else ttmove(_mb_crow, _mb_ccol); if (match != on) ttbeep(); return mb_point(); } static int mb_col(lp, pt) struct _Line *lp; int pt; { int col, point, v, m; col = 0; for (point = lp->idx; point < pt; ){ chsize(&_mb_buf[point], &v, &m); col += v; point += m; } return col; } static int mb_putchar(c) char c; { int i, more; char *new_mb_buf; struct _Line *lp; if (_mb_point == (_mb_gapend-1)){ more = _mb_size; if ((new_mb_buf = malloc(_mb_size+more)) == NULL) return -1; for (i = 0; i < _mb_point; i++) new_mb_buf[i] = _mb_buf[i]; for (i = _mb_gapend; i < _mb_size; i++) new_mb_buf[i+more] = _mb_buf[i]; free(_mb_buf); _mb_buf = new_mb_buf; _mb_gapend += more; _mb_size = _mb_size + more; if (_mb_point != _mb_prompt) for (lp = CLine->next; lp != &Line; lp = lp->next) lp->idx += more; } _mb_buf[_mb_point++] = c; _mb_bufsize++; return 0; } static VOID mb_move(m) int m; { if (m > 0){ while (m > 0){ _mb_buf[_mb_point++] = _mb_buf[_mb_gapend++]; --m; } } else { while (m < 0){ _mb_buf[--_mb_gapend] = _mb_buf[--_mb_point]; ++m; } } } static VOID mb_movech(n) int n; { int v, m; if (n > 0){ while (n > 0){ chsize(&_mb_buf[_mb_point-1], &v, &m); while ((m--) > 0) _mb_buf[_mb_point++] = _mb_buf[_mb_gapend++]; --n; } } else { while (n < 0){ chsize2(&_mb_buf[_mb_point-1], &v, &m); while ((m--) > 0) _mb_buf[--_mb_gapend] = _mb_buf[--_mb_point]; ++n; } } } static int mb_fixlines(col, line, point, colp, ptp) int col, point, *colp, *ptp; struct _Line *line; { int v, m, bp, ccol, opt, redraw, lno; struct _Line *lp0, *lp1; if (colp != NULL) *colp = col; if (ptp != NULL) *ptp = point; ccol = col; redraw = 0; bp = 1; lno = line->lno; for (;;){ if (point == _mb_point){ _mb_ccol = col; CLine = line; point = _mb_gapend; bp = 0; } if (point == _mb_size){ /* ASSRT: line != &Line */ goto End; } opt = point; chsize(&_mb_buf[point], &v, &m); col += v; ccol += v; point += m; if (col >= (ncol-1)-1){ if (line->next == &Line){ if ((lp0 = (struct _Line*) malloc(sizeof (struct _Line))) == NULL) return -1; line->next = lp0; lp0->next = &Line; Line.prev = lp0; lp0->prev = line; } line = line->next; line->lno = ++lno; line->idx = opt; if (bp == 1){ if (colp != NULL) *colp = 0; if (ptp != NULL) *ptp = line->idx; redraw = 1; } col = v; } } End: for (lp0 = line->next; lp0 != &Line; lp0 = lp1){ lp1 = lp0->next; free(lp0); } line->next = &Line; Line.prev = line; if ((_mb_ccol == (ncol-1)-2) && (_mb_gapend < _mb_size)){ CLine = CLine->next; _mb_ccol = 0; if (colp != NULL) *colp = 0; if (ptp != NULL) *ptp = CLine->idx; redraw = 1; } else if ((_mb_ccol == 0) && (_mb_gapend == _mb_size)){ lp0 = CLine; CLine = CLine->prev; free(lp0); CLine->next = &Line; Line.prev = CLine; mb_fixlines(0, CLine, CLine->idx, colp, ptp); redraw = 1; } return redraw; } static VOID mb_redisplay() { mb_refresh(0, CLine->idx); } static VOID mb_refresh(col, idx) int col, idx; { int v, m, limit; limit = (ncol-1)-2; ttmove(_mb_crow, col); for ( ; idx < _mb_point; ){ if (col >= limit) break; chsize(&_mb_buf[idx], &v, &m); while (m-- > 0) eputc(_mb_buf[idx++]); col += v; } for (idx = _mb_gapend; idx < _mb_size; ){ if (col >= limit) break; chsize(&_mb_buf[idx], &v, &m); while (m-- > 0) eputc(_mb_buf[idx++]); col += v; } if (CLine->next != &Line){ for ( ; col <= (ncol-1); col++) eputc('\\'); } else tteeol(); ttmove(_mb_crow, _mb_ccol); mb_flush(); } static VOID mb_flush() { ttflush(); } #ifdef CANNA static int mb_henkan( c ) int c; { int ilen; int i; static char kakutei[CANBUF]; static int oldlength, oldrevPos; int col, pt; struct _Line *lp; lp = CLine; ilen = jrKanjiString(0, c, kakutei, CANBUF, &ks); if (oldrevPos == 0) oldrevPos = mb_point(); if (oldlength == 0) oldlength = mb_point(); if (ilen < 0) return FALSE; if (ks.info & KanjiModeInfo){ jrKanjiControl(0,KC_QUERYMODE, mbMode); } if ( ilen > 0) { mb2_gotochar(oldlength); while (mb_point() > oldrevPos) mb2_erasec(1); mb_fixlines(0, Line.next, 0, &col, &pt); if (lp == CLine) mb_refresh(_mb_ccol, _mb_point); else mb_redisplay(); mb_insertstr(kakutei); oldlength = oldrevPos = 0; } if ( ks.length > 0) { mb2_gotochar(oldlength); while (mb_point() > oldrevPos) mb2_erasec(1); mb_fixlines(0, Line.next, 0, &col, &pt); if (lp == CLine) mb_refresh(_mb_ccol, _mb_point); else mb_redisplay(); oldrevPos = mb_point(); mb_insert( 1, '|'); mb_insertstr(ks.echoStr); mb_insert( 1, '|'); oldlength = mb_point(); mb_backwc(1); } else if ( ks.length == 0 && ilen == 0) { mb2_gotochar(oldlength); while (mb_point() > oldrevPos) mb2_erasec(1); mb_fixlines(0, Line.next, 0, &col, &pt); if (lp == CLine) mb_refresh(_mb_ccol, _mb_point); else mb_redisplay(); oldlength = oldrevPos = 0; } return TRUE; } #endif /* CANNA */ static char* sformat(fp, ap) register char *fp; register va_list *ap; { register char *s; register int n; int c, idx; char kname[NKNAME]; char *keyname(); char *cp; n = ncol + 1; if ((s = malloc(n)) == NULL) return NULL; idx = 0; while ((c = *fp++) != '\0'){ if (c != '%') idx = s_put_c(s, idx, n, c); else { c = *fp++; switch (c){ case 'c': (VOID) keyname(kname, va_arg(*ap, int)); idx = s_put_s(s, idx, n, kname); break; case 'k': cp = kname; for(c=0; c < key.k_count; c++) { cp = keyname(cp, key.k_chars[c]); *cp++ = ' '; } *--cp = '\0'; idx = s_put_s(s, idx, n, kname); break; case 'd': idx = s_put_i(s, idx, n, va_arg(*ap, int), 10); break; case 'o': idx = s_put_i(s, idx, n, va_arg(*ap, int), 8); break; case 's': idx = s_put_s(s, idx, n, va_arg(*ap, char *)); break; case 'l':/* explicit longword */ c = *fp++; switch(c) { case 'd': idx = s_put_l(s, idx, n, (long)va_arg(*ap, long), 10); break; default: idx = s_put_c(s, idx, n, c); break; } break; default: idx = s_put_c(s, idx, n, c); } } } s[idx] = '\0'; return s; } static int s_put_i(p, idx, n, i, r) register char *p; register int idx, n; register int i; register int r; { register int q; if(i<0) { idx = s_put_c(p, idx, n, '-'); i = -i; } if ((q=i/r) != 0) idx = s_put_i(p, idx, n, q, r); return s_put_c(p, idx, n, i%r+'0'); } static int s_put_l(p, idx, n, l, r) register char *p; register int idx, n; register long l; register int r; { register long q; if(l < 0) { idx = s_put_c(p, idx, n, '-'); l = -l; } if ((q=l/r) != 0) idx = s_put_l(p, idx, n, q, r); return s_put_c(p, idx, n, (int)(l%r)+'0'); } static int s_put_s(p, idx, n, s) register char *p, *s; register int idx, n; { register int c; while ((c = *s++) != '\0') idx = s_put_c(p, idx, n, c); return idx; } static int s_put_c(p, idx, n, c) register char *p; register int idx, n; register char c; { epresf = TRUE; if (idx < n) { if (ISCTRL(c)) { idx = s_put_c(p, idx, n, '^'); c = CCHR(c); } #ifdef KANJI #ifdef HANKANA { static int c1=0; if (ISKANJI(c)) { if (c1==0) c1=1; else c1=0; } else c1=0; if (ISHANKANA(c) && (c1 == 1)) idx--; } #endif /* HANKANA */ p[idx++] = c; #else /* NOT KANJI */ p[idx++] = c; #endif /* KANJI */ } return idx; } static VOID chsize(s, visu, mem) register char *s; register int *visu, *mem; { if (ISCTRL(*s)){ *visu = 2; *mem = 1; #ifdef KANJI } else if (ISKANJI(*s)){ *mem = 2; #ifdef HOJO_KANJI if (ISHOJO(*s)) { *mem = 3; *visu = 2; } else #endif /* HOJO_KANJI */ #ifdef HANKANA if (ISHANKANA(*s)) *visu = 1; else #endif /* HANKANA */ *visu = 2; #endif /* KANJI */ } else { *visu = 1; *mem = 1; } } static VOID chsize2(s, visu, mem) register char *s; register int *visu, *mem; { if (ISCTRL(*s)){ *visu = 2; *mem = 1; #ifdef KANJI } else if (ISKANJI(*s)){ *mem = 2; #ifdef HOJO_KANJI if (ISHOJO(*(s-2)) && ISKANJI(*(s-1))) { *mem = 3; *visu = 2; } else #endif /* HOJO_KANJI */ #ifdef HANKANA if (ISHANKANA(*(s-1))) *visu = 1; else #endif /* HANKANA */ *visu = 2; #endif /* KANJI */ } else { *visu = 1; *mem = 1; } } static VOID mb_hist_save(hist_buf, buf) char *hist_buf[]; char *buf; { int i; if (hist_buf[MB_NHISTS] != NULL) free(hist_buf[MB_NHISTS]); /* rotate history */ for (i = MB_NHISTS; i > 1; i--) hist_buf[i] = hist_buf[i-1]; /* and insert new history to head */ hist_buf[1] = malloc(strlen(buf)+1); strcpy(hist_buf[1], buf); } #else /* NOT MINIBUF_EDIT */ static int veread_del_char (); static int veread_complete (); static int veread(fp, buf, nbuf, flag, ap) char *fp; char *buf; int nbuf; int flag; va_list *ap; { int cpos; int c; #ifdef ADDFUNC /* 91.01.16 by S.Yoshida */ /* If an extra argument exists, use it. */ /* This is a very easy way of not getting an argument from */ /* the keyboard. */ if(earg_exist) { strcpy(buf, earg_text); earg_exist = FALSE; edef_text = NULL; return (TRUE); } #endif /* ADDFUNC */ #ifndef NO_MACRO if(inmacro) { bcopy (maclcur->l_text, buf, maclcur->l_used); buf[maclcur->l_used] = '\0'; maclcur = maclcur->l_fp; #ifdef EXTD_DIR edef_text = NULL; #endif return (TRUE); } #endif if ((flag & EFNEW) || ttrow != nrow - 1) { ttcolor(CTEXT); ttmove(nrow - 1, 0); epresf = TRUE; } else eputc(' '); eformat(fp, ap); tteeol(); #ifdef EXTD_DIR if (edef_text) { strcpy(buf, edef_text); edef_text = NULL; eputs(buf); cpos = strlen(buf); } else #endif { buf[0] = '\0'; cpos = 0; } for (;;) { ttflush(); c = getkey(FALSE); tteeol(); switch (c) { case ' ': case CCHR('I'): if (flag & EFAUTO) { #if 0 /* 90.12.10 Sawayanagi Yosirou */ if (flag & EFFILE) { char *p; p = adjustname (buf); while (cpos > 0) cpos = veread_del_char (buf, cpos); strcpy (buf, p); eputs (buf); cpos = strlen (buf); } #endif cpos = veread_complete (buf, cpos, c, flag); } else if (cpos < nbuf - 1) { buf[cpos++] = (char) c; buf[cpos] = '\0'; eputc((char) c); } break; case CCHR('J'): c = CCHR('M'); /* and continue */ case CCHR('M'): /* Return, done. */ if (flag & EFFUNC) { int matchnum; matchnum = complete (buf, flag); eputs (&buf[cpos]); tteeol(); cpos = strlen (buf); if (matchnum != COMPLT_SOLE && matchnum != COMPLT_NOT_UNIQUE) { /* complete() will be called again, but i don't mind it */ cpos = veread_complete (buf, cpos, (int)CCHR('I'), flag); break; } } complete_del_list (); if (flag & EFCR) { ttputc(CCHR('M')); ttflush (); } #ifndef NO_MACRO if (macrodef) { LINE *lp; if((lp = lalloc(cpos)) == NULL) return FALSE; lp->l_fp = maclcur->l_fp; maclcur->l_fp = lp; lp->l_bp = maclcur; maclcur = lp; bcopy(buf, lp->l_text, cpos); } #endif return ((buf[0] == '\0') ? FALSE : TRUE); case CCHR('G'): /* Bell, abort. */ case CCHR('['): (VOID) ctrlg(FFRAND, 0); ttflush(); complete_del_list (); return (ABORT); case CCHR('N'): complete_scroll_down (); break; case CCHR('P'): complete_scroll_up (); break; case CCHR('H'): case CCHR('?'): /* Rubout, erase. */ cpos = veread_del_char (buf, cpos); break; case CCHR('X'): /* C-X */ case CCHR('U'): /* C-U, kill line. */ while (cpos > 0) cpos = veread_del_char (buf, cpos); break; case CCHR('W'): /* C-W, kill to beginning of */ /* previous word */ /* back up to first word character or beginning */ while ((cpos > 0) && !ISWORD(buf[cpos - 1])) cpos = veread_del_char (buf, cpos); while ((cpos > 0) && ISWORD(buf[cpos - 1])) cpos = veread_del_char (buf, cpos); break; case CCHR('\\'): case CCHR('Q'): /* C-Q, quote next */ c = getkey(FALSE); /* and continue */ default: /* All the rest. */ if (cpos < nbuf - 1) { buf[cpos++] = (char) c; buf[cpos] = '\0'; eputc((char) c); } } } } static int veread_del_char (buf, cpos) char *buf; int cpos; { if (cpos <= 0) return (0); ttputc('\b'); ttputc(' '); ttputc('\b'); --ttcol; --cpos; if (ISCTRL(buf[cpos]) != FALSE) { ttputc('\b'); ttputc(' '); ttputc('\b'); --ttcol; } #ifdef KANJI /* 90.01.29 by S.Yoshida */ else if (ISKANJI(buf[cpos])) { #ifdef HANKANA /* 92.11.21 by S.Sasaki */ if (!ISHANKANA(buf[--cpos])) { ttputc('\b'); ttputc(' '); ttputc('\b'); --ttcol; } #else /* not HANKANA */ ttputc('\b'); ttputc(' '); ttputc('\b'); --ttcol; --cpos; #endif /* HANKANA */ } #endif /* KANJI */ buf[cpos] = '\0'; return (cpos); } static int veread_complete (buf, cpos, c, flag) char *buf; int cpos; int c; int flag; { int matchnum; int i; int wflag; int cur_ttrow; int cur_ttcol; wflag = (c == ' '); if (wflag) { buf[cpos] = ' '; buf[cpos + 1] = '\0'; if (complete (buf, flag) == COMPLT_NO_MATCH) buf[cpos] = '\0'; else { buf[cpos + 1] = '\0'; eputs (&buf[cpos]); tteeol(); ++cpos; return (cpos); } } matchnum = complete (buf, flag); if (buf[cpos] == '\0') { if (wflag) { if (matchnum == COMPLT_AMBIGUOUS || matchnum == COMPLT_NOT_UNIQUE) complete_list_names (buf, flag); else if (matchnum == COMPLT_NO_MATCH) { cur_ttrow = ttrow; cur_ttcol = ttcol; eputs (complete_message (matchnum)); tteeol(); ttmove (cur_ttrow, cur_ttcol); } } else { if (matchnum == COMPLT_AMBIGUOUS) complete_list_names (buf, flag); else { cur_ttrow = ttrow; cur_ttcol = ttcol; eputs (complete_message (matchnum)); tteeol(); ttmove (cur_ttrow, cur_ttcol); } } } else { if (wflag) { for (i = cpos + 1; buf[i] != '\0'; i++) { if (i > cpos && ! ISWORD(buf[i - 1])) { buf[i] = '\0'; break; } } } eputs (&buf[cpos]); tteeol(); cpos = strlen (buf); } return (cpos); } #endif /* MINIBUF_EDIT */ #else /* NOT NEW_COMPLETE */ static veread(fp, buf, nbuf, flag, ap) char *fp; char *buf; va_list *ap; { register int cpos; register int i; register int c; #ifdef ADDFUNC /* 91.01.16 by S.Yoshida */ /* If extra argument is exist, use it. */ /* This is very easy way to not get argument from keyboard. */ if(earg_exist) { strcpy(buf, earg_text); earg_exist = FALSE; return (TRUE); } #endif /* ADDFUNC */ #ifndef NO_MACRO if(inmacro) { bcopy(maclcur->l_text, buf, maclcur->l_used); buf[maclcur->l_used] = '\0'; maclcur = maclcur->l_fp; return TRUE; } #endif cpos = 0; if ((flag&EFNEW)!=0 || ttrow!=nrow-1) { ttcolor(CTEXT); ttmove(nrow-1, 0); epresf = TRUE; } else eputc(' '); eformat(fp, ap); tteeol(); ttflush(); #ifdef FEPCTRL /* 90.11.26 by K.Takano */ fepmode_off(); #endif for (;;) { c = getkey(FALSE); if ((flag&EFAUTO) != 0 && (c == ' ' || c == CCHR('I'))) { cpos += complt(flag, c, buf, cpos); continue; } switch (c) { case CCHR('J'): c = CCHR('M'); /* and continue */ case CCHR('M'): /* Return, done. */ if ((flag&EFFUNC) != 0) { if ((i = complt(flag, c, buf, cpos)) == 0) continue; if (i > 0) cpos += i; } buf[cpos] = '\0'; if ((flag&EFCR) != 0) { ttputc(CCHR('M')); ttflush(); } #ifndef NO_MACRO if(macrodef) { LINE *lp; if((lp = lalloc(cpos)) == NULL) return FALSE; lp->l_fp = maclcur->l_fp; maclcur->l_fp = lp; lp->l_bp = maclcur; maclcur = lp; bcopy(buf, lp->l_text, cpos); } #endif goto done; case CCHR('G'): /* Bell, abort. */ case CCHR('['): eputc(CCHR('G')); (VOID) ctrlg(FFRAND, 0); ttflush(); return ABORT; case CCHR('H'): case CCHR('?'): /* Rubout, erase. */ if (cpos != 0) { ttputc('\b'); ttputc(' '); ttputc('\b'); --ttcol; if (ISCTRL(buf[--cpos]) != FALSE) { ttputc('\b'); ttputc(' '); ttputc('\b'); --ttcol; } #ifdef KANJI /* 90.01.29 by S.Yoshida */ else if (ISKANJI(buf[cpos])) { #ifdef HANKANA /* 92.11.21 by S.Sasaki */ if (!ISHANKANA(buf[--cpos])) { ttputc('\b'); ttputc(' '); ttputc('\b'); --ttcol; } #else /* HANKANA */ ttputc('\b'); ttputc(' '); ttputc('\b'); --ttcol; --cpos; #endif /* HANKANA */ } #endif /* KANJI */ ttflush(); } break; case CCHR('X'): /* C-X */ case CCHR('U'): /* C-U, kill line. */ while (cpos != 0) { ttputc('\b'); ttputc(' '); ttputc('\b'); --ttcol; if (ISCTRL(buf[--cpos]) != FALSE) { ttputc('\b'); ttputc(' '); ttputc('\b'); --ttcol; } #ifdef KANJI /* 90.01.29 by S.Yoshida */ else if (ISKANJI(buf[cpos])) { #ifdef HANKANA /* 92.11.21 by S.Sasaki */ if (!ISHANKANA(buf[--cpos])) { ttputc('\b'); ttputc(' '); ttputc('\b'); --ttcol; } #else /* HANKANA */ ttputc('\b'); ttputc(' '); ttputc('\b'); --ttcol; --cpos; #endif /* HANKANA */ } #endif /* KANJI */ } ttflush(); break; case CCHR('W'): /* C-W, kill to beginning of */ /* previous word */ /* back up to first word character or beginning */ while ((cpos > 0) && !ISWORD(buf[cpos - 1])) { ttputc('\b'); ttputc(' '); ttputc('\b'); --ttcol; if (ISCTRL(buf[--cpos]) != FALSE) { ttputc('\b'); ttputc(' '); ttputc('\b'); --ttcol; } #ifdef KANJI /* 90.01.29 by S.Yoshida */ else if (ISKANJI(buf[cpos])) { ttputc('\b'); ttputc(' '); ttputc('\b'); --ttcol; --cpos; } #endif /* KANJI */ } while ((cpos > 0) && ISWORD(buf[cpos - 1])) { ttputc('\b'); ttputc(' '); ttputc('\b'); --ttcol; if (ISCTRL(buf[--cpos]) != FALSE) { ttputc('\b'); ttputc(' '); ttputc('\b'); --ttcol; } #ifdef KANJI /* 90.01.29 by S.Yoshida */ else if (ISKANJI(buf[cpos])) { #ifdef HANKANA /* 92.11.21 by S.Sasaki */ if (ISHANKANA(buf[--cpos])) { ttputc('\b'); ttputc(' '); ttputc('\b'); --ttcol; } #else /* not HANKANA */ ttputc('\b'); ttputc(' '); ttputc('\b'); --ttcol; --cpos; #endif /* HANKANA */ } #endif /* KANJI */ } ttflush(); break; case CCHR('\\'): case CCHR('Q'): /* C-Q, quote next */ c = getkey(FALSE); /* and continue */ default: /* All the rest. */ if (cpos < nbuf-1) { buf[cpos++] = (char) c; eputc((char) c); ttflush(); } } } done: return buf[0] != '\0'; } /* * do completion on a list of objects. */ static int complt(flags, c, buf, cpos) register char *buf; register int cpos; { register LIST *lh, *lh2; int i, nxtra; int nhits, bxtra; int wflag = FALSE; int msglen, nshown; char *msg; if ((flags&EFFUNC) != 0) { buf[cpos] = '\0'; i = complete_function(buf, c); if(i>0) { eputs(&buf[cpos]); ttflush(); return i; } switch(i) { case -3: msg = " [Ambiguous]"; break; case -2: i=0; msg = " [No match]"; break; case -1: case 0: return i; default: msg = " [Internal error]"; break; } #ifndef NO_FILECOMP /* 90.04.04 by K.Maeda */ } else if ((flags&EFFILE)!=0) { if (c != '\t' && c != ' ') panic("broken complt call: c"); buf[cpos] = '\0'; i = complete_filename(buf, cpos, c); if(i>0) { eputs(&buf[cpos]); ttflush(); return i; } switch(i) { case -3: msg = " [Ambiguous]"; break; case -2: /* no match */ #ifdef HUMAN68K /* 90.11.15 Sawayanagi Yosirou */ msg = " [No match]"; break; #else /* NOT HUMAN68K */ i=0; #endif /* HUMAN68K */ case -1: /* single match */ case 0: return i; default: msg = " [Internal error]"; break; } #endif /* NO_FILECOMP */ } else { if ((flags&EFBUF) != 0) lh = &(bheadp->b_list); else panic("broken complt call: flags"); if (c == ' ') wflag = TRUE; else if (c != '\t' && c != CCHR('M')) panic("broken complt call: c"); nhits = 0; nxtra = HUGE; while (lh != NULL) { for (i=0; il_name[i]) break; } if (i == cpos) { if (nhits == 0) lh2 = lh; ++nhits; if (lh->l_name[i] == '\0') nxtra = -1; else { bxtra = getxtra(lh, lh2, cpos, wflag); if (bxtra < nxtra) nxtra = bxtra; lh2 = lh; } } lh = lh->l_next; } if (nhits == 0) msg = " [No match]"; else if (nhits > 1 && nxtra == 0) msg = " [Ambiguous]"; else { /* Got a match, do it to it */ /* * Being lazy - ought to check length, but all things * autocompleted have known types/lengths. */ if (nxtra < 0 && nhits > 1 && c == ' ') nxtra = 1; for (i = 0; i < nxtra; ++i) { buf[cpos] = lh2->l_name[cpos]; eputc(buf[cpos++]); } ttflush(); if (nxtra < 0 && c != CCHR('M')) return 0; return nxtra; } } /* Set up backspaces, etc., being mindful of echo line limit */ msglen = strlen(msg); nshown = (ttcol + msglen + 2 > ncol) ? ncol - ttcol - 2 : msglen; eputs(msg); ttcol -= (i = nshown); /* update ttcol! */ while (i--) /* move back before msg */ ttputc('\b'); ttflush(); /* display to user */ i = nshown; while (i--) /* blank out on next flush */ eputc(' '); ttcol -= (i = nshown); /* update ttcol on BS's */ while (i--) ttputc('\b'); /* update ttcol again! */ return 0; } /* * The "lp1" and "lp2" point to list structures. The * "cpos" is a horizontal position in the name. * Return the longest block of characters that can be * autocompleted at this point. Sometimes the two * symbols are the same, but this is normal. */ getxtra(lp1, lp2, cpos, wflag) register LIST *lp1, *lp2; register int wflag; { register int i; i = cpos; for (;;) { if (lp1->l_name[i] != lp2->l_name[i]) break; if (lp1->l_name[i] == '\0') break; ++i; if (wflag && !ISWORD(lp1->l_name[i-1])) break; } return (i - cpos); } #endif /* NEW_COMPLETE */ /* * Special "printf" for the echo line. * Each call to "ewprintf" starts a new line in the * echo area, and ends with an erase to end of the * echo line. The formatting is done by a call * to the standard formatting routine. */ /*VARARGS 0 */ #ifdef SUPPORT_ANSI VOID ewprintf(char *fp, ...) { va_list pvar; #ifndef NO_MACRO if (inmacro) return; #endif va_start(pvar, fp); ttcolor(CTEXT); ttmove(nrow - 1, 0); eformat(fp, &pvar); va_end(pvar); tteeol(); ttflush(); epresf = TRUE; } #else /* SUPPORT_ANSI */ VOID ewprintf(va_alist) va_dcl { va_list pvar; register char *fp; #ifndef NO_MACRO if(inmacro) return; #endif va_start(pvar); fp = va_arg(pvar, char *); ttcolor(CTEXT); ttmove(nrow-1, 0); eformat(fp, &pvar); va_end(pvar); tteeol(); ttflush(); epresf = TRUE; } #endif /* SUPPORT_ANSI */ /* * Printf style formatting. This is * called by both "ewprintf" and "ereply" to provide * formatting services to their clients. The move to the * start of the echo line, and the erase to the end of * the echo line, is done by the caller. * Note: %c works, and prints the "name" of the character. * %k prints the name of a key (and takes no arguments). */ static VOID eformat(fp, ap) register char *fp; register va_list *ap; { register int c; char kname[NKNAME]; char *keyname(); char *cp; while ((c = *fp++) != '\0') { if (c != '%') eputc(c); else { c = *fp++; switch (c) { case 'c': (VOID) keyname(kname, va_arg(*ap, int)); eputs(kname); break; case 'k': cp = kname; for(c=0; c < key.k_count; c++) { cp = keyname(cp, key.k_chars[c]); *cp++ = ' '; } *--cp = '\0'; eputs(kname); break; case 'd': eputi(va_arg(*ap, int), 10); break; case 'o': eputi(va_arg(*ap, int), 8); break; case 's': eputs(va_arg(*ap, char *)); break; case 'l':/* explicit longword */ c = *fp++; switch(c) { case 'd': eputl((long)va_arg(*ap, long), 10); break; default: eputc(c); break; } break; default: eputc(c); } } } } /* * Put integer, in radix "r". */ static VOID eputi(i, r) register int i; register int r; { register int q; if(i<0) { eputc('-'); i = -i; } if ((q=i/r) != 0) eputi(q, r); eputc(i%r+'0'); } /* * Put long, in radix "r". */ static VOID eputl(l, r) register long l; register int r; { register long q; if(l < 0) { eputc('-'); l = -l; } if ((q=l/r) != 0) eputl(q, r); eputc((int)(l%r)+'0'); } /* * Put string. */ static VOID eputs(s) register char *s; { register int c; while ((c = *s++) != '\0') eputc(c); } /* * Put character. Watch for * control characters, and for the line * getting too long. */ static VOID eputc(c) register char c; { epresf = TRUE; #ifdef MINIBUF_EDIT if (ttcol <= (ncol-1)-1) #else if (ttcol+2 < ncol) #endif { if (ISCTRL(c)) { eputc('^'); c = CCHR(c); } #ifdef KANJI /* 90.01.29 by S.Yoshida */ #ifdef SS_SUPPORT /* 92.11.21 by S.Sasaki */ { static int c1=0; if (ISKANJI(c)) { #ifdef HOJO_KANJI if (ISHOJO(c)) { c1 = 2; ttcol--; } else #endif if (c1==0) c1=1; else c1--; } else c1=0; #ifdef HANKANA if (ISHANKANA(c) && c1 == 1) ttcol--; #endif } #endif /* SS_SUPPORT */ kttputc(c); #else /* NOT KANJI */ ttputc(c); #endif /* KANJI */ ++ttcol; } } #ifndef NEW_COMPLETE /* 90.12.10 Sawayanagi Yosirou */ #ifndef NO_FILECOMP /* 90.04.04 by K.Maeda */ complete_filename(buf, cpos, c) char *buf; int cpos, c; { register int nhits, i, j; char *files, *try, *hit; int nxtra, wflag, bxtra, res; if ((nhits=fffiles(buf, &files)) < 0) return -4; /* error */ if (nhits == 0) { res = -2; /* no match */ goto end; } if (c == ' ') wflag = TRUE; else wflag = FALSE; nxtra = HUGE; hit = files; for(try=files, i=0; i 1 && nxtra == 0) { res = -3; /* ambiguous */ goto end; } if (nxtra < 0 && nhits > 1 && c == ' ') nxtra = 1; if (nxtra >= 0) { for (i=cpos; ib_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ if(inmacro) { while(--n >= 0) { for(count = 0; count < maclcur->l_used; count++) { if((((c=maclcur->l_text[count]) == '\n') ? lnewline() : linsert(1, c)) != TRUE) return FALSE; } } maclcur = maclcur->l_fp; return TRUE; } if(n==1) thisflag |= CFINS; /* CFINS means selfinsert can tack on end */ #endif #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ if(eread("Insert: ", buf, sizeof(buf), EFNEW) == FALSE) return FALSE; while(--n >= 0) { cp = buf; while(*cp) { if(((*cp == '\n') ? lnewline() : linsert(1, *cp)) != TRUE) return FALSE; cp++; } } return TRUE; } /* * Bind a key to a function. Cases range from the trivial (replacing an * existing binding) to the extremly complex (creating a new prefix in a * map_element that already has one, so the map_element must be split, * but the keymap doesn't have enough room for another map_element, so * the keymap is reallocated). No attempt is made to reclaim space no * longer used, if this is a problem flags must be added to indicate * malloced verses static storage in both keymaps and map_elements. * Structure assignments would come in real handy, but K&R based compilers * don't have them. Care is taken so running out of memory will leave * the keymap in a usable state. */ static int remap(curmap, c, funct, pref_map) register KEYMAP *curmap;/* pointer to the map being changed */ int c; /* character being changed */ PF funct; /* function being changed to */ KEYMAP *pref_map; /* if funct==prefix, map to bind to or NULL for new */ /* extern MAP_ELEMENT *ele; must be set before calling */ { register int i; int n1, n2, nold; KEYMAP *mp; PF *pfp; MAP_ELEMENT *mep; if(ele >= &curmap->map_element[curmap->map_num] || c < ele->k_base) { if(ele > &curmap->map_element[0] && (funct!=prefix || (ele-1)->k_prefmap==NULL)) { n1 = c - (ele-1)->k_num; } else n1 = HUGE; if(ele < &curmap->map_element[curmap->map_num] && (funct!=prefix || ele->k_prefmap==NULL)) { n2 = ele->k_base - c; } else n2 = HUGE; if(n1 <= MAPELEDEF && n1 <= n2) { ele--; if((pfp = (PF *)malloc((unsigned)(c - ele->k_base+1) * sizeof(PF))) == NULL) { ewprintf("Out of memory"); return FALSE; } nold = ele->k_num - ele->k_base + 1; for(i=0; i < nold; i++) pfp[i] = ele->k_funcp[i]; while(--n1) pfp[i++] = curmap->map_default; pfp[i] = funct; ele->k_num = c; ele->k_funcp = pfp; } else if(n2 <= MAPELEDEF) { if((pfp = (PF *)malloc((unsigned)(ele->k_num - c + 1) * sizeof(PF))) == NULL) { ewprintf("Out of memory"); return FALSE; } nold = ele->k_num - ele->k_base + 1; for(i=0; i < nold; i++) pfp[i+n2] = ele->k_funcp[i]; while(--n2) pfp[n2] = curmap->map_default; pfp[0] = funct; ele->k_base = c; ele->k_funcp = pfp; } else { if(curmap->map_num >= curmap->map_max && (curmap = realocmap(curmap)) == NULL) return FALSE; if((pfp = (PF *)malloc(sizeof(PF))) == NULL) { ewprintf("Out of memory"); return FALSE; } pfp[0] = funct; for(mep = &curmap->map_element[curmap->map_num]; mep > ele; mep--) { mep->k_base = (mep-1)->k_base; mep->k_num = (mep-1)->k_num; mep->k_funcp = (mep-1)->k_funcp; mep->k_prefmap = (mep-1)->k_prefmap; } ele->k_base = c; ele->k_num = c; ele->k_funcp = pfp; ele->k_prefmap = NULL; curmap->map_num++; } if(funct == prefix) { if(pref_map != NULL) { ele->k_prefmap = pref_map; } else { if((mp = (KEYMAP *)malloc(sizeof(KEYMAP) + (MAPINIT-1)*sizeof(MAP_ELEMENT))) == NULL) { ewprintf("Out of memory"); ele->k_funcp[c - ele->k_base] = curmap->map_default; return FALSE; } mp->map_num = 0; mp->map_max = MAPINIT; mp->map_default = rescan; ele->k_prefmap = mp; } } } else { n1 = c - ele->k_base; if(ele->k_funcp[n1] == funct && (funct!=prefix || pref_map==NULL || pref_map==ele->k_prefmap)) return TRUE; /* no change */ if(funct!=prefix || ele->k_prefmap==NULL) { if(ele->k_funcp[n1] == prefix) ele->k_prefmap = (KEYMAP *)NULL; ele->k_funcp[n1] = funct; /* easy case */ if(funct==prefix) { if(pref_map!=NULL) ele->k_prefmap = pref_map; else { if((mp = (KEYMAP *)malloc(sizeof(KEYMAP) + (MAPINIT-1)*sizeof(MAP_ELEMENT))) == NULL) { ewprintf("Out of memory"); ele->k_funcp[c - ele->k_base] = curmap->map_default; return FALSE; } mp->map_num = 0; mp->map_max = MAPINIT; mp->map_default = rescan; ele->k_prefmap = mp; } } } else { /* this case is the splits */ /* determine which side of the break c goes on */ /* 0 = after break; 1 = before break */ n2 = 1; for(i=0; n2 && i < n1; i++) n2 &= ele->k_funcp[i] != prefix; if(curmap->map_num >= curmap->map_max && (curmap = realocmap(curmap)) == NULL) return FALSE; if((pfp = (PF *)malloc((unsigned)(ele->k_num - c + !n2) * sizeof(PF))) == NULL) { ewprintf("Out of memory"); return FALSE; } ele->k_funcp[n1] = prefix; for(i=n1+n2; i <= ele->k_num - ele->k_base; i++) pfp[i-n1-n2] = ele->k_funcp[i]; for(mep = &curmap->map_element[curmap->map_num]; mep > ele; mep--) { mep->k_base = (mep-1)->k_base; mep->k_num = (mep-1)->k_num; mep->k_funcp = (mep-1)->k_funcp; mep->k_prefmap = (mep-1)->k_prefmap; } ele->k_num = c - !n2; (ele+1)->k_base = c + n2; (ele+1)->k_funcp = pfp; ele += !n2; ele->k_prefmap = NULL; curmap->map_num++; if(pref_map == NULL) { if((mp = (KEYMAP *)malloc(sizeof(KEYMAP) + (MAPINIT-1)*sizeof(MAP_ELEMENT))) == NULL) { ewprintf("Out of memory"); ele->k_funcp[c - ele->k_base] = curmap->map_default; return FALSE; } mp->map_num = 0; mp->map_max = MAPINIT; mp->map_default = rescan; ele->k_prefmap = mp; } else ele->k_prefmap = pref_map; } } return TRUE; } /* reallocate a keymap, used above */ static KEYMAP *realocmap(curmap) register KEYMAP *curmap; { register KEYMAP *mp; register int i; extern int nmaps; if((mp = (KEYMAP *)malloc((unsigned)(sizeof(KEYMAP)+ (curmap->map_max+(MAPGROW-1))*sizeof(MAP_ELEMENT)))) == NULL) { ewprintf("Out of memory"); return NULL; } mp->map_num = curmap->map_num; mp->map_max = curmap->map_max + MAPGROW; mp->map_default = curmap->map_default; for(i=curmap->map_num; i--; ) { mp->map_element[i].k_base = curmap->map_element[i].k_base; mp->map_element[i].k_num = curmap->map_element[i].k_num; mp->map_element[i].k_funcp = curmap->map_element[i].k_funcp; mp->map_element[i].k_prefmap = curmap->map_element[i].k_prefmap; } for(i=nmaps; i--; ) { if(map_table[i].p_map == curmap) map_table[i].p_map = mp; else fixmap(curmap, mp, map_table[i].p_map); } ele = &mp->map_element[ele - &curmap->map_element[0]]; return mp; } /* fix references to a reallocated keymap (recursive) */ static VOID fixmap(curmap, mp, mt) register KEYMAP *mt; register KEYMAP *curmap; KEYMAP *mp; { register int i; for(i = mt->map_num; i--; ) { if(mt->map_element[i].k_prefmap != NULL) { if(mt->map_element[i].k_prefmap == curmap) mt->map_element[i].k_prefmap = mp; else fixmap(curmap, mp, mt->map_element[i].k_prefmap); } } } /* * do the input for local-set-key, global-set-key and define-key * then call remap to do the work. */ static int dobind(curmap, p, unbind) register KEYMAP *curmap; char *p; int unbind; { PF funct; char prompt[80]; char *pep; int c; int s; KEYMAP *pref_map = NULL; #ifndef NO_MACRO if(macrodef) { /* keystrokes arn't collected. Not hard, but pretty useless */ /* would not work for function keys in any case */ ewprintf("Can't rebind key in macro"); return FALSE; } #ifndef NO_STARTUP if(inmacro) { for(s=0; s < maclcur->l_used - 1; s++) { if(doscan(curmap, c=CHARMASK(maclcur->l_text[s])) != prefix) { if(remap(curmap, c, prefix, (KEYMAP *)NULL) != TRUE) { return FALSE; } } curmap = ele->k_prefmap; } (VOID) doscan(curmap, c=maclcur->l_text[s]); maclcur = maclcur->l_fp; } else { #endif #endif (VOID) strcpy(prompt, p); pep = prompt + strlen(prompt); #ifdef FEPCTRL /* 90.11.26 by K.Takano */ fepmode_off(); #endif for(;;) { ewprintf("%s", prompt); pep[-1] = ' '; pep = keyname(pep, c = getkey(FALSE)); if(doscan(curmap,c) != prefix) break; *pep++ = '-'; *pep = '\0'; curmap = ele->k_prefmap; } #ifndef NO_STARTUP } #endif if(unbind) funct = rescan; else { if ((s=eread("%s to command: ", prompt, 80, EFFUNC|EFNEW, prompt)) != TRUE) return s; if (((funct = name_function(prompt)) == prefix) ? (pref_map = name_map(prompt)) == NULL : funct==NULL) { ewprintf("[No match]"); return FALSE; } } return remap(curmap, c, funct, pref_map); } /* * bindkey: bind key sequence to a function in * the specified map. Used by excline so it can bind function keys. * To close to release to change calling sequence, should just pass * KEYMAP *curmap rather than KEYMAP **mapp. */ #ifdef BINDKEY bindkey(mapp, fname, keys, kcount) KEYMAP **mapp; char *fname; KCHAR *keys; int kcount; { KEYMAP *curmap = *mapp; PF funct; int c; KEYMAP *pref_map = NULL; if(fname == NULL) funct = rescan; else if (((funct = name_function(fname)) == prefix) ? (pref_map = name_map(fname)) == NULL : funct==NULL) { ewprintf("[No match: %s]", fname); return FALSE; } while(--kcount) { if(doscan(curmap, c = *keys++) != prefix) { if(remap(curmap, c, prefix, (KEYMAP *)NULL) != TRUE) return FALSE; } curmap = ele->k_prefmap; } (VOID) doscan(curmap, c = *keys); return remap(curmap, c, funct, pref_map); } #endif /* * This function modifies the fundamental keyboard map. */ /*ARGSUSED*/ bindtokey(f, n) { return dobind(map_table[0].p_map, "Global set key: ", FALSE); } /* * This function modifies the current mode's keyboard map. */ /*ARGSUSED*/ localbind(f, n) { return dobind(curbp->b_modes[curbp->b_nmodes]->p_map, "Local set key: ", FALSE); } /* * This function redefines a key in any keymap. */ /*ARGSUSED*/ define_key(f, n) { static char buf[48] = "Define key map: "; MAPS *mp; buf[16] = '\0'; if(eread(buf, &buf[16], 48 - 16, EFNEW) != TRUE) return FALSE; if((mp = name_mode(&buf[16])) == NULL) { ewprintf("Unknown map %s", &buf[16]); return FALSE; } (VOID) strncat(&buf[16], " key: ", 48-16-1); return dobind(mp->p_map, buf, FALSE); } unbindtokey(f, n) int f, n; { return dobind(map_table[0].p_map, "Global unset key: ", TRUE); } localunbind(f, n) int f, n; { return dobind(curbp->b_modes[curbp->b_nmodes]->p_map, "Local unset key: ", TRUE); } /* * Extended command. Call the message line * routine to read in the command name and apply autocompletion * to it. When it comes back, look the name up in the symbol table * and run the command if it is found. * Print an error if there is anything wrong. */ extend(f, n) { PF funct; int s; char xname[NXNAME]; if(!(f & FFARG)) s = eread("M-x ", xname, NXNAME, EFNEW|EFFUNC); else s = eread("%d M-x ", xname, NXNAME, EFNEW|EFFUNC, n); if(s != TRUE) return s; if((funct = name_function(xname)) != NULL) { #ifndef NO_MACRO if(macrodef) { LINE *lp = maclcur; macro[macrocount-1].m_funct = funct; maclcur = lp->l_bp; maclcur->l_fp = lp->l_fp; free((char *)lp); } #endif return (*funct)(f, n); } ewprintf("[No match]"); return FALSE; } #ifndef NO_STARTUP /* * Define the commands needed to do startup-file processing. * This code is mostly a kludge just so we can get startup-file processing. * * If you're serious about having this code, you should rewrite it. * To wit: * It has lots of funny things in it to make the startup-file look * like a GNU startup file; mostly dealing with parens and semicolons. * This should all vanish. * * We define eval-expression because it's easy. It can make * *-set-key or define-key set an arbitrary key sequence, so it isn't * useless. */ /* * evalexpr - get one line from the user, and run it. */ /*ARGSUSED*/ evalexpr(f, n) { int s; char exbuf[128]; if ((s = ereply("Eval: ", exbuf, 128)) != TRUE) return s; return excline(exbuf); } /* * evalbuffer - evaluate the current buffer as line commands. Useful * for testing startup files. */ /*ARGSUSED*/ evalbuffer(f, n) { register LINE *lp; register BUFFER *bp = curbp; register int s; static char excbuf[128]; for (lp = lforw(bp->b_linep); lp != bp->b_linep; lp = lforw(lp)) { if (llength(lp) >= 128) return FALSE; (VOID) strncpy(excbuf, ltext(lp), llength(lp)); excbuf[llength(lp)] = '\0'; /* make sure it's terminated */ if ((s = excline(excbuf)) != TRUE) return s; } return TRUE; } /* * evalfile - go get a file and evaluate it as line commands. You can * go get your own startup file if need be. */ /*ARGSUSED*/ evalfile(f, n) { register int s; char fname[NFILEN]; #ifdef EXTD_DIR ensurecwd(); edefset(curbp->b_cwd); #endif #ifndef NO_FILECOMP if ((s = eread("Load file: ", fname, NFILEN, EFNEW|EFFILE|EFCR)) != TRUE) #else if ((s = ereply("Load file: ", fname, NFILEN)) != TRUE) #endif return s; return load(fname); } /* * load - go load the file name we got passed. */ load(fname) char *fname; { int s = TRUE; int nbytes; char excbuf[256]; int lineno = 0; if ((fname = adjustname(fname)) == NULL) return FALSE; /* just to be careful */ if (ffropen(fname) != FIOSUC) return FALSE; ewprintf("Loading %s ...",fname); #ifdef KANJI /* 90.01.29 by S.Yoshida */ ksetfincode(NULL); #endif /* KANJI */ #ifdef HANKANA /* 92.11.21 by S.Sasaki */ while ((s = ffgetline(excbuf, sizeof(excbuf)/2-1, &nbytes)) == FIOSUC) { #else /* HANKANA */ while ((s = ffgetline(excbuf, sizeof(excbuf)-1, &nbytes)) == FIOSUC) { #endif /* HANKANA */ lineno++; #ifdef KANJI /* 90.01.29 by S.Yoshida */ nbytes = kcodeconv(excbuf, nbytes, NULL); #endif /* KANJI */ excbuf[nbytes] = '\0'; if (excline(excbuf) != TRUE) { s = FIOERR; ewprintf("Error loading file %s in %d line", fname, lineno); break; } } (VOID) ffclose(); excbuf[nbytes] = '\0'; if(s!=FIOEOF || (nbytes && excline(excbuf)!=TRUE)) return FALSE; ewprintf("Loading %s ... done",fname); return TRUE; } /* * excline - run a line from a load file or eval-expression. * if FKEYS is defined, duplicate functionallity of dobind so function * key values don't have to fit in type char. */ excline(line) register char *line; { register char *funcp, *argp = NULL; register int c; int status; int f, n; LINE *lp, *np; PF fp; #ifdef FKEYS int bind; KEYMAP *curmap; MAPS *mp; #define BINDARG 0 /* this arg is key to bind (local/global set key) */ #define BINDNO 1 /* not binding or non-quoted BINDARG */ #define BINDNEXT 2 /* next arg " (define-key) */ #define BINDDO 3 /* already found key to bind */ #define BINDEXT 1 /* space for trailing \0 */ #else #define BINDEXT 0 #endif PF name_function(); LINE *lalloc(); if(macrodef || inmacro) { ewprintf("Not now!"); return FALSE; } f = 0; n = 1; funcp = skipwhite(line); if (*funcp == '\0') return TRUE; /* No error on blank lines */ line = parsetoken(funcp); if (*line != '\0') { *line++ = '\0'; line = skipwhite(line); if ((*line >= '0' && *line <= '9') || *line == '-') { argp = line; line = parsetoken(line); } } if (argp != NULL) { f = FFARG; n = atoi(argp); } if((fp = name_function(funcp)) == NULL) { ewprintf("Unknown function: %s", funcp); return FALSE; } #ifdef FKEYS if(fp == bindtokey || fp == unbindtokey) { bind = BINDARG; curmap = map_table[0].p_map; } else if(fp == localbind || fp == localunbind) { bind = BINDARG; curmap = curbp->b_modes[curbp->b_nmodes]->p_map; } else if(fp == define_key) bind = BINDNEXT; else bind = BINDNO; #endif /* Pack away all the args now... */ if((np = lalloc(0))==FALSE) return FALSE; np->l_fp = np->l_bp = maclcur = np; while (*line != '\0') { argp = skipwhite(line); if (*argp == '\0') break; line = parsetoken(argp); if (*argp != '"') { if (*argp == '\'') ++argp; if((lp = lalloc((int)(line-argp)+BINDEXT))==NULL) { status = FALSE; goto cleanup; } bcopy(argp, ltext(lp), (int)(line-argp)); #ifdef FKEYS lp->l_used--; /* don't count BINDEXT! */ if(bind == BINDARG) bind = BINDNO; #endif } else { /* Quoted strings special */ ++argp; #ifdef FKEYS if(bind != BINDARG) { #endif if((lp = lalloc((int)(line-argp)+BINDEXT))==NULL) { status = FALSE; goto cleanup; } lp->l_used = 0; #ifdef FKEYS } else { key.k_count = 0; } #endif while (*argp != '"' && *argp != '\0') { if (*argp != '\\') c = *argp++; else { switch(*++argp) { case 't': case 'T': c = CCHR('I'); break; case 'n': case 'N': c = CCHR('J'); break; case 'r': case 'R': c = CCHR('M'); break; case 'e': case 'E': c = CCHR('['); break; case '^': /* split into two statements due to bug in OSK cpp */ c = CHARMASK(*++argp); #ifdef BUGFIX /* 90.02.28 by S.Yoshida */ if (c == '\\') { c = CHARMASK(*++argp); } #endif /* BUGFIX */ c = ISLOWER(c) ? CCHR(TOUPPER(c)) : CCHR(c); break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': c = *argp - '0'; if(argp[1] <= '7' && argp[1] >= '0') { c <<= 3; c += *++argp - '0'; if(argp[1] <= '7' && argp[1] >= '0') { c <<= 3; c += *++argp - '0'; } } break; #ifdef FKEYS case 'f': case 'F': c = *++argp - '0'; if(ISDIGIT(argp[1])) { c *= 10; c += *++argp - '0'; } c += KFIRST; break; #endif default: c = CHARMASK(*argp); break; } argp++; } #ifdef FKEYS if(bind == BINDARG) key.k_chars[key.k_count++] = c; else #endif lp->l_text[lp->l_used++] = c; } if(*line) line++; } #ifdef FKEYS switch(bind) { case BINDARG: bind = BINDDO; break; case BINDNEXT: lp->l_text[lp->l_used] = '\0'; if((mp = name_mode(lp->l_text)) == NULL) { ewprintf("No such mode: %s", lp->l_text); status = FALSE; free((char *)lp); goto cleanup; } curmap = mp->p_map; free((char *)lp); bind = BINDARG; break; default: #endif lp->l_fp = np->l_fp; lp->l_bp = np; np->l_fp = lp; np = lp; #ifdef FKEYS } #endif } #ifdef FKEYS switch(bind) { default: ewprintf("Bad args to set key"); status = FALSE; break; case BINDDO: if(fp != unbindtokey && fp != localunbind) { lp->l_text[lp->l_used] = '\0'; status = bindkey(&curmap, lp->l_text, key.k_chars, key.k_count); } else status = bindkey(&curmap, (char *)NULL, key.k_chars, key.k_count); break; case BINDNO: #endif inmacro = TRUE; maclcur = maclcur->l_fp; status = (*fp)(f, n); inmacro = FALSE; #ifdef FKEYS } #endif cleanup: lp = maclcur->l_fp; while(lp!=maclcur) { np = lp->l_fp; free((char *)lp); lp = np; } free((char *)lp); return status; } /* * a pair of utility functions for the above */ static char * skipwhite(s) register char *s; { while(*s == ' ' || *s == '\t' || *s == ')' || *s == '(') s++; if (*s == ';') *s = '\0' ; return s; } static char * parsetoken(s) register char *s; { if (*s != '"') { while(*s && *s!=' ' && *s!='\t' && *s!=')' && *s!='(') s++; if(*s==';') *s='\0'; } else do { /* Strings get special treatment */ /* Beware: You can \ out the end of the string! */ if (*s == '\\') ++s; } while (*++s != '"' && *s != '\0'); return s; } #endif ng-1.5beta1/file.c100644 1750 1750 53227 7303476024 12572 0ustar amurausers/* $Id: file.c,v 1.8 2001/05/25 15:36:52 amura Exp $ */ /* * File commands. */ /* * $Log: file.c,v $ * Revision 1.8 2001/05/25 15:36:52 amura * now buffers have only one mark (before windows have one mark) * * Revision 1.7 2001/02/18 19:29:30 amura * split dir.c to port depend/independ * * Revision 1.6 2001/02/18 17:07:25 amura * append AUTOSAVE feature (but NOW not work) * * Revision 1.5 2000/12/22 19:54:35 amura * fix some bug in filename handling * * Revision 1.4 2000/12/14 18:06:24 amura * filename length become flexible * * Revision 1.3 2000/06/27 01:49:43 amura * import to CVS * * Revision 1.2 2000/06/01 05:26:51 amura * Undo support * * Revision 1.1 1999/05/19 03:56:19 amura * Initial revision * */ /* 90.01.29 Modified for Ng 1.0 by S.Yoshida */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include "def.h" #ifdef UNDO #include "undo.h" #endif BUFFER *findbuffer(); VOID makename(); VOID upmodes(); static char *itos(); /* * insert a file into the current buffer. Real easy - just call the * insertfile routine with the file name. */ /*ARGSUSED*/ fileinsert(f, n) { register int s; char fname[NFILEN]; #ifdef EXTD_DIR ensurecwd(); edefset(curbp->b_cwd); #endif #ifndef NO_FILECOMP /* 90.04.04 by K.Maeda */ if ((s=eread("Insert file: ", fname, NFILEN, EFNEW|EFFILE|EFCR)) != TRUE) #else /* NO_FILECOMP */ if ((s=ereply("Insert file: ", fname, NFILEN)) != TRUE) #endif /* NO_FILECOMP */ return (s); #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return TRUE; } else #endif /* READONLY */ return insertfile(adjustname(fname), (char *) NULL); /* don't set buffer name */ } /* * fileopen is a combined routine of filevisit, filereadonly and * poptofile. */ static fileopen(f, n, readonly, popup, prompt) int f, n, readonly, popup; char *prompt; { register BUFFER *bp; register WINDOW *wp; int s; char fname[NFILEN]; char *adjf; #ifdef KANJI /* 90.01.29 by S.Yoshida */ int saved_kexpect; extern int global_kexpect; /* Defined at kanjic. */ #endif /* KANJI */ #ifdef EXTD_DIR ensurecwd(); edefset(curbp->b_cwd); #endif #ifndef NO_FILECOMP /* 90.04.04 by K.Maeda */ if ((s=eread(prompt, fname, NFILEN, EFNEW|EFFILE|EFCR)) != TRUE) #else /* NO_FILECOMP */ if ((s=ereply(prompt, fname, NFILEN)) != TRUE) #endif /* NO_FILECOMP */ return s; #ifdef KANJI /* 90.01.29 by S.Yoshida */ saved_kexpect = global_kexpect; if (f & FFARG) { if (n < 0) { global_kexpect = NIL; } else if (n == 4) { global_kexpect = T; } else if (n >= 0 && n <= 3) { global_kexpect = n; } else { ewprintf("Invalid argument %d", n); return FALSE; } } #endif /* KANJI */ adjf = adjustname(fname); #ifndef NO_DIRED /* 91.01.15 by K.Maeda */ /* 91.01.16 by S.Yoshida */ if (ffisdir(adjf)) { eargset(adjf); return dired(f, n); } #endif /* NO_DIRED */ if ((bp = findbuffer(adjf)) == NULL) { #ifdef KANJI /* 90.01.29 by S.Yoshida */ global_kexpect = saved_kexpect; #endif /* KANJI */ return FALSE; } if (popup) { if ((wp = popbuf(bp)) == NULL) { #ifdef KANJI /* 90.01.29 by S.Yoshida */ global_kexpect = saved_kexpect; #endif /* KANJI */ return FALSE; } curbp = bp; curwp = wp; } else { curbp = bp; if (showbuffer(bp, curwp, WFHARD) != TRUE) { #ifdef KANJI /* 90.01.29 by S.Yoshida */ global_kexpect = saved_kexpect; #endif /* KANJI */ return FALSE; } } if (bp->b_fname == NULL) { s = readin(adjf); /* Read it in. */ #ifdef KANJI /* 90.01.29 by S.Yoshida */ global_kexpect = saved_kexpect; #endif #ifdef READONLY if (readonly) { bp->b_flag |= BFRONLY; /* Mark as read-only */ } else if (bp->b_fname != NULL) { if (fchkreadonly(bp->b_fname)) {/* If no write permission, */ bp->b_flag |= BFRONLY; /* mark as read-only. */ ewprintf("File is write protected"); } } #endif /* READONLY */ return (s); } #ifdef KANJI /* 90.01.29 by S.Yoshida */ global_kexpect = saved_kexpect; #endif /* KANJI */ #ifdef READONLY if (readonly) { bp->b_flag |= BFRONLY; /* Mark as read-only */ wp = wheadp; /* Update mode lines. */ while (wp != NULL) { if (wp->w_bufp == bp) { wp->w_flag |= WFMODE; } wp = wp->w_wndp; } } #endif return TRUE; } /* * Select a file for editing. * Look around to see if you can find the * file in another buffer; if you can find it * just switch to the buffer. If you cannot find * the file, create a new buffer, read in the * text, and switch to the new buffer. */ /*ARGSUSED*/ filevisit(f, n) { return fileopen(f, n, FALSE, FALSE, "Find file: "); } /* * Pop to a file in the other window. Same as last function, just * popbuf instead of showbuffer. */ /*ARGSUSED*/ poptofile(f, n) { return fileopen(f, n, FALSE, TRUE, "Find file in other window: "); } #ifdef READONLY /* 91.01.05 by S.Yoshida */ /* * Select a file for viewing. * Look around to see if you can find the * fine in another buffer; if you can find it * just switch to the buffer. If you cannot find * the file, create a new buffer, read in the * text, and switch to the new buffer. * This function is based on filevisit(). */ /*ARGSUSED*/ filereadonly(f, n) { return fileopen(f, n, TRUE, FALSE, "Find file read-only: "); } #endif /* READONLY */ int filealternate(f, n) int f, n; { int s; char fname[NFILEN], *prompt = "Find alternate file: "; #ifdef EXTD_DIR ensurecwd(); edefset(curbp->b_cwd); #endif #ifndef NO_FILECOMP /* 90.04.04 by K.Maeda */ s = eread(prompt, fname, NFILEN, EFNEW | EFFILE | EFCR); #else /* NO_FILECOMP */ s = ereply(prompt, fname, NFILEN); #endif /* NO_FILECOMP */ if (s != TRUE) { return FALSE; } if (curbp) { eargset(curbp->b_bname); if (killbuffer(0, 1)) { eargset(fname); return filevisit(f, n); } } return FALSE; } /* * given a file name, either find the buffer it uses, or create a new * empty buffer to put it in. */ BUFFER * findbuffer(fname) char *fname; { register BUFFER *bp; char bname[NBUFN], *cp; unsigned count = 1; for (bp=bheadp; bp!=NULL; bp=bp->b_bufp) { if (bp->b_fname!=NULL && (fncmp(bp->b_fname, fname)==0)) return bp; } makename(bname, fname); /* New buffer name. */ cp = bname + strlen(bname); while(bfind(bname, FALSE) != NULL) { *cp = '<'; /* add "" to then name */ (VOID) strcpy(itos(cp, ++count)+1, ">"); } return bfind(bname, TRUE); } /* * Put the decimal representation of num into a buffer. Hacked to be * faster, smaller, and less general. */ static char *itos(bufp, num) char *bufp; unsigned num; { if (num >= 10) { bufp = itos(bufp, num/10); num %= 10; } *++bufp = '0' + num; return bufp; } /* * Read the file "fname" into the current buffer. * Make all of the text in the buffer go away, after checking * for unsaved changes. This is called by the "read" command, the * "visit" command, and the mainline (for "uemacs file"). */ readin(fname) char *fname; { register int status; register WINDOW *wp; #ifdef C_MODE extern int flag_use_c_mode; #endif if (bclear(curbp) != TRUE) /* Might be old. */ return TRUE; status = insertfile(fname, fname) ; #ifdef AUTOSAVE /* 96.12.24 by M.Suzuki */ curbp->b_flag &= ~(BFCHG|BFACHG); /* No change. */ #else curbp->b_flag &= ~BFCHG; /* No change. */ #endif /* AUTOSAVE */ for (wp=wheadp; wp!=NULL; wp=wp->w_wndp) { if (wp->w_bufp == curbp) { wp->w_dotp = wp->w_linep = lforw(curbp->b_linep); wp->w_lines = 0; wp->w_doto = 0; } } #ifdef C_MODE /* 91.01.13 by S.Yoshida */ if (flag_use_c_mode) { char *ptr; ptr = fname + strlen(fname); while (ptr > fname) { if (*(--ptr) == '.') break; } if (ptr > fname) { ptr++; if ( (ptr[1]=='\0' && (ptr[0]=='c' || ptr[0] =='h' || ptr[0]=='C' || ptr[0]=='m')) ||(ptr[2]=='\0' && ptr[0]=='c' && ptr[1]=='c') ||(ptr[3]=='\0' && (ptr[0]=='c'||ptr[0]=='h') && ptr[1]==ptr[2] && (ptr[1]=='p'||ptr[1]=='x')) ) { cmode(0, 1); /* Change into C-mode. */ } } } #endif /* C_MODE */ return status; } /* * insert a file in the current buffer, after dot. Set mark * at the end of the text inserted, point at the beginning. * Return a standard status. Print a summary (lines read, * error message) out as well. If the * BACKUP conditional is set, then this routine also does the read * end of backup processing. The BFBAK flag, if set in a buffer, * says that a backup should be taken. It is set when a file is * read in, but not on a new file (you don't need to make a backup * copy of nothing). */ insertfile(fname, newname) char fname[], newname[]; { register LINE *lp1 = (LINE *)NULL; register LINE *lp2; register WINDOW *wp; int nbytes; LINE *olp; /* Line we started at */ int opos; /* and offset into it */ int s, nline; BUFFER *bp; char line[NLINE]; #ifdef HANKANA /* 92.11.21 by S.Sasaki */ int leng; #endif /* HANKANA */ bp = curbp; /* Cheap. */ if (newname != (char *) NULL) { if (bp->b_fname != NULL) free(bp->b_fname); if ((bp->b_fname=malloc(strlen(newname)+1)) == NULL) { ewprintf("Could not allocate %d bytes", strlen(newname) + 1); return FALSE; } (VOID) strcpy(bp->b_fname, newname); #ifdef EXTD_DIR if (bp->b_cwd != NULL) free(bp->b_cwd); bp->b_cwd = NULL; #endif } if ((s=ffropen(fname)) == FIOERR) /* Hard file open. */ goto out; if (s == FIOFNF) { /* File not found. */ if (newname != NULL) ewprintf("(New file)"); else ewprintf("(File not found)"); goto out; } opos = curwp->w_doto; /* Open a new line, at point, and start inserting after it */ (VOID) lnewline(); olp = lback(curwp->w_dotp); if(olp == curbp->b_linep) { /* if at end of buffer, create a line to insert before */ (VOID) lnewline(); curwp->w_dotp = lback(curwp->w_dotp); } nline = 0; /* Don't count fake line at end */ #ifdef KANJI /* 90.01.29 by S.Yoshida */ ksetfincode(bp); #endif /* KANJI */ while ((s=ffgetline(line, NLINE, &nbytes)) != FIOERR) { switch(s) { case FIOSUC: ++nline; /* and continue */ case FIOEOF: /* the last line of the file */ #ifdef HANKANA /* 92.11.21 by S.Sasaki */ leng = kcodecount(line, nbytes); if ((lp1=lalloc(leng > nbytes ? leng : nbytes)) == NULL) { s = FIOERR; /* Keep message on the */ goto endoffile; /* display. */ } #else /* Not HANKANA */ if ((lp1=lalloc(nbytes)) == NULL) { s = FIOERR; /* Keep message on the */ goto endoffile; /* display. */ } #endif /* HANKANA */ bcopy(line, <ext(lp1)[0], nbytes); #ifdef KANJI /* 90.01.29 by S.Yoshida */ if ((lp1->l_used = kcodeconv(ltext(lp1), nbytes, bp)) < 0) { s = FIOERR; goto endoffile; } #endif /* KANJI */ lineread: lp2 = lback(curwp->w_dotp); lp2->l_fp = lp1; lp1->l_fp = curwp->w_dotp; lp1->l_bp = lp2; curwp->w_dotp->l_bp = lp1; if(s==FIOEOF) goto endoffile; break; case FIOLONG: { /* a line to long to fit in our buffer */ char *cp; char *cp2 = (char *)NULL; int i; nbytes = 0; for(;;) { if((cp = malloc((unsigned)(nbytes + NLINE))) == NULL) { ewprintf("Could not allocate %d bytes", nbytes + NLINE); s = FIOERR; if(nbytes) { free(cp2); cp2 = (char *)NULL; } goto endoffile; } if(nbytes) { bcopy(cp2, cp, nbytes); free(cp2); cp2 = (char *)NULL; } bcopy(line, cp+nbytes, NLINE); nbytes += NLINE; switch(s = ffgetline(line, NLINE, &i)) { case FIOERR: free(cp); goto endoffile; case FIOLONG: cp2 = cp; break; case FIOEOF: case FIOSUC: cp2 = cp; if((cp = malloc((unsigned)( nbytes + i ))) == NULL) { ewprintf("Could not allocate %d bytes", nbytes + i); s = FIOERR; free(cp2); cp2 = (char *)NULL; goto endoffile; } bcopy(cp2, cp, nbytes); bcopy(line, cp+nbytes, i); free(cp2); cp2 = (char *)NULL; #ifdef HANKANA /* 92.11.21 by S.Sasaki */ leng = kcodecount(cp, nbytes+i); if((lp1=lalloc( leng > nbytes+i ? leng : nbytes+i )) == NULL) { s = FIOERR; free(cp); goto endoffile; } bcopy(cp, <ext(lp1)[0], nbytes + i); #else /* not HANKANA */ if((lp1=lalloc(nbytes+i)) == NULL) { s = FIOERR; free(cp); goto endoffile; } bcopy(cp, <ext(lp1)[0], llength(lp1)); #endif /* HANKANA */ free(cp); #ifdef KANJI /* 90.01.29 by S.Yoshida */ if ( (lp1->l_used = kcodeconv(ltext(lp1), nbytes + i, bp)) <0 ) { s =FIOERR; goto endoffile; } #endif /* KANJI */ goto lineread; } } } default: ewprintf("Unknown code %d reading file", s); s = FIOERR; break; } } endoffile: (VOID) ffclose(); /* Ignore errors. */ if (s==FIOEOF) { /* Don't zap an error. */ if (nline == 1) ewprintf("(Read 1 line)"); else ewprintf("(Read %d lines)", nline); } /* Set mark at the end of the text */ curwp->w_dotp = bp->b_markp = lback(curwp->w_dotp); bp->b_marko = llength(bp->b_markp); (VOID) ldelnewline(); curwp->w_dotp = olp; curwp->w_doto = opos; if(olp == curbp->b_linep) curwp->w_dotp = lforw(olp); #ifdef AUTOSAVE /* 96.12.24 by M.Suzuki */ #ifndef NO_BACKUP if (newname != NULL) bp->b_flag |= (BFCHG|BFBAK|BFACHG);/* Need a backup. */ else bp->b_flag |= (BFCHG|BFACHG); #else bp->b_flag |= (BFCHG|BFACHG); #endif #else /* not AUTOSAVE */ #ifndef NO_BACKUP if (newname != NULL) bp->b_flag |= BFCHG | BFBAK; /* Need a backup. */ else bp->b_flag |= BFCHG; #else bp->b_flag |= BFCHG; #endif #endif /* AUTOSAVE */ /* if the insert was at the end of buffer, set lp1 to the end of * buffer line, and lp2 to the beginning of the newly inserted * text. (Otherwise lp2 is set to NULL.) This is * used below to set pointers in other windows correctly if they * are also at the end of buffer. */ lp1 = bp->b_linep; if (bp->b_markp == lp1) { lp2 = curwp->w_dotp; } else { (VOID) ldelnewline(); /* delete extranious newline */ out: lp2 = NULL; } for (wp=wheadp; wp!=NULL; wp=wp->w_wndp) { if (wp->w_bufp == curbp) { wp->w_flag |= WFMODE|WFEDIT; if (wp != curwp && lp2 != NULL) { if (wp->w_dotp == lp1) wp->w_dotp = lp2; if (bp->b_markp == lp1) bp->b_markp = lp2; if (wp->w_linep == lp1) { wp->w_linep = lp2; wp->w_lines = 0; } } } } #ifdef UNDO undo_reset(bp); #endif return s != FIOERR; /* False if error. */ } /* * Take a file name, and from it * fabricate a buffer name. This routine knows * about the syntax of file names on the target system. * BDC1 left scan delimiter. * BDC2 optional second left scan delimiter. * BDC3 optional right scan delimiter. */ VOID makename(bname, fname) char bname[]; char fname[]; { register char *cp1; register char *cp2; cp1 = &fname[0]; while (*cp1 != 0) ++cp1; --cp1; /* insure at least 1 character ! */ while (cp1!=&fname[0] && cp1[-1]!=BDC1 #ifdef BDC2 && cp1[-1]!=BDC2 #endif ) --cp1; cp2 = &bname[0]; while (cp2!=&bname[NBUFN-1] && *cp1!=0 #ifdef BDC3 && *cp1!=BDC3 #endif ) *cp2++ = *cp1++; *cp2 = 0; } #ifdef EXTD_DIR /* * Take a file name, and from it * fabricate a path name. This routine knows * about the syntax of file names on the target system. * BDC1 left scan delimiter. * BDC2 optional second left scan delimiter. * BDC3 optional right scan delimiter. * * Modified based on makename() and introduced by Tillanosoft, Mar 22, 1999 */ VOID makepath(dname, fname, len) char *dname, *fname; int len; { register char *cp1, *ecp1, *cp2, *ecp2; cp1 = fname; while (*cp1 != 0) { ++cp1; } while (fname < cp1 && cp1[-1] != BDC1 #ifdef BDC2 && cp1[-1] != BDC2 #endif ) { --cp1; } ecp1 = (fname < cp1) ? cp1 : fname; cp1 = fname; cp2 = dname; ecp2 = dname + len - 1; /* -1 is for the EOS at the end */ while (cp2 < ecp2 && cp1 < ecp1) { *cp2++ = *cp1++; } *cp2 = 0; } #endif /* EXTD_DIR */ /* * Ask for a file name, and write the * contents of the current buffer to that file. * Update the remembered file name and clear the * buffer changed flag. This handling of file names * is different from the earlier versions, and * is more compatable with Gosling EMACS than * with ITS EMACS. */ /*ARGSUSED*/ filewrite(f, n) { register int s; char fname[NFILEN]; char *adjfname; char *newname; #ifdef EXTD_DIR ensurecwd(); edefset(curbp->b_cwd); #endif #ifndef NO_FILECOMP /* 90.04.04 by K.Maeda */ if ((s=eread("Write file: ", fname, NFILEN, EFNEW|EFFILE|EFCR)) != TRUE) #else /* NO_FILECOMP */ if ((s=ereply("Write file: ", fname, NFILEN)) != TRUE) #endif /* NO_FILECOMP */ return (s); #ifdef AUTOSAVE /* 01.01.06 by M.Suzuki */ { char aname[NFILEN]; autosave_name(aname, fname, NFILEN); unlink(aname); } #endif /* AUTOSAVE */ adjfname = adjustname(fname); if ((s=writeout(curbp, adjfname)) == TRUE) { if ((newname=malloc(strlen(adjfname)+1)) == NULL) { ewprintf("Could not allocate %d bytes", strlen(adjfname) + 1); return FALSE; } (VOID) strcpy(newname, adjfname); if (curbp->b_fname != NULL) free(curbp->b_fname); curbp->b_fname = newname; #ifdef EXTD_DIR if (curbp->b_cwd != NULL) free(curbp->b_cwd); curbp->b_cwd = NULL; #endif #ifdef AUTOSAVE /* 96.12.24 by M.Suzuki */ #ifndef NO_BACKUP curbp->b_flag &= ~(BFBAK | BFCHG | BFACHG); #else curbp->b_flag &= ~(BFCHG|BFACHG); #endif #else /* not AUTOSAVE */ #ifndef NO_BACKUP curbp->b_flag &= ~(BFBAK | BFCHG); #else curbp->b_flag &= ~BFCHG; #endif #endif /* AUTOSAVE */ #ifdef BUGFIX /* 91.01.18 by S.Yoshida */ { BUFFER *bp; char bname[NBUFN], *cp; unsigned count = 1; makename(bname, adjfname); /* New buffer name. */ cp = bname + strlen(bname); while((bp = bfind(bname, FALSE)) != NULL) { if (bp->b_fname!=NULL && (fncmp(bp->b_fname, adjfname)==0)) { break; } *cp = '<'; /* add "" to then name */ (VOID) strcpy(itos(cp, ++count)+1, ">"); } if ((cp = malloc((unsigned)(strlen(bname)+1))) != NULL) { (VOID) strcpy(cp, bname); free(curbp->b_bname); curbp->b_bname = cp; } } #endif /* BUGFIX */ upmodes(curbp); } return s; } /* * Save the contents of the current buffer back into * its associated file. */ #ifndef NO_BACKUP #ifndef MAKEBACKUP #define MAKEBACKUP TRUE #endif static int makebackup = MAKEBACKUP; #endif /*ARGSUSED*/ filesave(f, n) { return buffsave(curbp); } /* * Save the contents of the buffer argument into its associated file. * Do nothing if there have been no changes * (is this a bug, or a feature). Error if there is no remembered * file name. If this is the first write since the read or visit, * then a backup copy of the file is made. * Allow user to select whether or not to make backup files * by looking at the value of makebackup. */ buffsave(bp) BUFFER *bp; { register int s; #ifndef NO_BACKUP /* 90.02.14 by S.Yoshida */ #ifdef BUGFIX /* 90.02.14 by S.Yoshida */ register int m = -1; VOID fsetfilemode(); #endif /* BUGFIX */ #endif /* NO_BACKUP */ if ((bp->b_flag&BFCHG) == 0) { /* Return, no changes. */ ewprintf("(No changes need to be saved)"); return TRUE; } if (bp->b_fname == NULL) { /* Must have a name. */ ewprintf("No file name"); return (FALSE); } #ifndef NO_BACKUP if (makebackup && (bp->b_flag&BFBAK)) { #ifdef BUGFIX /* 90.02.14 by S.Yoshida */ m = fgetfilemode(bp->b_fname); #endif /* BUGFIX */ s = fbackupfile(bp->b_fname); if (s == ABORT) /* Hard error. */ return FALSE; if (s == FALSE /* Softer error. */ && (s=eyesno("Backup error, save anyway")) != TRUE) return s; } #endif #ifdef AUTOSAVE /* 01.01.06 by M.Suzuki */ { char aname[NFILEN]; autosave_name(aname, bp->b_fname, NFILEN); unlink(aname); } #endif /* AUTOSAVE */ if ((s=writeout(bp, bp->b_fname)) == TRUE) { #ifndef NO_BACKUP #ifdef BUGFIX /* 90.02.14 by S.Yoshida */ if (m != -1) { fsetfilemode(bp->b_fname, m); } #endif /* BUGFIX */ #ifdef AUTOSAVE /* 96.12.24 by M.Suzuki */ bp->b_flag &= ~(BFCHG | BFBAK | BFACHG); #else bp->b_flag &= ~(BFCHG | BFBAK); #endif #else /* not NO_BACKUP */ #ifdef AUTOSAVE /* 96.12.24 by M.Suzuki */ bp->b_flag &= ~(BFCHG | BFACHG); #else bp->b_flag &= ~BFCHG; #endif #endif /* NO_BACKUP */ upmodes(bp); } return s; } #ifndef NO_BACKUP /* Since we don't have variables (we probably should) * this is a command processor for changing the value of * the make backup flag. If no argument is given, * sets makebackup to true, so backups are made. If * an argument is given, no backup files are made when * saving a new version of a file. Only used when BACKUP * is #defined. */ /*ARGSUSED*/ makebkfile(f, n) { if(f & FFARG) makebackup = n > 0; else makebackup = !makebackup; ewprintf("Backup files %sabled", makebackup ? "en" : "dis"); return TRUE; } #endif /* * This function performs the details of file * writing; writing the file in buffer bp to * file fn. Uses the file management routines * in the "fileio.c" package. Most of the grief * is checking of some sort. */ writeout(bp, fn) register BUFFER *bp; char *fn; { register int s; if (fn == NULL) return (FALSE); if ((s=ffwopen(fn)) != FIOSUC) /* Open writes message. */ return (FALSE); s = ffputbuf(bp); if (s == FIOSUC) { /* No write error. */ s = ffclose(); if (s==FIOSUC) ewprintf("Wrote %s", fn); } else /* Ignore close error */ (VOID) ffclose(); /* if a write error. */ return s == FIOSUC; } /* * Tag all windows for bp (all windows if bp NULL) as needing their * mode line updated. */ VOID upmodes(bp) register BUFFER *bp; { register WINDOW *wp; for (wp = wheadp; wp != NULL; wp = wp->w_wndp) #ifdef BUGFIX /* 91.01.15 by K.Maeda */ if (bp == NULL || wp->w_bufp == bp) wp->w_flag |= WFMODE; #else /* ORIGINAL */ if (bp == NULL || curwp->w_bufp == bp) wp->w_flag |= WFMODE; #endif /* BUGFIX */ } ng-1.5beta1/help.c100644 1750 1750 17740 7244000515 12573 0ustar amurausers/* $Id: help.c,v 1.3 2001/02/18 17:07:25 amura Exp $ */ /* Help functions for MicroGnuEmacs 2 */ /* * $Id: help.c,v 1.3 2001/02/18 17:07:25 amura Exp $ */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include "def.h" #ifndef NO_HELP #include "kbd.h" #include "key.h" #ifndef NO_MACRO #include "macro.h" #endif extern int rescan(); /* 91.02.06 Move static declaration to here for some compiler. by S.Yoshida */ static int showall(); static VOID findbind(); static VOID bindfound(); /* * Read a key from the keyboard, and look it * up in the keymap. Display the name of the function * currently bound to the key. */ /*ARGSUSED*/ desckey(f, n) { register KEYMAP *curmap; register PF funct; register char *pep; char prompt[80]; int c; int m; int i; #ifndef NO_MACRO if(inmacro) return TRUE; /* ignore inside keyboard macro */ #endif (VOID) strcpy(prompt, "Describe key briefly: "); pep = prompt + strlen(prompt); key.k_count = 0; m = curbp->b_nmodes; curmap = curbp->b_modes[m]->p_map; #ifdef FEPCTRL /* 90.11.26 by K.Takano */ fepmode_off(); #endif for(;;) { for(;;) { ewprintf("%s", prompt); pep[-1] = ' '; pep = keyname(pep, key.k_chars[key.k_count++] = c = getkey(FALSE)); if((funct = doscan(curmap, c)) != prefix) break; *pep++ = '-'; *pep = '\0'; curmap = ele->k_prefmap; } if(funct != rescan) break; if(ISUPPER(key.k_chars[key.k_count-1])) { funct = doscan(curmap, TOLOWER(key.k_chars[key.k_count-1])); if(funct == prefix) { *pep++ = '-'; *pep = '\0'; curmap = ele->k_prefmap; continue; } if(funct != rescan) break; } nextmode: if(--m < 0) break; curmap = curbp->b_modes[m]->p_map; for(i=0; i < key.k_count; i++) { funct = doscan(curmap, key.k_chars[i]); if(funct != prefix) { if(i == key.k_count - 1 && funct != rescan) goto found; funct = rescan; goto nextmode; } curmap = ele->k_prefmap; } *pep++ = '-'; *pep = '\0'; } found: if(funct == rescan) ewprintf("%k is not bound to any function"); else if((pep = function_name(funct)) != NULL) ewprintf("%k runs the command %s", pep); else ewprintf("%k is bound to an unnamed function"); #ifdef KANJI /* code from Ng-1.3.1L+6 */ if (ISKANJI(c)) getkey(FALSE); /* eat up kanji 2nd byte */ #endif return TRUE; } /* * This function creates a table, listing all * of the command keys and their current bindings, and stores * the table in the *help* pop-up buffer. This * lets MicroGnuEMACS produce it's own wall chart. */ static BUFFER *bp; static char buf[80]; /* used by showall and findbind */ /*ARGSUSED*/ wallchart(f, n) { int m; static char locbind[80] = "Local keybindings for mode "; #ifdef BUGFIX /* 91.02.06 by S.Yoshida */ if ((bp = bfind("*help*", TRUE)) == NULL) return FALSE; #ifdef AUTOSAVE /* 96.12.24 by M.Suzuki */ bp->b_flag &= ~(BFCHG | BFACHG);/* Blow away old. */ #else bp->b_flag &= ~BFCHG; /* Blow away old. */ #endif /* AUTOSAVE */ #else /* ORIGINAL */ bp = bfind("*help*", TRUE); #endif /* BUGFIX */ if (bclear(bp) != TRUE) return FALSE; /* Clear it out. */ for(m=curbp->b_nmodes; m > 0; m--) { (VOID) strcpy(&locbind[27], curbp->b_modes[m]->p_name); (VOID) strcat(&locbind[27], ":"); if((addline(bp, locbind) == FALSE) || (showall(buf, curbp->b_modes[m]->p_map) == FALSE) || (addline(bp, "") == FALSE)) return FALSE; } if((addline(bp, "Global bindings:") == FALSE) || (showall(buf, map_table[0].p_map) == FALSE)) return FALSE; return popbuftop(bp); } static int showall(ind, map) char *ind; KEYMAP *map; { register MAP_ELEMENT *ele; register int i; PF functp; char *cp; char *cp2; int last; if(addline(bp, "") == FALSE) return FALSE; last = -1; for(ele = &map->map_element[0]; ele < &map->map_element[map->map_num] ; ele++) { if(map->map_default != rescan && ++last < ele->k_base) { cp = keyname(ind, last); if(last < ele->k_base - 1) { (VOID) strcpy(cp, " .. "); cp = keyname(cp + 4, ele->k_base - 1); } do { *cp++ = ' '; } while(cp < &buf[16]); (VOID) strcpy(cp, function_name(map->map_default)); if(addline(bp, buf) == FALSE) return FALSE; } last = ele->k_num; for(i=ele->k_base; i <= last; i++) { functp = ele->k_funcp[i - ele->k_base]; if(functp != rescan) { if(functp != prefix) cp2 = function_name(functp); else cp2 = map_name(ele->k_prefmap); if(cp2 != NULL) { cp = keyname(ind, i); do { *cp++ = ' '; } while(cp < &buf[16]); (VOID) strcpy(cp, cp2); if (addline(bp, buf) == FALSE) return FALSE; } } } } for(ele = &map->map_element[0]; ele < &map->map_element[map->map_num]; ele++) { if(ele->k_prefmap != NULL) { for(i = ele->k_base; ele->k_funcp[i - ele->k_base] != prefix; i++) { if(i >= ele->k_num) /* damaged map */ return FALSE; } cp = keyname(ind, i); *cp++ = ' '; if(showall(cp, ele->k_prefmap) == FALSE) return FALSE; } } return TRUE; } int help_help pro((int, int)); help_help(f, n) int f, n; { KEYMAP *kp; PF funct; if((kp = name_map("help")) == NULL) return FALSE; ewprintf("a b c: "); #ifdef FEPCTRL /* 90.11.26 by K.Takano */ fepmode_off(); #endif do { #ifdef KANJI /* code from Ng-1.3.1L+6 */ int c = getkey(FALSE); if (ISKANJI(c)) { getkey(FALSE); return ABORT; } funct = doscan(kp, c); #else funct = doscan(kp, getkey(FALSE)); #endif } while(funct==NULL || funct==help_help); #ifndef NO_MACRO if(macrodef && macrocount < MAXMACRO) macro[macrocount-1].m_funct = funct; #endif return (*funct)(f, n); } static char buf2[128]; static char *buf2p; /*ARGSUSED*/ apropos_command(f, n) int f, n; { register char *cp1, *cp2; char string[NINPUT]; FUNCTNAMES *fnp; BUFFER *bp; if(eread("apropos: ", string, sizeof(string), EFNEW) == ABORT) return ABORT; /* FALSE means we got a 0 character string, which is fine */ #ifdef BUGFIX /* 91.02.06 by S.Yoshida */ if ((bp = bfind("*help*", TRUE)) == NULL) return FALSE; bp->b_flag &= ~BFCHG; /* Blow away old. */ #else /* ORIGINAL */ bp = bfind("*help*", TRUE); #endif /* BUGFIX */ if(bclear(bp) == FALSE) return FALSE; for(fnp = &functnames[0]; fnp < &functnames[nfunct]; fnp++) { for(cp1 = fnp->n_name; *cp1; cp1++) { cp2 = string; while(*cp2 && *cp1 == *cp2) cp1++, cp2++; if(!*cp2) { (VOID) strcpy(buf2, fnp->n_name); buf2p = &buf2[strlen(buf2)]; findbind(fnp->n_funct, buf, map_table[0].p_map); if(addline(bp, buf2) == FALSE) return FALSE; break; } else cp1 -= cp2 - string; } } return popbuftop(bp); } static VOID findbind(funct, ind, map) PF funct; char *ind; KEYMAP *map; { register MAP_ELEMENT *ele; register int i; char *cp; int last; last = -1; for(ele = &map->map_element[0]; ele < &map->map_element[map->map_num]; ele++) { if(map->map_default == funct && ++last < ele->k_base) { cp = keyname(ind, last); if(last < ele->k_base - 1) { (VOID) strcpy(cp, " .. "); (VOID) keyname(cp + 4, ele->k_base - 1); } bindfound(); } last = ele->k_num; for(i=ele->k_base; i <= last; i++) { if(funct == ele->k_funcp[i - ele->k_base]) { if(funct == prefix) { cp = map_name(ele->k_prefmap); #ifdef BUGFIX /* 90.08.01 by H.Ohnishi */ if(cp == NULL || strncmp(cp, buf2, strlen(cp)) != 0) continue; #else /* NOT BUGFIX */ if(strncmp(cp, buf2, strlen(cp)) != 0) continue; #endif /* BUGFIX */ } (VOID) keyname(ind, i); bindfound(); } } } for(ele = &map->map_element[0]; ele < &map->map_element[map->map_num]; ele++) { if(ele->k_prefmap != NULL) { for(i = ele->k_base; ele->k_funcp[i - ele->k_base] != prefix; i++) { if(i >= ele->k_num) return; /* damaged */ } cp = keyname(ind, i); *cp++ = ' '; findbind(funct, cp, ele->k_prefmap); } } } static VOID bindfound() { if(buf2p < &buf2[32]) { do { *buf2p++ = ' '; } while(buf2p < &buf2[32]); } else { *buf2p++ = ','; *buf2p++ = ' '; } (VOID) strcpy(buf2p, buf); buf2p += strlen(buf); } #endif ng-1.5beta1/jump.c100644 1750 1750 16602 7162442475 12630 0ustar amurausers/* $Id: jump.c,v 1.6 2000/09/21 17:28:29 amura Exp $ */ /* * jump-to-error * * Written by bsh, Dec 1991. */ /* * $Log: jump.c,v $ * Revision 1.6 2000/09/21 17:28:29 amura * replace macro _WIN32 to WIN32 for Cygwin * * Revision 1.5 2000/07/25 15:04:21 amura * fix filevisit() args * * Revision 1.4 2000/07/22 20:47:32 amura * do not use excline() * * Revision 1.3 2000/07/18 12:38:56 amura * remove some compile warning * * Revision 1.2 2000/06/27 01:49:43 amura * import to CVS * * Revision 1.1 2000/06/01 05:27:47 amura * Initial revision * */ #include "config.h" #ifdef JUMPERR #include "def.h" #ifndef BSD # ifndef index # define index(s,c) strchr(s,c) # endif #endif /* BSD */ #ifdef REGEX_JAPANESE #include "regex_j.h" #else #include "regex_e.h" #endif #define BYTEWIDTH 8 #ifndef R_OK /* for access() */ # define R_OK 4 #endif #define BUFLEN 100 static struct re_pattern_buffer re_buff; static char fastmap[(1 << BYTEWIDTH)]; static char compile_command[NLINE] = "make"; /* "compile" command buffer. * * This variable is *NOT* buffer local, this is * * global. Y.Koyanagi */ /* Regular expression for filename/linenumber in error in compilation log. * It mathes * filename, line 1234 or * filename: 1234 or * filename 1234 or * filename(1234) or * 1234 of filename or * filename at line 1234 */ #if defined(AMIGA) #define DEFAULT_REGEXP "\\(\\([^ \n]+:\\)?[^ \n]+\\(:? *\\| at line \\|, line \\|(\\)[0-9]+\\)\\|\\([0-9]+ *of *[^ \n]+\\)" #elif defined(MSDOS)||defined(HUMAN68K)||defined(WIN32) #define DEFAULT_REGEXP "\\(\\([a-zA-Z]:\\)?[^ :\n]+\\(:? *\\| at line \\|, line \\|(\\)[0-9]+\\)\\|\\([0-9]+ *of *[^ \n]+\\)" #else #define DEFAULT_REGEXP "\\([^ :\n]+\\(:? *\\| at line \\|, line \\|(\\)[0-9]+\\)\\|\\([0-9]+ *of *[^ \n]+\\)" #endif /* #define DEFAULT_REGEXP "\\([^ :\n]+\\(:? *\\|, line \\|(\\)[0-9]+\\)\\|\\([0-9]+ *of *[^ \n]+\\|[^ \n]+ \\(at \\)*line [0-9]+\\)" */ static char *grab_filename(); /* * */ set_regexp( pat ) char *pat; { char *message; re_buff.allocated = 40; re_buff.buffer = (char *) malloc (re_buff.allocated); if( re_buff.buffer == NULL ){ ewprintf( "Can't get %d bytes", re_buff.allocated ); re_buff.allocated = 0; return FALSE; } re_buff.fastmap = fastmap; re_buff.translate = NULL; message = re_compile_pattern (pat, strlen(pat), &re_buff); if (message != '\0') { ewprintf("Regex Error: %s", message); free( re_buff.buffer ); re_buff.allocated = 0; return(FALSE); } re_compile_fastmap (&re_buff); return TRUE; } parse_error_message( clp, col, namebuf, ip, parse_end ) LINE *clp; char *namebuf; int *ip, *parse_end; { struct re_registers regs; char buf[BUFLEN+1]; int i, len; char *filename; if( re_buff.allocated == 0 && !set_regexp( DEFAULT_REGEXP ) ) return FALSE; i = re_search (&re_buff, ltext(clp), llength(clp), col, llength(clp), ®s); if (i < 0) return FALSE; if( parse_end ) *parse_end = regs.end[0]+1; len = regs.end[0] - regs.start[0]; if( len > BUFLEN ) len = BUFLEN; strncpy( buf, ltext(clp) + regs.start[0], len ); buf[len] = '\0'; for(i=len; i>0 && ISDIGIT(buf[i-1]); --i ) ; if( i < len ){ /* we are looking filename-first style. */ *ip = atoi( &buf[i] ); buf[i] = '\0'; filename = grab_filename( buf ); } else { /* line-number-first style */ *ip = atoi(buf); while( ISDIGIT(buf[i]) || buf[i] == ' ' || buf[i] == '\t' ) ++i; filename = grab_filename( buf ); } if( *filename ){ strcpy( namebuf, filename ); return TRUE; } return FALSE; } /* * jump-to-error * Parse current line as a error message, then vist correspoding source code. */ jumptoerror(f,n) { int lineno; char buf[BUFLEN+1]; char *p=buf; int col; LINE *dlp; extern int access(); extern int gotoline(); extern int filevisit(), poptofile(); dlp = curwp->w_dotp; while (dlp != curbp->b_linep) { /* get filename and line number to visit */ col = 0; while (col < llength(dlp) && parse_error_message(dlp, col, buf, &lineno, &col ) ) { if (0 == access( buf, R_OK )){ /* ewprintf( "file:`%s' line %d", buf, lineno ); */ /* * All the hairly works to give filename to filevisit() */ curwp->w_flag |= WFHARD; curwp->w_doto = 0; curwp->w_linep = dlp; curwp->w_lines = 0; if (lforw(dlp) != curbp->b_linep) curwp->w_dotp = lforw(dlp); eargset(buf); if (f&FFARG) { if (!filevisit(FFRAND,0)) return FALSE; } else { if (!poptofile(FFRAND,0)) return FALSE; } gotoline( FFARG, lineno ); return TRUE; } } dlp = lforw(dlp); } curwp->w_flag |= WFHARD; curwp->w_doto = 0; curwp->w_dotp = lback(curbp->b_linep); curwp->w_linep = lback(curbp->b_linep); curwp->w_lines = 0; ewprintf( "No more errors." ); return FALSE; } /* * extract filename removing punctuations around. */ static char * grab_filename( buf ) char *buf; { char *p; #ifdef AMIGA int colon_has = FALSE; #endif if( *buf == '"' ){ /* "filename" */ for(p=buf+1; *p && *p != '"'; ++p ) ; *p = '\0'; return buf+1; } p = buf; #ifdef AMIGA for(;*p && !index(" \t,(", *p); ++p ) { if (*p == ':') { if (colon_has) break; else colon_has = TRUE; } } *p = '\0'; #else # if defined(MSDOS)||defined(HUMAN68K)||defined(WIN32) if (buf[1]==':' && buf[2]!='\0' && (ISUPPER(buf[0])||ISLOWER(buf[0]))) p += 2; # endif for(;*p && !index(" \t:,(", *p); ++p ) ; *p = '\0'; #endif return buf; } /* * COMMAND: compile * 91.09.14 Modified by Y.Koyanagi * "compile" command. */ /*ARGSUSED*/ compile(f, n) { register BUFFER *bp, *obp; register WINDOW *wp, *owp; register int s; char buf[NLINE],*result; extern char *call_process(); extern int isetmark(), gotobob(); if (compile_command[0] == '\0') s=eread("compile: ", buf, NLINE, EFNEW); else s=eread("compile: (%s) ", buf, NLINE, EFNEW, compile_command); if (s == ABORT) return s; if (s == TRUE) strcpy(compile_command, buf); if ((bp = bfind("*compilation*", TRUE)) == NULL) return FALSE; if ((wp = popbuf(bp)) == NULL) return FALSE; if (bclear(bp) != TRUE) return FALSE; obp = curbp; owp = curwp; curbp = bp; curwp = wp; /* cmode(0,1) */ if (addline(bp, compile_command) == FALSE) return FALSE; update(); if ((result = call_process(compile_command, NULL)) == NULL) return FALSE; isetmark(); s = insertfile(result, (char *)NULL); (VOID) gotobob(0, 1); bp->b_dotp = wp->w_dotp; bp->b_doto = wp->w_doto; curbp = obp; curwp = owp; bp->b_flag &= ~BFCHG; unlink(result); return s; } /* * COMMAND: c-next-error * 91.09.14 Modified by Y.Koyanagi * 00.03.30 Modified by amura for jump.c * goto next error using *compilation* buffer. */ /*ARGSUSED*/ nexterror(f, n) { register BUFFER *bp, *obp; register WINDOW *wp, *owp; register int s; if (strcmp(curbp->b_bname,"*compilation*") == 0) { nextwind(FFRAND,1); } if ((bp = bfind("*compilation*", TRUE)) == NULL) return FALSE; if ((wp = popbuf(bp)) == NULL) return FALSE; obp = curbp; owp = curwp; curbp = bp; curwp = wp; if ((s=jumptoerror(0, 1)) != TRUE) { curbp = obp; curwp = owp; return s; } return TRUE; } #endif /* JUMPERR */ ng-1.5beta1/kanji.c100644 1750 1750 121653 7266346740 12777 0ustar amurausers/* $Id: kanji.c,v 1.12 2001/04/15 16:35:44 amura Exp $ */ /* * Kanji handling routines. * These are only used when KANJI is #defined. * * Coded by Shigeki Yoshida (shige@csk.CO.JP) */ /* * $Log: kanji.c,v $ * Revision 1.12 2001/04/15 16:35:44 amura * patch for VC 6.0 from Katsuyoshi Ohara * * Revision 1.11 2001/02/18 17:07:25 amura * append AUTOSAVE feature (but NOW not work) * * Revision 1.10 2001/02/11 15:40:25 amura * some function are changed to static for speed/size * * Revision 1.9 2001/01/20 15:49:36 amura * move TOUFU charactor to kinit.h * * Revision 1.8 2001/01/11 13:15:17 amura * add Shift-JIS toufu charactor * * Revision 1.7 2001/01/05 14:07:03 amura * first implementation of Hojo Kanji support * * Revision 1.6 2000/12/18 17:17:41 amura * fix dropped NINPUT * * Revision 1.5 2000/12/14 18:12:14 amura * use alloca() and more memory secure * * Revision 1.4 2000/11/16 14:31:12 amura * fix some typos which cause compile error when using * strict ANSI-C compiler (ex ACK, gcc-1.x) * * Revision 1.3 2000/09/21 17:28:30 amura * replace macro _WIN32 to WIN32 for Cygwin * * Revision 1.2 2000/06/29 17:52:56 amura * enable VTCURSOR all input kanji code * * Revision 1.1.1.1 2000/06/27 01:47:55 amura * import to CVS * */ /* 90.01.29 Created by S.Yoshida */ #include "config.h" /* 90.12.20 by S.Yoshida */ #ifdef KANJI /* 90.01.29 by S.Yoshida */ #include "def.h" #include "kinit.h" int global_kfio = KFIO; /* default-kanji-fileio-code */ int global_kexpect = KEXPECT; /* kanji-expected-code */ int global_kinput = KINPUT; /* kanji-input-code */ int global_kdisplay = KDISPLAY; /* kanji-display-code */ static int to_k_fio = TO_KFIO; /* to-kanji-fileio */ static int to_a_fio = TO_AFIO; /* to-ascii-fileio */ static int to_k_display = TO_KDISPLAY; /* to-kanji-display */ static int to_a_display = TO_ADISPLAY; /* to-ascii-display */ #ifdef HANKANA /* 92.11.21 by S.Sasaki */ static int to_kana_fio = TO_KANAFIO; /* to-kana-fileio */ static int to_kana_display = TO_KANADISPLAY; /* to-kana-display */ #endif /* HANKANA */ static int local_kfin; /* Buffer local file input code. */ static char symbol_c[] = {'N', 'S', 'J', 'E', '-', 'T'}; static char *symbol_s[] = {"No-conversion", "Shift-JIS", "JIS", "EUC", "NIL", "T"}; /* Symbol chars & strings to */ /* display a KANJI code info to */ /* the user. This order depend */ /* on the values of KANJI code */ /* macro defined at def.h. */ static char *kcodename_u[] = {"NOCONV", "SHIFT-JIS", "JIS", "EUC", "NIL", "T"}; static char *kcodename_l[] = {"noconv", "shift-jis", "jis", "euc", "nil", "t"}; #define NKCODENAME 6 /* The strings of KANJI code */ /* name and the numner of KANJI */ /* code to determine what KANJI */ /* code the user want to use. */ /* This order depend on the */ /* values of KANJI code macro */ /* defined at def.h. */ #define ESC CCHR('[') /* Escape char. */ #define issjis1st(c) (((c) >= 0x81 && (c) <= 0x9f) || \ ((c) >= 0xe0 && (c) <= 0xfc)) #define iseuc1st(c) ((c) >= 0xa1 && (c) <= 0xfe) #ifdef HANKANA #define iskana(c) ((c) >= 0xa0 && (c) < 0xe0) #endif /* 90.07.25 Change to inline routine by S.Yoshida (from) */ #define jtoe(c1, c2) {c1 |= 0x80; c2 |= 0x80;} #define etoj(c1, c2) {c1 &= 0x7f; c2 &= 0x7f;} #define stoe(c1, c2) \ {\ if (c1 >=0xe0)\ c1 -= 0x40;\ if (c2 >= 0x9f) {\ c1 = (c1 - 0x88) * 2 + 0xb0;\ c2 += 0x02;\ } else {\ if (c2 >= 0x7f)\ c2 -= 0x01;\ c1 = (c1 - 0x89) * 2 + 0xb1;\ c2 = c2 + 0x61;\ }\ } #define etos(c1, c2) \ {\ c1 &= 0x7f;\ c2 &= 0x7f;\ if(c1 >= 0x5f)\ c1 += 0x80;\ if((c1 % 2) == 0) {\ c1 = (c1 - 0x30) / 2 + 0x88;\ c2 += 0x7e;\ } else {\ if(c2 >= 0x60)\ c2 += 0x01;\ c1 = (c1 - 0x31) / 2 + 0x89;\ c2 += 0x1f;\ }\ c1 &= 0xff;\ c2 &= 0xff;\ } /* 90.07.25 Change to inline routine by S.Yoshida (to) */ #define CAT_NONE 0 /* Category: No category. */ #define CAT_ASCII 1 /* Category: ASCII code char. */ #define CAT_KIGOU 2 /* Category: JIS KIGOU char. */ #define CAT_EISUUJI 3 /* Category: JIS EI-SUUJI char. */ #define CAT_HIRAGANA 4 /* Category: HIRAGANA char. */ #define CAT_KATAKANA 5 /* Category: KATAKANA char. */ #define CAT_GREEK 6 /* Category: JIS GREEK char. */ #define CAT_RUSSIAN 7 /* Category: JIS RUSSIAN char. */ #define CAT_KANJI 8 /* Category: KANJI char. */ /* prototype for static routines */ static int kcodenumber pro((int *code, int num)); static int kanalastchar pro((int *lastch)); static int klastchar pro((int *lastch, int kselect)); static int kcodecheck pro((char *p, int len)); static int bufjtoe_c pro((char *j, int len)); int bufstoe_c pro((char *p, int len)); /* * COMMAND: change-default-fileio-code * This is a command processor for changing the value of the global * file I/O KANJI code. When this function is called, the value is * changed rotaly. (NIL -> NOCONV -> SJIS -> JIS -> EUC) */ /*ARGSUSED*/ k_rot_fio(f, n) { if (global_kfio == NIL) { global_kfio = NOCONV; } else if (global_kfio == NOCONV) { global_kfio = SJIS; } else if (global_kfio == SJIS) { global_kfio = JIS; } else if (global_kfio == JIS) { global_kfio = EUC; } else if (global_kfio == EUC) { global_kfio = NIL; } return TRUE; } /* * COMMAND: set-default-fileio-code * This is a command processor for setting the value of the global * file I/O KANJI code. */ /*ARGSUSED*/ k_set_fio(f, n) { register int s; if (f & FFARG) { if (n >= 0 && n < NKCODENAME - 1) { global_kfio = n; s = TRUE; } else { s = FALSE; } } else if ((s = kcodenumber(&n, NKCODENAME - 1)) == TRUE) { global_kfio = n; } return (s); } /* * COMMAND: change-fileio-code * This is a command processor for changing the value of the buffer * local file I/O KANJI code. When this function is called, the value * is changed rotaly. (NIL -> NOCONV -> SJIS -> JIS -> EUC) */ /*ARGSUSED*/ k_rot_buffio(f, n) { if (curbp->b_kfio == NIL) { curbp->b_kfio = NOCONV; } else if (curbp->b_kfio == NOCONV) { curbp->b_kfio = SJIS; } else if (curbp->b_kfio == SJIS) { curbp->b_kfio = JIS; } else if (curbp->b_kfio == JIS) { curbp->b_kfio = EUC; } else if (curbp->b_kfio == EUC) { curbp->b_kfio = NIL; } upmodes(curbp); /* Only update cur-buf's modeline. */ return TRUE; } /* * COMMAND: set-kanji-fileio-code * This is a command processor for setting the value of the buffer * local file I/O KANJI code. */ /*ARGSUSED*/ k_set_buffio(f, n) { register int s; if (f & FFARG) { if (n > 0 && n < NKCODENAME - 1) { curbp->b_kfio = n; upmodes(curbp); /* Only update cur-buf's modeline. */ s = TRUE; } else { s = FALSE; } } else if ((s = kcodenumber(&n, NKCODENAME - 1)) == TRUE) { curbp->b_kfio = n; upmodes(curbp); /* Only update cur-buf's modeline. */ } return (s); } /* * COMMAND: set-kanji-expected-code * This is a command processor for setting the value of the global * expected file input KANJI code. */ /*ARGSUSED*/ k_set_expect(f, n) { register int s; if (f & FFARG) { if (n > 0 && n < NKCODENAME) { global_kexpect = n; s = TRUE; } else { s = FALSE; } } else if ((s = kcodenumber(&n, NKCODENAME)) == TRUE) { global_kexpect = n; } return (s); } /* * COMMAND: change-input-code * This is a command processor for changing the value of the global * keyboard input KANJI code. When this function is called, the value * is changed rotaly. (NOCONV -> SJIS -> JIS -> EUC) */ /*ARGSUSED*/ k_rot_input(f, n) { if (global_kinput == NOCONV) { global_kinput = SJIS; } else if (global_kinput == SJIS) { global_kinput = JIS; } else if (global_kinput == JIS) { global_kinput = EUC; } else if (global_kinput == EUC) { global_kinput = NOCONV; } upmodes(NULL); /* Update each win's modeline. */ return TRUE; } /* * COMMAND: set-kanji-input-code * This is a command processor for setting the value of the global * keyboard input KANJI code. */ /*ARGSUSED*/ k_set_input(f, n) { register int s; if (f & FFARG) { if (n > 0 && n < NKCODENAME - 1) { global_kinput = n; upmodes(NULL); /* Update each win's modeline. */ s = TRUE; } else { s = FALSE; } } else if ((s = kcodenumber(&n, NKCODENAME - 1)) == TRUE) { global_kinput = n; upmodes(NULL); /* Update each win's modeline. */ } return (s); } /* * COMMAND: change-display-code * This is a command processor for changing the value of the global * display KANJI code. When this function is called, the value is * changed rotaly. (NOCONV -> SJIS -> JIS -> EUC) */ /*ARGSUSED*/ k_rot_display(f, n) { if (global_kdisplay == NOCONV) { global_kdisplay = SJIS; } else if (global_kdisplay == SJIS) { global_kdisplay = JIS; } else if (global_kdisplay == JIS) { global_kdisplay = EUC; } else if (global_kdisplay == EUC) { global_kdisplay = NOCONV; } sgarbf = TRUE; /* Must update full screen. */ return TRUE; } /* * COMMAND: set-kanji-display-code * This is a command processor for setting the value of the global * display KANJI code. */ /*ARGSUSED*/ k_set_display(f, n) { register int s; if (f & FFARG) { if (n > 0 && n < NKCODENAME - 1) { global_kdisplay = n; sgarbf = TRUE; /* Must update full screen. */ s = TRUE; } else { s = FALSE; } } else if ((s = kcodenumber(&n, NKCODENAME - 1)) == TRUE) { global_kdisplay = n; sgarbf = TRUE; /* Must update full screen. */ } return (s); } /* * COMMAND: list-kanji-code * Display a list of kanji-code related valiables in the *Kanji Codes* * buffer. */ /*ARGSUSED*/ k_list_code(f, n) { register BUFFER *bp; register WINDOW *wp; char line[80]; if ((bp = bfind("*Kanji Codes*", TRUE)) == NULL) return FALSE; #ifdef AUTOSAVE /* 96.12.24 by M.Suzuki */ bp->b_flag &= ~(BFCHG | BFACHG); /* Blow away old. */ #else bp->b_flag &= ~BFCHG; /* Blow away old. */ #endif /* AUTOSAVE */ if (bclear(bp) != TRUE) return FALSE; strcpy(line, "* List of kanji-code related variables *"); if (addline(bp, line) == FALSE) return FALSE; strcpy(line, "Global variables:"); if (addline(bp, line) == FALSE) return FALSE; sprintf(line, "\tdefault-kanji-fileio-code : %s", symbol_s[global_kfio]); if (addline(bp, line) == FALSE) return FALSE; sprintf(line, "\tkanji-expected-code : %s", symbol_s[global_kexpect]); if (addline(bp, line) == FALSE) return FALSE; sprintf(line, "\tkanji-display-code : %s", symbol_s[global_kdisplay]); if (addline(bp, line) == FALSE) return FALSE; sprintf(line, "\tkanji-input-code : %s", symbol_s[global_kinput]); if (addline(bp, line) == FALSE) return FALSE; if (curbp->b_kfio == JIS || global_kfio == JIS || global_kdisplay == JIS) { sprintf(line, "\tto-kanji-fileio : %d (%c)", to_k_fio, to_k_fio); if (addline(bp, line) == FALSE) return FALSE; sprintf(line, "\tto-ascii-fileio : %d (%c)", to_a_fio, to_a_fio); if (addline(bp, line) == FALSE) return FALSE; #ifdef HANKANA /* 92.11.21 by S.Sasaki */ sprintf(line, "\tto-kana-fileio : %d (%c)", to_kana_fio, to_kana_fio); if (addline(bp, line) == FALSE) return FALSE; #endif /* HANKANA */ sprintf(line, "\tto-kanji-display : %d (%c)", to_k_display, to_k_display); if (addline(bp, line) == FALSE) return FALSE; sprintf(line, "\tto-ascii-display : %d (%c)", to_a_display, to_a_display); if (addline(bp, line) == FALSE) return FALSE; #ifdef HANKANA /* 92.11.21 by S.Sasaki */ sprintf(line, "\tto-kana-display : %d (%c)", to_kana_display, to_kana_display); if (addline(bp, line) == FALSE) return FALSE; #endif /* HANKANA */ } strcpy(line, "Buffer local variable:"); if (addline(bp, line) == FALSE) return FALSE; sprintf(line, "\tkanji-fileio-code : %s", symbol_s[curbp->b_kfio]); if (addline(bp, line) == FALSE) return FALSE; if ((wp = popbuf(bp)) == NULL) return FALSE; bp->b_dotp = lforw(bp->b_linep); /* put dot at beginning of buffer */ bp->b_doto = 0; wp->w_dotp = bp->b_dotp; /* fix up if window already on screen */ wp->w_doto = bp->b_doto; return TRUE; } /* * COMMAND: list-kanji-code-briefly * Display a list of values of kanji-code related valiables in the * mini buffer. */ /*ARGSUSED*/ k_show_code(f, n) { char buf[80]; char *bp; #ifdef HANKANA /* 92.11.21 by S.Sasaki */ sprintf(buf, "global:[FID=%c%c%c] local:[F=%c] expected:[E=%c]", #else /* not HANKANA */ sprintf(buf, "global: [FID=%c%c%c] local: [F=%c] expected: [E=%c]", #endif /* HANKANA */ symbol_c[global_kfio], symbol_c[global_kinput], symbol_c[global_kdisplay], symbol_c[curbp->b_kfio], symbol_c[global_kexpect]); if (curbp->b_kfio == JIS || global_kfio == JIS || global_kdisplay == JIS) { bp = buf + strlen(buf); #ifdef HANKANA /* 92.11.21 by S.Sasaki */ sprintf(bp, " K:[FD=%c%c] A:[FD=%c%c] KANA:[FD=%c%c]", to_k_fio, to_k_display, to_a_fio, to_a_display, to_kana_fio, to_kana_display); #else /* not HANKANA */ sprintf(bp, " Ksel: [FD=%c%c] Asel: [FD=%c%c]", to_k_fio, to_k_display, to_a_fio, to_a_display); #endif /* HANKANA */ } ewprintf(buf); return TRUE; } /* * COMMAND: set-to-kanji-fileio * This is a command processor for setting the value of the global * KANJI select char for a file. */ /*ARGSUSED*/ k_set_tokfio(f, n) { int s; if (f & FFARG) { if (n == '@' || n == 'B') { to_k_fio = n; s = TRUE; } else { s = FALSE; } } else if ((s = klastchar(&n, TRUE)) == TRUE) { to_k_fio = n; } return (s); } /* * COMMAND: set-to-ascii-fileio * This is a command processor for setting the value of the global * ASCII select char for a file. */ /*ARGSUSED*/ k_set_toafio(f, n) { register int s; if (f & FFARG) { if (n == 'B' || n == 'J' || n == 'H') { to_a_fio = n; s = TRUE; } else { s = FALSE; } } else if ((s = klastchar(&n, FALSE)) == TRUE) { to_a_fio = n; } return (s); } #ifdef HANKANA /* 92.11.21 by S.Sasaki */ /* * COMMAND: set-to-kana-fileio * This is a command processor for setting the value of the global * KANA select char for a file. */ /*ARGSUSED*/ k_set_tokanafio(f, n) { register int s; if (f & FFARG) { if (n == '7' || n == '8' || n == 'I') { to_kana_fio = n; s = TRUE; } else { s = FALSE; } } else if ((s = kanalastchar(&n)) == TRUE) { to_kana_fio = n; } return (s); } /* * COMMAND: set-to-kana-display * This is a command processor for setting the value of the global * KANA select char for a display. */ /*ARGSUSED*/ k_set_tokanadisplay(f, n) { int s; if (f & FFARG) { if (n == '7' || n == '8' || n == 'I') { to_kana_fio = n; s = TRUE; } else { s = FALSE; } } else if ((s = kanalastchar(&n)) == TRUE) { to_kana_display = n; } return (s); } #endif /* HANKANA */ /* * COMMAND: set-to-kanji-display * This is a command processor for setting the value of the global * KANJI select char for a display. */ /*ARGSUSED*/ k_set_tokdisplay(f, n) { int s; if (f & FFARG) { if (n == '@' || n == 'B') { to_k_fio = n; s = TRUE; } else { s = FALSE; } } else if ((s = klastchar(&n, TRUE)) == TRUE) { to_k_display = n; } return (s); } /* * COMMAND: set-to-ascii-display * This is a command processor for setting the value of the global * ASCII select char for a display. */ /*ARGSUSED*/ k_set_toadisplay(f, n) { int s; if (f & FFARG) { if (n == 'B' || n == 'J' || n == 'H') { to_a_fio = n; s = TRUE; } else { s = FALSE; } } else if ((s = klastchar(&n, FALSE)) == TRUE) { to_a_display = n; } return (s); } /* * Select target KANJI code and return its inner number. */ static int kcodenumber(code, num) int *code; int num; { register int s; register int i; register int n; char kcode[NINPUT]; for (n = 0; n < 2; n++) { if ((s = ereply("Kanji Code System : ", kcode, sizeof(kcode))) != TRUE) { return (s); } if (ISDIGIT(kcode[0])) { if ((i = atoi(kcode)) >= 0 && i < num) { *code = i; return TRUE; } } else { for (i = 0; i < num; i++) { if (strcmp(kcodename_u[i], kcode) == 0 || strcmp(kcodename_l[i], kcode) == 0) { *code = i; return TRUE; } } } } return FALSE; } #ifdef HANKANA /* 92.11.21 by S.Sasaki */ /* * Input last char of the KANA code select escape sequence, * and return its value. */ static int kanalastchar(lastch) int *lastch; { register int s; register int i; register char *p = "KANA Select Char [78I] : "; register int n; char lchar[NINPUT]; for (n = 0; n < 2; n++) { if ((s = ereply(p, lchar, sizeof(lchar))) != TRUE) { return (s); } if (ISDIGIT(lchar[0])) { i = atoi(lchar); if (i==7) i='7'; if (i==8) i='8'; } else { i = lchar[0]; } if (i == '7' || i == '8' || i == 'I') { *lastch = i; return TRUE; } } return FALSE; } #endif /* HANKANA */ /* * Input last char of the KANJI/ASCII code select escape sequence, * and return its value. KANJI select char is input when kselect * is TRUE, othewise ASCII select char is input. */ static int klastchar(lastch, kselect) int *lastch; int kselect; { register int s; register int i; register char *p = kselect ? "KANJI Select Char [@B] : " : "ASCII Select Char [BHJ] : "; register int n; char lchar[NINPUT]; for (n = 0; n < 2; n++) { if ((s = ereply(p, lchar, sizeof(lchar))) != TRUE) { return (s); } if (ISDIGIT(lchar[0])) { i = atoi(lchar); } else { i = lchar[0]; } if ((kselect && (i == '@' || i == 'B')) || (!kselect && (i == 'B' || i == 'J' || i == 'H'))) { *lastch = i; return TRUE; } } return FALSE; } /* * Set the buffer local file I/O code when buffer is created. */ VOID ksetbufcode(bp) BUFFER *bp; { bp->b_kfio = global_kfio; } /* * Show file I/O, input, display KANJI code into mode line. */ kdispbufcode(bp) register BUFFER *bp; { register int n = 0; /* 90.12.28 Change display style like as Nemacs 3.3. by S.Yoshida */ vtputc(symbol_c[bp->b_kfio]); n++; vtputc(symbol_c[global_kinput]); n++; vtputc(symbol_c[global_kdisplay]); n++; vtputc(':'); n++; return (n); } /* * Input one byte from the keyboard with KANJI code conversion. */ #define SELROMA 0 #define SELKANJI 1 #define SELKANA 2 #define SELHOJO 3 static int kgetkey_more = FALSE; #ifdef HOJO_KANJI static int hojo1st = '\0'; #endif VOID kgetkeyflush() { kgetkey_more = FALSE; #ifdef HOJO_KANJI hojo1st = '\0'; #endif } kgetkey() { static int kselected = SELROMA; static int savedchar = '\0'; /* 91.01.15 NULL -> '\0' */ register int c1, c2; /* 90.07.25 Add "register". */ /* by S.Yoshida */ #ifdef HOJO_KANJI if (hojo1st != '\0') { c1 = hojo1st; hojo1st = '\0'; return c1; } #endif if (kgetkey_more) { kgetkey_more = FALSE; return (savedchar); } reinput: c1 = getkbd(); /* * If you enable next codes, you cannot input C-n,C-o in JIS input mode. * I think this state you don't want to, I disable these. * 27 mar 2000, amura */ #ifdef notdef /* HANKANA /* 92.11.21 by S.Sasaki */ if (global_kinput == JIS && c1 == 0x0e) { kselected = SELKANA; goto reinput; } if (global_kinput == JIS && c1 == 0x0f) { kselected = SELROMA; goto reinput; } #endif /* HANKANA */ if (global_kinput == JIS && c1 == ESC) { if ((c1 = getkbd()) == '$') { if ((c2 = getkbd()) == '@' || c2 == 'B') { kselected = SELKANJI; goto reinput; #ifdef HOJO_KANJI } else if (c2 == '(') { if ((c1 = getkbd()) == 'D') { kselected = SELHOJO; goto reinput; } else { ungetkbd(c1); ungetkbd(c2); ungetkbd('$'); c1 = ESC; } #endif } else { ungetkbd(c2); ungetkbd(c1); c1 = ESC; } } else if (c1 == '(') { if ((c2 = getkbd()) == 'B' || c2 == 'J' || c2 == 'H') { kselected = SELROMA; /* When typeahead() is TRUE, update() */ /* isn't done. So, sometimes a input */ /* strings isn't displayed with JIS */ /* code input. To display the input */ /* strings certainly, do update() when */ /* ASCII select sequence has come. */ update(); goto reinput; } else { ungetkbd(c2); ungetkbd(c1); c1 = ESC; } #ifdef VTCURSOR /* 92.03.16 by Gen KUROKI, renamed by amura */ } else if (c1 == 'O' || c1 == '[') { c2 = getkbd(); switch (c2) { case 'A': c1 = CCHR('P'); break; case 'B': c1 = CCHR('N'); break; case 'C': c1 = CCHR('F'); break; case 'D': c1 = CCHR('B'); break; default: ungetkbd(c2); ungetkbd(c1); c1 = ESC; break; } #endif /* VTCURSOR */ #ifdef HANKANA /* 92.11.21 by S.Sasaki */ } else if (c1 == '(') { if ((c2 = getkbd()) == 'I' ) { kselected = SELKANA; goto reinput; } else { ungetkbd(c2); ungetkbd(c1); c1 = ESC; } #endif /* HANKANA */ } else { #ifdef JISFIX /* 92.03.16 by Gen KUROKI */ savedchar = c1; kgetkey_more = TRUE; #else /* not JISFIX */ ungetkbd(c1); #endif /* JISFIX */ c1 = ESC; } #ifdef JISFIX /* 92.03.16 by Gen KUROKI */ } else if (global_kinput == JIS && c1 == 0xff ) { c1 = 0x7f; #endif /* JISFIX */ } else if (global_kinput == JIS && kselected == SELKANJI) { #ifdef JISFIX /* 92.03.16 by Gen KUROKI */ c1 &= 0x7f; if (!ISCTRL(c1)) { #endif /* JISFIX */ c2 = getkbd(); jtoe(c1, c2); savedchar = c2; kgetkey_more = TRUE; #ifdef JISFIX /* 92.03.16 by Gen KUROKI */ } #endif /* JISFIX */ #ifdef HOJO_KANJI } else if (global_kinput == JIS && kselected == SELHOJO) { c1 &= 0x7f; c2 = getkbd(); jtoe(c1, c2); hojo1st = c1; savedchar = c2; kgetkey_more = TRUE; c1 = SS3; #endif /* HOJO_KANJI */ #ifdef HANKANA /* 92.11.21 by S.Sasaki */ } else if (global_kinput == JIS && kselected == SELKANA) { savedchar = c1 | 0x80; kgetkey_more = TRUE; c1 = SS2; } else if ( (global_kinput == JIS || global_kinput == SJIS) && iskana(c1 & 0xff)) { savedchar = c1; kgetkey_more = TRUE; c1 = SS2; #endif /* HANKANA */ } else if (global_kinput == SJIS && issjis1st(c1)) { c2 = getkbd(); stoe(c1, c2); savedchar = c2; kgetkey_more = TRUE; } else if (global_kinput == EUC && iseuc1st(c1)) { savedchar = getkbd(); kgetkey_more = TRUE; #ifdef VTCURSOR /* 92.03.16 by Gen KUROKI, renamed by amura */ } else if (c1 == ESC) { c1 = getkbd(); if (c1 == 'O' || c1 == '[') { c2 = getkbd(); switch (c2) { case 'A': c1 = CCHR('P'); break; case 'B': c1 = CCHR('N'); break; case 'C': c1 = CCHR('F'); break; case 'D': c1 = CCHR('B'); break; default: ungetkbd(c2); ungetkbd(c1); c1 = ESC; break; } } else { ungetkbd(c1); c1 = ESC; } #endif /* VTCURSOR */ } return(c1); } #ifdef WIN32 extern int ttputkc(int, int); #else #define ttputkc(a, b) (ttputc(a),ttputc(b)) #endif static int kdselected = SELROMA; #ifdef HANKANA static int kanadselected = FALSE; #endif /* * Output one byte to the display with KANJI code conversion. */ kttputc(c) register int c; /* 90.07.25 Add "register". by S.Yoshida */ { static int c1 = '\0'; /* 91.01.15 NULL -> '\0' */ int res; #ifdef HOJO_KANJI static int c2 = '\0'; #endif if (c1 != '\0') { /* KANJI 1st byte exists. */ res = 2; if (global_kdisplay == JIS) { #ifdef HANKANA /* 92.11.21 by S.Sasaki */ if (ISHANKANA(c1)) { if (!kanadselected) { kanadselected = TRUE; switch (to_kana_display) { case '7': ttputc(0x0e); break; case '8': break; case 'I': ttputc(ESC); ttputc('('); ttputc(to_kana_display); kdselected = SELKANA; break; } ttputc(to_kana_display=='8' ? c : c&0x7f); } c1 = '\0'; return 1; } else if ( kanadselected && to_kana_display == '7') ttputc(0x0f); kanadselected = FALSE; #endif /* HANKANA */ #ifdef HOJO_KANJI if (ISHOJO(c1)) { if (c2 == '\0') { c2 = c; return 0; } if (kdselected != SELHOJO) { ttputc(ESC); ttputc('$'); ttputc('('); ttputc('D'); kdselected = SELHOJO; } etoj(c2, c); ttputc(c2); ttputc(c); c2 = '\0'; c1 = '\0'; return 2; } #endif /* HOJO_KANJI */ if (kdselected != SELKANJI) { ttputc(ESC); ttputc('$'); ttputc(to_k_display); kdselected = SELKANJI; } etoj(c1, c); ttputc(c1); ttputc(c); c1 = '\0'; /* 91.01.15 NULL -> '\0' */ } else if (global_kdisplay == SJIS) { #ifdef HANKANA /* 92.11.21 by S.Sasaki */ if (ISHANKANA(c1)) { ttputc(c); c1 = '\0'; /* 91.01.15 NULL -> '\0' */ return 1; } #endif /* HANKANA */ #ifdef HOJO_KANJI if (ISHOJO(c1)) { if (c2 == '\0') { c2 = c; return 0; } /* print TOUFU */ c1 = TOUFU1ST; c2 = TOUFU2ND; etos(c1, c2); ttputkc(c1, c2); c1 = '\0'; c2 = '\0'; return 2; } #endif /* HOJO_KANJI */ etos(c1, c); ttputkc(c1, c); c1 = '\0'; /* 91.01.15 NULL -> '\0' */ } else { /* May be EUC. */ #ifdef HANKANA if (ISHANKANA(c1)) { res = 1; } #endif #ifdef HOJO_KANJI if (ISHOJO(c1)) { if (c2 == '\0') { c2 = c; return 0; } ttputc(c1); ttputc(c2); ttputc(c); c1 = '\0'; c2 = '\0'; return 2; } #endif /* HOJO_KANJI */ ttputc(c1); ttputc(c); c1 = '\0'; /* 91.01.15 NULL -> '\0' */ } } else if (ISKANJI(c)) { /* KANJI (EUC) 1st byte. */ c1 = c; res = 0; } else { /* May be ASCII. */ if (global_kdisplay == JIS) { #ifdef HANKANA /* 92.11.21 by S.Sasaki */ if (kanadselected) { kanadselected = FALSE; if (to_kana_display == '7') ttputc(0x0f); } #endif /* HANKANA */ if (kdselected != SELROMA) { ttputc(ESC); ttputc('('); ttputc(to_a_display); kdselected = SELROMA; } } ttputc(c); res = 1; } return res; } /* * Check current JIS code condition, and output KANJI/ASCII code * select escape sequence to the display if nessesary. */ VOID kdselectcode(next_is_k) register int next_is_k; /* Is next code KANJI ? */ { if (global_kdisplay != JIS) { return; } /* Now KANJI && next is ASCII */ if (kdselected==SELKANJI && !next_is_k) { ttputc(ESC); /* Select ASCII code. */ ttputc('('); ttputc(to_a_display); kdselected = SELROMA; #ifdef HANKANA /* 92.11.21 by S.Sasaki */ } else if (kanadselected && !next_is_k) { /* Now KANJI && next is ASCII */ kanadselected = FALSE; /* Select ASCII code. */ if (to_kana_display == '7') ttputc(0x0f); if (kdselected != SELROMA) { ttputc(ESC); ttputc('('); ttputc(to_a_display); } } else if (kanadselected && next_is_k) { kanadselected = FALSE; if (to_kana_display == '7') ttputc(0x0f); ttputc(ESC); ttputc('$'); ttputc(to_k_display); kdselected = TRUE; #endif /* HANKANA */ } else if (!kdselected && next_is_k) { /* Now ASCII && next is KANJI */ ttputc(ESC); /* Select KANJI code. */ ttputc('$'); ttputc(to_k_display); kdselected = TRUE; } } int kfselected = SELROMA; #ifdef HANKANA /* 92.11.21 by S.Sasaki */ int kanafselected = FALSE; #endif /* HANKANA */ /* * Output one byte to the file with KANJI code conversion. */ VOID kputc(c, fp, kfio) register int c; /* 90.07.25 Add "register". by S.Yoshida */ register FILE *fp; register int kfio; { static int c1 = '\0'; /* 91.01.15 NULL -> '\0' */ if (c1 != '\0') { /* KANJI 1st byte exists. */ /* 91.01.15 NULL -> '\0' */ if (kfio == JIS) { #ifdef HANKANA /* 92.11.21 by S.Sasaki */ if (ISHANKANA(c1)) { if (!kanafselected) { kanafselected = TRUE; switch (to_kana_fio) { case '7': putc(0x0e, fp); break; case '8': break; case 'I': putc(ESC, fp); putc('(', fp); putc(to_kana_fio, fp); kfselected = SELKANA; break; } } putc( to_kana_fio == '8' ? c : c & 0x7f, fp); c1 ='\0'; return; } #endif /* HANKANA */ #ifdef HANKANA /* 92.11.21 by S.Sasaki */ if (kanafselected && to_kana_fio == '7') putc(0x0f, fp); kanafselected = FALSE; #endif /* HANKANA */ if (kfselected != SELKANJI) { putc(ESC, fp); putc('$', fp); putc(to_k_fio, fp); kfselected = SELKANJI; } etoj(c1, c); putc(c1, fp); putc(c, fp); c1 = '\0'; /* 91.01.15 NULL -> '\0' */ } else if (kfio == SJIS) { #ifdef HANKANA /* 92.11.21 by S.Sasaki */ if (ISHANKANA(c1)) { putc(c, fp); c1 = '\0'; /* 91.01.15 NULL -> '\0' */ } else { etos(c1, c); putc(c1, fp); putc(c, fp); c1 = '\0'; /* 91.01.15 NULL -> '\0' */ } #else /* not HANKANA */ etos(c1, c); putc(c1, fp); putc(c, fp); c1 = '\0'; /* 91.01.15 NULL -> '\0' */ #endif /* HANKANA */ } else { /* May be EUC. */ putc(c1, fp); putc(c, fp); c1 = '\0'; /* 91.01.15 NULL -> '\0' */ } } else if (ISKANJI(c)) { /* KANJI (EUC) 1st byte. */ c1 = c; } else { /* May be ASCII. */ if (kfio == JIS) { #ifdef HANKANA /* 92.11.21 by S.Sasaki */ if (kanafselected && to_kana_fio == '7') putc(0x0f, fp); kanafselected = FALSE; #endif /* HANKANA */ if (kfselected != SELROMA) { putc(ESC, fp); putc('(', fp); putc(to_a_fio, fp); kfselected = SELROMA; } } putc(c, fp); } } /* * Check current JIS code condition, and output KANJI/ASCII code * select escape sequence to the file if nessesary. * You must not call this function when file I/O code is not JIS. */ VOID kfselectcode(fp, next_is_k) register FILE *fp; register int next_is_k; /* Is next code KANJI ? */ { /* Now KANJI && next is ASCII */ if (kfselected!=SELROMA && !next_is_k) { putc(ESC, fp); /* Select ASCII code. */ putc('(', fp); putc(to_a_fio, fp); kfselected = SELROMA; #ifdef HANKANA /* 92.11.21 by S.Sasaki */ } else if (kanafselected && !next_is_k) { kanafselected = FALSE; if (to_kana_fio == 'I') { putc(ESC, fp); putc('(', fp); putc(to_a_fio, fp); kfselected = SELROMA; } else if (to_kana_fio == '7') { putc(0x0f, fp); } } else if (kanafselected && next_is_k) { kanafselected = FALSE; if (to_kana_fio == '7') putc(0x0f, fp); putc(ESC, fp); putc('$', fp); putc(to_k_fio, fp); kfselected = SELKANJI; #endif /* HANKANA */ } else if (!kfselected && next_is_k) { /* Now ASCII && next is KANJI */ putc(ESC, fp); /* Select KANJI code. */ putc('$', fp); putc(to_k_fio, fp); kfselected = SELKANJI; } } /* * Set buffer local file input code to read new file. */ VOID ksetfincode(bp) register BUFFER *bp; { if ((local_kfin = global_kexpect) == T) { local_kfin = NIL; } else if (local_kfin == NIL) { if (bp != NULL) { local_kfin = bp->b_kfio; } } } /* * Convert KANJI code form a file code (JIS/Shift-JIS/EUC) to * a buffer code (EUC) in the text line. * When file KANJI code is not decided, we check and determine it * to see a text line. */ kcodeconv(buf, len, bp) register char *buf; register int len; register BUFFER *bp; { if (local_kfin == NIL) { /* Not decided. */ local_kfin = kcodecheck(buf, len); } if (local_kfin != NIL) { /* Must convert. */ if (local_kfin == JIS) { len = bufjtoe(buf, len); } else if (local_kfin == SJIS) { #ifdef HANKANA /* 92.11.21 by S.Sasaki */ len = bufstoe(buf, len); #else /* Not HANKANA */ bufstoe(buf, len); #endif /* HANKANA */ } /* EUC need not convert. */ if (bp != NULL && bp->b_kfio == NIL) { /* set buffer local code. */ bp->b_kfio = local_kfin; } } return(len); } /* * Count after converting KANJI code form a file code (JIS/Shift-JIS/EUC) to * a buffer code (EUC) in the text line. * When file KANJI code is not decided, we check and determine it * to see a text line. */ #ifdef SS_SUPPORT /* 92.11.21 by S.Sasaki */ kcodecount(buf, len) register char *buf; register int len; { if (local_kfin == NIL) { /* Not decided. */ local_kfin = kcodecheck(buf, len); } if (local_kfin != NIL) { /* Must convert. */ if (local_kfin == JIS) { len = bufjtoe_c(buf, len); } else if (local_kfin == SJIS) { len = bufstoe_c(buf, len); } } return(len); } #endif /* SS_SUPPORT */ /* * Check and determine what kind of KANJI code exists. * If no KANJI code exists, NIL (Not determine/No conversion) is * returned. If both EUC and Shift-JIS code is possible, * we think it is EUC. * This routine is refered to Nemacs's kanji.c. */ #ifdef SS_SUPPORT /* 92.11.21 by S.Sasaki */ static int kcodecheck(p, len) char *p; int len; { register unsigned char c; register char *endp = p + len - 1; register int notjis = FALSE; while (p < endp) { c = *p++; if (c == ESC && ( *p == '$' || *p == '(' ) && !notjis) { return (JIS); } else if (c >= 0x80) { if (!iskana(c)) notjis = TRUE; if (c < 0xa0 && c != SS2 && c != SS3) { return (SJIS); } else if (c > 0xef) { return (EUC); } c = *p++; if (c < 0xa0) { return (SJIS); } else if (c > 0xfc) { return (EUC); } } } return (notjis ? EUC: NIL); } #else /* not SS_SUPPORT */ static int kcodecheck(p, len) char *p; int len; { register unsigned char c; register char *endp = p + len - 1; register int notjis = FALSE; while (p < endp) { c = *p++; if (c == ESC && *p == '$' && !notjis) { return (JIS); } else if (c >= 0x80) { notjis = TRUE; if (c < 0xa0) { return (SJIS); } else if (c < 0xe0 || c > 0xef) { return (EUC); } c = *p++; if (c < 0xa1) { return (SJIS); } else if (c > 0xfc) { return (EUC); } } } return (notjis ? EUC: NIL); } #endif /* SS_SUPPORT */ /* * Convert KANJI code from JIS to EUC of the text in a buffer. * KANJI/ASCII selecting escape sequence is striped. So converted * EUC text must be shorter than sorce JIS code text. */ bufjtoe(j, len) char *j; /* JIS code text. */ int len; { register int c1, c2; /* 90.07.25 Add "register". */ /* by S.Yoshida */ register char *e = j; /* Converted EUC text. (same buffer) */ register char *endj = j + len; #ifdef HANKANA /* 92.11.21 by S.Sasaki */ register int kselected = SELROMA; char *cp, *eorg = j; #else /* not HANKANA */ register int kselected = FALSE; #endif /* HANKANA */ #ifdef HANKANA /* 92.11.21 by S.Sasaki */ if ( len == 0 ) return(0); if((cp = alloca((unsigned)(len))) == NULL) { ewprintf("Could not allocate %d bytes", len); return(-1); } bcopy(j, cp, len); j = cp; endj = j + len; #endif /* HANKANA */ while (j < endj) { c1 = *j++; if (c1 == ESC) { if (*j == '$' && (j[1] == '@' || j[1] == 'B')) { kselected = SELKANJI; j += 2; } else if (*j == '(' && (j[1] == 'B' || j[1] == 'J' || j[1] == 'H')) { kselected = SELROMA; j += 2; #ifdef HANKANA /* 92.11.21 by S.Sasaki */ } else if (*j == '(' && j[1] == 'I') { kselected = SELKANA; j += 2; #endif /* HANKANA */ #ifdef HOJO_KANJI } else if (*j == '$' && j[1] == '(' && j[2] == 'D') { kselected = SELHOJO; j += 3; #endif } else { *e++ = c1; } #ifdef HANKANA /* 92.11.21 by S.Sasaki */ } else if (c1 == 0x0e) { kselected = SELKANA; } else if (c1 == 0x0f) { kselected = SELROMA; #endif /* HANKANA */ } else if (kselected == SELKANJI) { c2 = *j++; jtoe(c1, c2); *e++ = c1; *e++ = c2; #ifdef HOJO_KANJI } else if (kselected == SELHOJO) { *e++ = (char)SS3; c2 = *j++; jtoe(c1, c2); *e++ = c1; *e++ = c2; #endif #ifdef HANKANA /* 92.11.21 by S.Sasaki */ } else if (kselected == SELKANA) { *e++ = (char)SS2; *e++ = (char)(c1 | 0x80); } else if (iskana(c1 & 0xff)) { *e++ = (char)SS2; *e++ = (char)c1; #endif /* HANKANA */ } else { *e++ = (char)c1; } } #ifdef HANKANA /* 92.11.21 by S.Sasaki */ return (e - eorg); #else /* not HANKANA */ return (len + e - j); #endif /* HANKANA */ } /* * Convert KANJI code from Shift-JIS to EUC of the text in a buffer. */ #ifdef HANKANA /* 92.11.21 by S.Sasaki */ bufstoe(p, len) char *p; int len; { register int c1, c2; /* 90.07.25 Add "register". */ /* by S.Yoshida */ register char *porg, *tmpstr, *cp, *endcp; if ( len == 0 ) return(0); if((tmpstr = alloca((unsigned)(len))) == NULL) { ewprintf("Could not allocate %d bytes", len); return(-1); } cp = tmpstr; bcopy(p, cp, len); endcp = cp + len; porg = p; while (cp < endcp) { c1 = *cp++ & 0xff; if (iskana(c1)) { *p++ = (char)SS2; *p++ = (char)c1; } else if (issjis1st(c1)) { c2 = *cp++ & 0xff; stoe(c1, c2); *p++ = (char)c1; *p++ = (char)c2; } else { *p++ = (char)c1; } } return(p - porg); } #else /* not HANKANA */ bufstoe(p, len) char *p; int len; { register int c1, c2; /* 90.07.25 Add "register". */ /* by S.Yoshida */ register char *endp = p + len; while (p < endp) { c1 = *p++ & 0xff; if (issjis1st(c1)) { c2 = *p++ & 0xff; stoe(c1, c2); p[-2] = c1; p[-1] = c2; } } } #endif /* HANKANA */ VOID bufetos(p, len) char *p; int len; { register int c1, c2; /* 90.07.25 Add "register". */ /* by S.Yoshida */ register char *endp = p + len; register char *q = p; while (p < endp) { c1 = *p++ & 0xff; if (ISKANJI(c1)) { #ifdef HANKANA if (ISHANKANA(c1)) *q++ = *p++; else #endif /* HANKANA */ #ifdef HOJO_KANJI if (ISHOJO(c1)) { c1 = TOUFU1ST; c2 = TOUFU2ND; etos(c1,c2); *q++ = c1; *q++ = c2; p += 2; } else #endif { c2 = *p++ & 0xff; etos(c1,c2); *q++ = c1; *q++ = c2; } } else *q++ = c1; } } #ifdef SS_SUPPORT /* 92.11.21 by S.Sasaki */ static int bufjtoe_c(j, len) char *j; /* JIS code text. */ int len; { register int c1, c2; /* 90.07.25 Add "register". */ /* by S.Yoshida */ register int leng; register char *endj = j + len; register int kselected = SELROMA; leng = 0; while (j < endj) { c1 = *j++; if (c1 == ESC) { if (*j == '$' && (j[1] == '@' || j[1] == 'B')) { kselected = SELKANJI; j += 2; } else if (*j == '(' && (j[1] == 'B' || j[1] == 'J' || j[1] == 'H')) { kselected = SELROMA; j += 2; #ifdef HANKANA } else if (*j == '(' && j[1] == 'I') { kselected = SELKANA; j += 2; #endif #ifdef HOJO_KANJI } else if (*j == '$' && j[1] == '(' && j[2] == 'D') { kselected = SELHOJO; j += 3; #endif } else { leng++; } } else if (c1 == 0x0e) { kselected = SELKANA; } else if (c1 == 0x0f) { kselected = SELROMA; } else if (kselected == SELKANJI) { j++; leng += 2; #ifdef HOJO_KANJI } else if (kselected == SELHOJO) { j++; leng += 3; #endif #ifdef HANKANA } else if (kselected == SELKANA) { leng += 2; } else if (iskana(c1 & 0xff)) { leng += 2; #endif } else { leng++; } } return (leng); } int bufstoe_c(p, len) char *p; int len; { register int c1; /* 90.07.25 Add "register". */ /* by S.Yoshida */ register char *endp; endp = p + len; len=0; while (p < endp) { c1 = *p++ & 0xff; #ifdef HANKANA if (iskana(c1)) { len += 2; } else #endif if (issjis1st(c1)) { p++; len += 2; } else { len++; } } return(len); } #endif /* SS_SUPPORT */ /* * Is current position char KANJI ? */ iskanji() { return(ISKANJI(lgetc(curwp->w_dotp, curwp->w_doto))); } #ifdef HOJO_KANJI /* * Is current position char Hojo KANJI ? */ ishojo() { return(ISHOJO(lgetc(curwp->w_dotp, curwp->w_doto))); } #endif /* * Is this KANJI word char ? * This routine return TRUE when c1 is ASCII char, * but it doesn't happen now. */ iskword(c1, c2) register int c1; register int c2; { return(charcategory(c1, c2) != CAT_NONE); } /* * Get char category of current position char. */ getcategory() { return(charcategory(lgetc(curwp->w_dotp, curwp->w_doto), lgetc(curwp->w_dotp, curwp->w_doto + 1))); } int cur_cat; /* Current char category. */ int cur_dir; /* Current search direction. */ /* * Set char category of search start position char, * and set search direction. */ VOID initcategory(dir) int dir; { cur_cat = getcategory(); cur_dir = dir; } /* * Is it in a same category ? * return TRUE if category of current position char is same as * start position char's one (now in a word), or it is HIRAGANA * added to the end of that word. */ incategory() { register int cat; if (curwp->w_doto == llength(curwp->w_dotp)) { return FALSE; } cat = getcategory(); if (cur_dir == 1) { /* Direction is forward. */ if (cat == CAT_HIRAGANA) { /* Now start added HIRAGANA part. */ cur_cat = cat; } } else { /* Direcrion is backward. */ if (cur_cat == CAT_HIRAGANA && cat != cur_cat) { /* Now end added HIRAGANA part and start word part. */ cur_cat = cat; } } return(cat == cur_cat); } /* * Return char category of one char. */ charcategory(c1, c2) register int c1; register int c2; { switch (c1) { case 0xa1: if (c2 >= 0xb8 && c2 <= 0xbb) { return(CAT_KANJI); } else if (c2 >= 0xb3 && c2 <= 0xb6) { return(CAT_HIRAGANA); } else if (c2 == 0xbc) { return(CAT_KATAKANA); } /* else it is KIGOU. */ case 0xa2: case 0xa8: return(CAT_KIGOU); /* Not reached */ case 0xa3: return(CAT_EISUUJI); /* Not reached */ case 0xa4: return(CAT_HIRAGANA); /* Not reached */ case 0xa5: return(CAT_KATAKANA); /* Not reached */ case 0xa6: return(CAT_GREEK); /* Not reached */ case 0xa7: return(CAT_RUSSIAN); /* Not reached */ default: if (c1 <= 0x7f) { return(CAT_ASCII); } else if (c1 >= 0xb0) { return(CAT_KANJI); } return(CAT_NONE); /* Not reached */ } } #endif /* KANJI */ ng-1.5beta1/kanji_.c100644 1750 1750 3701 7126003714 13051 0ustar amurausers/* $Id: kanji_.c,v 1.1.1.1 2000/06/27 01:47:56 amura Exp $ */ /* mskanji.c: ms-kanji handling routines * -> kanji_.c: euc kanji handling routines *serow / amura */ /* * $Log: kanji_.c,v $ * Revision 1.1.1.1 2000/06/27 01:47:56 amura * import to CVS * */ #include "kanji_.h" #define UCH(c) ((unsigned char)(c)) /* kpart(pLim, pChr); * char * pLim; Buffer Top or Limit for scanning * char * pChr; Pointer to the char * return whith 1 : *pChr is First byte of MS-Kanji * return whith 2 : *pChr is Second byte of MS-Kanji * return whith 0 : otherwize */ int kpart(pLim, pChr) char *pLim; char *pChr; { register char * p = pChr - 1; register int ct = 0; while (ISKANJI(*p) && p >= pLim) { p--; ct++; } return (ct & 1) ? 2 : ISKANJI(*pChr); } /* jstrlen: return the number of charctors in string. */ int jstrlen(s) char * s; { int len; for (len = 0; *s; s++, len++) { if (ISKANJI(*s) && s[1]) s++; } return len; } /* jnthchar: return with the pointer to n'th charactor in string. * return (char *)0, when jstrlen(s) < n */ char * jnthchar(s, n) char * s; int n; { if (n) { while (--n) { if (ISKANJI(*s)) s++; s++; } } return s; } /* jindex: return with the pointer to 'ch' in "string" * return with (char *)0, when not found */ char * jindex(s, c) char *s; int c; { while (*s) { if (UCH(*s) == UCH(c)) return s; if (ISKANJI(*s) && s[1]) { s++; } s++; } return (char *)0; } /* jrindex: return with the pointer to Right end 'ch' in "string" * return with (char *)0, when not found */ char * jrindex(s, c) char *s; int c; { char * olds = (char *)0; while (*s) { if (UCH(*s) == UCH(c)) olds = s; if (ISKANJI(*s) && s[1]) { s++; } s++; } return olds; } char * jstrlower(s) char *s; { char *ws = s; while (*ws) { if (ISKANJI(*ws) && ws[1]) ws++; else *ws = (('A' <= *ws) && (*ws <= 'Z')) ? *ws - 'A' + 'a': *ws; ws++; } return s; } ng-1.5beta1/kanji_.h100644 1750 1750 750 7126003714 13037 0ustar amurausers/* $Id: kanji_.h,v 1.1.1.1 2000/06/27 01:47:56 amura Exp $ */ /* * $Log: kanji_.h,v $ * Revision 1.1.1.1 2000/06/27 01:47:56 amura * import to CVS * */ #if defined(__STDC__) || defined(MSDOS) int kpart(char *pLim,char *pChr); int jstrlen(char *s); char *jnthchar(char *s,int n); char *jindex(char *s,int c); char *jrindex(char *s,int c); char *jstrlower(char *s); #else int kpart(); int jstrlen(); char *jnthchar(); char *jindex(); char *jrindex(); char *jstrlower(); #endif ng-1.5beta1/kbd.c100644 1750 1750 37606 7244000516 12407 0ustar amurausers/* $Id: kbd.c,v 1.10 2001/02/18 17:07:26 amura Exp $ */ /* * Terminal independent keyboard handling. */ /* * $Log: kbd.c,v $ * Revision 1.10 2001/02/18 17:07:26 amura * append AUTOSAVE feature (but NOW not work) * * Revision 1.9 2001/01/05 14:07:04 amura * first implementation of Hojo Kanji support * * Revision 1.8 2000/11/04 13:44:58 amura * undo memory exception is more safety * * Revision 1.7 2000/10/02 16:13:06 amura * ignore mouse event in minibuffer editing * * Revision 1.6 2000/09/21 17:28:30 amura * replace macro _WIN32 to WIN32 for Cygwin * * Revision 1.5 2000/09/13 21:03:53 amura * can compile option UNDO without KANJI * * Revision 1.4 2000/07/20 12:45:17 amura * support undo with auto-fill mode * * Revision 1.3 2000/07/16 15:44:41 amura * undo bug on autofill fixed * * Revision 1.2 2000/06/27 01:49:43 amura * import to CVS * * Revision 1.1 2000/06/01 05:29:03 amura * Initial revision * */ /* 90.01.29 Modified for Ng 1.0 by S.Yoshida */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include "def.h" #include "kbd.h" #ifdef UNDO #include "undo.h" #endif #define EXTERN #include "key.h" #ifndef NO_MACRO #include "macro.h" #endif #ifdef CANNA #include extern jrKanjiStatus ks; int henkan( ); #endif #ifdef MOUSE int allow_mouse_event = FALSE; /* allow mouse event */ #endif #ifdef DO_METAKEY int use_metakey = TRUE; /* * Toggle the value of use_metakey */ do_meta(f, n) { if(f & FFARG) use_metakey = n > 0; else use_metakey = !use_metakey; ewprintf("Meta keys %sabled", use_metakey ? "en" : "dis"); #ifdef PC9801 if (use_metakey) setezkey(); else resetezkey(); #endif return TRUE; } #endif #ifdef BSMAP static int bs_map = BSMAP; /* * Toggle backspace mapping */ bsmap(f, n) { if(f & FFARG) bs_map = n > 0; else bs_map = ! bs_map; ewprintf("Backspace mapping %sabled", bs_map ? "en" : "dis"); return TRUE; } #endif #ifndef NO_DPROMPT #define PROMPTL 80 char prompt[PROMPTL], *promptp; #endif static int pushed = FALSE; static int pushedc; VOID ungetkey(c) int c; { #ifdef DO_METAKEY if(use_metakey && pushed && c==CCHR('[')) pushedc |= METABIT; else #endif pushedc = c; #ifdef BSMAP if(bs_map) if(pushedc==CCHR('H')) pushedc=CCHR('?'); else if(pushedc==CCHR('?')) pushedc=CCHR('H'); #endif pushed = TRUE; } int getkey(flag) int flag; { int c; char *keyname(); #ifndef NO_DPROMPT if(flag && !pushed) { if(prompt[0]!='\0' && ttwait()) { ewprintf("%s", prompt); /* avoid problems with % */ update(); /* put the cursor back */ epresf = KPROMPT; } if(promptp > prompt) *(promptp-1) = ' '; } #endif #ifdef AUTOSAVE autosave_check(TRUE); #endif if(pushed) { c = pushedc; pushed = FALSE; #ifdef KANJI /* 90.01.29 by S.Yoshida */ } else c = kgetkey(); #else /* NOT KANJI */ } else c = getkbd(); #endif /* KANJI */ #ifdef BSMAP if(bs_map) if(c==CCHR('H')) c=CCHR('?'); else if(c==CCHR('?')) c=CCHR('H'); #endif #ifdef DO_METAKEY if(use_metakey && (c&METABIT)) { pushedc = c & ~METABIT; pushed = TRUE; c = CCHR('['); } #endif #ifndef NO_DPROMPT if(flag && promptp < &prompt[PROMPTL - 5]) { promptp = keyname(promptp, c); *promptp++ = '-'; *promptp = '\0'; } #endif #ifdef AUTOSAVE /* 96.12.24 by M.Suzuki */ autosave_check(FALSE); #endif /* AUTOSAVE */ return c; } /* * doscan scans a keymap for a keyboard character and returns a pointer * to the function associated with that character. Sets ele to the * keymap element the keyboard was found in as a side effect. */ MAP_ELEMENT *ele; PF doscan(map, c) register KEYMAP *map; register int c; { register MAP_ELEMENT *elec = &map->map_element[0]; /* local register copy for faster access */ register MAP_ELEMENT *last = &map->map_element[map->map_num]; PF funct; while(elec < last && c > elec->k_num) elec++; ele = elec; /* used by prefix and binding code */ if(elec >= last || c < elec->k_base) funct = map->map_default; else funct = elec->k_funcp[c - elec->k_base]; return funct; } doin() { KEYMAP *curmap; PF funct; int d; #ifdef UNDO int s; BUFFER *bp; #endif #ifndef NO_DPROMPT *(promptp = prompt) = '\0'; #endif #ifdef FEPCTRL /* 90.11.26 by K.Takano */ fepmode_on(); #endif #ifdef MOUSE allow_mouse_event = TRUE; #endif curmap = curbp->b_modes[curbp->b_nmodes]->p_map; key.k_count = 0; d=getkey(TRUE); #ifdef MOUSE allow_mouse_event = FALSE; #endif #ifdef CANNA if( (curbp->b_flag & BFCANNA) && (ks.length != 0 || !(d==' '||ISCTRL(d)||ISKANJI(d))) ) return henkan(d); else #endif while((funct=doscan(curmap,(key.k_chars[key.k_count++]=d))) == prefix) { #ifdef FEPCTRL /* 90.11.26 by K.Takano */ fepmode_off(); #endif curmap = ele->k_prefmap; d = getkey(TRUE); } #ifndef NO_MACRO if(macrodef && macrocount < MAXMACRO) macro[macrocount++].m_funct = funct; #endif if (epresf == TRUE) eerase(); #ifdef UNDO bp = curbp; ublock_open(bp); s = (*funct)(0, 1); ublock_close(bp); return s; #else return (*funct)(0, 1); #endif } rescan(f, n) int f, n; { int c; register KEYMAP *curmap; int i; PF fp = (PF)NULL; int mode = curbp->b_nmodes; for(;;) { if(ISUPPER(key.k_chars[key.k_count-1])) { c = TOLOWER(key.k_chars[key.k_count-1]); curmap = curbp->b_modes[mode]->p_map; for(i=0; i < key.k_count-1; i++) { if((fp=doscan(curmap,(key.k_chars[i]))) != prefix) break; curmap = ele->k_prefmap; } if(fp==prefix) { if((fp = doscan(curmap, c)) == prefix) { #ifdef FEPCTRL /* 90.11.26 by K.Takano */ fepmode_off(); #endif while((fp=doscan(curmap,key.k_chars[key.k_count++] = getkey(TRUE))) == prefix) curmap = ele->k_prefmap; } if(fp!=rescan) { #ifndef NO_MACRO if(macrodef && macrocount <= MAXMACRO) macro[macrocount-1].m_funct = fp; #endif return (*fp)(f, n); } } } /* try previous mode */ if(--mode < 0) return ABORT; curmap = curbp->b_modes[mode]->p_map; for(i=0; i < key.k_count; i++) { if((fp=doscan(curmap,(key.k_chars[i]))) != prefix) break; curmap = ele->k_prefmap; } if(fp==prefix) { #ifdef FEPCTRL /* 90.11.26 by K.Takano */ fepmode_off(); #endif while((fp=doscan(curmap,key.k_chars[i++]=getkey(TRUE))) == prefix) curmap = ele->k_prefmap; key.k_count = i; } if(fp!=rescan && i>=key.k_count-1) { #ifndef NO_MACRO if(macrodef && macrocount <= MAXMACRO) macro[macrocount-1].m_funct = fp; #endif return (*fp)(f, n); } } } int universal_argument pro((int, int)); universal_argument(f, n) int f, n; { int c, nn=4; KEYMAP *curmap; PF funct; #ifdef FEPCTRL /* 90.11.26 by K.Takano */ fepmode_off(); #endif if(f&FFUNIV) nn *= n; for(;;) { key.k_chars[0] = c = getkey(TRUE); key.k_count = 1; if(c == '-') return negative_argument(f, nn); if(c >= '0' && c <= '9') return digit_argument(f, nn); curmap = curbp->b_modes[curbp->b_nmodes]->p_map; while((funct=doscan(curmap,c)) == prefix) { curmap = ele->k_prefmap; key.k_chars[key.k_count++] = c = getkey(TRUE); } if(funct != universal_argument) { #ifndef NO_MACRO if(macrodef && macrocount < MAXMACRO-1) { if(f&FFARG) macrocount--; macro[macrocount++].m_count = nn; macro[macrocount++].m_funct = funct; } #endif return (*funct)(FFUNIV, nn); } nn <<= 2; } } /*ARGSUSED*/ digit_argument(f, n) int f, n; { int nn, c; KEYMAP *curmap; PF funct; #ifdef FEPCTRL /* 90.11.26 by K.Takano */ fepmode_off(); #endif nn = key.k_chars[key.k_count-1] - '0'; for(;;) { c = getkey(TRUE); if(c < '0' || c > '9') break; nn *= 10; nn += c - '0'; } key.k_chars[0] = c; key.k_count = 1; curmap = curbp->b_modes[curbp->b_nmodes]->p_map; while((funct=doscan(curmap,c)) == prefix) { curmap = ele->k_prefmap; key.k_chars[key.k_count++] = c = getkey(TRUE); } #ifndef NO_MACRO if(macrodef && macrocount < MAXMACRO-1) { if(f&FFARG) macrocount--; else macro[macrocount-1].m_funct = universal_argument; macro[macrocount++].m_count = nn; macro[macrocount++].m_funct = funct; } #endif return (*funct)(FFOTHARG, nn); } negative_argument(f, n) int f, n; { int nn = 0, c; KEYMAP *curmap; PF funct; #ifdef FEPCTRL /* 90.11.26 by K.Takano */ fepmode_off(); #endif for(;;) { c = getkey(TRUE); if(c < '0' || c > '9') break; nn *= 10; nn += c - '0'; } if(nn) nn = -nn; else nn = -n; key.k_chars[0] = c; key.k_count = 1; curmap = curbp->b_modes[curbp->b_nmodes]->p_map; while((funct=doscan(curmap,c)) == prefix) { curmap = ele->k_prefmap; key.k_chars[key.k_count++] = c = getkey(TRUE); } #ifndef NO_MACRO if(macrodef && macrocount < MAXMACRO-1) { if(f&FFARG) macrocount--; else macro[macrocount-1].m_funct = universal_argument; macro[macrocount++].m_count = nn; macro[macrocount++].m_funct = funct; } #endif return (*funct)(FFNEGARG, nn); } /* * Insert a character. While defining a macro, create a "LINE" containing * all inserted characters. */ #ifdef KANJI /* 90.01.29 by S.Yoshida */ int no_k2nd = 0; /* We have no KANJI 2nd byte */ int inkfill = FALSE; /* Now we are in a fillword(). */ #endif /* KANJI */ selfinsert(f, n) int f, n; { register int c; int count; VOID lchange(); #ifndef NO_MACRO LINE *lp; int insert pro((int, int)); #endif #ifdef KANJI /* 90.01.29 by S.Yoshida */ int lkanji2nd; /* For over write mode. */ #endif /* KANJI */ if (n < 0) return FALSE; if (n == 0) return TRUE; c = key.k_chars[key.k_count-1]; #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ #ifdef KANJI /* 90.01.29 by S.Yoshida */ /* In a autofill mode, normally fill trigger is only ' ' char. But */ /* KANJI version require any KANJI char is also fill trigger. */ /* This must be done at keymap.c to add KANJI fill trigger list in */ /* a fillmap. But there are too many KANJI chars, so we use this */ /* easy way. */ if(curbp->b_flag & BFAUTOFILL && /* Autofill mode and */ !inkfill && no_k2nd!=0) { /* KANJI 2nd byte. */ int s; #ifdef UNDO if (isundo()) { if (lastflag & CFINS2) { if (undostart == undoptr) { curbp->b_utop--; if (curbp->b_utop < 0) curbp->b_utop = UNDOSIZE; undostart = &curbp->b_ustack[curbp->b_utop]; } if (undobefore == NULL) panic("selfinsert: Run insert error"); undoptr = undobefore; } } #endif inkfill = TRUE; s = fillword(f, n); /* fill word with KANJI char. */ inkfill = FALSE; return (s); } /* End of autofill mode add routine. */ if (no_k2nd != 0) { /* If there is only KANJI 1st byte, */ no_k2nd--; /* we believe 'c' is KANJI 2nd byte.*/ } else if (ISKANJI(c)) { if ((n % 2) == 0) { /* This is easy bug fix. */ n |= 0x01; } #ifdef HOJO_KANJI if (ISHOJO(c)) no_k2nd = 2; else #endif no_k2nd = 1; /* When there is no KANJI 2nd */ /* byte, we don't do update(). */ } #endif /* KANJI */ #ifndef NO_MACRO if(macrodef && macrocount < MAXMACRO) { if(f & FFARG) macrocount -= 2; if(lastflag & CFINS) { /* last command was insert -- tack on end */ macrocount--; if(maclcur->l_size < maclcur->l_used + n) { if((lp = lallocx(maclcur->l_used + n)) == NULL) return FALSE; lp->l_fp = maclcur->l_fp; lp->l_bp = maclcur->l_bp; lp->l_fp->l_bp = lp->l_bp->l_fp = lp; bcopy(maclcur->l_text, lp->l_text, maclcur->l_used); for(count = maclcur->l_used; count < lp->l_used; count++) lp->l_text[count] = c; free((char *)maclcur); maclcur = lp; } else { maclcur->l_used += n; for(count = maclcur->l_used-n; count < maclcur->l_used; count++) maclcur->l_text[count] = c; } } else { macro[macrocount-1].m_funct = insert; if((lp = lallocx(n)) == NULL) return FALSE; lp->l_bp = maclcur; lp->l_fp = maclcur->l_fp; maclcur->l_fp = lp; maclcur = lp; for(count = 0; count < n; count++) lp->l_text[count] = c; } thisflag |= CFINS; } #endif if(c == '\n') { do { count = lnewline(); } while (--n && count==TRUE); return count; } #ifdef UNDO if (isundo()) { thisflag |= CFINS2; if(curbp->b_flag & BFOVERWRITE) { /* Overwrite mode */ UNDO_DATA *undo; if (lastflag & CFINS2) { #ifdef KANJI if (!inkfill && undostart==undoptr) { #else if (undostart==undoptr) { #endif curbp->b_utop--; if (curbp->b_utop < 0) curbp->b_utop = UNDOSIZE; undostart = &curbp->b_ustack[curbp->b_utop]; } if (undobefore == NULL) panic("selfinsert: Run insert error"); undoptr = undobefore; undo = *undoptr; } else { undo_setup(undo); if (!isundo()) goto noundo; undo->u_dotlno = get_lineno(curbp,curwp->w_dotp); undo->u_doto = curwp->w_doto; undo->u_type = UDOVER; undo->u_used = 0; undo->u_code[0] = '\0'; } if (!undo_bgrow(undo, n)) goto noundo; lchange(WFEDIT); #ifdef KANJI /* 90.01.29 by S.Yoshida */ if (undo->u_code[0]) { lputc(curwp->w_dotp, curwp->w_doto, undo->u_code[0]); lkanji2nd = 1; } else lkanji2nd = 0; #endif /* KANJI */ count = undo->u_used; while(curwp->w_doto < llength(curwp->w_dotp) && n--) { undo->u_buffer[count] = lgetc(curwp->w_dotp, curwp->w_doto); #ifdef KANJI /* 90.01.29 by S.Yoshida */ if (lkanji2nd != 0) { lkanji2nd--; } else if (ISKANJI(undo->u_buffer[count])){ #ifdef HOJO_KANJI if (ISHOJO(undo->u_buffer[count])) lkanji2nd = 2; else #endif lkanji2nd = 1; } #endif /* KANJI */ lputc(curwp->w_dotp, curwp->w_doto++, c); count++; } undo->u_used = count; #ifdef KANJI /* 90.01.29 by S.Yoshida */ if (lkanji2nd!=0 && curwp->w_doto < llength(curwp->w_dotp)) { undo->u_code[0] = lgetc(curwp->w_dotp, curwp->w_doto); lputc(curwp->w_dotp, curwp->w_doto, ' '); } else undo->u_code[0] = '\0'; #endif /* KANJI */ undo_finish(&(undo->u_next)); if (!(lastflag & CFINS2)) { if (undoptr!=NULL && *undoptr!=NULL) (*undoptr)->u_type = UDNONE; } if (n<=0) return TRUE; } else if (lastflag & CFINS2) {/* not Overwrite mode */ #ifdef KANJI if (!inkfill && undostart==undoptr) { #else if (undostart==undoptr) { #endif curbp->b_utop--; if (curbp->b_utop < 0) curbp->b_utop = UNDOSIZE; undostart = &curbp->b_ustack[curbp->b_utop]; } if (undobefore == NULL) panic("selfinsert: Run insert error"); undoptr = undobefore; } /* if this is NOT, somecase linsert() panic */ else if (*undoptr != NULL) (*undoptr)->u_type = UDNONE; } else noundo: #endif /* UNDO */ if(curbp->b_flag & BFOVERWRITE) { /* Overwrite mode */ lchange(WFEDIT); #ifdef KANJI /* 90.01.29 by S.Yoshida */ lkanji2nd = 0; #endif /* KANJI */ while(curwp->w_doto < llength(curwp->w_dotp) && n--) { #ifdef KANJI /* 90.01.29 by S.Yoshida */ if (lkanji2nd != 0) { lkanji2nd--; } else if (ISKANJI(lgetc(curwp->w_dotp, curwp->w_doto))) { #ifdef HOJO_KANJI if (ISHOJO(lgetc(curwp->w_dotp, curwp->w_doto))) lkanji2nd = 2; else #endif lkanji2nd = 1; } #endif /* KANJI */ lputc(curwp->w_dotp, curwp->w_doto++, c); } #ifdef KANJI /* 90.01.29 by S.Yoshida */ if (lkanji2nd!=0 && curwp->w_doto < llength(curwp->w_dotp)) { lputc(curwp->w_dotp, curwp->w_doto, ' '); } #endif /* KANJI */ if(n<=0) return TRUE; } return linsert(n, c); } /* * this could be implemented as a keymap with everthing defined * as self-insert. */ quote(f, n) { register int c; key.k_count = 1; if((key.k_chars[0] = getkey(TRUE)) >= '0' && key.k_chars[0] <= '7') { key.k_chars[0] -= '0'; if((c = getkey(TRUE)) >= '0' && c <= '7') { key.k_chars[0] <<= 3; key.k_chars[0] += c - '0'; if((c = getkey(TRUE)) >= '0' && c <= '7') { key.k_chars[0] <<= 3; key.k_chars[0] += c - '0'; } else ungetkey(c); } else ungetkey(c); } return selfinsert(f, n); } ng-1.5beta1/kbd.h100644 1750 1750 3075 7126003714 12367 0ustar amurausers/* $Id: kbd.h,v 1.1 2000/06/27 01:47:56 amura Exp $ */ /* * kbd.h: type definitions for symbol.c and kbd.c for mg experimental */ /* * $Log: kbd.h,v $ * Revision 1.1 2000/06/27 01:47:56 amura * Initial revision * */ typedef struct { KCHAR k_base; /* first key in element */ KCHAR k_num; /* last key in element */ PF *k_funcp; /* pointer to array of pointers to functions */ struct keymap_s *k_prefmap; /* keymap of ONLY prefix key in element */ } MAP_ELEMENT; /* predefined keymaps are NOT type KEYMAP because final array needs * dimension. If any changes are made to this struct, they must be * reflected in all keymap declarations. */ #define KEYMAPE(NUM) {\ short map_num;\ short map_max;\ PF map_default;\ MAP_ELEMENT map_element[NUM];\ } /* elements used */ /* elements allocated */ /* default function */ /* realy [e_max] */ typedef struct keymap_s KEYMAPE(1) KEYMAP; #define none ctrlg #define prefix (PF)NULL /* number of map_elements to grow an overflowed keymap by */ #define IMAPEXT 0 #define MAPGROW 3 #define MAPINIT (MAPGROW+1) /* max number of default bindings added to avoid creating new element */ #define MAPELEDEF 4 typedef struct MAPS_S { KEYMAP *p_map; char *p_name; } MAPS; extern MAPS map_table[]; typedef struct { PF n_funct; char *n_name; } FUNCTNAMES; extern FUNCTNAMES functnames[]; extern int nfunct; extern PF doscan(); extern PF name_function(); extern char *function_name(); extern int complete_function(); extern KEYMAP *name_map(); extern char *map_name(); extern MAPS *name_mode(); extern MAP_ELEMENT *ele; ng-1.5beta1/key.h100644 1750 1750 747 7126003714 12402 0ustar amurausers/* $Id: key.h,v 1.1.1.1 2000/06/27 01:47:56 amura Exp $ */ /* key.h: Insert file for mg 2 functions that need to reference key pressed */ /* * $Log: key.h,v $ * Revision 1.1.1.1 2000/06/27 01:47:56 amura * import to CVS * */ #ifndef EXTERN #define EXTERN extern #endif #define MAXKEY 8 /* maximum number of prefix chars */ EXTERN struct { /* the chacter sequence in a key */ int k_count; /* number of chars */ KCHAR k_chars[MAXKEY]; /* chars */ } key; #undef EXTERN ng-1.5beta1/keymap.c100644 1750 1750 136207 7632242733 13164 0ustar amurausers/* $Id: keymap.c,v 1.9.2.1 2003/03/08 01:22:35 amura Exp $ */ /* * Keyboard maps. This is character set dependent. * The terminal specific parts of building the * keymap has been moved to a better place. */ /* * $Log: keymap.c,v $ * Revision 1.9.2.1 2003/03/08 01:22:35 amura * NOTAB is always enabled * * Revision 1.9 2001/04/28 18:54:27 amura * support line-number-mode (based on MATSUURA's patch ) * * Revision 1.8 2001/03/02 08:49:04 amura * now AUTOSAVE feature implemented almost all (except for WIN32 * * Revision 1.7 2000/11/16 14:31:12 amura * fix some typos which cause compile error when using * strict ANSI-C compiler (ex ACK, gcc-1.x) * * Revision 1.6 2000/09/21 17:28:30 amura * replace macro _WIN32 to WIN32 for Cygwin * * Revision 1.5 2000/09/01 19:45:16 amura * add default keybind for "undo" * * Revision 1.4 2000/06/27 01:49:44 amura * import to CVS * * Revision 1.3 2000/06/01 05:30:09 amura * Undo support * * Revision 1.2 2000/03/10 21:29:32 amura * some function added * * Revision 1.1 1999/05/19 03:59:01 amura * Initial revision * */ /* 90.01.29 Modified for Ng 1.0 by S.Yoshida */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include "def.h" #include "kbd.h" #define _PF() pro((int, int)) /* * Defined by "basic.c". */ extern int gotobol _PF(); /* Move to start of line */ extern int backchar _PF(); /* Move backward by characters */ extern int gotoeol _PF(); /* Move to end of line */ extern int forwchar _PF(); /* Move forward by characters */ extern int gotobob _PF(); /* Move to start of buffer */ extern int gotoeob _PF(); /* Move to end of buffer */ extern int forwline _PF(); /* Move forward by lines */ extern int backline _PF(); /* Move backward by lines */ extern int forwpage _PF(); /* Move forward by pages */ extern int backpage _PF(); /* Move backward by pages */ extern int pagenext _PF(); /* Page forward next window */ extern int setmark _PF(); /* Set mark */ extern int swapmark _PF(); /* Swap "." and mark */ extern int gotoline _PF(); /* Go to a specified line. */ #ifdef GOSMACS extern int forw1page _PF(); /* move forward by lines */ extern int back1page _PF(); /* move back by lines */ #endif #ifdef NEXTLINE extern int nextline _PF(); /* next-line-noexpand */ #endif #ifdef ADDFUNC extern int linenumbermode _PF(); /* line-number-mode */ #endif /* * Defined by "buffer.c". */ extern int listbuffers _PF(); /* Display list of buffers */ extern int usebuffer _PF(); /* Switch a window to a buffer */ extern int poptobuffer _PF(); /* Other window to a buffer */ extern int killbuffer _PF(); /* Make a buffer go away. */ extern int savebuffers _PF(); /* Save unmodified buffers */ extern int bufferinsert _PF(); /* Insert buffer into another */ extern int notmodified _PF(); /* Reset modification flag */ #ifdef READONLY /* 91.01.05 by S.Yoshida */ extern int togglereadonly _PF(); /* Toggle read-only flag */ #endif /* READONLY */ #ifdef VARIABLE_TAB extern int set_default_tabwidth _PF();/* set default tab width */ extern int set_tabwidth _PF(); /* set local tab width */ extern int set_cmode_tabwidth _PF();/* set c-mode tab width */ #endif /* VARIABLE_TAB */ #ifdef BUFFER_MODE extern int b_del _PF(); /* buffer-mode mark for kill */ extern int b_undel _PF(); /* buffer-mode unmark */ extern int b_expunge _PF(); /* buffer-mode kill marked buff */ extern int b_thiswin _PF(); /* buffer-mode on this window */ #endif /* * Defined by "cmode.c". */ #ifdef C_MODE /* 90.07.24 by K.Takano */ extern int cm_use_c_mode _PF(); /* use-c-mode */ extern int cm_brace _PF(); /* c-mode electric-c-brace */ extern int cm_brace_blink _PF(); /* c-mode electric-c-brace-blink*/ extern int cm_semi _PF(); /* c-mode electric-c-semi */ extern int cm_term _PF(); /* c-mode electric-c-terminator */ extern int cm_indent _PF(); /* c-mode indent line */ extern int cm_lfindent _PF(); /* c-mode newline and indent */ extern int cm_set_indent _PF(); /* set-c-indent-level */ extern int cm_set_imagin _PF(); /* set-c-brace-imaginary-offset */ extern int cm_set_brace _PF(); /* set-c-brace-offset */ extern int cm_set_arg _PF(); /* set-c-argdecl-indent */ extern int cm_set_label _PF(); /* set-c-label-offset */ extern int cm_set_cstat _PF(); /* set-c-continued-statement-offset*/ extern int cm_set_cbrace _PF(); /* set-c-continued-brace-offset */ extern int cm_set_newl _PF(); /* set-c-auto-newline */ extern int cm_set_tab _PF(); /* set-c-tab-always-indent */ extern int cm_list_var _PF(); /* list-c-mode-variables */ extern int cm_indentregion _PF(); /* c-indent-region Y.Koyanagi */ #endif /* C_MODE */ #ifndef NO_DIR /* * Defined by "dir.c" */ extern int changedir _PF(); /* change current directory */ extern int showcwdir _PF(); /* show current directory */ #ifndef NO_DIRED /* * defined by "dired.c" */ extern int dired _PF(); /* dired */ extern int d_findfile _PF(); /* dired find file */ extern int d_del _PF(); /* dired mark for deletion */ extern int d_undel _PF(); /* dired unmark */ extern int d_undelbak _PF(); /* dired unmark backwards */ extern int d_expunge _PF(); /* dired expunge */ extern int d_copy _PF(); /* dired copy */ extern int d_rename _PF(); /* dired rename */ extern int d_otherwindow _PF(); /* dired other window */ extern int d_ffotherwindow _PF(); /* dired find file other window */ extern int d_flag _PF(); /* dired mark backup files */ extern int d_viewfile _PF(); /* dired find file read only */ extern int d_execute _PF(); /* dired execute command (win32)*/ #endif #endif /* * Defined by "extend.c". */ extern int extend _PF(); /* Extended commands. */ extern int bindtokey _PF(); /* Modify global key bindings. */ extern int localbind _PF(); /* Modify mode key bindings. */ extern int define_key _PF(); /* modify any key map */ extern int unbindtokey _PF(); /* delete global binding */ extern int localunbind _PF(); /* delete local binding */ extern int insert _PF(); /* insert string */ #ifndef NO_STARTUP extern int evalexpr _PF(); /* Extended commands (again) */ extern int evalbuffer _PF(); /* Evaluate current buffer */ extern int evalfile _PF(); /* Evaluate a file */ #endif /* * Defined by "file.c". */ extern int filevisit _PF(); /* Get a file, read write */ extern int poptofile _PF(); /* Get a file, other window */ #ifdef READONLY /* 91.01.05 by S.Yoshida */ extern int filereadonly _PF(); /* Get a file, read only */ #endif /* READONLY */ extern int filealternate _PF(); /* Get a file, in this buffer */ extern int filewrite _PF(); /* Write a file */ extern int filesave _PF(); /* Save current file */ extern int fileinsert _PF(); /* Insert file into buffer */ #ifndef NO_BACKUP extern int makebkfile _PF(); /* Control backups on saves */ #endif /* * defined by help.c */ #ifndef NO_HELP extern int desckey _PF(); /* describe key */ extern int wallchart _PF(); /* Make wall chart. */ extern int help_help _PF(); /* help help */ extern int apropos_command _PF(); /* apropos */ #endif /* * defined by "jump.c" Dec 1991. bsh */ #ifdef JUMPERR extern int jumptoerror _PF(); /* parse current line as error message */ extern int nexterror _PF(); /* next-error Y.Koyanagi/amura */ extern int compile _PF(); /* compile Y.Koyanagi */ #endif /* * defined by "kanji.c" */ #ifdef KANJI /* 90.01.29 by S.Yoshida */ extern int k_rot_fio _PF(); /* Change global file I/O code. */ extern int k_set_fio _PF(); /* Set global file I/O code. */ extern int k_rot_buffio _PF(); /* Change buffer file I/O code. */ extern int k_set_buffio _PF(); /* Set buffer file I/O code. */ extern int k_set_expect _PF(); /* Set expected file input code. */ extern int k_rot_input _PF(); /* Change keyboard input code. */ extern int k_set_input _PF(); /* Set keyboard input code. */ extern int k_rot_display _PF(); /* Change KANJI display code. */ extern int k_set_display _PF(); /* Set KANJI display code. */ extern int k_list_code _PF(); /* List each KANJI code values. */ extern int k_show_code _PF(); /* Show each KANJI code values. */ extern int k_set_tokfio _PF(); /* Set file KANJI select char. */ extern int k_set_toafio _PF(); /* Set file ASCII select char. */ extern int k_set_tokdisplay _PF(); /* Set disp KANJI select char. */ extern int k_set_toadisplay _PF(); /* Set disp ASCII select char. */ #ifdef HANKANA /* 92.11.21 by S.Sasaki */ extern int k_set_tokanafio _PF(); /* Set file KANA select char. */ extern int k_set_tokanadisplay _PF();/* Set disp KANA select char. */ #endif /* HANKANA */ #endif /* KANJI */ /* * defined by "kbd.c" */ #ifdef DO_METAKEY extern int do_meta _PF(); /* interpret meta keys */ #endif #ifdef BSMAP extern int bsmap _PF(); /* backspace mapping */ #endif extern int universal_argument _PF();/* Ctrl-U */ extern int digit_argument _PF(); /* M-1, etc. */ extern int negative_argument _PF();/* M-- */ extern int selfinsert _PF(); /* Insert character */ extern int rescan _PF(); /* internal try again function */ /* * defined by "kinsoku.c" */ #ifdef KINSOKU /* 90.01.29 by S.Yoshida */ extern int kc_list_char _PF(); /* List BOL/EOL KINSOKU chars. */ extern int kc_add_bol _PF(); /* Add BOL KINSOKU chars. */ extern int kc_del_bol _PF(); /* Delete BOL KINSOKU chars. */ extern int kc_add_eol _PF(); /* Add EOL KINSOKU chars. */ extern int kc_del_eol _PF(); /* Delete EOL KINSOKU chars. */ #endif /* KINSOKU */ /* * defined by "line.c" */ #ifdef UNDO extern int do_undo _PF(); /* undo */ #endif /* * defined by "macro.c" */ #ifndef NO_MACRO extern int definemacro _PF(); /* Begin macro */ extern int finishmacro _PF(); /* End macro */ extern int executemacro _PF(); /* Execute macro */ #endif /* * Defined by "main.c". */ extern int ctrlg _PF(); /* Abort out of things */ extern int quit _PF(); /* Quit */ /* * Defined by "match.c" */ extern int showmatch _PF(); /* Hack to show matching paren */ #ifdef GOMATCH extern int gotomatch _PF(); /* goto-matching-fence a la kemacs */ #endif /* defined by "modes.c" */ extern int indentmode _PF(); /* set auto-indent mode */ extern int fillmode _PF(); /* set word-wrap mode */ extern int blinkparen _PF(); /* Fake blink-matching-paren var */ extern int notabmode _PF(); /* no tab mode */ extern int overwrite _PF(); /* overwrite mode */ #ifdef C_MODE /* 90.07.24 by K.Takano */ extern int cmode _PF(); /* set c-mode */ #endif /* C_MODE */ extern int set_default_mode _PF(); /* set default modes */ /* * defined by "paragraph.c" - the paragraph justification code. */ extern int gotobop _PF(); /* Move to start of paragraph. */ extern int gotoeop _PF(); /* Move to end of paragraph. */ extern int fillpara _PF(); /* Justify a paragraph. */ extern int killpara _PF(); /* Delete a paragraph. */ extern int setfillcol _PF(); /* Set fill column for justify. */ extern int fillword _PF(); /* Insert char with word wrap. */ #ifdef FILLPREFIX /* 90.12.30 by S.Yoshida */ extern int setfillprefix _PF(); /* Set fill prefix strings. */ #endif /* FILLPREFIX */ /* * Defined by "random.c". */ extern int showcpos _PF(); /* Show the cursor position */ extern int twiddle _PF(); /* Twiddle characters */ extern int quote _PF(); /* Insert literal */ extern int openline _PF(); /* Open up a blank line */ extern int newline _PF(); /* Insert newline */ extern int deblank _PF(); /* Delete blank lines */ extern int justone _PF(); /* Delete extra whitespace */ extern int delwhite _PF(); /* Delete all whitespace */ extern int indent _PF(); /* Insert newline, then indent */ extern int forwdel _PF(); /* Forward delete */ extern int backdel _PF(); /* Backward delete in */ extern int killline _PF(); /* Kill forward */ extern int killoneline _PF(); /* Kill current line */ extern int yank _PF(); /* Yank back from killbuffer. */ extern int space_to_tabstop _PF(); #ifdef ZAPTOC_A # define ZAPTOCHAR #endif #ifdef ZAPTOCHAR extern int zaptochar _PF(); /* Kill up to CHAR */ #endif #ifdef ADDFUNC /* 90.02.15 by S.Yoshida */ extern int pagelines _PF(); /* Count lines in the page. */ extern int regionlines _PF(); /* Count lines in the region. */ #endif /* ADDFUNC */ #ifdef REGEX /* * Defined by "re_search.c" */ extern int re_forwsearch _PF(); /* Regex search forward */ extern int re_backsearch _PF(); /* Regex search backwards */ extern int re_searchagain _PF(); /* Repeat regex search command */ extern int re_queryrepl _PF(); /* Regex query replace */ extern int setcasefold _PF(); /* Set case fold in searches */ extern int delmatchlines _PF(); /* Delete all lines matching */ extern int delnonmatchlines _PF(); /* Delete all lines not matching */ extern int cntmatchlines _PF(); /* Count matching lines */ extern int cntnonmatchlines _PF(); /* Count nonmatching lines */ #endif /* * Defined by "region.c". */ extern int killregion _PF(); /* Kill region. */ extern int copyregion _PF(); /* Copy region to kill buffer. */ extern int lowerregion _PF(); /* Lower case region. */ extern int upperregion _PF(); /* Upper case region. */ extern int copybuffer _PF(); /* Copy buffer to kill buffer */ #ifdef PREFIXREGION extern int prefixregion _PF(); /* Prefix all lines in region */ extern int setprefix _PF(); /* Set line prefix string */ #endif /* * Defined by "search.c". */ extern int forwsearch _PF(); /* Search forward */ extern int backsearch _PF(); /* Search backwards */ extern int searchagain _PF(); /* Repeat last search command */ extern int forwisearch _PF(); /* Incremental search forward */ extern int backisearch _PF(); /* Incremental search backwards */ extern int queryrepl _PF(); /* Query replace */ #ifndef NO_SHELL /* 91.01.10 by K.Maeda */ /* * Defined by "shell.c" */ extern int shellcmnd _PF(); /* Get shell command result. */ #endif /* NO_SHELL */ /* * Defined by "spawn.c". */ extern int spawncli _PF(); /* Run CLI in a subjob. */ #ifdef VMS extern int attachtoparent _PF(); /* Attach to parent process */ #endif /* * Defined by "ttyio.c". */ #ifdef IBMPC /* 91.01.11 by S.Yoshida */ extern int j31_set_cursor _PF(); /* Set J-3100 cursor mode. */ #endif /* IBMPC */ #ifdef FEPCTRL /* 90.11.26 by K.Takano */ extern int fepmode_set _PF(); /* Set FEP control mode */ extern int fepmode_chg _PF(); /* Change FEP control mode */ extern int fepmode_toggle _PF(); /* Toggle FEP on/off */ #endif /* defined by "version.c" */ extern int showversion(); /* Show version numbers, etc. */ #ifdef ADDFUNC /* 90.12.28 by S.Yoshida */ extern int showngversion(); /* Show Ng version, etc. */ #endif /* ADDFUNC */ /* * Defined by "window.c". */ extern int reposition _PF(); /* Reposition window */ extern int refresh _PF(); /* Refresh the screen */ extern int nextwind _PF(); /* Move to the next window */ #ifdef GOSMACS extern int prevwind _PF(); /* Move to the previous window */ #endif extern int onlywind _PF(); /* Make current window only one */ extern int splitwind _PF(); /* Split current window */ extern int delwind _PF(); /* Delete current window */ extern int enlargewind _PF(); /* Enlarge display window. */ extern int shrinkwind _PF(); /* Shrink window. */ /* * Defined by "word.c". */ extern int backword _PF(); /* Backup by words */ extern int forwword _PF(); /* Advance by words */ extern int upperword _PF(); /* Upper case word. */ extern int lowerword _PF(); /* Lower case word. */ extern int capword _PF(); /* Initial capitalize word. */ extern int delfword _PF(); /* Delete forward word. */ extern int delbword _PF(); /* Delete backward word. */ /* * Defined by "version.c". */ extern int showversion _PF(); /* Show ng version breifry */ extern int showngversion _PF(); /* Show ng version verbose */ /* * Defined by "skg.c". */ #ifdef INCLUDE_SKG extern int skginput _PF(); /* Get Kanji strings. */ extern int skg_set_romanname _PF();/* Set Roman->Kana dict name */ extern int skg_set_dicname _PF(); /* Set Kana->Kanji dict name */ #endif /* * Defined by "autosave.c". */ #ifdef AUTOSAVE extern int as_set_interval _PF(); /* Autosave interval time */ #endif #ifdef WIN32 #ifndef NO_STARTUP extern int ConfigStartupFilePath _PF(); #endif extern int tticon _PF(); #endif #ifdef AMIGA #ifdef DO_ICONIFY extern int tticon _PF(); #endif #ifdef DO_MENU extern int amigamenu _PF(); /* Menu function */ #endif #ifdef MOUSE extern int amigamouse _PF(); /* Amiga mouse functions */ extern int mgotobob _PF(); extern int mforwdel _PF(); extern int mdelwhite _PF(); extern int mdelwind _PF(); extern int mgotoeob _PF(); extern int menlargewind _PF(); extern int mkillline _PF(); extern int mkillregion _PF(); extern int mdelfword _PF(); extern int mreposition _PF(); extern int mbackpage _PF(); extern int mforwpage _PF(); extern int mshrinkwind _PF(); extern int msplitwind _PF(); extern int myank _PF(); #endif /* MOUSE */ extern int togglewindow _PF(); /* Defined by "ttyio.c" */ extern int togglezooms _PF(); /* "" "" */ #ifdef CHANGE_FONT extern int setfont _PF(); /* Defined by "ttyio.c" */ #endif #ifdef CHANGE_COLOR /* functions to mess with the mode line rendition, window colors*/ extern int ttmode _PF(); /* Defined by "tty.c" */ extern int tttext _PF(); /* "" */ extern int textforeground _PF(); /* "" */ extern int textbackground _PF(); /* "" */ extern int modeforeground _PF(); /* "" */ extern int modebackground _PF(); /* "" */ #endif /* * This file contains map segment definitions for adding function keys to * keymap declarations. Currently you can add things to the fundamental * mode keymap and the dired mode keymap. See the declaration of * diredmap and fundmap for details. */ #include "amiga_maps.c" #endif /* AMIGA */ #ifdef CANNA /* * Defined by "canna.c". */ extern int canna_toggle(); #endif /* initial keymap declarations, deepest first */ #ifndef NO_HELP static PF cHcG[] = { ctrlg, /* ^G */ help_help, /* ^H */ }; static PF cHa[] = { apropos_command,/* a */ wallchart, /* b */ desckey, /* c */ }; static struct KEYMAPE(2+IMAPEXT) helpmap = { 2, 2+IMAPEXT, rescan, { {CCHR('G'),CCHR('H'), cHcG, (KEYMAP *)NULL}, {'a', 'c', cHa, (KEYMAP *)NULL}, } }; #endif #ifdef KANJI /* 90.01.29 by S.Yoshida */ static PF cXcKcG[] = { ctrlg, /* ^G */ }; static PF cXcKC[] = { k_list_code, /* C */ rescan, /* D */ rescan, /* E */ k_rot_fio, /* F */ }; static PF cXcKc[] = { k_show_code, /* c */ k_rot_display, /* d */ rescan, /* e */ k_rot_buffio, /* f */ rescan, /* g */ rescan, /* h */ k_rot_input, /* i */ }; static struct KEYMAPE(3+IMAPEXT) cXcKmap = { 3, 3+IMAPEXT, rescan, { {CCHR('G'), CCHR('G'), cXcKcG, (KEYMAP *)NULL}, {'C', 'F', cXcKC, (KEYMAP *)NULL}, {'c', 'i', cXcKc, (KEYMAP *)NULL}, } }; #endif /* KANJI */ static PF cX4cF[] = { poptofile, /* ^f */ ctrlg, /* ^g */ }; static PF cX4b[] = { poptobuffer, /* b */ rescan, /* c */ rescan, /* d */ rescan, /* e */ poptofile, /* f */ }; static struct KEYMAPE(2+IMAPEXT) cX4map = { 2, 2+IMAPEXT, rescan, { {CCHR('F'),CCHR('G'), cX4cF, (KEYMAP *)NULL}, {'b', 'f', cX4b, (KEYMAP *)NULL}, } }; static PF cXcB[] = { listbuffers, /* ^B */ quit, /* ^C */ rescan, /* ^D */ rescan, /* ^E */ filevisit, /* ^F */ ctrlg, /* ^G */ }; #ifdef KANJI /* 90.01.29 by S.Yoshida */ static PF cXcK[] = { prefix, /* ^K */ #else /* NOT KANJI */ static PF cXcL[] = { #endif /* KANJI */ lowerregion, /* ^L */ rescan, /* ^M */ rescan, /* ^N */ deblank, /* ^O */ rescan, /* ^P */ #ifdef READONLY togglereadonly, /* ^Q */ filereadonly, /* ^R */ #else /* NOT READONLY */ rescan, /* ^Q */ rescan, /* ^R */ #endif /* READONLY */ filesave, /* ^S */ rescan, /* ^T */ upperregion, /* ^U */ filealternate, /* ^V */ filewrite, /* ^W */ swapmark, /* ^X */ }; #ifndef NO_MACRO static PF cXlp[] = { definemacro, /* ( */ finishmacro, /* ) */ }; #endif #ifdef FILLPREFIX /* 90.12.30 by S.Yoshida */ static PF cXdot[] = { setfillprefix, /* . */ rescan, /* / */ #else /* NOT FILLPREFIX */ static PF cX0[] = { #endif /* FILLPREFIX */ delwind, /* 0 */ onlywind, /* 1 */ splitwind, /* 2 */ rescan, /* 3 */ prefix, /* 4 */ }; static PF cXeq[] = { showcpos, /* = */ }; static PF cXcar[] = { enlargewind, /* ^ */ rescan, /* _ */ #ifdef JUMPERR jumptoerror, /* ` */ #else rescan, /* ` */ #endif rescan, /* a */ usebuffer, /* b */ rescan, /* c */ #ifndef NO_DIRED dired, /* d */ #else rescan, /* d */ #endif #ifndef NO_MACRO executemacro, /* e */ #else rescan, /* e */ #endif setfillcol, /* f */ rescan, /* g */ rescan, /* h */ fileinsert, /* i */ rescan, /* j */ killbuffer, /* k */ #ifdef ADDFUNC /* 90.02.15 by S.Yoshida */ pagelines, /* l */ #else /* NOT ADDFUNC */ rescan, /* l */ #endif /* ADDFUNC */ rescan, /* m */ rescan, /* n */ nextwind, /* o */ rescan, /* p */ rescan, /* q */ rescan, /* r */ savebuffers, /* s */ #ifdef UNDO rescan, /* t */ do_undo, /* u */ #endif }; #ifndef NO_MACRO static struct KEYMAPE(6+IMAPEXT) cXmap = { 6, 6+IMAPEXT, #else static struct KEYMAPE(5+IMAPEXT) cXmap = { 5, 5+IMAPEXT, #endif rescan, { {CCHR('B'),CCHR('G'), cXcB, (KEYMAP *)NULL}, #ifdef KANJI /* 90.01.29 by S.Yoshida */ {CCHR('K'),CCHR('X'), cXcK, (KEYMAP *)&cXcKmap}, #else /* NOT KANJI */ {CCHR('L'),CCHR('X'), cXcL, (KEYMAP *)NULL}, #endif /* KANJI */ #ifndef NO_MACRO {'(', ')', cXlp, (KEYMAP *)NULL}, #endif #ifdef FILLPREFIX /* 90.12.30 by S.Yoshida */ {'.', '4', cXdot, (KEYMAP *)&cX4map}, #else /* NOT FILLPREFIX */ {'0', '4', cX0, (KEYMAP *)&cX4map}, #endif /* FILLPREFIX */ {'=', '=', cXeq, (KEYMAP *)NULL}, #ifdef UNDO {'^', 'u', cXcar, (KEYMAP *)NULL}, #else {'^', 's', cXcar, (KEYMAP *)NULL}, #endif } }; static PF metacG[] = { ctrlg, /* ^G */ }; static PF metacV[] = { pagenext, /* ^V */ }; static PF metasp[] = { justone, /* space */ #ifndef NO_SHELL /* 91.01.10 by K.Maeda */ shellcmnd, /* ! */ #endif /* NO_SHELL */ }; static PF metapct[] = { queryrepl, /* % */ }; static PF metami[] = { negative_argument, /* - */ rescan, /* . */ rescan, /* / */ digit_argument, /* 0 */ digit_argument, /* 1 */ digit_argument, /* 2 */ digit_argument, /* 3 */ digit_argument, /* 4 */ digit_argument, /* 5 */ digit_argument, /* 6 */ digit_argument, /* 7 */ digit_argument, /* 8 */ digit_argument, /* 9 */ rescan, /* : */ rescan, /* ; */ gotobob, /* < */ #ifdef ADDFUNC /* 90.02.15 by S.Yoshida */ regionlines, /* = */ #else /* NOT ADDFUNC */ rescan, /* = */ #endif /* ADDFUNC */ gotoeob, /* > */ }; static PF metalb[] = { gotobop, /* [ */ delwhite, /* \ */ gotoeop, /* ] */ rescan, /* ^ */ rescan, /* _ */ rescan, /* ` */ rescan, /* a */ backword, /* b */ capword, /* c */ delfword, /* d */ rescan, /* e */ forwword, /* f */ }; static PF metal[] = { lowerword, /* l */ rescan, /* m */ rescan, /* n */ rescan, /* o */ rescan, /* p */ fillpara, /* q */ backsearch, /* r */ forwsearch, /* s */ rescan, /* t */ upperword, /* u */ backpage, /* v */ copyregion, /* w */ extend, /* x */ #ifdef ZAPTOCHAR rescan, /* y */ zaptochar, /* z */ #endif }; static PF metatilde[] = { notmodified, /* ~ */ delbword, /* DEL */ }; #ifdef INCLUDE_SKG static PF metacK[] = { skginput, /* ^K */ }; #define XSKGMAP 1 #else #define XSKGMAP 0 #endif static struct KEYMAPE(8+IMAPEXT+XSKGMAP) metamap = { 8+XSKGMAP, 8+IMAPEXT+XSKGMAP, rescan, { {CCHR('G'),CCHR('G'), metacG, (KEYMAP *)NULL}, #ifdef INCLUDE_SKG {CCHR('K'),CCHR('K'), metacK, (KEYMAP *)NULL}, #endif {CCHR('V'),CCHR('V'), metacV, (KEYMAP *)NULL}, #ifndef NO_SHELL /* 91.01.10 by K.Maeda */ {' ', '!', metasp, (KEYMAP *)NULL}, #else /* NO_SHELL */ {' ', ' ', metasp, (KEYMAP *)NULL}, #endif /* NO_SHELL */ {'%', '%', metapct,(KEYMAP *)NULL}, {'-', '>', metami, (KEYMAP *)NULL}, {'[', 'f', metalb, (KEYMAP *)NULL}, #ifndef ZAPTOCHAR {'l', 'x', metal, (KEYMAP *)NULL}, #else {'l', 'z', metal, (KEYMAP *)NULL}, #endif {'~', CCHR('?'), metatilde,(KEYMAP *)NULL}, } }; static PF fund_at[] = { setmark, /* ^@ */ gotobol, /* ^A */ backchar, /* ^B */ rescan, /* ^C */ forwdel, /* ^D */ gotoeol, /* ^E */ forwchar, /* ^F */ ctrlg, /* ^G */ #ifndef NO_HELP prefix, /* ^H */ #else rescan, /* ^H */ #endif }; /* ^I is selfinsert */ static PF fund_CJ[] = { indent, /* ^J */ killline, /* ^K */ reposition, /* ^L */ newline, /* ^M */ forwline, /* ^N */ #ifdef CANNA canna_toggle, /* ^O */ #else openline, /* ^O */ #endif backline, /* ^P */ quote, /* ^Q */ backisearch, /* ^R */ forwisearch, /* ^S */ twiddle, /* ^T */ universal_argument, /* ^U */ forwpage, /* ^V */ killregion, /* ^W */ prefix, /* ^X */ yank, /* ^Y */ #ifndef VMS spawncli, /* ^Z */ #else attachtoparent, /* ^Z */ #endif }; static PF fund_esc[] = { prefix, /* esc */ #ifdef MSDOS /* 90.02.20 by S.Yoshida */ #ifdef PC9801 /* 97.09.11 by amura */ #ifdef FEPCTRL fepmode_toggle, /* ^\ */ /* ^\ is fep-toggle */ #else setmark, /* ^\ */ /* ^\ is also set-mark-command. */ #endif /* FEPCTRL */ #else /* NOT PC9801 */ #ifdef IBMPC #ifdef FEPCTRL fepmode_toggle, /* ^\ */ /* ^\ is fep-toggle */ #else setmark, /* ^\ */ /* ^\ is also set-mark-command. */ #endif /* FEPCTRL */ #else /* NOT IBMPC and PC9801 */ setmark, /* ^\ */ /* ^\ is also set-mark-command. */ #endif /* IBMPC */ #endif /* PC9801 */ #else /* NOT MSDOS */ #ifdef HUMAN68K /* 90.11.09 Sawayanagi Yosirou */ #ifdef FEPCTRL fepmode_toggle, /* ^\ */ /* ^\ is fep-toggle */ #else setmark, /* ^\ */ /* ^\ is also set-mark-command. */ #endif /* FEPCTRL */ #else /* NOT HUMAN68K */ rescan, /* ^\ */ /* selfinsert is default on fundamental */ #endif /* HUMAN68K */ #endif /* MSDOS */ rescan, /* ^] */ rescan, /* ^^ */ #ifdef UNDO do_undo, /* _ */ #else rescan, /* ^_ */ #endif }; static PF fund_del[] = { backdel, /* DEL */ }; #ifndef FUND_XMAPS #define NFUND_XMAPS 0 /* extra map sections after normal ones */ #endif static struct KEYMAPE(4+NFUND_XMAPS+IMAPEXT) fundmap = { 4 + NFUND_XMAPS, 4 + NFUND_XMAPS + IMAPEXT, selfinsert, { #ifndef NO_HELP {CCHR('@'),CCHR('H'), fund_at, (KEYMAP *)&helpmap}, #else {CCHR('@'),CCHR('H'), fund_at, (KEYMAP *)NULL}, #endif {CCHR('J'),CCHR('Z'), fund_CJ, (KEYMAP *)&cXmap}, {CCHR('['),CCHR('_'), fund_esc,(KEYMAP *)&metamap}, {CCHR('?'),CCHR('?'), fund_del,(KEYMAP *)NULL}, #ifdef FUND_XMAPS FUND_XMAPS, #endif } }; static PF fill_sp[] = { fillword, /* ' ' */ }; static struct KEYMAPE(1+IMAPEXT) fillmap = { 1, 1+IMAPEXT, rescan, { {' ', ' ', fill_sp, (KEYMAP *)NULL}, } }; static PF indent_lf[] = { newline, /* ^J */ rescan, /* ^K */ rescan, /* ^L */ indent, /* ^M */ }; static struct KEYMAPE(1+IMAPEXT) indntmap = { 1, 1+IMAPEXT, rescan, { {CCHR('J'), CCHR('M'), indent_lf, (KEYMAP *)NULL}, } }; static PF blink_rp[] = { showmatch, /* ) */ }; static struct KEYMAPE(1+IMAPEXT) blinkmap = { 1, 1+IMAPEXT, rescan, { {')', ')', blink_rp, (KEYMAP *)NULL}, } }; static PF notab_tab[] = { space_to_tabstop, /* ^I */ }; static struct KEYMAPE(1+IMAPEXT) notabmap = { 1, 1+IMAPEXT, rescan, { {CCHR('I'),CCHR('I'), notab_tab, (KEYMAP *)NULL}, } }; static struct KEYMAPE(1+IMAPEXT) overwmap = { 0, 1+IMAPEXT, /* 1 to avoid 0 sized array */ rescan, { /* unused dummy entry for VMS C */ {(KCHAR)0, (KCHAR)0, (PF *)NULL, (KEYMAP *)NULL}, } }; #ifndef NO_DIRED static PF dirednul[] = { setmark, /* ^@ */ gotobol, /* ^A */ backchar, /* ^B */ rescan, /* ^C */ d_del, /* ^D */ gotoeol, /* ^E */ forwchar, /* ^F */ ctrlg, /* ^G */ #ifndef NO_HELP prefix, /* ^H */ #endif }; static PF diredcl[] = { reposition, /* ^L */ forwline, /* ^M */ forwline, /* ^N */ rescan, /* ^O */ backline, /* ^P */ rescan, /* ^Q */ backisearch, /* ^R */ forwisearch, /* ^S */ rescan, /* ^T */ universal_argument, /* ^U */ forwpage, /* ^V */ rescan, /* ^W */ prefix, /* ^X */ }; static PF diredcz[] = { #ifndef VMS spawncli, /* ^Z */ #else attachtoparent, /* ^Z */ #endif prefix, /* esc */ rescan, /* ^\ */ rescan, /* ^] */ rescan, /* ^^ */ rescan, /* ^_ */ forwline, /* SP */ }; static PF diredc[] = { d_copy, /* c */ d_del, /* d */ d_findfile, /* e */ d_findfile, /* f */ }; static PF diredn[] = { forwline, /* n */ d_ffotherwindow,/* o */ backline, /* p */ rescan, /* q */ d_rename, /* r */ rescan, /* s */ rescan, /* t */ d_undel, /* u */ #ifdef READONLY d_viewfile, /* v */ #else rescan, /* v */ #endif rescan, /* w */ d_expunge, /* x */ }; static PF diredf[] = { d_flag, /* ~ */ }; static PF direddl[] = { d_undelbak, /* del */ }; #ifndef DIRED_XMAPS #define NDIRED_XMAPS 0 /* number of extra map sections */ #endif static struct KEYMAPE(7 + NDIRED_XMAPS + IMAPEXT) diredmap = { 7 + NDIRED_XMAPS, 7 + NDIRED_XMAPS + IMAPEXT, rescan, { #ifndef NO_HELP {CCHR('@'), CCHR('H'), dirednul, (KEYMAP *)&helpmap}, #else {CCHR('@'), CCHR('G'), dirednul, (KEYMAP *)NULL}, #endif {CCHR('L'), CCHR('X'), diredcl, (KEYMAP *)&cXmap}, {CCHR('Z'), ' ', diredcz, (KEYMAP *)&metamap}, {'c', 'f', diredc, (KEYMAP *)NULL}, {'n', 'x', diredn, (KEYMAP *)NULL}, {'~', '~', diredf, (KEYMAP *)NULL}, {CCHR('?'), CCHR('?'), direddl, (KEYMAP *)NULL}, #ifdef DIRED_XMAPS DIRED_XMAPS, /* map sections for dired mode keys */ #endif } }; #endif #ifdef C_MODE /* 90.07.24 by K.Takano */ static PF cmodeci[] = { cm_indent, /* ^I */ cm_lfindent, /* ^J */ rescan, /* ^K */ rescan, /* ^L */ newline, /* ^M */ }; static PF cmodecolon[] = { cm_term, /* : */ cm_semi, /* ; */ }; static PF cmodepar[] = { cm_brace_blink, /* { */ rescan, /* | */ cm_brace_blink, /* } */ }; static struct KEYMAPE(3+IMAPEXT) cmodemap = { 3, 3 + IMAPEXT, rescan, { {CCHR('I'), CCHR('M'), cmodeci, (KEYMAP *)NULL}, {':', ';', cmodecolon, (KEYMAP *)NULL}, {'{', '}', cmodepar, (KEYMAP *)NULL}, } }; #endif /* C_MODE */ #ifdef BUFFER_MODE /* 1999.5.30 by Tillanosoft */ static PF buffernul[] = { setmark, /* ^@ */ gotobol, /* ^A */ backchar, /* ^B */ rescan, /* ^C */ b_del, /* ^D */ gotoeol, /* ^E */ forwchar, /* ^F */ ctrlg, /* ^G */ #ifndef NO_HELP prefix, /* ^H */ #endif }; static PF buffercl[] = { reposition, /* ^L */ forwline, /* ^M */ forwline, /* ^N */ rescan, /* ^O */ backline, /* ^P */ rescan, /* ^Q */ backisearch, /* ^R */ forwisearch, /* ^S */ rescan, /* ^T */ universal_argument, /* ^U */ forwpage, /* ^V */ rescan, /* ^W */ prefix, /* ^X */ }; static PF buffercz[] = { #ifndef VMS spawncli, /* ^Z */ #else attachtoparent, /* ^Z */ #endif prefix, /* esc */ rescan, /* ^\ */ rescan, /* ^] */ rescan, /* ^^ */ rescan, /* ^_ */ forwline, /* SP */ }; /* 1 2 d done f done g k done n done o p done u done x done ~ % */ static PF bufferd[] = { b_del, /* d */ rescan, /* e */ b_thiswin, /* f */ rescan, /* g */ rescan, /* h */ rescan, /* i */ rescan, /* j */ b_del, /* k */ rescan, /* l */ rescan, /* m */ forwline, /* n */ rescan, /* o */ backline, /* p */ rescan, /* q */ rescan, /* r */ rescan, /* s */ rescan, /* t */ b_undel, /* u */ rescan, /* v */ rescan, /* w */ b_expunge, /* x */ }; static struct KEYMAPE(4 + IMAPEXT) bufmodemap = { 4, 4 + IMAPEXT, rescan, { #ifndef NO_HELP {CCHR('@'), CCHR('H'), buffernul, (KEYMAP *)&helpmap}, #else {CCHR('@'), CCHR('G'), buffernul, (KEYMAP *)NULL}, #endif {CCHR('L'), CCHR('X'), buffercl, (KEYMAP *)&cXmap}, {CCHR('Z'), ' ', buffercz, (KEYMAP *)&metamap}, {'d', 'x', bufferd, (KEYMAP *)NULL}, } }; #endif /* BUF_MODE */ /* give names to the maps, for use by help etc. * If the map is to be bindable, it must also be listed in the * function name table below with the same name. * Maps created dynamicly currently don't get added here, thus are unnamed. * Modes are just named keymaps with functions to add/subtract them from * a buffer's list of modes. If you change a mode name, change it in * modes.c also. */ MAPS map_table[] = { /* fundamental map MUST be first entry */ {(KEYMAP *)&fundmap, "fundamental"}, {(KEYMAP *)&fillmap, "fill"}, {(KEYMAP *)&indntmap, "indent"}, {(KEYMAP *)&blinkmap, "blink"}, {(KEYMAP *)¬abmap, "notab"}, {(KEYMAP *)&overwmap, "overwrite"}, {(KEYMAP *)&metamap, "esc prefix"}, {(KEYMAP *)&cXmap, "c-x prefix"}, {(KEYMAP *)&cX4map, "c-x 4 prefix"}, #ifdef KANJI /* 90.01.29 by S.Yoshida */ {(KEYMAP *)&cXcKmap, "kanji-prefix"}, #endif /* KANJI */ #ifndef NO_HELP {(KEYMAP *)&helpmap, "help"}, #endif #ifndef NO_DIRED {(KEYMAP *)&diredmap, "dired"}, #endif #ifdef C_MODE /* 90.07.24 by K.Takano */ {(KEYMAP *)&cmodemap, "C"}, #endif /* C_MODE */ #ifdef BUFFER_MODE {(KEYMAP *)&bufmodemap, "Buffer Menu"}, #endif }; #define NMAPS (sizeof map_table/sizeof(MAPS)) int nmaps = NMAPS; /* for use by rebind in extend.c */ char *map_name(map) KEYMAP *map; { MAPS *mp = &map_table[0]; do { if(mp->p_map == map) return mp->p_name; } while(++mp < &map_table[NMAPS]); return (char *)NULL; } MAPS *name_mode(name) char *name; { MAPS *mp = &map_table[0]; do { if(strcmp(mp->p_name,name)==0) return mp; } while(++mp < &map_table[NMAPS]); return (MAPS *)NULL; } KEYMAP *name_map(name) char *name; { MAPS *mp; return (mp=name_mode(name))==NULL ? (KEYMAP *)NULL : mp->p_map; } /* Warning: functnames MUST be in alphabetical order! (due to binary * search in name_function.) If the function is prefix, it must be listed * with the same name in the map_table above. */ FUNCTNAMES functnames[] = { #ifdef BUFFER_MODE {b_del, "Buffer-menu-delete"}, {b_expunge, "Buffer-menu-execute"}, {b_thiswin, "Buffer-menu-this-window"}, {b_undel, "Buffer-menu-unmark"}, #endif #ifdef KINSOKU /* 90.01.29 by S.Yoshida */ {kc_add_bol, "add-kinsoku-bol-chars"}, {kc_add_eol, "add-kinsoku-eol-chars"}, #endif /* KINSOKU */ #ifdef AMIGA #ifdef DO_ICONIFY {tticon, "amiga-iconify"}, #endif #ifdef DO_MENU {amigamenu, "amiga-menu"}, #endif #ifdef CHANGE_COLOR {modebackground,"amiga-mode-background"}, {modeforeground,"amiga-mode-foreground"}, {ttmode, "amiga-mode-rendition"}, #endif #ifdef CHANGE_FONT {setfont, "amiga-set-font"}, #endif #ifdef CHANGE_COLOR {textbackground,"amiga-text-background"}, {textforeground,"amiga-text-foreground"}, {tttext, "amiga-text-rendition"}, #endif {togglewindow, "amiga-toggle-border"}, {togglezooms, "amiga-zoom-mode"}, #endif /* AMIGA */ #ifndef NO_HELP {apropos_command, "apropos"}, #endif {fillmode, "auto-fill-mode"}, {indentmode, "auto-indent-mode"}, {backchar, "backward-char"}, {delbword, "backward-kill-word"}, {gotobop, "backward-paragraph"}, {backword, "backward-word"}, {gotobob, "beginning-of-buffer"}, {gotobol, "beginning-of-line"}, {blinkparen, "blink-matching-paren"}, {showmatch, "blink-matching-paren-hack"}, #ifdef BSMAP {bsmap, "bsmap-mode"}, #endif #ifdef C_MODE /* 90.07.24 by K.Takano */ {cm_indent, "c-indent-command"}, {cm_indentregion, "c-indent-region"}, /* Y.Koyanagi */ {cmode, "c-mode"}, {cm_lfindent, "c-newline-and-indent"}, #endif /* C_MODE */ {prefix, "c-x 4 prefix"}, {prefix, "c-x prefix"}, #ifndef NO_MACRO {executemacro, "call-last-kbd-macro"}, #endif #ifdef CANNA {canna_toggle, "canna-toggle"}, #endif {capword, "capitalize-word"}, #ifndef NO_DIR {changedir, "cd"}, #endif #ifdef KANJI /* 90.01.29 by S.Yoshida */ {k_rot_fio, "change-default-fileio-code"}, {k_rot_display, "change-display-code"}, #endif /* KANJI */ #ifdef FEPCTRL /* 90.11.26 by K.Takano */ {fepmode_chg, "change-fep-control"}, #endif #ifdef KANJI /* 90.01.29 by S.Yoshida */ {k_rot_buffio, "change-fileio-code"}, {k_rot_input, "change-input-code"}, #endif /* KANJI */ #ifdef JUMPERR /* 91.09.14 by Y.Koyanagi */ {compile, "compile"}, #endif /* JUMPERR */ #ifndef NO_STARTUP #ifdef WIN32 {ConfigStartupFilePath, "configure"}, #endif #endif {copybuffer, "copy-buffer-as-kill"}, {copyregion, "copy-region-as-kill"}, #ifdef ADDFUNC /* 90.02.15 by S.Yoshida */ {pagelines, "count-lines-page"}, {regionlines, "count-lines-region"}, #endif /* ADDFUNC */ #ifdef REGEX {cntmatchlines, "count-matches"}, {cntnonmatchlines,"count-non-matches"}, #endif {define_key, "define-key"}, {backdel, "delete-backward-char"}, {deblank, "delete-blank-lines"}, {forwdel, "delete-char"}, {delwhite, "delete-horizontal-space"}, #ifdef KINSOKU /* 90.01.29 by S.Yoshida */ {kc_del_bol, "delete-kinsoku-bol-chars"}, {kc_del_eol, "delete-kinsoku-eol-chars"}, #endif /* KINSOKU */ #ifdef REGEX {delmatchlines, "delete-matching-lines"}, {delnonmatchlines,"delete-non-matching-lines"}, #endif {onlywind, "delete-other-windows"}, {delwind, "delete-window"}, #ifndef NO_HELP {wallchart, "describe-bindings"}, {desckey, "describe-key-briefly"}, #endif {digit_argument,"digit-argument"}, #ifndef NO_DIRED {dired, "dired"}, {d_undelbak, "dired-backup-unflag"}, {d_copy, "dired-copy-file"}, {d_expunge, "dired-do-deletions"}, {d_execute, "dired-do-shell-command"}, {d_findfile, "dired-find-file"}, {d_ffotherwindow, "dired-find-file-other-window"}, {d_flag, "dired-flag-backup-files"}, {d_del, "dired-flag-file-deleted"}, {d_otherwindow, "dired-other-window"}, {d_rename, "dired-rename-file"}, {d_undel, "dired-unflag"}, #endif {lowerregion, "downcase-region"}, {lowerword, "downcase-word"}, #ifdef C_MODE /* 90.07.24 by K.Takano */ {cm_brace, "electric-c-brace"}, {cm_brace_blink,"electric-c-brace-blink"}, {cm_semi, "electric-c-semi"}, {cm_term, "electric-c-terminator"}, #endif /* C_MODE */ {showversion, "emacs-version"}, #ifndef NO_MACRO {finishmacro, "end-kbd-macro"}, #endif {gotoeob, "end-of-buffer"}, {gotoeol, "end-of-line"}, {enlargewind, "enlarge-window"}, {prefix, "esc prefix"}, #ifndef NO_STARTUP {evalbuffer, "eval-current-buffer"}, {evalexpr, "eval-expression"}, #endif {swapmark, "exchange-point-and-mark"}, {extend, "execute-extended-command"}, #ifdef FEPCTRL {fepmode_toggle,"fep-toggle"}, #else # ifdef CANNA {canna_toggle, "fep-toggle"}, # endif #endif {fillpara, "fill-paragraph"}, {filevisit, "find-file"}, {poptofile, "find-file-other-window"}, #ifdef READONLY /* 91.01.05 by S.Yoshida */ {filereadonly, "find-file-read-only"}, #endif /* READONLY */ {forwchar, "forward-char"}, {gotoeop, "forward-paragraph"}, {forwword, "forward-word"}, {bindtokey, "global-set-key"}, {unbindtokey, "global-unset-key"}, {gotoline, "goto-line"}, #ifdef GOMATCH {gotomatch, "goto-matching-fence"}, #endif #ifndef NO_HELP {prefix, "help"}, {help_help, "help-help"}, #endif #ifdef IBMPC /* 91.01.11 by S.Yoshida */ {j31_set_cursor, "ibmpc-set-cursor"}, #endif /* IBMPC */ #if (defined(AMIGA)&&defined(DO_ICONIFY))||defined(WIN32) {tticon, "iconify-frame"}, #endif /* ICONIFY */ {insert, "insert"}, {bufferinsert, "insert-buffer"}, {fileinsert, "insert-file"}, {fillword, "insert-with-wrap"}, {backisearch, "isearch-backward"}, {forwisearch, "isearch-forward"}, #ifdef IBMPC /* 91.01.11 by S.Yoshida */ {j31_set_cursor, "j31-set-cursor"}, #endif /* IBMPC */ #ifdef JUMPERR {jumptoerror, "jump-to-error"}, #endif {justone, "just-one-space"}, #ifdef KANJI /* 90.01.29 by S.Yoshida */ {prefix, "kanji-prefix"}, #endif /* KANJI */ {ctrlg, "keyboard-quit"}, {killbuffer, "kill-buffer"}, {killline, "kill-line"}, {killoneline, "kill-oneline"}, {killpara, "kill-paragraph"}, {killregion, "kill-region"}, {delfword, "kill-word"}, {linenumbermode, "line-number-mode"}, {listbuffers, "list-buffers"}, #ifdef C_MODE /* 90.07.24 by K.Takano */ {cm_list_var, "list-c-mode-variables"}, #endif /* C_MODE */ #ifdef KANJI /* 90.01.29 by S.Yoshida */ {k_list_code, "list-kanji-codes"}, {k_show_code, "list-kanji-codes-briefly"}, #ifdef KINSOKU /* 90.01.29 by S.Yoshida */ {kc_list_char, "list-kinsoku-chars"}, #endif /* KINSOKU */ #endif /* KANJI */ #ifndef NO_STARTUP {evalfile, "load"}, #endif {localbind, "local-set-key"}, {localunbind, "local-unset-key"}, #ifndef NO_BACKUP {makebkfile, "make-backup-files"}, #endif #ifdef DO_METAKEY {do_meta, "meta-key-mode"}, /* better name, anyone? */ #endif #ifndef KANJI {showngversion, "mg-version"}, #endif #ifdef AMIGA #ifdef MOUSE {mgotobob, "mouse-beginning-of-buffer"}, {mforwdel, "mouse-delete-char"}, {mdelwhite, "mouse-delete-horizontal-space"}, {mdelwind, "mouse-delete-window"}, {mgotoeob, "mouse-end-of-buffer"}, {menlargewind, "mouse-enlarge-window"}, {mkillline, "mouse-kill-line"}, {mkillregion, "mouse-kill-region"}, {mdelfword, "mouse-kill-word"}, {mreposition, "mouse-recenter"}, {mbackpage, "mouse-scroll-down"}, {mforwpage, "mouse-scroll-up"}, {amigamouse, "mouse-set-point"}, {mshrinkwind, "mouse-shrink-window"}, {msplitwind, "mouse-split-window-vertically"}, {myank, "mouse-yank"}, #endif #endif {negative_argument, "negative-argument"}, {newline, "newline"}, {indent, "newline-and-indent"}, #ifdef JUMPERR /* Y.Koyanagi */ {nexterror, "next-error"}, #endif {forwline, "next-line"}, #ifdef NEXTLINE {nextline, "next-line-add-newlines"}, #endif #ifdef ADDFUNC /* 90.12.28 by S.Yoshida */ #ifdef KANJI {showngversion, "ng-version"}, #endif #endif {notabmode, "no-tab-mode"}, {notmodified, "not-modified"}, {openline, "open-line"}, {nextwind, "other-window"}, {overwrite, "overwrite-mode"}, #ifdef PREFIXREGION {prefixregion, "prefix-region"}, #endif {backline, "previous-line"}, #ifdef GOSMACS {prevwind, "previous-window"}, #endif #ifdef VMS {spawncli, "push-to-dcl"}, #endif #ifndef NO_DIR {showcwdir, "pwd"}, #endif {queryrepl, "query-replace"}, #ifdef REGEX {re_queryrepl, "query-replace-regexp"}, #endif {quote, "quoted-insert"}, #ifdef REGEX {re_searchagain,"re-search-again"}, {re_backsearch, "re-search-backward"}, {re_forwsearch, "re-search-forward"}, #endif {reposition, "recenter"}, {refresh, "redraw-display"}, {filesave, "save-buffer"}, {quit, "save-buffers-kill-emacs"}, {savebuffers, "save-some-buffers"}, {backpage, "scroll-down"}, #ifdef GOSMACS {back1page, "scroll-one-line-down"}, {forw1page, "scroll-one-line-up"}, #endif {pagenext, "scroll-other-window"}, {forwpage, "scroll-up"}, {searchagain, "search-again"}, {backsearch, "search-backward"}, {forwsearch, "search-forward"}, {selfinsert, "self-insert-command"}, #ifdef AUTOSAVE {as_set_interval,"set-auto-save-interval"}, #endif #ifdef C_MODE /* 90.07.24 by K.Takano */ {cm_set_arg, "set-c-argdecl-indent"}, {cm_set_newl, "set-c-auto-newline"}, {cm_set_imagin, "set-c-brace-imaginary-offset"}, {cm_set_brace, "set-c-brace-offset"}, {cm_set_cbrace, "set-c-continued-brace-offset"}, {cm_set_cstat, "set-c-continued-statement-offset"}, {cm_set_indent, "set-c-indent-level"}, {cm_set_label, "set-c-label-offset"}, {cm_set_tab, "set-c-tab-always-indent"}, #ifdef VARIABLE_TAB {set_cmode_tabwidth, "set-c-tab-width"}, #endif #endif /* C_MODE */ #ifdef REGEX {setcasefold, "set-case-fold-search"}, #endif #ifdef KANJI /* 90.01.29 by S.Yoshida */ {k_set_fio, "set-default-fileio-code"}, #endif /* KANJI */ {set_default_mode, "set-default-mode"}, #ifdef VARIABLE_TAB {set_default_tabwidth,"set-default-tab-width"}, #endif /* VARIABLE_TAB */ #ifdef FEPCTRL /* 90.11.26 by K.Takano */ {fepmode_set, "set-fep-control"}, #endif /* FEPCTRL */ {setfillcol, "set-fill-column"}, #ifdef FILLPREFIX /* 90.12.30 by S.Yoshida */ {setfillprefix, "set-fill-prefix"}, #endif /* FILLPREFIX */ #ifdef KANJI /* 90.01.29 by S.Yoshida */ {k_set_display, "set-kanji-display-code"}, {k_set_expect, "set-kanji-expected-code"}, {k_set_buffio, "set-kanji-fileio-code"}, {k_set_input, "set-kanji-input-code"}, #endif /* KANJI */ {setmark, "set-mark-command"}, #ifdef PREFIXREGION {setprefix, "set-prefix-string"}, #endif #ifdef INCLUDE_SKG /* 00.2.16 by amura */ {skg_set_dicname, "set-skg-kanji-dictionary"}, {skg_set_romanname, "set-skg-roman-dictionary"}, #endif /* INCLUDE_SKG */ #ifdef VARIABLE_TAB {set_tabwidth, "set-tab-width"}, #endif /* VARIABLE_TAB */ #ifdef KANJI /* 90.01.29 by S.Yoshida */ {k_set_toadisplay, "set-to-ascii-display"}, {k_set_toafio, "set-to-ascii-fileio"}, #ifdef HANKANA /* 92.11.21 by S.Sasaki */ {k_set_tokanadisplay, "set-to-kana-display"}, {k_set_tokanafio, "set-to-kana-fileio"}, #endif /* HANKANA */ {k_set_tokdisplay, "set-to-kanji-display"}, {k_set_tokfio, "set-to-kanji-fileio"}, #endif /* KANJI */ #ifndef NO_SHELL /* 91.01.10 by K.Maeda */ {shellcmnd, "shell-command"}, #endif /* NO_SHELL */ {shrinkwind, "shrink-window"}, #ifdef INCLUDE_SKG /* 93.09.07 by H.Konishi */ {skginput, "skg-input"}, #endif /* INCLUDE_SKG */ {space_to_tabstop, "space-to-tabstop"}, {splitwind, "split-window-vertically"}, #ifndef NO_MACRO {definemacro, "start-kbd-macro"}, #endif #ifdef VMS {attachtoparent,"suspend-emacs"}, #else {spawncli, "suspend-emacs"}, #endif {usebuffer, "switch-to-buffer"}, {poptobuffer, "switch-to-buffer-other-window"}, {fillmode, "text-mode"}, /* dummy */ #ifdef READONLY /* 91.01.05 by S.Yoshida */ {togglereadonly, "toggle-read-only"}, #endif /* READONLY */ {twiddle, "transpose-chars"}, #ifdef UNDO {do_undo, "undo"}, #endif {universal_argument, "universal-argument"}, {upperregion, "upcase-region"}, {upperword, "upcase-word"}, #ifdef C_MODE {cm_use_c_mode, "use-c-mode"}, #endif {showcpos, "what-cursor-position"}, {filewrite, "write-file"}, {yank, "yank"}, #ifdef ZAPTOCHAR /* Nov 91, bsh */ {zaptochar, "zap-to-char"}, #endif }; #define NFUNCT (sizeof(functnames)/sizeof(FUNCTNAMES)) int nfunct = NFUNCT; /* used by help.c */ /* * The general-purpose version of ROUND2 blows osk C (2.0) out of the water. * (reboot required) If you need to build a version of mg with less than 32 * or more than 511 functions, something better must be done. * The version that should work, but doesn't is: * #define ROUND2(x) (1+((x>>1)|(x>>2)|(x>>3)|(x>>4)|(x>>5)|(x>>6)|(x>>7)|\ * (x>>8)|(x>>9)|(x>>10)|(x>>11)|(x>>12)|(x>>13)|(x>>14)|(x>>15))) */ #define ROUND2(x) (x<128?(x<64?32:64):(x<256?128:256)) #ifdef NEW_COMPLETE /* 90.12.10 Sawayanagi Yosirou */ name_fent(fname, flag) #else /* NOT NEW_COMPLETE */ static name_fent(fname, flag) #endif /* NEW_COMPLETE */ register char *fname; int flag; { register int try; register int x = ROUND2(NFUNCT); register int base = 0; register int notit; do { /* + can be used instead of | here if more efficent. */ if((try = base | x) < NFUNCT) { if((notit = strcmp(fname, functnames[try].n_name)) >= 0) { if(!notit) return try; base = try; } } } while((x>>=1) || (try==1 && base==0)); /* try 0 once if needed */ return flag ? base : -1; } /* * Translate from function name to function pointer, using binary search. */ PF name_function(fname) char *fname; { int i; if((i = name_fent(fname, FALSE)) >= 0) return functnames[i].n_funct; return (PF)NULL; } #ifndef NEW_COMPLETE /* 90.12.10 Sawayanagi Yosirou */ /* complete function name */ complete_function(fname, c) register char *fname; { register int i, j, k, l; int oj; i = name_fent(fname, TRUE); for(j=0; (l=fname[j]) && functnames[i].n_name[j]==l; j++) {} if(fname[j]!='\0') { if(++i >= NFUNCT) return -2; /* no match */ for(j=0; (l=fname[j]) && functnames[i].n_name[j]==l; j++) {} if(fname[j]!='\0') return -2; /* no match */ } if(c==CCHR('M') && functnames[i].n_name[j]=='\0') return -1; for(k=i+1; ki) { /* multiple matches */ while((l = functnames[i].n_name[j]) == functnames[k].n_name[j]) { fname[j++] = l; if(l=='-' && c==' ') break; } if(j==oj) return -3; /* ambiguous */ } else { /* single match */ while(l = functnames[i].n_name[j]) { fname[j++] = l; if(l=='-' && c==' ') break; } } fname[j] = '\0'; return j - oj; } #endif /* NEW_COMPLETE */ /* translate from function pointer to function name. */ char *function_name(fpoint) register PF fpoint; { register FUNCTNAMES *fnp = &functnames[0]; if(fpoint == prefix) return (char *)NULL; /* ambiguous */ do { if(fnp->n_funct == fpoint) return fnp->n_name; } while(++fnp < &functnames[NFUNCT]); return (char *)NULL; } ng-1.5beta1/kinit.h100644 1750 1750 4636 7232331620 12747 0ustar amurausers/* $Id: kinit.h,v 1.3 2001/01/20 15:49:36 amura Exp $ */ /* * Initial KANJI code setting. (Like site-init.el in Nemacs) * * Coded by Shigeki Yoshida (shige@csk.CO.JP) */ /* * $Log: kinit.h,v $ * Revision 1.3 2001/01/20 15:49:36 amura * move TOUFU charactor to kinit.h * * Revision 1.2 2000/09/21 17:28:30 amura * replace macro _WIN32 to WIN32 for Cygwin * * Revision 1.1.1.1 2000/06/27 01:47:56 amura * import to CVS * */ /* 90.01.29 Created by S.Yoshida */ /* NOCONV No KANJI code conversion. */ /* SJIS KANJI code is Shift-JIS. */ /* JIS KANJI code is JIS. */ /* EUC KANJI code is EUC. */ /* NIL Not decided. */ /* T Guess. */ #ifdef MSDOS /* 90.02.11 by S.Yoshida */ #define KFIO SJIS /* default-kanji-fileio-code */ #define KEXPECT T /* kanji-expected-code */ #define KINPUT SJIS /* kanji-input-code */ #define KDISPLAY SJIS /* kanji-display-code */ #else /* NOT MSDOS */ #ifdef HUMAN68K /* 90.11.09 Sawayanagi Yosirou */ #define KFIO SJIS /* default-kanji-fileio-code */ #define KEXPECT T /* kanji-expected-code */ #define KINPUT SJIS /* kanji-input-code */ #define KDISPLAY SJIS /* kanji-display-code */ #else /* NOT HUMAN68K */ #ifdef WIN32 #define KFIO SJIS /* default-kanji-fileio-code */ #define KEXPECT T /* kanji-expected-code */ #define KINPUT SJIS /* kanji-input-code */ #define KDISPLAY SJIS /* kanji-display-code */ #else /* WIN32 */ #define KFIO NIL /* default-kanji-fileio-code */ #define KEXPECT T /* kanji-expected-code */ #define KINPUT EUC /* kanji-input-code */ #define KDISPLAY EUC /* kanji-display-code */ #endif /* WIN32 */ #endif /* HUMAN68K */ #endif /* MSDOS */ /* '@' Select JIS-78 [ESC-$-@]. */ /* 'B' Select JIS-83 [ESC-$-B]. */ #define TO_KFIO 'B' /* to-kanji-fileio */ #define TO_KDISPLAY 'B' /* to-kanji-display */ /* 'B' Select ASCII [ESC-(-B]. */ /* 'J' Select JIS-ROMAJI [ESC-(-J]. */ /* 'H' Illegal selection, but used. [ESC-(-H]. */ #define TO_AFIO 'B' /* to-ascii-fileio */ #define TO_ADISPLAY 'B' /* to-ascii-display */ #ifdef HANKANA /* 92.11.21 by S.Sasaki */ /* '7' Use SI/SO for KATAKANA [SI / SO] */ /* '8' Through KATAKANA code Through. */ /* 'I' Select JIS-KATAKANA [ESC-(-I]. */ #define TO_KANAFIO '7' /* to-kana-fileio */ #define TO_KANADISPLAY '7' /* to-kana-display */ #endif /* HANKANA */ #ifdef HOJO_KANJI #define TOUFU1ST (0x22|0x80) /* EUC igeta */ #define TOUFU2ND (0x2E|0x80) #endif ng-1.5beta1/kinsoku.c100644 1750 1750 22750 7244000516 13324 0ustar amurausers/* $Id: kinsoku.c,v 1.4 2001/02/18 17:07:26 amura Exp $ */ /* * Kinsoku char handling routines. * These are only used when KANJI is #defined. * * Coded by Shigeki Yoshida (shige@csk.CO.JP) */ /* * $Log: kinsoku.c,v $ * Revision 1.4 2001/02/18 17:07:26 amura * append AUTOSAVE feature (but NOW not work) * * Revision 1.3 2001/02/11 15:40:25 amura * some function are changed to static for speed/size * * Revision 1.2 2000/11/16 14:31:13 amura * fix some typos which cause compile error when using * strict ANSI-C compiler (ex ACK, gcc-1.x) * * Revision 1.1.1.1 2000/06/27 01:47:56 amura * import to CVS * */ /* 90.01.29 Created by S.Yoshida */ #include "config.h" /* 90.12.20 by S.Yoshida */ #ifdef KINSOKU /* 90.01.29 by S.Yoshida */ #include "def.h" #define MAXBOLKC 128 /* Maximum number of BOL (begin */ /* of line) KINSOKU chars. */ #define MAXEOLKC 64 /* Maximum number of EOL (end */ /* of line) KINSOKU chars. */ /* BOL KINSOKU char list (EUC). */ /* This table must be sorted. */ static unsigned short bolkchar[MAXBOLKC] = { '!', '\'', ')', ',', '-', /* 5 */ '.', ':', ';', '?', ']', /* 10 */ '_', '}', '~', 0xa1a2, 0xa1a3, /* 15 */ 0xa1a4, 0xa1a5, 0xa1a6, 0xa1a7, 0xa1a8, /* 20 */ 0xa1a9, 0xa1aa, 0xa1ab, 0xa1ac, 0xa1ad, /* 25 */ 0xa1ae, 0xa1af, 0xa1b0, 0xa1b1, 0xa1b2, /* 30 */ 0xa1b3, 0xa1b4, 0xa1b5, 0xa1b6, 0xa1b7, /* 35 */ 0xa1b8, 0xa1b9, 0xa1ba, 0xa1bb, 0xa1bc, /* 40 */ 0xa1bd, 0xa1be, 0xa1bf, 0xa1c0, 0xa1c1, /* 45 */ 0xa1c2, 0xa1c3, 0xa1c4, 0xa1c5, 0xa1c7, /* 50 */ 0xa1c9, 0xa1cb, 0xa1cd, 0xa1cf, 0xa1d1, /* 55 */ 0xa1d3, 0xa1d5, 0xa1d7, 0xa1d9, 0xa1db, /* 60 */ 0xa1eb, 0xa1ec, 0xa1ed, 0xa1ee, 0xa4a1, /* 65 */ 0xa4a3, 0xa4a5, 0xa4a7, 0xa4a9, 0xa4c3, /* 70 */ 0xa4e3, 0xa4e5, 0xa4e7, 0xa4ee, 0xa5a1, /* 75 */ 0xa5a3, 0xa5a5, 0xa5a7, 0xa5a9, 0xa5c3, /* 80 */ 0xa5e3, 0xa5e5, 0xa5e7, 0xa5ee, 0xa5f5, /* 85 */ 0xa5f6 }; /* EOL KINSOKU char list (EUC). */ /* This table must be sorted. */ static unsigned short eolkchar[MAXEOLKC] = { '(', '[', '{', 0xa1c6, 0xa1c8, /* 5 */ 0xa1ca, 0xa1cc, 0xa1ce, 0xa1d0, 0xa1d2, /* 10 */ 0xa1d4, 0xa1d6, 0xa1d8, 0xa1da, 0xa1eb, /* 15 */ 0xa1ec, 0xa1ed, 0xa1ee, 0xa1f7, 0xa1f8 /* 20 */ }; static int nbolkc = 86; /* Number of BOL KINSOKU chars. */ static int neolkc = 20; /* Number of EOL KINSOKU chars. */ /* * FUNCTION: list-kinsoku-chars * Display a list of kinsoku-bol-chars and kinsoku-eol-chars values * in the *Kinsoku Chars* buffer. */ /*ARGSUSED*/ kc_list_char(f, n) { register unsigned short *p; /* KINSOKU char list pointer. */ register unsigned short *eop; /* End of KINSOKU char list. */ register char c; register char *l; /* Display line buffer pointer. */ register char *eol; /* End of display line buffer. */ register BUFFER *bp; register WINDOW *wp; #define DISPLEN 64 char line[DISPLEN + 1]; /* Display line buffer. */ if ((bp = bfind("*Kinsoku Chars*", TRUE)) == NULL) return FALSE; #ifdef AUTOSAVE /* 96.12.24 by M.Suzuki */ bp->b_flag &= ~(BFCHG | BFACHG); /* Blow away old. */ #else bp->b_flag &= ~BFCHG; /* Blow away old. */ #endif /* AUTOSAVE */ if (bclear(bp) != TRUE) return FALSE; strcpy(line, "kinsoku-bol-chars:"); /* BOL KINSOKU char list. */ if (addline(bp, line) == FALSE) return FALSE; l = line; *l++ = '\t'; /* List line start with TAB. */ eol = &line[DISPLEN]; p = bolkchar; eop = &bolkchar[nbolkc]; while (p < eop) { if (l >= eol) { *l = '\0'; if (addline(bp, line) == FALSE) return FALSE; l = line; *l++ = '\t'; /* List line start with TAB. */ } else { if ((c = (*p >> 8) & 0xff) != 0) { *l++ = c; } c = *p++ & 0xff; if (ISCTRL(c)) { /* This may be needless... */ *l++ = '^'; *l++ = CCHR(c); } else { *l++ = c; } } } if (l > line) { /* Not shown line exists. */ *l = '\0'; if (addline(bp, line) == FALSE) return FALSE; } line[0] = '\0'; if (addline(bp, line) == FALSE) return FALSE; strcpy(line, "kinsoku-eol-chars:"); /* EOL KINSOKU char list. */ if (addline(bp, line) == FALSE) return FALSE; l = line; *l++ = '\t'; /* List line start with TAB. */ eol = &line[DISPLEN]; p = eolkchar; eop = &eolkchar[neolkc]; while (p < eop) { if (l >= eol) { *l = '\0'; if (addline(bp, line) == FALSE) return FALSE; l = line; *l++ = '\t'; /* List line start with TAB. */ } else { if ((c = (*p >> 8) & 0xff) != 0) { *l++ = c; } c = *p++ & 0xff; if (ISCTRL(c)) { /* This may be needless... */ *l++ = '^'; *l++ = CCHR(c); } else { *l++ = c; } } } if (l > line) { /* Not shown line exists. */ *l = '\0'; if (addline(bp, line) == FALSE) return FALSE; } if ((wp = popbuf(bp)) == NULL) return FALSE; bp->b_dotp = lforw(bp->b_linep); /* put dot at beginning of buffer */ bp->b_doto = 0; wp->w_dotp = bp->b_dotp; /* fix up if window already on screen */ wp->w_doto = bp->b_doto; return TRUE; } /* * FUNCTION: add-kinsoku-bol-chars * Add some BOL (begin of line) KINSOKU chars to a BOL KINSOKU char list * (kinsoku-bol-chars = bolkchar[]). */ /*ARGSUSED*/ kc_add_bol(f, n) { register int s; register short c; register char *p; char kchar[NFILEN]; if ((s = ereply("Kinsoku Chars : ", kchar, NFILEN)) != TRUE) { return (s); } for (p = kchar; *p;) { c = *p++ & 0xff; if (ISKANJI(c)) { c = (c << 8) | (*p++ & 0xff); } if (nbolkc < MAXBOLKC) { if (kcinsert(bolkchar, c, nbolkc)) { nbolkc++; } } else { ewprintf("Too many kinsoku-bol-chars!"); return FALSE; } } return TRUE; } /* * FUNCTION: delete-kinsoku-bol-chars * Delete some BOL (begin of line) KINSOKU chars from a BOL KINSOKU char list * (kinsoku-bol-chars = bolkchar[]). */ /*ARGSUSED*/ kc_del_bol(f, n) { register int s; register short c; register char *p; char kchar[NFILEN]; if ((s = ereply("Kinsoku Chars : ", kchar, NFILEN)) != TRUE) { return (s); } for (p = kchar; *p;) { c = *p++ & 0xff; if (ISKANJI(c)) { c = (c << 8) | (*p++ & 0xff); } if (nbolkc > 0) { if (kcdelete(bolkchar, c, nbolkc)) { nbolkc--; } } else { ewprintf("No kinsoku-bol-chars!"); return FALSE; } } return TRUE; } /* * FUNCTION: add-kinsoku-eol-chars * Add some EOL (end of line) KINSOKU chars to a EOL KINSOKU char list * (kinsoku-eol-chars = eolkchar[]). */ /*ARGSUSED*/ kc_add_eol(f, n) { register int s; register short c; register char *p; char kchar[NFILEN]; if ((s = ereply("Kinsoku Chars : ", kchar, NFILEN)) != TRUE) { return (s); } for (p = kchar; *p;) { c = *p++ & 0xff; if (ISKANJI(c)) { c = (c << 8) | (*p++ & 0xff); } if (neolkc < MAXEOLKC) { if (kcinsert(eolkchar, c, neolkc)) { neolkc++; } } else { ewprintf("Too many kinsoku-eol-chars!"); return FALSE; } } return TRUE; } /* * FUNCTION: delete-kinsoku-eol-chars * Delete some EOL (end of line) KINSOKU chars from a EOL KINSOKU char list * (kinsoku-eol-chars = eolkchar[]). */ /*ARGSUSED*/ kc_del_eol(f, n) { register int s; register short c; register char *p; char kchar[NFILEN]; if ((s = ereply("Kinsoku Chars : ", kchar, NFILEN)) != TRUE) { return (s); } for (p = kchar; *p;) { c = *p++ & 0xff; if (ISKANJI(c)) { c = (c << 8) | (*p++ & 0xff); } if (neolkc > 0) { if (kcdelete(eolkchar, c, neolkc)) { neolkc--; } } else { ewprintf("No kinsoku-eol-chars!"); return FALSE; } } return TRUE; } /* * Insert one KINSOKU char in a KINSOKU char list. */ int #ifdef SUPPORT_ANSI /* for strict compiler */ kcinsert(unsigned short *kclist, unsigned short kc, int nkc) #else kcinsert(kclist, kc, nkc) unsigned short *kclist; /* KINSOKU char list. */ unsigned short kc; /* Target KINSOKU char. */ int nkc; /* Current number of KINSOKU chars. */ #endif { unsigned short *p = kclist; /* Start of KINSOKU char list. */ unsigned short *eop = &kclist[nkc]; /* End of KINSOKU char list. */ unsigned short *pp; for (; p < eop; p++) { if (kc < *p) { break; } else if (kc == *p) { /* Already exist. */ return FALSE; } } if (p < eop) { pp = eop; for (; pp > p; pp--) { *pp = pp[-1]; } } *p = kc; return TRUE; } /* * Delete one KINSOKU char form a KINSOKU char list. */ int #ifdef SUPPORT_ANSI /* for strict compiler */ kcdelete(unsigned short *kclist, unsigned short kc,int nkc) #else kcdelete(kclist, kc, nkc) unsigned short *kclist; /* KINSOKU char list. */ unsigned short kc; /* Target KINSOKU char. */ int nkc; /* Current number of KINSOKU chars. */ #endif { unsigned short *p = kclist; /* Start of KINSOKU char list. */ unsigned short *eop = &kclist[nkc]; /* End of KINSOKU char list. */ for (; p < eop; p++) { if (kc == *p) { break; } } if (p == eop) { /* Not exist that char. */ return FALSE; } for (; p < eop; p++) { *p = p[1]; } return TRUE; } /* * Is this BOL (begin of line) KINSOKU char ? * c1 must be KANJI 1st byte or 0 (when c2 is ASCII). */ isbolkchar(c1, c2) int c1; int c2; { register unsigned short c = ((c1 & 0xff) << 8) | (c2 & 0xff); register unsigned short *p = &bolkchar[0]; register unsigned short *eop = &bolkchar[nbolkc]; if (c < *p || c > eop[-1]) { return FALSE; } while (p < eop) { if (c == *p++) { return TRUE; } } return FALSE; } /* * Is this EOL (end of line) KINSOKU char ? * c1 must be KANJI 1st byte or 0 (when c2 is ASCII). */ iseolkchar(c1, c2) int c1; int c2; { register unsigned short c = ((c1 & 0xff) << 8) | (c2 & 0xff); register unsigned short *p = &eolkchar[0]; register unsigned short *eop = &eolkchar[neolkc]; if (c < *p || c > eop[-1]) { return FALSE; } while (p < eop) { if (c == *p++) { return TRUE; } } return FALSE; } #endif /* KINSOKU */ ng-1.5beta1/line.c100644 1750 1750 56720 7632242733 12606 0ustar amurausers/* $Id: line.c,v 1.17.2.2 2003/03/08 01:22:35 amura Exp $ */ /* * Text line handling. * The functions in this file * are a general set of line management * utilities. They are the only routines that * touch the text. They also touch the buffer * and window structures, to make sure that the * necessary updating gets done. There are routines * in this file that handle the kill buffer too. * It isn't here for any good reason. * * Note that this code only updates the dot and * mark values in the window list. Since all the code * acts on the current window, the buffer that we * are editing must be being displayed, which means * that "b_nwnd" is non zero, which means that the * dot and mark values in the buffer headers are * nonsense. */ /* * $Log: line.c,v $ * Revision 1.17.2.2 2003/03/08 01:22:35 amura * NOTAB is always enabled * * Revision 1.17.2.1 2003/03/08 00:17:23 amura * fix query-replace bug, too * * Revision 1.17 2001/07/23 17:12:02 amura * fix mark handling when make newline on the mark position * * Revision 1.16 2001/06/19 15:23:19 amura * to make uniform all indent * * Revision 1.15 2001/05/25 15:36:52 amura * now buffers have only one mark (before windows have one mark) * * Revision 1.14 2001/04/28 18:54:27 amura * support line-number-mode (based on MATSUURA's patch ) * * Revision 1.13 2001/02/18 17:07:26 amura * append AUTOSAVE feature (but NOW not work) * * Revision 1.12 2001/02/01 16:28:48 amura * remove small kludge because it raise warning with mpatrol * * Revision 1.11 2001/01/05 14:07:04 amura * first implementation of Hojo Kanji support * * -- snip -- * * Revision 1.1 1999/06/12 19:56:32 amura * Initial revision * */ /* 90.01.29 Modified for Ng 1.0 by S.Yoshida */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include "def.h" #ifdef UNDO #include "undo.h" #endif #ifdef CLIPBOARD extern int send_clipboard(); extern int receive_clipboard(); #endif /* number of bytes member is from start of structure type */ /* should be computed at compile time */ #ifndef OFFSET #define OFFSET(type,member) ((char *)&(((type *)0)->member)-(char *)((type *)0)) #endif #ifndef NBLOCK #define NBLOCK 16 /* Line block chunk size */ #endif #ifndef KBLOCK #define KBLOCK 256 /* Kill buffer block size. */ #endif static char *kbufp = NULL; /* Kill buffer data. */ static RSIZE kused = 0; /* # of bytes used in KB. */ static RSIZE ksize = 0; /* # of bytes allocated in KB. */ static RSIZE kstart = 0; /* # of first used byte in KB. */ /* this is small tricks for speed up of get_lineno() */ static int lineno_cache = FALSE; int set_lineno = -1; /* * This routine allocates a block of memory large enough to hold a LINE * containing "used" characters. The block is rounded up to whatever * needs to be allocated. (use lallocx for lines likely to grow.) * Return a pointer to the new block, or NULL if there isn't * any memory left. Print a message in the message line if no space. */ LINE * lalloc(used) register int used; { register LINE *lp; register int size; /* any padding at the end of the structure is used */ if((size = used + OFFSET(LINE, l_text[0])) < sizeof(LINE)) size = sizeof(LINE); #ifdef MALLOCROUND MALLOCROUND(size); /* round up to a size optimal to malloc */ #endif if((lp = (LINE *)malloc((unsigned)size)) == NULL) { ewprintf("Can't get %d bytes", size); return (LINE *)NULL; } lp->l_size = size - OFFSET(LINE, l_text[0]); lp->l_used = used; return lp; } /* * Like lalloc, only round amount desired up because this line will * probably grow. We always make room for at least one more char. * (thus making 0 not a special case anymore.) */ LINE * lallocx(used) int used; { register int size; register LINE *lp; size = (NBLOCK+used) & ~(NBLOCK-1); if((lp = lalloc(size)) != NULL) lp->l_used = used; return lp; } /* * Delete line "lp". Fix all of the * links that might point at it (they are * moved to offset 0 of the next line. * Unlink the line from whatever buffer it * might be in. Release the memory. The * buffers are updated too; the magic conditions * described in the above comments don't hold * here. */ VOID lfree(lp) register LINE *lp; { register BUFFER *bp; register WINDOW *wp; for(wp = wheadp; wp != NULL; wp = wp->w_wndp) { if (wp->w_linep == lp) { wp->w_linep = lp->l_fp; wp->w_lines = 0; } if (wp->w_dotp == lp) { wp->w_dotp = lp->l_fp; wp->w_doto = 0; } } for(bp = bheadp; bp != NULL; bp = bp->b_bufp) { if (bp->b_nwnd == 0) { if (bp->b_dotp == lp) { bp->b_dotp = lp->l_fp; bp->b_doto = 0; } if (bp->b_markp == lp) { bp->b_markp = lp->l_fp; bp->b_marko = 0; } } } lp->l_bp->l_fp = lp->l_fp; lp->l_fp->l_bp = lp->l_bp; free((char *) lp); } /* * This routine gets called when * a character is changed in place in the * current buffer. It updates all of the required * flags in the buffer and window system. The flag * used is passed as an argument; if the buffer is being * displayed in more than 1 window we change EDIT to * HARD. Set MODE if the mode line needs to be * updated (the "*" has to be set). */ VOID lchange(flag) register int flag; { register WINDOW *wp; #ifdef AUTOSAVE /* 96.12.24 by M.Suzuki */ curbp->b_flag |= BFACHG; #endif /* AUTOSAVE */ if ((curbp->b_flag&BFCHG) == 0) { /* First change, so */ flag |= WFMODE; /* update mode lines. */ curbp->b_flag |= BFCHG; } for(wp = wheadp; wp != NULL; wp = wp->w_wndp) { if (wp->w_bufp == curbp) { wp->w_flag |= flag; if(wp != curwp) wp->w_flag |= WFHARD; } } } /* * Insert "n" copies of the character "c" * at the current location of dot. In the easy case * all that happens is the text is stored in the line. * In the hard case, the line has to be reallocated. * When the window list is updated, take special * care; I screwed it up once. You always update dot * in the current window. You update mark, and a * dot in another window, if it is greater than * the place where you did the insert. Return TRUE * if all is well, and FALSE on errors. */ linsert(n, c) int n; { register char *cp1; register char *cp2; register LINE *lp1; LINE *lp2; LINE *lp3; register int doto; register RSIZE i; WINDOW *wp; #ifdef UNDO UNDO_DATA *undo; #endif lchange(WFEDIT); lp1 = curwp->w_dotp; /* Current line */ if (lp1 == curbp->b_linep) { /* At the end: special */ /* (now should only happen in empty buffer */ if (curwp->w_doto != 0) { ewprintf("bug: linsert"); return FALSE; } if ((lp2=lallocx(n)) == NULL) /* Allocate new line */ return FALSE; lp3 = lp1->l_bp; /* Previous line */ lp3->l_fp = lp2; /* Link in */ lp2->l_fp = lp1; lp1->l_bp = lp2; lp2->l_bp = lp3; for (i=0; il_text[i] = c; #ifdef UNDO undo_setup(undo); if (isundo()) { if (undo_type(undo) != UDINS) { undo_bfree(undo); undo->u_dotlno = get_lineno(curbp, lp2); undo->u_doto = 0; undo->u_used = 0; undo->u_type = UDINS; } undo->u_used += n; undo_finish(&(undo->u_next)); } #endif for(wp = wheadp; wp != NULL; wp = wp->w_wndp) { if (wp->w_linep == lp1) { wp->w_linep = lp2; wp->w_lines = 0; } if (wp->w_dotp == lp1) wp->w_dotp = lp2; } /*NOSTRICT*/ if (curbp->b_markp == lp1) curbp->b_markp = lp2; curwp->w_doto = n; return TRUE; } doto = curwp->w_doto; /* Save for later. */ /*NOSTRICT (2) */ if (lp1->l_used+n > lp1->l_size) { /* Hard: reallocate */ if ((lp2=lallocx(lp1->l_used+n)) == NULL) return FALSE; cp1 = &lp1->l_text[0]; cp2 = &lp2->l_text[0]; while (cp1 != &lp1->l_text[doto]) *cp2++ = *cp1++; /*NOSTRICT*/ cp2 += n; while (cp1 != &lp1->l_text[lp1->l_used]) *cp2++ = *cp1++; lp1->l_bp->l_fp = lp2; lp2->l_fp = lp1->l_fp; lp1->l_fp->l_bp = lp2; lp2->l_bp = lp1->l_bp; free((char *) lp1); } else { /* Easy: in place */ lp2 = lp1; /* Pretend new line */ /*NOSTRICT*/ lp2->l_used += n; cp2 = &lp1->l_text[lp1->l_used]; cp1 = cp2-n; while (cp1 != &lp1->l_text[doto]) *--cp2 = *--cp1; } for (i=0; il_text[doto+i] = c; #ifdef UNDO undo_setup(undo); if (isundo()) { if (undo_type(undo) != UDINS) { undo_bfree(undo); undo->u_dotlno = get_lineno(curbp, lp2); undo->u_doto = doto; undo->u_used = 0; undo->u_type = UDINS; } undo->u_used += n; undo_finish(&(undo->u_next)); } #endif for(wp = wheadp; wp != NULL; wp = wp->w_wndp) { if (wp->w_linep == lp1) { wp->w_linep = lp2; wp->w_lines = 0; } if (wp->w_dotp == lp1) { wp->w_dotp = lp2; if (wp==curwp || wp->w_doto>doto) /*NOSTRICT*/ wp->w_doto += n; } } if (curbp->b_markp == lp1) { curbp->b_markp = lp2; if (curbp->b_marko > doto) /*NOSTRICT*/ curbp->b_marko += n; } return TRUE; } /* * Insert a newline into the buffer * at the current location of dot in the current * window. The funny ass-backwards way is no longer used. */ lnewline() { register LINE *lp1; register LINE *lp2; register int doto; register int nlen; WINDOW *wp; #ifdef UNDO UNDO_DATA *undo; lineno_cache = FALSE; #endif lchange(WFHARD); lp1 = curwp->w_dotp; /* Get the address and */ doto = curwp->w_doto; /* offset of "." */ #ifdef BUGFIX /* amura */ if (lp1 == curbp->b_linep) { /* At the end: special */ /* (now should only happen in empty buffer */ if (doto != 0) { ewprintf("bug: lnewline"); return FALSE; } if ((lp2=lallocx(0)) == NULL) /* Allocate new line */ return FALSE; lp2->l_bp = lp1->l_bp; lp1->l_bp->l_fp = lp2; lp2->l_fp = lp1; lp1->l_bp = lp2; curwp->w_dotp = lp1 = lp2; } #endif if (doto == 0) { /* avoid unnessisary copying */ if ((lp2 = lallocx(0)) == NULL) /* new first part */ return FALSE; lp2->l_bp = lp1->l_bp; lp1->l_bp->l_fp = lp2; lp2->l_fp = lp1; lp1->l_bp = lp2; #ifdef UNDO undo_setup(undo); if (isundo()) { undo_bfree(undo); undo->u_dotlno = get_lineno(curbp,lp2); undo->u_doto = 0; undo->u_type = UDINSNL; undo->u_used = 1; undo_finish(&(undo->u_next)); } #endif for(wp = wheadp; wp!=NULL; wp = wp->w_wndp) if(wp->w_linep == lp1) { wp->w_linep = lp2; wp->w_lines = 0; } return TRUE; } nlen = llength(lp1) - doto; /* length of new part */ if((lp2=lallocx(nlen)) == NULL) /* New second half line */ return FALSE; #ifdef UNDO undo_setup(undo); if (isundo()) { undo_bfree(undo); undo->u_dotlno = get_lineno(curbp,lp1); undo->u_doto = doto; undo->u_type = UDINSNL; undo->u_used = 1; undo_finish(&(undo->u_next)); } #endif if (nlen != 0) bcopy(&lp1->l_text[doto], &lp2->l_text[0], nlen); lp1->l_used = doto; lp2->l_bp = lp1; lp2->l_fp = lp1->l_fp; lp1->l_fp = lp2; lp2->l_fp->l_bp = lp2; for(wp = wheadp; wp != NULL; wp = wp->w_wndp) { /* Windows */ if (wp->w_dotp == lp1 && wp->w_doto >= doto) { wp->w_dotp = lp2; wp->w_doto -= doto; } } if (curbp->b_markp == lp1 && curbp->b_marko > doto) { curbp->b_markp = lp2; curbp->b_marko -= doto; } return TRUE; } /* * This function deletes "n" bytes, * starting at dot. It understands how do deal * with end of lines, etc. It returns TRUE if all * of the characters were deleted, and FALSE if * they were not (because dot ran into the end of * the buffer. The "kflag" indicates either no insertion, * or direction of insertion into the kill buffer. #ifdef KANJI * (91.01.01 Add comment by S.Yoshida) * When after deleting "n" bytes, here is KANJI 2nd byte, * the KANJI 2nd byte is also deleted. #endif */ ldelete(n, kflag) RSIZE n; { register char *cp1; register char *cp2; register LINE *dotp; register int doto; register RSIZE chunk; WINDOW *wp; #ifdef KANJI /* 90.01.29 by S.Yoshida */ register int i; register int kanji2nd; #endif /* KANJI */ #ifdef UNDO UNDO_DATA* undo = NULL; int char_num = 0; if (n != 0) { undo_setup(undo); if (isundo()) { if (n == 1) { char_num = 1; undo_bfree(undo); undo->u_used = 0; undo->u_doto = curwp->w_doto; undo->u_dotlno = get_lineno(curbp, curwp->w_dotp); undo->u_type = (kflag==KBACK) ? UDBS : UDDEL; } else if (undo_balloc(undo, n)) { char_num = 2; undo->u_used = 0; undo->u_doto = curwp->w_doto; undo->u_dotlno = get_lineno(curbp, curwp->w_dotp); undo->u_type = (kflag==KBACK) ? UDBS : UDDEL; } } } #endif #ifdef KANJI if (kflag & KNOKANJI) kanji2nd = -1; else kanji2nd = 0; kflag = KFLAGS(kflag); #endif /* * HACK - doesn't matter, and fixes back-over-nl bug for empty * kill buffers. */ if (kused == kstart) kflag = KFORW; while (n != 0) { dotp = curwp->w_dotp; doto = curwp->w_doto; if (dotp == curbp->b_linep) /* Hit end of buffer. */ return FALSE; chunk = dotp->l_used-doto; /* Size of chunk. */ if (chunk > n) chunk = n; if (chunk == 0) { /* End of line, merge. */ if(dotp == lback(curbp->b_linep)) return FALSE; /* End of buffer. */ lchange(WFHARD); if (ldelnewline() == FALSE || (kflag!=KNONE && kinsert('\n', kflag)==FALSE)) { #ifdef UNDO undo_reset(curbp); #endif return FALSE; } #ifdef UNDO if (isundo()) { if (char_num == 1) { undo->u_code[0] = '\n'; undo->u_code[1] = 0; } else if (undo_bgrow(undo, 1)) { undo->u_buffer[undo->u_used] = '\n'; undo->u_used++; } } #endif --n; continue; } lchange(WFEDIT); cp1 = &dotp->l_text[doto]; /* Scrunch text. */ #ifdef KANJI /* 90.01.29 by S.Yoshida */ if (kanji2nd < 0) /* ignore KANJI */ cp2 = cp1 + chunk; else { cp2 = cp1; kanji2nd = 0; for (i = 0; i < chunk; i++, cp2++) { if (kanji2nd) { kanji2nd--; #ifdef HOJO_KANJI } else if (ISHOJO(*cp2)) { kanji2nd = 2; #endif } else if (ISKANJI(*cp2)) { kanji2nd = 1; } } if (kanji2nd) { cp2 += kanji2nd; chunk += kanji2nd; n += kanji2nd; } } #else /* NOT KANJI */ cp2 = cp1 + chunk; #endif /* KANJI */ #ifdef UNDO if (isundo()) { if (char_num == 1) { if (chunk == 1) { undo->u_code[0] = *cp1; undo->u_code[1] = 0; } else { undo->u_code[0] = *cp1; undo->u_code[1] = *(cp1+1); } } else if (undo_bgrow(undo, chunk)) { bcopy(cp1, &(undo->u_buffer[undo->u_used]), (int)chunk); undo->u_used += chunk; } } #endif if (kflag == KFORW) { while (ksize - kused < chunk) if (kgrow(FALSE) == FALSE) return FALSE; bcopy(cp1, &(kbufp[kused]), (int) chunk); kused += chunk; } else if (kflag == KBACK) { while (kstart < chunk) if (kgrow(TRUE) == FALSE) return FALSE; bcopy(cp1, &(kbufp[kstart-chunk]), (int) chunk); kstart -= chunk; } else if (kflag != KNONE) panic("broken ldelete call"); while (cp2 != &dotp->l_text[dotp->l_used]) *cp1++ = *cp2++; dotp->l_used -= (int) chunk; for(wp = wheadp; wp != NULL; wp = wp->w_wndp ) { if (wp->w_dotp==dotp && wp->w_doto>=doto) { /*NOSTRICT*/ wp->w_doto -= (short)chunk; if (wp->w_doto < doto) wp->w_doto = doto; } } if (curbp->b_markp==dotp && curbp->b_marko>=doto) { /*NOSTRICT*/ curbp->b_marko -= (short)chunk; if (curbp->b_marko < doto) curbp->b_marko = doto; } n -= chunk; } #ifdef CLIPBOARD if (kflag != KNONE) send_clipboard(); #endif #ifdef UNDO if (isundo() && char_num!=0) undo_finish(&(undo->u_next)); #endif return TRUE; } /* * Delete a newline. Join the current line * with the next line. If the next line is the magic * header line always return TRUE; merging the last line * with the header line can be thought of as always being a * successful operation, even if nothing is done, and this makes * the kill buffer work "right". Easy cases can be done by * shuffling data around. Hard cases require that lines be moved * about in memory. Return FALSE on error and TRUE if all * looks ok. */ ldelnewline() { register LINE *lp1; register LINE *lp2; register WINDOW *wp; LINE *lp3; #ifdef UNDO lineno_cache = FALSE; #endif lp1 = curwp->w_dotp; lp2 = lp1->l_fp; if (lp2 == curbp->b_linep) /* At the buffer end. */ return TRUE; if (lp2->l_used <= lp1->l_size - lp1->l_used) { bcopy(&lp2->l_text[0], &lp1->l_text[lp1->l_used], lp2->l_used); for(wp = wheadp; wp != NULL; wp = wp->w_wndp) { if (wp->w_linep == lp2) { wp->w_linep = lp1; wp->w_lines = 0; } if (wp->w_dotp == lp2) { wp->w_dotp = lp1; wp->w_doto += lp1->l_used; } } if (curbp->b_markp == lp2) { curbp->b_markp = lp1; curbp->b_marko += lp1->l_used; } lp1->l_used += lp2->l_used; lp1->l_fp = lp2->l_fp; lp2->l_fp->l_bp = lp1; free((char *) lp2); return TRUE; } if ((lp3=lalloc(lp1->l_used + lp2->l_used)) == NULL) return FALSE; bcopy(&lp1->l_text[0], &lp3->l_text[0], lp1->l_used); bcopy(&lp2->l_text[0], &lp3->l_text[lp1->l_used], lp2->l_used); lp1->l_bp->l_fp = lp3; lp3->l_fp = lp2->l_fp; lp2->l_fp->l_bp = lp3; lp3->l_bp = lp1->l_bp; for(wp = wheadp; wp != NULL; wp = wp->w_wndp) { if (wp->w_linep==lp1 || wp->w_linep==lp2) { wp->w_linep = lp3; wp->w_lines = 0; } if (wp->w_dotp == lp1) wp->w_dotp = lp3; else if (wp->w_dotp == lp2) { wp->w_dotp = lp3; wp->w_doto += lp1->l_used; } } if (curbp->b_markp == lp1) curbp->b_markp = lp3; else if (curbp->b_markp == lp2) { curbp->b_markp = lp3; curbp->b_marko += lp1->l_used; } free((char *) lp1); free((char *) lp2); return TRUE; } /* * Replace plen characters before dot with argument string. * Control-J characters in st are interpreted as newlines. * There is a casehack disable flag (normally it likes to match * case of replacement to what was there). */ lreplace(plen, st, f) register RSIZE plen; /* length to remove */ char *st; /* replacement string */ int f; /* case hack disable */ { register RSIZE rlen; /* replacement length */ register int rtype; /* capitalization */ register int c; /* used for random characters */ register int doto; /* offset into line */ #ifdef UNDO UNDO_DATA *undo; UNDO_DATA **undoptr_save = NULL; #endif /* * Find the capitalization of the word that was found. * f says use exact case of replacement string (same thing that * happens with lowercase found), so bypass check. */ /*NOSTRICT*/ (VOID) backchar(FFARG | FFRAND, (int) plen); rtype = _L; c = lgetc(curwp->w_dotp, curwp->w_doto); if (ISUPPER(c)!=FALSE && f==FALSE) { rtype = _U|_L; if (curwp->w_doto+1 < llength(curwp->w_dotp)) { c = lgetc(curwp->w_dotp, curwp->w_doto+1); if (ISUPPER(c) != FALSE) { rtype = _U; } } } /* * make the string lengths match (either pad the line * so that it will fit, or scrunch out the excess). * be careful with dot's offset. */ rlen = strlen(st); doto = curwp->w_doto; #ifdef UNDO undo_setup(undo); if (isundo()) { /* * In only this case, u_buffer is terminated by \0. * Because do_undo() use this function 'lreplace', */ if (undo_balloc(undo, plen+1)) { bcopy(&(curwp->w_dotp)->l_text[doto], undo->u_buffer, plen); undo->u_buffer[plen] = '\0'; undo->u_dotlno = get_lineno(curbp,curwp->w_dotp); undo->u_doto = doto; undo->u_type = UDREPL; undo->u_used = rlen; undoptr_save = undoptr; undoptr = NULL; } } #endif if (plen > rlen) #ifdef KANJI (VOID) ldelete((RSIZE) (plen-rlen), KNONE|KNOKANJI); #else (VOID) ldelete((RSIZE) (plen-rlen), KNONE); #endif else if (plen < rlen) { if (linsert((int)(rlen-plen), ' ') == FALSE) return FALSE; } curwp->w_doto = doto; /* * do the replacement: If was capital, then place first * char as if upper, and subsequent chars as if lower. * If inserting upper, check replacement for case. */ while ((c = CHARMASK(*st++)) != '\0') { if ((rtype&_U)!=0 && ISLOWER(c)!=0) c = TOUPPER(c); if (rtype == (_U|_L)) rtype = _L; if (c == CCHR('J')) { if (curwp->w_doto == llength(curwp->w_dotp)) (VOID) forwchar(FFRAND, 1); else { if (ldelete((RSIZE) 1, KNONE) != FALSE) (VOID) lnewline(); } } else if (curwp->w_dotp == curbp->b_linep) { (VOID) linsert(1, c); } else if (curwp->w_doto == llength(curwp->w_dotp)) { if (ldelete((RSIZE) 1, KNONE) != FALSE) (VOID) linsert(1, c); } else lputc(curwp->w_dotp, curwp->w_doto++, c); } lchange(WFHARD); #ifdef UNDO if (undoptr_save != NULL) { undobefore = undoptr_save; undoptr = &(undo->u_next); } #endif return (TRUE); } /* * Delete all of the text * saved in the kill buffer. Called by commands * when a new kill context is being created. The kill * buffer array is released, just in case the buffer has * grown to immense size. No errors. */ VOID kdelete() { if (kbufp != NULL) { free((char *) kbufp); kbufp = NULL; kstart = kused = ksize = 0; } } /* * Insert a character to the kill buffer, * enlarging the buffer if there isn't any room. Always * grow the buffer in chunks, on the assumption that if you * put something in the kill buffer you are going to put * more stuff there too later. Return TRUE if all is * well, and FALSE on errors. Print a message on * errors. Dir says whether to put it at back or front. */ kinsert(c, dir) { if (kused == ksize && dir == KFORW && kgrow(FALSE) == FALSE) return FALSE; if (kstart == 0 && dir == KBACK && kgrow(TRUE) == FALSE) return FALSE; if (dir == KFORW) kbufp[kused++] = c; else if (dir == KBACK) kbufp[--kstart] = c; else panic("broken kinsert call"); /* Oh shit! */ return (TRUE); } /* * kgrow - just get more kill buffer for the callee. back is true if * we are trying to get space at the beginning of the kill buffer. */ kgrow(back) { register int nstart; register char *nbufp; if ((unsigned)(ksize+KBLOCK) <= (unsigned)ksize) { /* probably 16 bit unsigned */ ewprintf("Kill buffer size at maximum"); return FALSE; } if ((nbufp=malloc((unsigned)(ksize+KBLOCK))) == NULL) { ewprintf("Can't get %ld bytes", (long)(ksize+KBLOCK)); return FALSE; } nstart = (back == TRUE) ? (kstart + KBLOCK) : (KBLOCK / 4) ; if (kused-kstart > 0) bcopy(&(kbufp[kstart]), &(nbufp[nstart]), (int) (kused-kstart)); if (kbufp != NULL) free((char *) kbufp); kbufp = nbufp; ksize += KBLOCK; kused = kused - kstart + nstart; kstart = nstart; return TRUE; } /* * This function gets characters from * the kill buffer. If the character index "n" is * off the end, it returns "-1". This lets the caller * just scan along until it gets a "-1" back. */ kremove(n) { if (n < 0 || n + kstart >= kused) return -1; return CHARMASK(kbufp[n + kstart]); } #ifdef CLIPBOARD int send_clipboard_ pro((char *buf, int size)); int size_clipboard_ pro((void)); int recieve_clipboard_ pro((char *buf, int *size)); int send_clipboard( void ) { if (&kbufp[kstart] != NULL) return send_clipboard_(&kbufp[kstart], kused-kstart); else return send_clipboard_("", 0); } int receive_clipboard( void ) { int size; char *buf; kdelete() ; size = size_clipboard_(); if ( !size ) { return TRUE; } buf = malloc(size); if (!buf) { return FALSE; } buf[0] = 0 ; recieve_clipboard_(buf, &size); ksize = size + 1; ksize = (ksize + KBLOCK - 1) / KBLOCK * KBLOCK ; kbufp = malloc(ksize); if (!kbufp) { ksize = 0; free(buf); return FALSE; } bcopy(buf, kbufp, size); kused = size; kstart = 0; free(buf); return TRUE; } #endif /* CLIPBOARD */ int get_lineno(bp, blp) BUFFER *bp; LINE *blp; { register LINE *lp; register int n = 0; static BUFFER *before_bp; static LINE *before_blp; static int before_n; if (set_lineno != -1) return set_lineno; if (lineno_cache && blp==before_blp && bp==before_bp) return before_n; before_blp = blp; before_bp = bp; lp = lforw(bp->b_linep); while (lp != blp) { lp = lforw(lp); if (lp == bp->b_linep) break; n++; } if (lp == bp->b_linep) n = 0; before_n = n; lineno_cache = TRUE; return n; } ng-1.5beta1/macro.c100644 1750 1750 3445 7126003714 12724 0ustar amurausers/* $Id: macro.c,v 1.1.1.1 2000/06/27 01:47:56 amura Exp $ */ /* keyboard macros for MicroGnuEmacs 1x */ /* * $Log: macro.c,v $ * Revision 1.1.1.1 2000/06/27 01:47:56 amura * import to CVS * */ #include "config.h" /* 90.12.20 by S.Yoshida */ #ifndef NO_MACRO #include "def.h" #include "key.h" #define EXTERN #define INIT(i) = (i) #include "macro.h" /*ARGSUSED*/ definemacro(f, n) int f, n; { register LINE *lp1; LINE *lp2; macrocount = 0; if(macrodef) { ewprintf("already defining macro"); return macrodef = FALSE; } /* free lines allocated for string arguments */ if(maclhead != NULL) { for(lp1 = maclhead->l_fp; lp1 != maclhead; lp1 = lp2) { lp2 = lp1->l_fp; free((char *)lp1); } free((char *)lp1); } if((maclhead = lp1 = lalloc(0)) == NULL) return FALSE; ewprintf("Defining Keyboard Macro..."); maclcur = lp1->l_fp = lp1->l_bp = lp1; return macrodef = TRUE; } int finishmacro pro((int, int)); /*ARGSUSED*/ finishmacro(f, n) int f, n; { macrodef = FALSE; ewprintf("End Keyboard Macro Definition"); return TRUE; } /*ARGSUSED*/ executemacro(f, n) int f, n; { int i, j; PF funct; int universal_argument pro((int, int)); int flag, num; if(macrodef || (macrocount >= MAXMACRO && macro[MAXMACRO].m_funct != finishmacro)) return FALSE; if(macrocount == 0) return TRUE; inmacro = TRUE; for(i = n; i > 0; i--) { maclcur = maclhead->l_fp; flag = 0; num = 1; for(j = 0; j < macrocount-1; j++) { funct = macro[j].m_funct; if(funct == universal_argument) { flag = FFARG; num = macro[++j].m_count; continue; } if((*funct)(flag, num) != TRUE) { inmacro = FALSE; return FALSE; } lastflag = thisflag; thisflag = 0; flag = 0; num = 1; } } inmacro = FALSE; return TRUE; } #endif ng-1.5beta1/macro.h100644 1750 1750 1102 7126003714 12715 0ustar amurausers/* $Id: macro.h,v 1.1.1.1 2000/06/27 01:47:56 amura Exp $ */ /* definitions for keyboard macros */ /* * $Log: macro.h,v $ * Revision 1.1.1.1 2000/06/27 01:47:56 amura * import to CVS * */ #ifndef EXTERN #define EXTERN extern #define INIT(i) #endif #define MAXMACRO 256 /* maximum functs in a macro */ EXTERN int inmacro INIT(FALSE); EXTERN int macrodef INIT(FALSE); EXTERN int macrocount INIT(0); EXTERN union { PF m_funct; int m_count; /* for count-prefix */ } macro[MAXMACRO]; EXTERN LINE *maclhead INIT(NULL); EXTERN LINE *maclcur; #undef EXTERN #undef INIT ng-1.5beta1/main.c100644 1750 1750 15305 7303500512 12560 0ustar amurausers/* $Id: main.c,v 1.9 2001/05/25 15:59:06 amura Exp $ */ /* * Mainline */ /* * $Log: main.c,v $ * Revision 1.9 2001/05/25 15:59:06 amura * WIN32 version support AUTOSAVE feature * * Revision 1.8 2001/05/25 15:36:53 amura * now buffers have only one mark (before windows have one mark) * * Revision 1.7 2000/12/14 18:12:14 amura * use alloca() and more memory secure * * Revision 1.6 2000/09/21 17:28:31 amura * replace macro _WIN32 to WIN32 for Cygwin * * Revision 1.5 2000/09/01 19:36:02 amura * support KANJI filename on WIN32 * * Revision 1.4 2000/07/25 15:06:18 amura * handle Kanji filename for win32 * * Revision 1.3 2000/07/18 12:51:25 amura * cleaning code * * Revision 1.2 2000/06/27 01:49:44 amura * import to CVS * * Revision 1.1 2000/06/01 05:34:17 amura * Initial revision * */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include "def.h" #ifndef NO_MACRO #include "macro.h" #endif int thisflag; /* Flags, this command */ int lastflag; /* Flags, last command */ int curgoal; /* Goal column */ BUFFER *curbp; /* Current buffer */ WINDOW *curwp; /* Current window */ BUFFER *bheadp; /* BUFFER listhead */ WINDOW *wheadp = (WINDOW *)NULL; /* WINDOW listhead */ char pat[NPAT]; /* Pattern */ #ifndef NO_DPROMPT extern char prompt[], *promptp; /* delayed prompting */ #endif static VOID edinit(); #ifdef WIN32 VOID Main(int argc, char**argv) #else /* WIN32 */ main(argc, argv) int argc; char **argv; #endif /* WIN32 */ { #ifndef NO_STARTUP char *startupfile(); #endif #ifdef ADDOPT int gotoline(); char *startupfunc = (char *)NULL; int line = 0; int fgoto = FALSE; #ifndef NO_STARTUP char *ngrcfile = (char *)NULL; #endif #endif char *cp; VOID vtinit(), makename(), eerase(); BUFFER *tmpbp; /* 91.02.17 by N.Yuasa */ BUFFER *findbuffer(); #ifdef ADDFUNC /* 90.12.28 by S.Yoshida */ if (argc > 1 && argv[1][0] == '-') { switch (argv[1][1]) { case 'v': printversion(); exit(GOOD); case 'c': printversion(); printoptions(); exit(GOOD); case '-': --argc; argv++; break; #ifdef ADDOPT #ifndef NO_STARTUP case 'I': if (argv[1][2]) ngrcfile = &argv[1][2]; else { ngrcfile = argv[2]; --argc; argv++; } --argc; argv++; break; #endif /* NO_STARTUP */ case 'f': if (argv[1][2]) startupfunc = &argv[1][2]; else { startupfunc = argv[2]; --argc; argv++; } --argc; argv++; break; #endif /* ADDOPT */ default: break; } } #endif #ifdef SYSINIT SYSINIT; /* system dependent. */ #endif vtinit(); /* Virtual terminal. */ #ifndef NO_DIR dirinit(); /* Get current directory */ #endif edinit(); /* Buffers, windows. */ #ifdef ADDOPT # ifndef NO_STARTUP ttykeymapinit(ngrcfile); /* Symbols, bindings. */ # else ttykeymapinit(); /* Symbols, bindings. */ # endif #else ttykeymapinit(); /* Symbols, bindings. */ #endif /* doing update() before reading files causes the error messages from * the file I/O show up on the screen. (and also an extra display * of the mode line if there are files specified on the command line.) */ update(); #ifndef NO_STARTUP /* User startup file. */ #ifdef ADDOPT if ((cp = startupfile(ngrcfile, (char *)NULL)) != NULL) #else if ((cp = startupfile((char *)NULL)) != NULL) #endif (VOID) load(cp); #endif /* NO_STARTUP */ while (--argc > 0) { #ifdef ADDOPT if ((!fgoto) && argv[1][0] == '+'){ line = atoi(&argv[1][1]); ++argv; fgoto = TRUE; continue; } #endif /* ADDOPT */ #if defined(KANJI)&&(defined(MSDOS)||defined(HUMAN68K)||defined(WIN32)) { char argve[NFILEN]; strncpy(argve, *++argv, NFILEN); argve[NFILEN-1] = 0; bufstoe(argve, strlen(argve) + 1); cp = adjustname(argve); } #else cp = adjustname(*++argv); #endif /* KANJI and (MSDOS or HUMAN68K or WIN32) */ #ifndef NO_DIRED /* 91.01.16 by S.Yoshida */ if (ffisdir(cp)) { eargset(cp); (VOID) dired(0, 1); #ifdef ADDOPT /* 92.03.16 by Gen KUROKI */ if (fgoto) { gotoline(1,line); fgoto = FALSE; } #endif /* ADDOPT */ continue; } #endif /* NO_DIRED */ if ((tmpbp = findbuffer(cp)) == NULL) break; /* 91.02.17 by N.Yuasa */ else curbp = tmpbp; (VOID) showbuffer(curbp, curwp, 0); (VOID) readin(cp); #ifdef READONLY /* 91.01.16 by S.Yoshida */ if (fchkreadonly(curbp->b_fname)) { /* If no write permission, */ curbp->b_flag |= BFRONLY; /* mark as read-only. */ ewprintf("File is write protected"); } #ifdef ADDOPT /* 92.03.16 by Gen KUROKI */ if (fgoto) { gotoline(1,line); fgoto = FALSE; } #endif /* ADDOPT */ } #endif /* READONLY */ thisflag = 0; /* Fake last flags. */ #ifdef ADDOPT if (startupfunc) { extern PF name_function pro((char *)); PF fn; fn = name_function(startupfunc); if (fn) { (*fn)(FFRAND, 1); } } #endif /* ADDOPT */ for(;;) { #ifdef C_ALLOCA (void)alloca(0); /* for garbage correction */ #endif #ifndef NO_DPROMPT *(promptp = prompt) = '\0'; if(epresf == KPROMPT) eerase(); #endif update(); lastflag = thisflag; thisflag = 0; switch(doin()) { case TRUE: break; case ABORT: ewprintf("Quit"); /* and fall through */ case FALSE: default: ttbeep(); #ifdef KANJI kgetkeyflush(); #endif #ifndef NO_MACRO macrodef = FALSE; #endif } } #ifndef WIN32 return 0; #endif } /* * Initialize default buffer and window. */ static VOID edinit() { register BUFFER *bp; register WINDOW *wp; bheadp = NULL; bp = bfind("*scratch*", TRUE); /* Text buffer. */ wp = (WINDOW *)malloc(sizeof(WINDOW)); /* Initial window. */ if (bp==NULL || wp==NULL) panic("edinit"); curbp = bp; /* Current ones. */ wheadp = wp; curwp = wp; wp->w_wndp = NULL; /* Initialize window. */ wp->w_bufp = bp; bp->b_nwnd = 1; /* Displayed. */ wp->w_linep = wp->w_dotp = bp->b_linep; wp->w_lines = 0; wp->w_doto = 0; bp->b_markp = NULL; bp->b_marko = 0; wp->w_toprow = 0; wp->w_ntrows = nrow-2; /* 2 = mode, echo. */ wp->w_force = 0; wp->w_flag = WFMODE|WFHARD; /* Full. */ } /* * Quit command. If an argument, always * quit. Otherwise confirm if a buffer has been * changed and not written out. Normally bound * to "C-X C-C". */ /*ARGSUSED*/ quit(f, n) { register int s; VOID vttidy(); if ((s = anycb(FALSE)) == ABORT) return ABORT; if (s == FALSE || eyesno("Some modified buffers exist, really exit") == TRUE) { vttidy(); #ifndef NO_DIR dirend(); #endif #ifdef SYSCLEANUP SYSCLEANUP; #endif exit(GOOD); } return TRUE; } /* * User abort. Should be called by any input routine that sees a C-g * to abort whatever C-g is aborting these days. Currently does * nothing. */ /*ARGSUSED*/ ctrlg(f, n) { return ABORT; } ng-1.5beta1/match.c100644 1750 1750 13530 7632242733 12743 0ustar amurausers/* $Id: match.c,v 1.3.2.1 2003/03/08 01:22:35 amura Exp $ */ /* * Name: MicroEMACS * Limited parenthesis matching routines * * The hacks in this file implement automatic matching * of (), [], {}, and other characters. It would be * better to have a full-blown syntax table, but there's * enough overhead in the editor as it is. * * Since I often edit Scribe code, I've made it possible to * blink arbitrary characters -- just bind delimiter characters * to "blink-matching-paren-hack" */ /* * $Log: match.c,v $ * Revision 1.3.2.1 2003/03/08 01:22:35 amura * NOTAB is always enabled * * Revision 1.3 2001/02/11 15:38:05 amura * bugfix on VARIABLE_TAB suggested by ng1.3.1L6 * * Revision 1.2 2000/11/16 14:31:13 amura * fix some typos which cause compile error when using * strict ANSI-C compiler (ex ACK, gcc-1.x) * * Revision 1.1.1.1 2000/06/27 01:47:56 amura * import to CVS * */ /* Nov 1991. Modified by bsh to add electric-c-brace-blink and * goto-matching-fence. */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include "def.h" #include "key.h" static VOID displaymatch(); static int getmatch(); /* Nov 91. Added by bsh */ /* Balance table. When balance() encounters a character * that is to be matched, it first searches this table * for a balancing left-side character. If the character * is not in the table, the character is balanced by itself. * This is to allow delimiters in Scribe documents to be matched. */ static struct balance { char left, right; } bal[] = { { '(', ')' }, { '[', ']' }, { '{', '}' }, { '<', '>' }, { '\0','\0'} }; /* * Self-insert character, then show matching character, * if any. Bound to "blink-matching-paren-command". */ showmatch(f, n) { register int i, s; LINE *clp; int cbo; for (i = 0; i < n; i++) { if ((s = selfinsert(FFRAND|f, 1)) != TRUE) return s; if( !getmatch(curwp->w_dotp, curwp->w_doto - 1, &clp, &cbo, -1)) ttbeep(); else displaymatch(clp,cbo); } return TRUE; } /* * goto-matching-fence a la kemacs. * Nov 1991. Added by bsh. */ gotomatch(f,n) { LINE *clp; int cbo; int dir = 0; if( f & FFNEGARG ) dir = -1; else if( f & FFUNIV ) dir = n; if( !getmatch(curwp->w_dotp, curwp->w_doto, &clp, &cbo, dir)){ ttbeep(); return FALSE; } curwp->w_dotp = clp; curwp->w_doto = cbo; curwp->w_flag |= WFMOVE; return TRUE; } /* bsh: Mainly for cm_brace_blink */ blinkmatch( clp, cbo ) LINE *clp; int cbo; { LINE *mlp; int mbo; if( !getmatch(clp,cbo,&mlp,&mbo,-1) ) return FALSE; displaymatch(mlp,mbo); return TRUE; } static getmatch( clp, cbo, mlp, mbo, dir ) register LINE *clp; register int cbo; LINE **mlp; int *mbo; int dir; /* Default direction if not decided from the char at dot*/ { int i, rbal, lbal; int depth, c; rbal = lbal = cbo >=llength(clp) ? '\n' : lgetc(clp,cbo); for (i = 0; bal[i].right != '\0'; i++) if (bal[i].right == rbal) { lbal = bal[i].left; dir = -1; /* Backward */ break; } else if(bal[i].left == lbal){ rbal = bal[i].right; dir = 1; /* Forward */ break; } if( dir == 0 ) return FALSE; depth = 0; if( dir < 0 ) for (;;) { if (cbo == 0) { /* beginning of line */ clp = lback(clp); if (clp == curbp->b_linep) return (FALSE); cbo = llength(clp); /* End of line */ c = '\n'; } else { --cbo; c = lgetc(clp,cbo); /* somewhere in middle */ } /* Check for a matching character. If still in a nested */ /* level, pop out of it and continue search. This check */ /* is done before the nesting check so single-character */ /* matches will work too. */ if (c == lbal) { if (depth == 0) { *mlp = clp; *mbo = cbo; return (TRUE); } else depth--; } /* Check for another level of nesting. */ if (c == rbal) depth++; } else for(++cbo;;++cbo){ if( cbo > llength(clp) ){ if ((clp= lforw(clp)) == curbp->b_linep) return FALSE; cbo = 0; } if( cbo == llength(clp) ) c = '\n'; else c = lgetc(clp,cbo); if( c == rbal ){ if( depth == 0 ){ *mlp = clp; *mbo = cbo; return TRUE; } --depth; } if( c == lbal ) ++depth; } return FALSE; } /* * Display matching character. * Matching characters that are not in the current window * are displayed in the echo line. If in the current * window, move dot to the matching character, * sit there a while, then move back. */ static VOID displaymatch(clp, cbo) register LINE *clp; register int cbo; { register LINE *tlp; register int tbo; register int cp; register int bufo; register int c; int inwindow; char buf[NLINE]; /* Figure out if matching char is in current window by */ /* searching from the top of the window to dot. */ inwindow = FALSE; for (tlp = curwp->w_linep; tlp != lforw(curwp->w_dotp); tlp = lforw(tlp)) if (tlp == clp) inwindow = TRUE; if (inwindow == TRUE) { tlp = curwp->w_dotp; /* save current position */ tbo = curwp->w_doto; curwp->w_dotp = clp; /* move to new position */ curwp->w_doto = cbo; curwp->w_flag |= WFMOVE; update(); /* show match */ #ifdef ADDFUNC /* 91.01.23 by Sawayanagi Yosirou */ ttwait(); /* wait 1 sec. or key press. */ #else /* NOT ADDFUNC */ sleep(1); /* wait a bit */ #endif /* ADDFUNC */ curwp->w_dotp = tlp; /* return to old position */ curwp->w_doto = tbo; curwp->w_flag |= WFMOVE; update(); } else { /* match not in this window so display line in echo area */ bufo = 0; for (cp = 0; cp < llength(clp); cp++) { /* expand tabs */ c = lgetc(clp,cp); if (c != '\t' || (curbp->b_flag & BFNOTAB)) if(ISCTRL(c)) { buf[bufo++] = '^'; buf[bufo++] = CCHR(c); } else buf[bufo++] = c; else do { buf[bufo++] = ' '; #ifdef VARIABLE_TABWIDTH } while (bufo % curbp->b_tabwidth); #else } while (bufo & 7); #endif } buf[bufo++] = '\0'; ewprintf("Matches %s",buf); } } ng-1.5beta1/modes.c100644 1750 1750 10267 7632242733 12762 0ustar amurausers/* $Id: modes.c,v 1.3.2.1 2003/03/08 01:22:35 amura Exp $ */ /* * Commands to toggle modes. Without an argument, toggle mode. * Negitive or zero argument, mode off. Positive argument, mode on. */ /* 90.01.29 Modified for Ng 1.0 by S.Yoshida */ /* * $Log: modes.c,v $ * Revision 1.3.2.1 2003/03/08 01:22:35 amura * NOTAB is always enabled * * Revision 1.3 2000/12/14 18:12:14 amura * use alloca() and more memory secure * * Revision 1.2 2000/06/27 01:49:44 amura * import to CVS * * Revision 1.1 1999/05/19 04:22:31 amura * Initial revision * */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include "def.h" #include "kbd.h" int defb_nmodes = 0; MAPS *defb_modes[PBMODES] = {&map_table[0]}; int defb_flag = 0; static int changemode(f, n, mode) int f, n; char *mode; { register int i; MAPS *m; VOID upmodes(); if((m = name_mode(mode)) == NULL) { ewprintf("Can't find mode %s", mode); return FALSE; } if(!(f & FFARG)) { for(i=0; i <= curbp->b_nmodes; i++) if(curbp->b_modes[i] == m) { n = 0; /* mode already set */ break; } } if(n > 0) { for(i=0; i <= curbp->b_nmodes; i++) if(curbp->b_modes[i] == m) return TRUE; /* mode already set */ if(curbp->b_nmodes >= PBMODES-1) { ewprintf("Too many modes"); return FALSE; } curbp->b_modes[++(curbp->b_nmodes)] = m; } else { /* fundamental is b_modes[0] and can't be unset */ for(i=1; i <= curbp->b_nmodes && m != curbp->b_modes[i]; i++) {} if(i > curbp->b_nmodes) return TRUE; /* mode wasn't set */ for(; i < curbp->b_nmodes; i++) curbp->b_modes[i] = curbp->b_modes[i+1]; curbp->b_nmodes--; } upmodes(curbp); return TRUE; } indentmode(f, n) { return changemode(f, n, "indent"); } fillmode(f, n) { #ifdef KANJI /* 90.01.29 by S.Yoshida */ if(changemode(f, n, "fill") == FALSE) return FALSE; if(f & FFARG) { if(n <= 0) curbp->b_flag &= ~BFAUTOFILL; else curbp->b_flag |= BFAUTOFILL; } else curbp->b_flag ^= BFAUTOFILL; return TRUE; #else /* NOT KANJI */ return changemode(f, n, "fill"); #endif /* KANJI */ } /* * Fake the GNU "blink-matching-paren" variable. */ blinkparen(f, n) { return changemode(f, n, "blink"); } notabmode(f, n) { if(changemode(f, n, "notab") == FALSE) return FALSE; if(f & FFARG) { if(n <= 0) curbp->b_flag &= ~BFNOTAB; else curbp->b_flag |= BFNOTAB; } else curbp->b_flag ^= BFNOTAB; return TRUE; } #ifdef C_MODE /* 90.07.24 by K.Takano */ cmode(f, n) { #ifdef VARIABLE_TAB extern int cmode_tab; int set_tabwidth(); if (cmode_tab != 0) set_tabwidth(-1, cmode_tab); #endif /* VARIABLE_TAB */ return changemode(f, n, "C"); } #endif overwrite(f, n) int f, n; { if(changemode(f, n, "overwrite") == FALSE) return FALSE; if(f & FFARG) { if(n <= 0) curbp->b_flag &= ~BFOVERWRITE; else curbp->b_flag |= BFOVERWRITE; } else curbp->b_flag ^= BFOVERWRITE; return TRUE; } set_default_mode(f, n) int f, n; { register int i; register MAPS *m; char mode[NINPUT]; if(eread("Set Default Mode: ", mode, sizeof(mode), EFNEW) != TRUE) return ABORT; if((m = name_mode(mode)) == NULL) { ewprintf("can't find mode %s", mode); return FALSE; } if(!(f & FFARG)) { for(i=0; i <= defb_nmodes; i++) if(defb_modes[i] == m) { n = 0; /* mode already set */ break; } } if(n > 0) { for(i=0; i <= defb_nmodes; i++) if(defb_modes[i] == m) return TRUE; /* mode already set */ if(defb_nmodes >= PBMODES-1) { ewprintf("Too many modes"); return FALSE; } defb_modes[++defb_nmodes] = m; } else { /* fundamental is defb_modes[0] and can't be unset */ for(i=1; i <= defb_nmodes && m != defb_modes[i]; i++) {} if(i > defb_nmodes) return TRUE; /* mode wasn't set */ for(; i < defb_nmodes; i++) defb_modes[i] = defb_modes[i+1]; defb_nmodes--; } #ifdef KANJI /* 90.01.29 by S.Yoshida */ if(strcmp(mode, "fill")==0) if(n<=0) defb_flag &= ~BFAUTOFILL; else defb_flag |= BFAUTOFILL; #endif /* KANJI */ if(strcmp(mode, "overwrite")==0) if(n<=0) defb_flag &= ~BFOVERWRITE; else defb_flag |= BFOVERWRITE; if(strcmp(mode, "notab")==0) if(n<=0) defb_flag &= ~BFNOTAB; else defb_flag |= BFNOTAB; return TRUE; } ng-1.5beta1/paragraph.c100644 1750 1750 55354 7632242733 13626 0ustar amurausers/* $Id: paragraph.c,v 1.7.2.1 2003/03/08 01:22:35 amura Exp $ */ /* * Code for dealing with paragraphs and filling. Adapted from MicroEMACS 3.6 * and GNU-ified by mwm@ucbvax. Several bug fixes by blarson@usc-oberon. */ /* * $Log: paragraph.c,v $ * Revision 1.7.2.1 2003/03/08 01:22:35 amura * NOTAB is always enabled * * Revision 1.7 2001/07/18 14:56:09 amura * fix silly bug * * Revision 1.6 2001/06/19 15:23:19 amura * to make uniform all indent * * Revision 1.5 2001/05/25 15:36:53 amura * now buffers have only one mark (before windows have one mark) * * Revision 1.4 2000/10/02 16:24:42 amura * bugfix by Tillanosoft(Ng for Win32) * * Revision 1.3 2000/07/16 15:44:41 amura * undo bug on autofill fixed * * Revision 1.2 2000/06/27 01:49:44 amura * import to CVS * * Revision 1.1 2000/06/01 05:34:38 amura * Initial revision * */ /* 90.01.29 Modified for Ng 1.0 by S.Yoshida */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include "def.h" #ifdef UNDO #include "undo.h" #endif static int fillcol = 70 ; #define MG_MAXWORD 256 #ifdef FILLPREFIX /* 90.12.30 by S.Yoshida */ static int fillprefix_col = 0; /* fill-prefix column length. */ static int fillprefix_len = 0; /* fill-prefix byte length. */ #define PREFIXLENGTH 40 static char fillprefix[PREFIXLENGTH] = { '\0' }; #endif /* FILLPREFIX */ /* * go back to the begining of the current paragraph * here we look for a or or * combination to delimit the begining of a paragraph #ifdef FILLPREFIX * (91.01.01 Add comment by S.Yoshida) * We also look for a line starting without fill-prefix strings. * If line is started with fill-prefix string, we strip it to * look for a etc. #endif */ /*ARGSUSED*/ gotobop(f, n) { if (n < 0) /* the other way...*/ return gotoeop(f, -n); while (n-- > 0) { /* for each one asked for */ /* first scan back until we are in a word */ while (backchar(FFRAND, 1) && !inword()) {} curwp->w_doto = 0; /* and go to the B-O-Line */ /* and scan back until we hit a or */ while (lback(curwp->w_dotp) != curbp->b_linep) #ifdef FILLPREFIX /* 91.01.01 by S.Yoshida */ /* We strip fill-prefix strings to scan back. */ if (llength(lback(curwp->w_dotp)) > fillprefix_len && strncmp(ltext(curwp->w_dotp), fillprefix, fillprefix_len) == 0 && lgetc(curwp->w_dotp,fillprefix_len) != ' ' && lgetc(curwp->w_dotp,fillprefix_len) != '\t') #else /* NOT FILLPREFIX */ if (llength(lback(curwp->w_dotp)) && lgetc(curwp->w_dotp,0) != ' ' && lgetc(curwp->w_dotp,0) != '\t') #endif /* FILLPREFIX */ curwp->w_dotp = lback(curwp->w_dotp); else break; } curwp->w_flag |= WFMOVE; /* force screen update */ return TRUE; } /* * go forword to the end of the current paragraph * here we look for a or or * combination to delimit the begining of a paragraph #ifdef FILLPREFIX * (91.01.01 Add comment by S.Yoshida) * We also look for a line starting without fill-prefix strings. * If line is started with fill-prefix string, we strip it to * look for a etc. #endif */ /*ARGSUSED*/ gotoeop(f, n) { if (n < 0) /* the other way...*/ return gotobop(f, -n); while (n-- > 0) { /* for each one asked for */ /* Find the first word on/after the current line */ curwp->w_doto = 0; while(forwchar(FFRAND, 1) && !inword()) {} curwp->w_doto = 0; curwp->w_dotp = lforw(curwp->w_dotp); /* and scan forword until we hit a or ... */ while (curwp->w_dotp != curbp->b_linep) { #ifdef FILLPREFIX /* 91.01.01 by S.Yoshida */ /* We strip fill-prefix strings to scan forword. */ if (llength(curwp->w_dotp) > fillprefix_len && strncmp(ltext(curwp->w_dotp), fillprefix, fillprefix_len) == 0 && lgetc(curwp->w_dotp,fillprefix_len) != ' ' && lgetc(curwp->w_dotp,fillprefix_len) != '\t') #else /* NOT FILLPREFIX */ if (llength(curwp->w_dotp) && lgetc(curwp->w_dotp,0) != ' ' && lgetc(curwp->w_dotp,0) != '\t') #endif /* FILLPREFIX */ curwp->w_dotp = lforw(curwp->w_dotp); else break; } if(curwp->w_dotp == curbp->b_linep) { /* beond end of buffer, cleanup time */ curwp->w_dotp = lback(curwp->w_dotp); curwp->w_doto = llength(curwp->w_dotp); break; } } curwp->w_flag |= WFMOVE; /* force screen update */ return TRUE; } /* * Fill the current paragraph according to the current * fill column #ifdef FILLPREFIX * (91.01.01 Add comment by S.Yoshida) * with current fill-prefix strings. #endif */ /*ARGSUSED*/ fillpara(f, n) { register int c; /* current char durring scan */ register int wordlen; /* length of current word */ #ifdef BUGFIX /* 91.01.02 by S.Yoshida */ register int wordcol; /* column length of current word */ #endif /* BUGFIX */ register int clength; /* position on line during fill */ register int i; /* index during word copy */ register int eopflag; /* Are we at the End-Of-Paragraph? */ #ifdef KANJI /* 90.01.29 by S.Yoshida */ register int c2; /* KANJI 2nd byte. */ int lastsepchar; /* last separater char. */ int ksepflag; /* must separate with KANJI ? */ int kexist; /* this word contain KANJI ? */ int kstart; /* this word start with KANJI ? */ int kend; /* last word end with KANJI ? */ #ifdef KINSOKU /* 90.01.29 by S.Yoshida */ int lastiseolkc; /* last is EOL KINSOKU char ? */ int bolkclen; /* BOL KINSOKU char byte length. */ #endif /* KINSOKU */ #endif /* KANJI */ int firstflag; /* first word? (needs no space) */ int newlength; /* tentative new line length */ int eolflag; /* was at end of line */ LINE *eopline; /* pointer to line just past EOP */ char wbuf[MG_MAXWORD]; /* buffer for current word */ #ifdef VARIABLE_TAB int tab = curbp->b_tabwidth; #endif /* VARIABLE_TAB */ #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ /* record the pointer to the line just past the EOP */ (VOID) gotoeop(FFRAND, 1); if(curwp->w_doto != 0) { /* paragraph ends at end of buffer */ (VOID) lnewline(); /* In order to reduce the complexity, simply add a newline (by the above code) so that the rest of the source code will not be affected by the exceptional paragraph. This idea was brought to the source code by the original authors, but there was a bug which over-delete one word at the end of the paragraph in the case the paragraph ends with EOB and there is a certain FILLPREFIX string for the paragraph. This bug was brought to the source code when FILLPREFIX feature had been introduced. This bug has been fixed by re-writing the way to get the `eopline' here. Tillanosoft Sep 4, 2000 */ (VOID)gotoeop(FFRAND, 1); } eopline = curwp->w_dotp; /* and back top the begining of the paragraph */ (VOID) gotobop(FFRAND, 1); /* initialize various info */ while (!inword() && forwchar(FFRAND, 1)) {} #ifdef BUGFIX /* 91.01.02 by S.Yoshida */ for (clength = 0, i = 0; i < curwp->w_doto; i++) { c = lgetc(curwp->w_dotp, i); if (c == '\t' && !(curbp->b_flag & BFNOTAB)) #ifdef VARIABLE_TAB clength = (clength/tab + 1)*tab - 1; #else clength |= 0x07; #endif else if (ISCTRL(c) != FALSE) ++clength; ++clength; } wordcol = 0; #else /* ORIGINAL */ clength = curwp->w_doto; #endif /* BUGFIX */ wordlen = 0; /* scan through lines, filling words */ firstflag = TRUE; eopflag = FALSE; #ifdef KANJI /* 90.01.29 by S.Yoshida */ lastsepchar = '\0'; /* 91.01.16 NULL -> '\0' */ kexist = FALSE; kstart = FALSE; kend = FALSE; #ifdef KINSOKU /* 90.01.29 by S.Yoshida */ lastiseolkc = FALSE; bolkclen = 0; #endif /* KINSOKU */ #endif /* KANJI */ while (!eopflag) { /* get the next character in the paragraph */ if (eolflag=(curwp->w_doto == llength(curwp->w_dotp))) { c = ' '; if (lforw(curwp->w_dotp) == eopline) eopflag = TRUE; } else c = lgetc(curwp->w_dotp, curwp->w_doto); #ifdef KANJI /* 90.01.29 by S.Yoshida */ c2 = '\0'; /* 91.01.15 NULL -> '\0' */ ksepflag = FALSE; if (ISKANJI(c)) { if (eolflag=((curwp->w_doto + 1) == llength(curwp->w_dotp))) { c = ' '; if (lforw(curwp->w_dotp) == eopline) eopflag = TRUE; } else { c2 = lgetc(curwp->w_dotp, curwp->w_doto + 1); if (wordlen > 0 #ifdef KINSOKU /* 90.01.29 by S.Yoshida */ && !lastiseolkc && !isbolkchar(c, c2) #endif /* KINSOKU */ ) { c2 = '\0'; /* 91.01.15 NULL -> '\0' */ ksepflag = TRUE; } else { #ifdef KINSOKU /* 90.01.29 by S.Yoshida */ if (isbolkchar(c, c2)) { bolkclen += 2; } lastiseolkc = iseolkchar(c, c2); #endif /* KINSOKU */ if (wordlen == 0) { kstart = TRUE; } kexist = TRUE; } } } else { if (0 < wordlen && ISKANJI(wbuf[wordlen - 1]) && #ifdef KINSOKU /* 90.01.29 by S.Yoshida */ !lastiseolkc && !isbolkchar(0, c) && #endif /* KINSOKU */ c != ' ' && c != '\t') { ksepflag = TRUE; } #ifdef KINSOKU /* 90.01.29 by S.Yoshida */ if (kexist && isbolkchar(0, c)) { bolkclen++; } lastiseolkc = iseolkchar(0, c); #endif /* KINSOKU */ } /* and then delete it */ if (!ksepflag) if (ldelete((RSIZE) (c2 ? 2 : 1), KNONE) == FALSE && !eopflag) #else /* NOT KANJI */ /* and then delete it */ if (ldelete((RSIZE) 1, KNONE) == FALSE && !eopflag) #endif /* KANJI */ return FALSE; #ifdef FILLPREFIX /* 90.12.31 by S.Yoshida */ /* and if EOL & not EOP, delete fill-prefix strings. */ if (eolflag && !eopflag) { if (ldelete((RSIZE) fillprefix_len, KNONE) == FALSE) return FALSE; } #endif /* FILLPREFIX */ /* if not a separator, just add it in */ #ifndef KANJI /* 90.01.29 by S.Yoshida */ if (c != ' ' && c != '\t') { #else /* KANJI */ if (c != ' ' && c != '\t' && !ksepflag) { if (c2 != '\0') { /* 91.01.15 NULL -> '\0' */ if (wordlen < MG_MAXWORD - 2) { wbuf[wordlen++] = c; wbuf[wordlen++] = c2; #ifdef BUGFIX /* 91.01.02 by S.Yoshida */ wordcol += 2; #endif /* BUGFIX */ } else { ewprintf("Word too long!"); } } else #endif /* KANJI */ if (wordlen < MG_MAXWORD - 1) { wbuf[wordlen++] = c; #ifdef BUGFIX /* 91.01.02 by S.Yoshida */ if (c == '\t' && !(curbp->b_flag & BFNOTAB)) #ifdef VARIABLE_TAB wordcol = (wordcol/tab + 1)*tab -1; #else wordcol |= 0x07; #endif else if (ISCTRL(c) != FALSE) ++wordcol; ++wordcol; #endif /* BUGFIX */ } else { /* You loose chars beyond MG_MAXWORD if the word * is to long. I'm to lazy to fix it now; it * just silently truncated the word before, so * I get to feel smug. */ ewprintf("Word too long!"); } } else if (wordlen) { /* calculate tenatitive new length with word added */ #ifdef KANJI /* 90.01.29 by S.Yoshida */ c2 = c; /* save separate char. */ #ifdef BUGFIX /* 91.01.02 by S.Yoshida */ newlength = clength + wordcol #else /* ORIGINAL */ newlength = clength + wordlen #endif /* BUGFIX */ #ifdef KINSOKU /* 90.01.29 by S.Yoshida */ - bolkclen #endif /* KINSOKU */ + ((!firstflag && (lastsepchar == ' ' || lastsepchar == '\t' || (lastsepchar == '\n' && !kend && !kstart))) ? 1 : 0); #else /* NOT KANJI */ #ifdef BUGFIX /* 91.01.02 by S.Yoshida */ newlength = clength + 1 + wordcol; #else /* ORIGINAL */ newlength = clength + 1 + wordlen; #endif /* BUGFIX */ #endif /* KANJI */ /* if at end of line or at doublespace and previous * character was one of '.','?','!' doublespace here. */ if((eolflag || curwp->w_doto==llength(curwp->w_dotp) || (c=lgetc(curwp->w_dotp,curwp->w_doto))==' ' || c=='\t') && 0 < wordlen && ISEOSP(wbuf[wordlen - 1]) && wordlenu_type = UDNONE; #endif (VOID) linsert(1, ' '); ++clength; } firstflag = FALSE; } else { if(curwp->w_doto > 0 && lgetc(curwp->w_dotp,curwp->w_doto-1)==' ') { curwp->w_doto -= 1; (VOID) ldelete((RSIZE) 1, KNONE); } /* start a new line */ (VOID) lnewline(); #ifdef FILLPREFIX /* 90.12.31 by S.Yoshida */ /* and add the fill-prefix strings. */ { char *cp = fillprefix; #ifdef UNDO if (undoptr != NULL) { if (*undoptr != NULL) (*undoptr)->u_type = UDNONE; if (*cp) if (linsert(1, *cp++) == FALSE) return FALSE; while (*cp) { undoptr = undobefore; if (linsert(1, *cp) == FALSE) return FALSE; cp++; } } else #endif while (*cp) { if (linsert(1, *cp) == FALSE) return FALSE; cp++; } } clength = fillprefix_col; #else /* NOT FILLPREFIX */ clength = 0; #endif /* FILLPREFIX */ } /* and add the word in in either case */ #ifdef UNDO if (undoptr != NULL) { if (*undoptr != NULL) (*undoptr)->u_type = UDNONE; if (wordlen > 0) { (VOID) linsert(1, wbuf[0]); } for (i=1; i '\0' */ kexist = FALSE; kstart = FALSE; kend = (0 < wordlen && ISKANJI(wbuf[wordlen - 1])); #ifdef KINSOKU /* 90.01.29 by S.Yoshida */ bolkclen = 0; #endif /* KINSOKU */ #endif /* KANJI */ wordlen = 0; #ifdef BUGFIX /* 91.01.02 by S.Yoshida */ wordcol = 0; #endif /* BUGFIX */ } } /* and add a last newline for the end of our new paragraph */ (VOID) lnewline(); /* we realy should wind up where we started, (which is hard to keep * track of) but I think the end of the last line is better than the * begining of the blank line. */ (VOID) backchar(FFRAND, 1); return TRUE; } /* delete n paragraphs starting with the current one */ /*ARGSUSED*/ killpara(f, n) { register int status; /* returned status of functions */ #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ while (n--) { /* for each paragraph to delete */ /* mark out the end and begining of the para to delete */ (VOID) gotoeop(FFRAND, 1); /* set the mark here */ curbp->b_markp = curwp->w_dotp; curbp->b_marko = curwp->w_doto; /* go to the begining of the paragraph */ (VOID) gotobop(FFRAND, 1); curwp->w_doto = 0; /* force us to the begining of line */ /* and delete it */ if ((status = killregion(FFRAND, 1)) != TRUE) return status; /* and clean up the 2 extra lines */ (VOID) ldelete((RSIZE) 1, KFORW); } return TRUE; } #ifdef KANJI /* 90.01.29 by S.Yoshida */ #ifndef BUGFIX #define BUGFIX #endif /* BUGFIX */ #endif /* KANJI */ /* * check to see if we're past fillcol, and if so, * justify this line. As a last step, justify the line. #ifdef FILLPREFIX * (91.01.01 Add comment by S.Yoshida) * When insert a newline, fill-prefix strings is added * at begin of the line. #endif */ /*ARGSUSED*/ fillword(f, n) { register char c; register int col, i, nce; #ifdef KANJI /* 90.01.29 by S.Yoshida */ register int kanji2nd = FALSE; /* Now we are on a KANJI 2nd byte. */ int kinserted = FALSE; /* KANJI 2nd byte has inserted. */ extern int inkfill; /* Fill with KANJI 2nd byte. */ /* This flag is defined at kbd.c. */ #endif /* KANJI */ #ifdef VARIABLE_TAB int tab = curbp->b_tabwidth; #endif /* VARIABLE_TAB */ #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ #ifdef BUGFIX /* 90.01.29 by S.Yoshida */ for (i = col = 0; col < fillcol; ++i, ++col) { #else /* ORIGINAL */ for (i = col = 0; col <= fillcol; ++i, ++col) { #endif /* BUGFIX */ if (i == curwp->w_doto) return selfinsert(f, n) ; c = lgetc(curwp->w_dotp, i); if (c == '\t'&& !(curbp->b_flag & BFNOTAB)) #ifdef VARIABLE_TAB col = (col/tab + 1)*tab - 1; #else col |= 0x07; #endif else if (ISCTRL(c) != FALSE) ++col; #ifdef KANJI /* 90.01.29 by S.Yoshida */ if (kanji2nd) { /* We think 'c' is KANJI 2nd byte. */ kanji2nd = FALSE; } else if (ISKANJI(c)) { /* KANJI 1st byte. */ kanji2nd = TRUE; } #endif /* KANJI */ } if (curwp->w_doto != llength(curwp->w_dotp)) { (VOID) selfinsert(f, n); nce = llength(curwp->w_dotp) - curwp->w_doto; #ifndef KANJI /* 90.01.29 by S.Yoshida */ } else nce = 0; #else /* KANJI */ } else { nce = 0; if (inkfill) { /* To check KINSOKU char, we need KANJI 2nd byte. */ (VOID) selfinsert(f, n); /* Insert KANJI 2nd byte. */ } } if (kanji2nd) { /* When stop at KANJI 2nd byte, */ i--; /* Go to KANJI 1st byte. */ } #endif /* KANJI */ curwp->w_doto = i; #ifdef KANJI /* 90.01.29 by S.Yoshida */ #ifdef KINSOKU /* 90.01.29 by S.Yoshida */ /* Skip BOL (begin of line) KINSOKU chars to not separate with it. */ if (ISKANJI(c = lgetc(curwp->w_dotp, curwp->w_doto)) && isbolkchar(c, lgetc(curwp->w_dotp, curwp->w_doto + 1)) || !ISKANJI(c) && isbolkchar(0, c)) { do { (VOID) forwchar(FFRAND, 1); } while (curwp->w_doto < llength(curwp->w_dotp) && (ISKANJI(c = lgetc(curwp->w_dotp, curwp->w_doto)) && isbolkchar(c, lgetc(curwp->w_dotp, curwp->w_doto + 1)) || !ISKANJI(c) && isbolkchar(0, c))); if (curwp->w_doto == llength(curwp->w_dotp)) { if (inkfill) { curwp->w_doto -= nce; } else { (VOID) lnewline(); curwp->w_doto = 0; curwp->w_flag |= WFMOVE; } return TRUE; } } #endif /* KINSOKU */ if (curwp->w_doto < llength(curwp->w_dotp) && curwp->w_doto > 0 && ((c = lgetc(curwp->w_dotp, curwp->w_doto)) != ' ' && c != '\t' && !ISKANJI(c) && !ISKANJI(lgetc(curwp->w_dotp, curwp->w_doto - 1)) #ifdef KINSOKU /* 90.01.29 by S.Yoshida */ || (!ISKANJI((c = lgetc(curwp->w_dotp, curwp->w_doto - 1))) && iseolkchar(0, c) || curwp->w_doto > 1 && ISKANJI(c) && iseolkchar(lgetc(curwp->w_dotp, curwp->w_doto - 2), c)) #endif /* KINSOKU */ )) #else /* NOT KANJI */ #ifdef BUGFIX /* 90.01.29 by S.Yoshida */ if (curwp->w_doto < llength(curwp->w_dotp) && (c = lgetc(curwp->w_dotp, curwp->w_doto)) != ' ' && c != '\t') #else /* ORIGINAL */ if ((c = lgetc(curwp->w_dotp, curwp->w_doto)) != ' ' && c != '\t') #endif /* BUGFIX */ #endif /* KANJI */ do { (VOID) backchar(FFRAND, 1); #ifdef KANJI /* 90.01.29 by S.Yoshida */ } while (curwp->w_doto > 0 && ((c = lgetc(curwp->w_dotp, curwp->w_doto)) != ' ' && c != '\t' && !ISKANJI(c) && !ISKANJI(lgetc(curwp->w_dotp, curwp->w_doto - 1)) #ifdef KINSOKU /* 90.01.29 by S.Yoshida */ || (!ISKANJI((c = lgetc(curwp->w_dotp, curwp->w_doto - 1))) && iseolkchar(0, c) || curwp->w_doto > 1 && ISKANJI(c) && iseolkchar(lgetc(curwp->w_dotp, curwp->w_doto - 2), c)) #endif /* KINSOKU */ )); #else /* NOT KANJI */ } while ((c = lgetc(curwp->w_dotp, curwp->w_doto)) != ' ' && c != '\t' && curwp->w_doto > 0); #endif /* KANJI */ if (curwp->w_doto == 0) do { (VOID) forwchar(FFRAND, 1); #ifdef KANJI /* 90.01.29 by S.Yoshida */ } while (curwp->w_doto < llength(curwp->w_dotp) && ((c = lgetc(curwp->w_dotp, curwp->w_doto)) != ' ' && c != '\t' && !ISKANJI(c) && !ISKANJI(lgetc(curwp->w_dotp, curwp->w_doto - 1)) #ifdef KINSOKU /* 90.01.29 by S.Yoshida */ || (!ISKANJI((c = lgetc(curwp->w_dotp, curwp->w_doto - 1))) && iseolkchar(0, c) || curwp->w_doto > 1 && ISKANJI(c) && iseolkchar(lgetc(curwp->w_dotp, curwp->w_doto - 2), c)) #endif /* KINSOKU */ )); #else /* NOT KANJI */ } while ((c = lgetc(curwp->w_dotp, curwp->w_doto)) != ' ' && c != '\t' && curwp->w_doto < llength(curwp->w_dotp)); #endif /* KANJI */ (VOID) delwhite(FFRAND, 1); (VOID) lnewline(); #ifdef FILLPREFIX /* 90.12.31 by S.Yoshida */ /* Add the fill-prefix strings at the begin of line. */ { char *cp = fillprefix; #ifdef UNDO if (isundo()) { if (*undoptr != NULL) (*undoptr)->u_type = UDNONE; if (*cp) { if (linsert(1, *cp++) == FALSE) return FALSE; } while (*cp) { undoptr = undobefore; if (linsert(1, *cp) == FALSE) return FALSE; cp++; } } else #endif while (*cp) { if (linsert(1, *cp) == FALSE) return FALSE; cp++; } } #endif /* FILLPREFIX */ i = llength(curwp->w_dotp) - nce; #ifdef FILLPREFIX /* 90.12.31 by S.Yoshida */ curwp->w_doto = i>fillprefix_len ? i : fillprefix_len; #else /* NOT FILLPREFIX */ curwp->w_doto = i>0 ? i : 0; #endif /* FILLPREFIX */ curwp->w_flag |= WFMOVE; #ifdef KANJI /* 90.01.29 by S.Yoshida */ if (!inkfill) /* previously inserted. */ #endif /* KANJI */ #ifdef FILLPREFIX /* 90.12.31 by S.Yoshida */ if (nce == 0 && curwp->w_doto > fillprefix_len) return fillword(f, n); #else /* NOT FILLPREFIX */ if (nce == 0 && curwp->w_doto != 0) return fillword(f, n); #endif /* FILLPREFIX */ return TRUE; } /* Set fill column to n. */ setfillcol(f, n) { extern int getcolpos() ; #ifdef BUGFIX /* 90.02.14 by S.Yoshida */ fillcol = ((f & FFARG) ? n : (getcolpos() - 1)); #else /* ORIGINAL */ fillcol = ((f & FFARG) ? n : getcolpos()); #endif /* BUGFIX */ ewprintf("Fill column set to %d", fillcol); return TRUE; } #ifdef FILLPREFIX /* 90.12.30 by S.Yoshida */ /* * Set fill-prefix strings. */ setfillprefix(f, n) { register char c; register int col, i; #ifdef VARIABLE_TAB int tab = curbp->b_tabwidth; #endif /* VARIABLE_TAB */ fillprefix_col = getcolpos() - 1; if (fillprefix_col == 0) { fillprefix_len = 0; fillprefix[0] = '\0'; ewprintf("fill-prefix cancelled"); } else if (fillprefix_col + 1 > PREFIXLENGTH) { ewprintf("fill-prefix is too long; unchanged (\"%s\")", fillprefix); } else { for (i = col = 0; col < fillprefix_col; ++i, ++col) { c = lgetc(curwp->w_dotp, i); if (c == '\t' && !(curbp->b_flag & BFNOTAB) ) #ifdef VARIABLE_TAB col = (col/tab + 1)*tab - 1; #else col |= 0x07; #endif else if (ISCTRL(c) != FALSE) ++col; fillprefix[i] = c; } fillprefix_len = i; fillprefix[i] = '\0'; ewprintf("fill-prefix: \"%s\"", fillprefix); } return TRUE; } #endif /* FILLPREFIX */ ng-1.5beta1/random.c100644 1750 1750 64216 7632242733 13136 0ustar amurausers/* $Id: random.c,v 1.10.2.1 2003/03/08 01:22:35 amura Exp $ */ /* * Assorted commands. * The file contains the command * processors for a large assortment of unrelated * commands. The only thing they have in common is * that they are all command processors. */ /* * $Log: random.c,v $ * Revision 1.10.2.1 2003/03/08 01:22:35 amura * NOTAB is always enabled * * Revision 1.10 2001/07/23 17:12:02 amura * fix mark handling when make newline on the mark position * * Revision 1.9 2001/07/22 20:46:58 amura * before checkin has bug. now mark handling is fixed * * Revision 1.8 2001/06/19 15:15:32 amura * add correcting mark position when yank empty line * * Revision 1.7 2001/05/25 15:37:21 amura * now buffers have only one mark (before windows have one mark) * * Revision 1.6 2001/02/18 17:07:26 amura * append AUTOSAVE feature (but NOW not work) * * Revision 1.5 2001/01/05 14:07:04 amura * first implementation of Hojo Kanji support * * -- snip -- * * Revision 1.1 2000/06/01 05:35:32 amura * Initial revision * */ /* 90.01.29 Modified for Ng 1.0 by S.Yoshida */ /* 91.11.30 Modified by bsh */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include "def.h" #ifdef UNDO #include "undo.h" #endif /* * Display a bunch of useful information about * the current location of dot. The character under the * cursor (in octal), the current line, row, and column, and * approximate position of the cursor in the file (as a percentage) * is displayed. The column position assumes an infinite position * display; it does not truncate just because the screen does. * This is normally bound to "C-X =". */ /*ARGSUSED*/ showcpos(f, n) { register LINE *clp; register long nchar; long cchar=0; register int nline, row; int cline=0, cbyte=0; /* Current line/char/byte */ #ifdef CHGMISC /* 99.3.26 by M.Suzuki */ int cbyte2; #endif /* CHGMISC */ int ratio; int x, y; clp = lforw(curbp->b_linep); /* Collect the data. */ nchar = 0; nline = 0; for (;;) { ++nline; /* Count this line */ if (clp == curwp->w_dotp) { cline = nline; /* Mark line */ cchar = nchar + curwp->w_doto; #ifdef CHGMISC /* 99.3.26 by M.Suzuki */ if (curwp->w_doto == llength(clp)){ cbyte = '\n'; cbyte2 = 0; } else { cbyte = lgetc(clp, curwp->w_doto); cbyte2 = lgetc(clp, curwp->w_doto+1); } #else if (curwp->w_doto == llength(clp)) cbyte = '\n'; else cbyte = lgetc(clp, curwp->w_doto); #endif } nchar += llength(clp); /* Now count the chars */ clp = lforw(clp); if (clp == curbp->b_linep) break; nchar++; /* count the newline */ } row = curwp->w_toprow + 1; /* Determine row. */ clp = curwp->w_linep; while (clp!=curbp->b_linep && clp!=curwp->w_dotp) { row += countlines(clp); clp = lforw(clp); } row += colrow(clp, curwp->w_doto, &x, &y); /*NOSTRICT*/ ratio = nchar ? (100L*cchar) / nchar : 100; #ifdef CHGMISC /* 99.3.26 by M.Suzuki */ if (ISKANJI(cbyte)){ char w[3]; w[0] = cbyte; w[1] = cbyte2; w[2] = '\0'; ewprintf("Char: %s (0%o,0%o)(0x%x,0x%x) point=%ld(%d%%) " "line=%d offset=%d row=%d col=%d", w, cbyte, cbyte2, cbyte, cbyte2, cchar, ratio, cline, getcolpos(), row, x+1); } else #endif /* CHGMISC */ ewprintf( "Char: %c (0%o) point=%ld(%d%%) line=%d offset=%d row=%d col=%d", cbyte, cbyte, cchar, ratio, cline, getcolpos(), row, x+1); return TRUE; } getcolpos() { register int col, i, c; #ifdef SS_SUPPORT /* 92.11.21 by S.Sasaki */ int kan2nd = 0; #endif /* SS_SUPPORT */ #ifdef VARIABLE_TAB int tab = curbp->b_tabwidth; #endif /* VARIABLE_TAB */ #ifdef BUGFIX /* 90.04.10 by m.tei (Nikkei MIX) */ col = 0; /* Determine column. */ #else /* NOT BUGFIX */ col = 1; /* Determine column. */ #endif /* BUGFIX */ for (i=0; iw_doto; ++i) { c = lgetc(curwp->w_dotp, i); if (c == '\t' && !(curbp->b_flag & BFNOTAB)) { #ifdef VARIABLE_TAB col = (col/tab + 1)*tab - 1; #else col |= 0x07; #endif #ifndef BUGFIX /* 90.04.10 by m.tei (Nikkei MIX) */ ++col; #endif /* BUGFIX */ } else if (ISCTRL(c) != FALSE) ++col; ++col; #ifdef SS_SUPPORT /* 92.11.21 by S.Sasaki */ if (ISKANJI(c)) { #ifdef HOJO_KANJI if (ISHOJO(c) && kan2nd==0) { kan2nd = 3; col--; } #endif #ifdef HANKANA if (ISHANKANA(c) && kan2nd==0) col--; #endif if (kan2nd == 0) kan2nd = 1; else kan2nd--; } #endif /* SS_SUPPORT */ } #ifdef BUGFIX /* 90.04.10 by m.tei (Nikkei MIX) */ col++; #endif /* BUGFIX */ return col; } /* * Twiddle the two characters on either side of * dot. If dot is at the end of the line twiddle the * two characters before it. Return with an error if dot * is at the beginning of line; it seems to be a bit * pointless to make this work. This fixes up a very * common typo with a single stroke. Normally bound * to "C-T". This always works within a line, so * "WFEDIT" is good enough. */ /*ARGSUSED*/ twiddle(f, n) { register LINE *dotp; register int doto; register int cr; #ifdef KANJI /* 90.01.29 by S.Yoshida */ register int cr2; register int cr3; register int cr4; #endif /* KANJI */ VOID lchange(); #ifdef UNDO UNDO_DATA *undo; #endif #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ dotp = curwp->w_dotp; doto = curwp->w_doto; if(doto==llength(dotp)) { if(--doto<=0) return FALSE; #ifdef KANJI /* 90.01.29 by S.Yoshida */ if (ISKANJI(lgetc(dotp, doto))) { if (--doto <= 0) return FALSE; } #endif /* KANJI */ } else { if(doto==0) return FALSE; ++curwp->w_doto; #ifdef KANJI /* 90.01.29 by S.Yoshida */ if (ISKANJI(lgetc(dotp, doto))) { ++curwp->w_doto; } #endif /* KANJI */ } #ifdef UNDO undo_setup(undo); if (isundo()) { undo_bfree(undo); undo->u_dotlno = get_lineno(curbp,dotp); undo->u_doto = doto; undo->u_type = UDTWIDDLE; undo->u_used = 0; undo_finish(&(undo->u_next)); } #endif /* UNDO */ #ifdef KANJI /* 90.01.29 by S.Yoshida */ cr = lgetc(dotp, doto); if (ISKANJI(cr)) { /* It's KANJI 1st byte. */ cr2 = lgetc(dotp, doto + 1); /* Get KANJI 2nd byte. */ } else { cr2 = '\0'; /* cr is ASCII. */ /* 91.01.15 NULL -> '\0' */ } cr3 = lgetc(dotp, --doto); if (ISKANJI(cr3)) { /* It's KANJI 2nd byte. */ cr4 = cr3; cr3 = lgetc(dotp, --doto); /* Get KANJI 1st byte. */ } else { cr4 = '\0'; /* cr3 is ASCII. */ /* 91.01.15 NULL -> '\0' */ } lputc(dotp, doto++, cr); /* ASCII or KANJI 1st. */ if (cr2 != '\0') { /* This char is KANJI. */ /* 91.01.15 NULL -> '\0' */ lputc(dotp, doto++, cr2); /* Put KANJI 2nd byte. */ } lputc(dotp, doto++, cr3); /* ASCII or KANJI 1st. */ if (cr4 != '\0') { /* This char is KANJI. */ /* 91.01.15 NULL -> '\0' */ lputc(dotp, doto++, cr4); } #else /* NOT KANJI */ cr = lgetc(dotp, doto--); lputc(dotp, doto+1, lgetc(dotp, doto)); lputc(dotp, doto, cr); #endif /* KANJI */ lchange(WFEDIT); return TRUE; } /* * Open up some blank space. The basic plan * is to insert a bunch of newlines, and then back * up over them. Everything is done by the subcommand * procerssors. They even handle the looping. Normally * this is bound to "C-O". */ /*ARGSUSED*/ openline(f, n) { register int i; register int s; #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ if (n < 0) return FALSE; if (n == 0) return TRUE; i = n; /* Insert newlines. */ do { s = lnewline(); } while (s==TRUE && --i); if (s == TRUE) /* Then back up overtop */ s = backchar(f | FFRAND, n); /* of them all. */ return s; } /* * Insert a newline. * If you are at the end of the line and the * next line is a blank line, just move into the * blank line. This makes "C-O" and "C-X C-O" work * nicely, and reduces the ammount of screen * update that has to be done. This would not be * as critical if screen update were a lot * more efficient. */ /*ARGSUSED*/ newline(f, n) { #ifndef BUGFIX /* 90.02.14 by S.Yoshida */ register LINE *lp; #endif /* BUGFIX */ register int s; #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ if (n < 0) return FALSE; while (n--) { #ifndef BUGFIX /* 90.02.14 by S.Yoshida */ lp = curwp->w_dotp; if (llength(lp) == curwp->w_doto && lforw(lp) != curbp->b_linep && llength(lforw(lp)) == 0) { if ((s=forwchar(FFRAND, 1)) != TRUE) return s; } else #endif /* BUGFIX */ if ((s=lnewline()) != TRUE) return s; } return TRUE; } /* * Delete blank lines around dot. * What this command does depends if dot is * sitting on a blank line. If dot is sitting on a * blank line, this command deletes all the blank lines * above and below the current line. If it is sitting * on a non blank line then it deletes all of the * blank lines after the line. Normally this command * is bound to "C-X C-O". Any argument is ignored. */ /*ARGSUSED*/ deblank(f, n) { register LINE *lp1; register LINE *lp2; register RSIZE nld; #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ lp1 = curwp->w_dotp; while (llength(lp1)==0 && (lp2=lback(lp1))!=curbp->b_linep) lp1 = lp2; lp2 = lp1; nld = (RSIZE) 0; while ((lp2=lforw(lp2))!=curbp->b_linep && llength(lp2)==0) ++nld; if (nld == 0) return (TRUE); curwp->w_dotp = lforw(lp1); curwp->w_doto = 0; return ldelete((RSIZE)nld, KNONE); } /* * Delete any whitespace around dot, then insert a space. */ justone(f, n) { #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ (VOID) delwhite(f, n); return linsert(1, ' '); } /* * Delete any whitespace around dot. */ /*ARGSUSED*/ delwhite(f, n) { register int col, c, s; #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ col = curwp->w_doto; while (((c = lgetc(curwp->w_dotp, col)) == ' ' || c == '\t') && col < llength(curwp->w_dotp)) ++col; do { if (curwp->w_doto == 0) { s = FALSE; break; } if ((s = backchar(FFRAND, 1)) != TRUE) break; } while ((c = lgetc(curwp->w_dotp, curwp->w_doto)) == ' ' || c == '\t'); if (s == TRUE) (VOID) forwchar(FFRAND, 1); (VOID) ldelete((RSIZE)(col - curwp->w_doto), KNONE); return TRUE; } /* * Insert a newline, then enough * tabs and spaces to duplicate the indentation * of the previous line. Assumes tabs are every eight * characters. Quite simple. Figure out the indentation * of the current line. Insert a newline by calling * the standard routine. Insert the indentation by * inserting the right number of tabs and spaces. * Return TRUE if all ok. Return FALSE if one * of the subcomands failed. Normally bound * to "C-J". */ /*ARGSUSED*/ indent(f, n) { register int nicol; register int c; register int i; #ifdef VARIABLE_TAB int tab = curbp->b_tabwidth; #endif /* VARIABLE_TAB */ #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ if (n < 0) return (FALSE); while (n--) { nicol = 0; for (i=0; iw_dotp); ++i) { c = lgetc(curwp->w_dotp, i); if (c!=' ' && c!='\t') break; if (c == '\t') #ifdef VARIABLE_TAB nicol = (nicol/tab + 1)*tab - 1; #else nicol |= 0x07; #endif ++nicol; } if (lnewline() == FALSE || ((curbp->b_flag&BFNOTAB) ? linsert(nicol, ' ') == FALSE : ( ((i=nicol/8)!=0 && linsert(i, '\t')==FALSE) || ((i=nicol%8)!=0 && linsert(i, ' ')==FALSE)))) return FALSE; } return TRUE; } /* * Delete forward. This is real * easy, because the basic delete routine does * all of the work. Watches for negative arguments, * and does the right thing. If any argument is * present, it kills rather than deletes, to prevent * loss of text if typed with a big argument. * Normally bound to "C-D". */ /*ARGSUSED*/ forwdel(f, n) { #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ if (n < 0) return backdel(f | FFRAND, -n); if (f & FFARG) { /* Really a kill. */ if ((lastflag&CFKILL) == 0) kdelete(); thisflag |= CFKILL; } return ldelete((RSIZE) n, (f & FFARG) ? KFORW : KNONE); } /* * Delete backwards. This is quite easy too, * because it's all done with other functions. Just * move the cursor back, and delete forwards. * Like delete forward, this actually does a kill * if presented with an argument. */ /*ARGSUSED*/ backdel(f, n) { register int s; #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ if (n < 0) return forwdel(f | FFRAND, -n); if (f & FFARG) { /* Really a kill. */ if ((lastflag&CFKILL) == 0) kdelete(); thisflag |= CFKILL; } if ((s=backchar(f | FFRAND, n)) == TRUE) s = ldelete((RSIZE) n, (f & FFARG) ? KFORW : KNONE); #ifdef UNDO if (isundo() && undobefore!=NULL) (*undobefore)->u_type = UDBS; #endif return s; } /* * Kill line. If called without an argument, * it kills from dot to the end of the line, unless it * is at the end of the line, when it kills the newline. * If called with an argument of 0, it kills from the * start of the line to dot. If called with a positive * argument, it kills from dot forward over that number * of newlines. If called with a negative argument it * kills any text before dot on the current line, * then it kills back abs(arg) lines. */ /*ARGSUSED*/ killline(f, n) { register RSIZE chunk; register LINE *nextp; register int i, c; VOID kdelete(); #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ if ((lastflag&CFKILL) == 0) /* Clear kill buffer if */ kdelete(); /* last wasn't a kill. */ thisflag |= CFKILL; if (!(f & FFARG)) { for (i = curwp->w_doto; i < llength(curwp->w_dotp); ++i) if ((c = lgetc(curwp->w_dotp, i)) != ' ' && c != '\t') break; if (i == llength(curwp->w_dotp)) chunk = llength(curwp->w_dotp)-curwp->w_doto + 1; else { chunk = llength(curwp->w_dotp)-curwp->w_doto; if (chunk == 0) chunk = 1; } } else if (n > 0) { chunk = llength(curwp->w_dotp)-curwp->w_doto+1; nextp = lforw(curwp->w_dotp); i = n; while (--i) { if (nextp == curbp->b_linep) break; chunk += llength(nextp)+1; nextp = lforw(nextp); } } else { /* n <= 0 */ chunk = curwp->w_doto; curwp->w_doto = 0; i = n; while (i++) { if (lback(curwp->w_dotp) == curbp->b_linep) break; curwp->w_dotp = lback(curwp->w_dotp); curwp->w_flag |= WFMOVE; chunk += llength(curwp->w_dotp)+1; } } /* * KFORW here is a bug. Should be KBACK/KFORW, but we need to * rewrite the ldelete code (later)? */ return (ldelete(chunk, KFORW)); } /* */ /* Kill oneline by S.Sasaki May-05-1992 */ /* */ killoneline(f, n) { register RSIZE chunk; register LINE *nextp; register int i; VOID kdelete(); #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ if ((lastflag&CFKILL) == 0) /* Clear kill buffer if */ kdelete(); /* last wasn't a kill. */ thisflag |= CFKILL; if (!(f & FFARG)) { curwp->w_doto = 0; chunk = llength(curwp->w_dotp) + 1; } else if (n > 0) { curwp->w_doto = 0; chunk = llength(curwp->w_dotp)+1; nextp = lforw(curwp->w_dotp); i = n; while (--i) { if (nextp == curbp->b_linep) break; chunk += llength(nextp)+1; nextp = lforw(nextp); } } else { /* n <= 0 */ chunk = llength(curwp->w_dotp)+1; curwp->w_doto = 0; i = n; while (i++) { if (lback(curwp->w_dotp) == curbp->b_linep) break; curwp->w_dotp = lback(curwp->w_dotp); curwp->w_flag |= WFMOVE; chunk += llength(curwp->w_dotp)+1; } } /* * KFORW here is a bug. Should be KBACK/KFORW, but we need to * rewrite the ldelete code (later)? */ return ldelete(chunk,KFORW); } /* * Yank text back from the kill buffer. This * is really easy. All of the work is done by the * standard insert routines. All you do is run the loop, * and check for errors. The blank * lines are inserted with a call to "newline" * instead of a call to "lnewline" so that the magic * stuff that happens when you type a carriage * return also happens when a carriage return is * yanked back from the kill buffer. * An attempt has been made to fix the cosmetic bug * associated with a yank when dot is on the top line of * the window (nothing moves, because all of the new * text landed off screen). */ /*ARGSUSED*/ yank(f, n) { register int c; register int i; register LINE *lp; register int nline; VOID isetmark(); int mark_adjust = FALSE; #ifdef UNDO int run_insert = FALSE; #endif #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ if (n < 0) return FALSE; #ifdef CLIPBOARD if ( !receive_clipboard() ) { return FALSE ; } #endif /* CLIPBOARD */ nline = 0; /* Newline counting. */ while (n--) { isetmark(); /* mark around last yank */ i = 0; #ifdef UNDO if (isundo()) { extern int get_lineno pro((BUFFER*,LINE*)); extern int set_lineno; set_lineno = get_lineno(curbp, curwp->w_dotp); while ((c=kremove(i)) >= 0) { if (c == '\n') { if (i == 0 && curbp->b_marko == 0) mark_adjust = TRUE; if (newline(FFRAND, 1) == FALSE) { set_lineno = -1; return FALSE; } /* Mark position correction. */ if (mark_adjust) { LINE *lp=lback(curwp->w_dotp); curbp->b_markp = lp; curbp->b_marko = llength(lp); mark_adjust = FALSE; } ++nline; set_lineno++; run_insert = FALSE; } else { if (run_insert) undoptr = undobefore; else if (*undoptr != NULL) (*undoptr)->u_type = UDNONE; if (linsert(1, c) == FALSE) { set_lineno = -1; return FALSE; } run_insert = TRUE; } ++i; } set_lineno = -1; } else #endif while ((c=kremove(i)) >= 0) { if (c == '\n') { if (i == 0 && curbp->b_marko == 0) mark_adjust = TRUE; if (newline(FFRAND, 1) == FALSE) return FALSE; /* Mark position correction. */ if (mark_adjust) { LINE *lp=lback(curwp->w_dotp); curbp->b_markp = lp; curbp->b_marko = llength(lp); mark_adjust = FALSE; } ++nline; } else { if (linsert(1, c) == FALSE) return FALSE; } ++i; } } lp = curwp->w_linep; /* Cosmetic adjustment */ if (curwp->w_dotp == lp) { /* if offscreen insert. */ while (nline > 0 && lback(lp)!=curbp->b_linep) { lp = lback(lp); nline --; } curwp->w_linep = lp; /* Adjust framing. */ curwp->w_lines = 0; curwp->w_flag |= WFHARD; } return TRUE; } /*ARGSUSED*/ space_to_tabstop(f, n) int f, n; { #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ if(n<0) return FALSE; if(n==0) return TRUE; return linsert((n<<3) - (curwp->w_doto & 7), ' '); } #ifdef ZAPTOC_A # define ZAPTOCHAR #endif #ifdef ZAPTOCHAR /* Nov 91, bsh */ /* * Zap to ARG'th occurence of char, but not including it. * Goes backward if ARG is negative. * #ifdef ZAPTOC_A * Goes to end of buffer if char not found. * #else * do nothing if it can't reach to ARG'th occurence of char. * #endif * * Real work to search CHAR is done by forwsrch, which does real work * of forwsearch() (M-x search-forward). Global buffer `pat' is used * for interface. */ zaptochar(f,n) { int c; RSIZE nbytes; LINE *sp = curwp->w_dotp; /* save dot */ int so = curwp->w_doto; LINE *cp; int co; ewprintf( "Zap to char: " ); c = getkey(FALSE); if( c == CCHR('G') ) /* you can't zap to ^G */ return FALSE; pat[0] = c; #ifndef KANJI pat[1] = '\0'; #else if( !ISKANJI(c) ) pat[1] = '\0'; #ifdef HOJO_KANJI else if( ISHOJO(c) ) { c = getkey(FALSE); if( !ISKANJI(c) ) return FALSE; pat[1] = c; c = getkey(FALSE); if( !ISKANJI(c) ) return FALSE; pat[2] = c; pat[3] = '\0'; } #endif else { c = getkey(FALSE); if( !ISKANJI(c) ) return FALSE; pat[1] = c; pat[2] = '\0'; } #endif /* KANJI */ if( n == 0 ) n = 1; if( n < 0 ){ while(n < 0 && backsrch()) ++n; if( n < 0 ){ /* not found */ #ifdef ZAPTOC_A curwp->w_dotp = lforw(curbp->b_linep); curwp->w_doto = 0; #else /* Safer */ goto notfound; #endif } else { /* Not including last occurence of CHR */ forwchar( FFRAND, 1 ); } cp = curwp->w_dotp; co = curwp->w_doto; } else { while(n > 0 && forwsrch()) --n; if( n > 0 ){ #ifdef ZAPTOC_A curwp->w_dotp = lback(curbp->b_linep); curwp->w_doto = llength(curwp->w_dotp); #else goto notfound; #endif } else { /* Not including last occurence of CHAR */ backchar( FFRAND, 1 ); } co = so; cp = sp; so = curwp->w_doto; /* Swap dot and previous point */ sp = curwp->w_dotp; curwp->w_doto = co; /* Previous position */ curwp->w_dotp = cp; } /* Region to kill is (dot) .. (cp,co). * Count up chars and let ldelete() to do real work */ if( cp == sp ){ /* on the same line */ nbytes = so - co; } else { nbytes = llength(cp) - co + 1 + so; for(cp = lforw(cp); cp != sp; cp = lforw(cp)) nbytes += llength(cp)+1; } if ((lastflag&CFKILL) == 0) /* This is a kill type */ kdelete(); /* command, so do magic */ thisflag |= CFKILL; /* kill buffer stuff. */ return (ldelete(nbytes,KFORW)); notfound: ewprintf( "Not found" ); curwp->w_dotp = sp; curwp->w_doto = so; return FALSE; } #endif #ifdef ADDFUNC /* 90.02.15 by S.Yoshida */ /* * Count lines in the current page. (Now, page is same as buffer) */ /*ARGSUSED*/ pagelines(f, n) { register LINE *lp; register int prelines; register int postlines; register int totallines; prelines = 0; for (lp = lforw(curbp->b_linep); lp != curwp->w_dotp; lp = lforw(lp)) { prelines++; } if (curwp->w_doto > 0) { /* "dot" is in the line. */ prelines++; } postlines = 0; for (lp = curwp->w_dotp; lp != curbp->b_linep; lp = lforw(lp)) { postlines++; } if (curwp->w_dotp == lback(curbp->b_linep) && /* "dot" is at the */ curwp->w_doto == llength(curwp->w_dotp)) { /* end of buffer. */ postlines = 0; } else if (llength(lback(curbp->b_linep)) == 0) { /* Last line has */ /* no text. */ postlines--; } totallines = prelines + postlines; if (curwp->w_doto > 0 && !(curwp->w_dotp == lback(curbp->b_linep) && curwp->w_doto == llength(curwp->w_dotp))) { totallines--; } ewprintf("Page has %d lines (%d + %d)", totallines, prelines, postlines); return TRUE; } /* * Count lines in the current region. */ /*ARGSUSED*/ regionlines(f, n) { register LINE *lp; register int totallines; register int counting; totallines = 0; if (curwp->w_dotp == curbp->b_markp) { if (curwp->w_doto != curbp->b_marko) { totallines = 1; } } else { counting = FALSE; for (lp = lforw(curbp->b_linep); lp != curbp->b_linep; lp = lforw(lp)) { if (lp == curwp->w_dotp) { if (counting) { /* End of counting. */ if (curwp->w_doto > 0) { totallines++; } break; } else { /* Start of counting. */ counting = TRUE; } } else if (lp == curbp->b_markp) { if (counting) { /* End of counting. */ if (curbp->b_marko > 0) { totallines++; } break; } else { /* Start of counting. */ counting = TRUE; } } if (counting) { totallines++; } } } ewprintf("Region has %d lines", totallines); return TRUE; } /* Investigate the dot position to return a ratio value. The ratio value will be between 0 and 100. The following values are special case and all of them are negative value. MG_RATIO_ALL All portion of the buffer is shown in the window. MG_RATIO_TOP Top portion of the buffer is shown in the window. MG_RATIO_BOT Bottom portion of the buffer is shown in the window. By Tillanosoft, Mar 21, 1999. patched by amura, 2 Apl 2000 */ int windowpos(wp) register WINDOW *wp; { extern int rowcol2offset pro((LINE *, int, int)); LINE *lp, *targetlp; register BUFFER *bp = wp->w_bufp; int top = FALSE, bot = FALSE, off; int res = MG_RATIO_ALL; /* check if the beginning of top line is shown */ if (wp->w_linep == lforw(bp->b_linep)) { if (wp->w_lines == 0) { top = TRUE; } } /* check if the end of the bottom line is shown */ lp = wp->w_linep; off = rowcol2offset(lp, wp->w_lines + wp->w_ntrows, ncol); while (off < 0) { if (lforw(lp) != bp->b_linep) { lp = lforw(lp); off = rowcol2offset(lp, -off - 1, ncol); } else { bot = TRUE; break; } } if (top && bot) { res = MG_RATIO_ALL; } else if (top) { res = MG_RATIO_TOP; } else if (bot) { res = MG_RATIO_BOT; } else { /* count the bytes of the dot and the end */ long nchar = 0, cchar = 0; targetlp = wp->w_linep; lp = lforw(bp->b_linep); for (;;) { if (lp == targetlp) { cchar = nchar + skipline(lp, wp->w_lines); } nchar += llength(lp); /* Now count the chars */ lp = lforw(lp); if (lp == bp->b_linep) { break; } nchar++; /* count the newline */ } res = (cchar * 100) / nchar; if (res >= 100) { res = 99; } } return res; } #endif /* ADDFUNC */ ng-1.5beta1/re_search.c100644 1750 1750 45060 7166131702 13600 0ustar amurausers/* $Id: re_search.c,v 1.2 2000/10/02 16:11:46 amura Exp $ */ /* * regular expression search commands for * MicroGnuEmacs * * This file contains functions to implement several of gnuemacs' * regular expression functions for MicroGnuEmacs. Several of * the routines below are just minor rearrangements of the MicroGnuEmacs * non-regular expression search functions. Hence some of them date back * in essential structure to the original MicroEMACS; others are modifications * of Rich Ellison's code. I, Peter Newton, wrote about half from scratch. * * Although I have nothing to do with the GNU project, these functions * require the GNU project's regular expression package (files regex.c and * regex.h). Hence, this file comes under the same copyright notice * as the GNU project's code. As far as I know, the rest of MicroGnuEmacs * need not since it may be used independently of any GNU project code. In * any case, I certainly do not warrant either the correctness or utility * of this code. The GNU project copyright notice follows. Don't you * wish they would make it a bit shorter! */ /* GNU Emacs copying permission notice Copyright (C) 1985 Richard M. Stallman Verbatim copies of this document, including its copyright notice, may be distributed by anyone in any manner. Distribution with modifications is not permitted. GNU Emacs is distributed in the hope that it will be useful, but without any warranty. No author or distributor accepts responsibility to anyone for the consequences of using it or for whether it serves any particular purpose or works at all, unless he says so in writing. Everyone is granted permission to copy, modify and redistribute GNU Emacs under the following conditions: Permission is granted to anyone to make or distribute verbatim copies of GNU Emacs source code as received, in any medium, provided that all copyright notices and permission and nonwarranty notices are preserved, and that the distributor grants the recipient permission for further redistribution as permitted by this document, and gives him and points out to him an exact copy of this document to inform him of his rights. Permission is granted to distribute modified versions of GNU Emacs source code, or of portions of it, under the above conditions, provided also that all changed files carry prominent notices stating who last changed them and that all the GNU-Emacs-derived material, including everything packaged together with it and not independently usable, is distributed under the conditions stated in this document. Permission is granted to distribute GNU Emacs in compiled or executable form under the same conditions applying for source code, provided that either A. it is accompanied by the corresponding machine-readable source code, or B. it is accompanied by a written offer, with no time limit, to give anyone a machine-readable copy of the corresponding source code in return for reimbursement of the cost of distribution. This written offer must permit verbatim duplication by anyone. C. it is distributed by someone who received only the executable form, and is accompanied by a copy of the written offer of source code which he received along with it. In other words, you are welcome to use, share and improve GNU Emacs You are forbidden to forbid anyone else to use, share and improve what you give them. Help stamp out software-hoarding! */ /* * $Log: re_search.c,v $ * Revision 1.2 2000/10/02 16:11:46 amura * small fix in re_searchagain() * * Revision 1.1.1.1 2000/06/27 01:47:56 amura * import to CVS * */ #include "config.h" /* 90.12.20 by S.Yoshida */ #ifdef REGEX #include "def.h" #include "macro.h" #define SRCH_BEGIN (0) /* Search sub-codes. */ #define SRCH_FORW (-1) #define SRCH_BACK (-2) #define SRCH_NOPR (-3) #define SRCH_ACCM (-4) #define SRCH_MARK (-5) char re_pat[NPAT]; /* Regex pattern */ int re_srch_lastdir = SRCH_NOPR; /* Last search flags. */ int casefoldsearch = TRUE; /* Does search ignore case ? */ /* Indexed by a character, gives the upper case equivalent of the character */ static unsigned char upcase[0400] = { 000, 001, 002, 003, 004, 005, 006, 007, 010, 011, 012, 013, 014, 015, 016, 017, 020, 021, 022, 023, 024, 025, 026, 027, 030, 031, 032, 033, 034, 035, 036, 037, 040, 041, 042, 043, 044, 045, 046, 047, 050, 051, 052, 053, 054, 055, 056, 057, 060, 061, 062, 063, 064, 065, 066, 067, 070, 071, 072, 073, 074, 075, 076, 077, 0100, 0101, 0102, 0103, 0104, 0105, 0106, 0107, 0110, 0111, 0112, 0113, 0114, 0115, 0116, 0117, 0120, 0121, 0122, 0123, 0124, 0125, 0126, 0127, 0130, 0131, 0132, 0133, 0134, 0135, 0136, 0137, 0140, 0101, 0102, 0103, 0104, 0105, 0106, 0107, 0110, 0111, 0112, 0113, 0114, 0115, 0116, 0117, 0120, 0121, 0122, 0123, 0124, 0125, 0126, 0127, 0130, 0131, 0132, 0173, 0174, 0175, 0176, 0177, 0200, 0201, 0202, 0203, 0204, 0205, 0206, 0207, 0210, 0211, 0212, 0213, 0214, 0215, 0216, 0217, 0220, 0221, 0222, 0223, 0224, 0225, 0226, 0227, 0230, 0231, 0232, 0233, 0234, 0235, 0236, 0237, 0240, 0241, 0242, 0243, 0244, 0245, 0246, 0247, 0250, 0251, 0252, 0253, 0254, 0255, 0256, 0257, 0260, 0261, 0262, 0263, 0264, 0265, 0266, 0267, 0270, 0271, 0272, 0273, 0274, 0275, 0276, 0277, 0300, 0301, 0302, 0303, 0304, 0305, 0306, 0307, 0310, 0311, 0312, 0313, 0314, 0315, 0316, 0317, 0320, 0321, 0322, 0323, 0324, 0325, 0326, 0327, 0330, 0331, 0332, 0333, 0334, 0335, 0336, 0337, 0340, 0341, 0342, 0343, 0344, 0345, 0346, 0347, 0350, 0351, 0352, 0353, 0354, 0355, 0356, 0357, 0360, 0361, 0362, 0363, 0364, 0365, 0366, 0367, 0370, 0371, 0372, 0373, 0374, 0375, 0376, 0377 }; /* * Search forward. * Get a search string from the user, and search for it, * starting at ".". If found, "." gets moved to just after the * matched characters, and display does all the hard stuff. * If not found, it just prints a message. */ /*ARGSUSED*/ re_forwsearch(f, n) { register int s; if ((s=re_readpattern("RE Search")) != TRUE) return (s); if (re_forwsrch() == FALSE) { ewprintf("Search failed: \"%s\"", re_pat); return (FALSE); } re_srch_lastdir = SRCH_FORW; return (TRUE); } /* * Reverse search. * Get a search string from the user, and search, starting at "." * and proceeding toward the front of the buffer. If found "." is left * pointing at the first character of the pattern [the last character that * was matched]. */ /*ARGSUSED*/ re_backsearch(f, n) { register int s; if ((s=re_readpattern("RE Search backward")) != TRUE) return (s); if (re_backsrch() == FALSE) { ewprintf("Search failed: \"%s\"", re_pat); return (FALSE); } re_srch_lastdir = SRCH_BACK; return (TRUE); } /* * Search again, using the same search string * and direction as the last search command. The direction * has been saved in "srch_lastdir", so you know which way * to go. */ /*ARGSUSED*/ /* This code has problems-- some incompatibility(?) with extend.c causes match to fail when it should not. */ re_searchagain(f, n) { if (re_srch_lastdir == SRCH_NOPR) { ewprintf("No last search"); return (FALSE); } if (re_srch_lastdir == SRCH_FORW) { if (re_forwsrch() == FALSE) { ewprintf("Search failed: \"%s\"", re_pat); return (FALSE); } return (TRUE); } if (re_srch_lastdir == SRCH_BACK) { if (re_backsrch() == FALSE) { ewprintf("Search failed: \"%s\"", re_pat); return (FALSE); } return (TRUE); } return (FALSE); } #ifdef REGEX_JAPANESE #include "regex_j.h" #else #include "regex_e.h" #endif #define BYTEWIDTH 8 /* Compiled regex goes here-- changed only when new pattern read */ static struct re_pattern_buffer re_buff; static char fastmap[(1 << BYTEWIDTH)]; /* regs holds boundaries of matched text */ static struct re_registers regs; /* * Re-Query Replace. * Replace strings selectively. Does a search and replace operation. */ /*ARGSUSED*/ re_queryrepl(f, n) { register int s; register int rcnt = 0; /* Replacements made so far */ register int plen; /* length of found string */ char news[NPAT]; /* replacement string */ #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ /* Casefold check */ if (!casefoldsearch) f = TRUE; if ((s=re_readpattern("RE Query replace")) != TRUE) return (s); if ((s=ereply("Query replace %s with: ",news, NPAT, re_pat)) == ABORT) return (s); if (s == FALSE) news[0] = '\0'; ewprintf("Query replacing %s with %s:", re_pat, news); /* * Search forward repeatedly, checking each time whether to insert * or not. The "!" case makes the check always true, so it gets put * into a tighter loop for efficiency. */ while (re_forwsrch() == TRUE) { retry: update(); switch (getkey(FALSE)) { case ' ': #ifdef EMACS_QUERY_KEYS case 'y': case 'Y': #endif /* EMACS_QUERY_KEYS */ plen = regs.end[0] - regs.start[0]; if (re_doreplace((RSIZE) plen, news, f) == FALSE) return (FALSE); rcnt++; break; case '.': plen = regs.end[0] - regs.start[0]; if (re_doreplace((RSIZE) plen, news, f) == FALSE) return (FALSE); rcnt++; goto stopsearch; case CCHR('G'): /* ^G */ (VOID) ctrlg(FFRAND, 0); case CCHR('['): /* ESC */ case '`': #ifdef EMACS_QUERY_KEYS case CCHR('M'): #endif /* EMACS_QUERY_KEYS */ goto stopsearch; case '!': do { plen = regs.end[0] - regs.start[0]; if (re_doreplace((RSIZE) plen, news, f) == FALSE) return (FALSE); rcnt++; } while (re_forwsrch() == TRUE); goto stopsearch; case CCHR('?'): /* To not replace */ #ifdef EMACS_QUERY_KEYS case 'n': case 'N': #endif /* EMACS_QUERY_KEYS */ break; default: ewprintf(" replace, [.] rep-end, don't, [!] repl rest quit"); goto retry; } } stopsearch: curwp->w_flag |= WFHARD; update(); if (!inmacro) { if (rcnt == 0) ewprintf("(No replacements done)"); else if (rcnt == 1) ewprintf("(1 replacement done)"); else ewprintf("(%d replacements done)", rcnt); } return TRUE; } /* Routine re_doreplace calls lreplace to make replacements needed by * re_query replace. Its reason for existence is to deal with \1, * \2. etc. */ /* Maximum length of replacement string */ #define REPLEN 256 re_doreplace(plen, st, f) register RSIZE plen; /* length to remove */ char *st; /* replacement string */ int f; /* case hack disable */ { int s; int num, k; register int j; int more, state; LINE *clp; char repstr[REPLEN]; clp = curwp->w_dotp; more = TRUE; j = 0; state = 0; /* The following FSA parses the replacement string */ while (more) { switch (state) { case 0: if (*st == '\\') { st++; state = 1; } else if (*st == '\0') more = FALSE; else { repstr[j] = *st; j++; if (j >= REPLEN) return(FALSE); st++; } break; case 1: if (*st >= '0' && *st <= '9') { num = *st - '0'; st++; state = 2; } else if (*st == '\0') more = FALSE; else { repstr[j] = *st; j++; if (j >= REPLEN) return(FALSE); st++; state = 0; } break; case 2: if (*st >= '0' && *st <= '9') { num = 10*num + *st - '0'; st++; } else { if (num >= RE_NREGS) return(FALSE); k = regs.end[num] - regs.start[num]; if (j+k >= REPLEN) return(FALSE); bcopy(&(clp->l_text[regs.start[num]]), &repstr[j], k); j += k; if (*st == '\0') more = FALSE; if (*st == '\\') { st++; state = 1; } else { repstr[j] = *st; j++; if (j >= REPLEN) return(FALSE); st++; state = 0; } } break; } /* end case */ } /* end while */ repstr[j] = '\0'; s = lreplace(plen, repstr, f); return(s); } /* * This routine does the real work of a * forward search. The pattern is sitting in the external * variable "pat". If found, dot is updated, the window system * is notified of the change, and TRUE is returned. If the * string isn't found, FALSE is returned. */ re_forwsrch() { register LINE *clp; register int tbo; int ntries; int i, plen; clp = curwp->w_dotp; tbo = curwp->w_doto; if (tbo == clp->l_used) /* Don't start matching off end of line-- must * move to beginning of next line, unless at end */ if (clp != curbp->b_linep) { clp = lforw(clp); tbo = 0; } /* Note this loop does not process the last line, but this editor always makes the last line empty so this is good. */ while (clp != (curbp->b_linep)) { ntries = llength(clp) - tbo; i = re_search (&re_buff, ltext(clp), llength(clp), tbo, ntries, ®s); if (i == -1) { clp = lforw(clp); tbo = 0; } else { curwp->w_doto = regs.end[0]; curwp->w_dotp = clp; curwp->w_flag |= WFMOVE; return (TRUE); } } return(FALSE); } /* * This routine does the real work of a * backward search. The pattern is sitting in the external * variable "re_pat". If found, dot is updated, the window system * is notified of the change, and TRUE is returned. If the * string isn't found, FALSE is returned. */ re_backsrch() { register LINE *clp; register int tbo; int ntries; int i, startpos; char m[1]; clp = curwp->w_dotp; tbo = curwp->w_doto; /* Start search one position to the left of dot */ tbo = tbo - 1; if (tbo < 0) { /* must move up one line */ clp = lback(clp); tbo = llength(clp); } /* Note this loop does not process the last line, but this editor always makes the last line empty so this is good. */ while (clp != (curbp->b_linep)) { ntries = tbo; i = re_search (&re_buff, ltext(clp), llength(clp), tbo, -ntries, ®s); if (i == -1) { clp = lback(clp); tbo = llength(clp); } else { curwp->w_doto = regs.start[0]; curwp->w_dotp = clp; curwp->w_flag |= WFMOVE; return (TRUE); } } return(FALSE); } /* * Read a pattern. * Stash it in the external variable "re_pat". The "pat" is * not updated if the user types in an empty line. If the user typed * an empty line, and there is no old pattern, it is an error. * Display the old pattern, in the style of Jeff Lomicka. There is * some do-it-yourself control expansion. */ re_readpattern(prompt) char *prompt; { register int s; char tpat[NPAT]; char *message; if (re_pat[0] == '\0') s = ereply("%s: ", tpat, NPAT, prompt); else s = ereply("%s: (default %s) ", tpat, NPAT, prompt, re_pat); if (s == TRUE) { /* New pattern given */ (VOID) strcpy(re_pat, tpat); re_buff.allocated = 40; re_buff.buffer = (char *) malloc (re_buff.allocated); re_buff.fastmap = fastmap; if (casefoldsearch) re_buff.translate = upcase; else re_buff.translate = '\0'; message = re_compile_pattern (re_pat, strlen(re_pat), &re_buff); if (message != '\0') { ewprintf("Regex Error: %s", message); re_pat[0] = '\0'; return(FALSE); } re_compile_fastmap (&re_buff); } else if (s==FALSE && re_pat[0]!='\0') /* Just using old pattern */ s = TRUE; return (s); } /* Cause case to not matter in searches. This is the default. If * called with argument cause case to matter. */ setcasefold(f, n) { if (f & FFARG) { casefoldsearch = FALSE; ewprintf("Case-fold-search unset"); } else { casefoldsearch = TRUE; ewprintf("Case-fold-search set"); } /* Invalidate the regular expression pattern since I'm too lazy * to recompile it. */ re_pat[0] = '\0'; return(TRUE); } /* end setcasefold */ /* Delete all lines after dot that contain a string matching regex */ delmatchlines(f, n) { int s; if ((s=re_readpattern("Flush lines (containing match for regexp)")) != TRUE) return (s); s = killmatches(TRUE); return(s); } /* Delete all lines after dot that don't contain a string matching regex */ delnonmatchlines(f, n) { int s; if ((s=re_readpattern("Keep lines (containing match for regexp)")) != TRUE) return (s); s = killmatches(FALSE); return(s); } /* This function does the work of deleting matching lines */ killmatches(cond) int cond; { int s, i; int count = 0; LINE *clp; #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ clp = curwp->w_dotp; if (curwp->w_doto == llength(clp)) /* Consider dot on next line */ clp = lforw(clp); while (clp != (curbp->b_linep)) { /* see if line matches */ i = re_search (&re_buff, ltext(clp), llength(clp), 0, llength(clp), ®s); /* Delete line when appropriate */ if ((cond == FALSE && i == -1) || (cond == TRUE && i != -1)) { curwp->w_doto = 0; curwp->w_dotp = clp; count++; s = ldelete(llength(clp)+1, KNONE); clp = curwp->w_dotp; curwp->w_flag |= WFMOVE; if (s == FALSE) return(FALSE); } else clp = lforw(clp); } ewprintf("%d line(s) deleted", count); if (count > 0) curwp->w_flag |= WFMOVE; return(TRUE); } #ifndef BUGFIX /* 91.01.09 by S.Yoshida */ petersfunc(f, n) { int s; LINE *clp; char c; curwp->w_doto = 0; s = ldelete(llength(curwp->w_dotp)+1, KNONE); curwp->w_flag |= WFMOVE; return(s); } #endif /* BUGFIX */ /* Count lines matching regex */ cntmatchlines(f, n) { int s; if ((s=re_readpattern("Count lines (matching regexp)")) != TRUE) return (s); s = countmatches(TRUE); return(s); } /* Count lines that fail to match regex */ cntnonmatchlines(f, n) { int s; if ((s=re_readpattern("Count lines (not matching regexp)")) != TRUE) return (s); s = countmatches(FALSE); return(s); } /* This function does the work of counting matching lines */ countmatches(cond) int cond; { int s, i; int count = 0; LINE *clp; clp = curwp->w_dotp; if (curwp->w_doto == llength(clp)) /* Consider dot on next line */ clp = lforw(clp); while (clp != (curbp->b_linep)) { /* see if line matches */ i = re_search (&re_buff, ltext(clp), llength(clp), 0, llength(clp), ®s); /* Count line when appropriate */ if ((cond == FALSE && i == -1) || (cond == TRUE && i != -1)) count++; clp = lforw(clp); } if (cond) ewprintf("Number of lines matching: %d", count); else ewprintf("Number of lines not matching: %d", count); return(TRUE); } #endif ng-1.5beta1/regex.c100644 1750 1750 703 7126003714 12707 0ustar amurausers/* $Id: regex.c,v 1.1.1.1 2000/06/27 01:47:56 amura Exp $ */ /* This source is select Regular Expression routine */ /* * $Log: regex.c,v $ * Revision 1.1.1.1 2000/06/27 01:47:56 amura * import to CVS * */ #include "config.h" /* 90.12.20 by S.Yoshida */ #ifdef REGEX #include "def.h" /* defines VOID etc. for mg */ # define ng # ifdef REGEX_JAPANESE # include "kanji_.c" # include "regex_j.c" # else # include "regex_e.c" # endif #endif ng-1.5beta1/regex_e.c100644 1750 1750 126436 7126003714 13307 0ustar amurausers/* $Id: regex_e.c,v 1.1.1.1 2000/06/27 01:47:56 amura Exp $ */ /* Imagine Generic gnuemacs copyright notice here */ /* * $Log: regex_e.c,v $ * Revision 1.1.1.1 2000/06/27 01:47:56 amura * import to CVS * */ /* To test, compile with -Dtest. This Dtestable feature turns this into a self-contained program which reads a pattern, describes how it compiles, then reads a string and searches for it. */ #ifdef MSDOS /* 90.03.28 by A.Shirahashi */ #include #include #endif /* MSDOS */ #ifdef emacs /* The `emacs' switch turns on certain special matching commands that make sense only in emacs. */ #include "config.h" #include "lisp.h" #include "buffer.h" #include "syntax.h" #else /* not emacs */ /* * Define the syntax stuff, so we can do the \<...\> things. */ #ifndef Sword /* must be non-zero in some of the tests below... */ #define Sword 1 #endif #define SYNTAX(c) re_syntax_table[c] #ifdef SYNTAX_TABLE char *re_syntax_table; #else static char re_syntax_table[256]; static VOID init_syntax_once () { register int c; static int done = 0; if (done) return; bzero (re_syntax_table, sizeof re_syntax_table); for (c = 'a'; c <= 'z'; c++) re_syntax_table[c] = Sword; for (c = 'A'; c <= 'Z'; c++) re_syntax_table[c] = Sword; for (c = '0'; c <= '9'; c++) re_syntax_table[c] = Sword; done = 1; } #endif /* SYNTAX_TABLE */ #endif /* not emacs */ #include "regex_e.h" #ifdef MSDOS /* 90.03.28 by A.Shirahashi */ /* 90.12.26 Moved to here for TC++ 1.0 by Junn Ohta */ void *alloca(size_t); void init_syntax_once(void); char *re_compile_pattern(char *,int,struct re_pattern_buffer *); int store_jump(char *,char,char *); int insert_jump(char,char *,char *,char *); void re_compile_fastmap(struct re_pattern_buffer *); int re_search(struct re_pattern_buffer *,char *,int,int,int, struct re_registers *); int re_search_2(struct re_pattern_buffer *,char *,int,char *,int,int, int,struct re_registers *,int); int re_match(struct re_pattern_buffer *,char *,int,int, struct re_registers *); int re_match_2(struct re_pattern_buffer *,char *,int, char *,int,int,struct re_registers *,int); int bcmp_translate(char *,char *,int,char *); char *re_comp(char *); int re_exec(char *); #endif /* MSDOS */ /* Number of failure points to allocate space for initially, when matching. If this number is exceeded, more space is allocated, so it is not a hard limit. */ #ifndef NFAILURES #define NFAILURES 80 #endif NFAILURES /* width of a byte in bits */ #define BYTEWIDTH 8 /* These are the command codes that appear in compiled regular expressions, one per byte. Some command codes are followed by argument bytes. A command code can specify any interpretation whatever for its arguments. Zero-bytes may appear in the compiled regular expression. */ typedef char regexpcode; #define unused 0 #define exactn 1 /* followed by one byte giving n, and then by n literal bytes */ #define begline 2 /* fails unless at beginning of line */ #define endline 3 /* fails unless at end of line */ #define jump 4 /* followed by two bytes giving relative address to jump to */ #define on_failure_jump 5 /* followed by two bytes giving relative address of place */ /* to resume at in case of failure. */ #define finalize_jump 6 /* Throw away latest failure point and then jump to address. */ #define maybe_finalize_jump 7 /* Like jump but finalize if safe to do so. */ /* This is used to jump back to the beginning of a repeat. If the command that follows this jump is clearly incompatible with the one at the beginning of the repeat, such that we can be sure that there is no use backtracking out of repetitions already completed, then we finalize. */ #define dummy_failure_jump 8 /* jump, and push a dummy failure point. */ /* This failure point will be thrown away if an attempt is made to use it for a failure. A + construct makes this before the first repeat. */ #define anychar 9 /* matches any one character */ #define charset 10 /* matches any one char belonging to specified set. */ /* First following byte is # bitmap bytes. Then come bytes for a bit-map saying which chars are in. Bits in each byte are ordered low-bit-first. A character is in the set if its bit is 1. A character too large to have a bit in the map is automatically not in the set */ #define charset_not 11 /* similar but match any character that is NOT one of those specified */ #define start_memory 12 /* starts remembering the text that is matched */ /* and stores it in a memory register. followed by one byte containing the register number. Register numbers must be in the range 0 through NREGS. */ #define stop_memory 13 /* stops remembering the text that is matched */ /* and stores it in a memory register. followed by one byte containing the register number. Register numbers must be in the range 0 through NREGS. */ #define duplicate 14 /* match a duplicate of something remembered. */ /* Followed by one byte containing the index of the memory register. */ #define before_dot 15 /* Succeeds if before dot */ #define at_dot 16 /* Succeeds if at dot */ #define after_dot 17 /* Succeeds if after dot */ #define begbuf 18 /* Succeeds if at beginning of buffer */ #define endbuf 19 /* Succeeds if at end of buffer */ #define wordchar 20 /* Matches any word-constituent character */ #define notwordchar 21 /* Matches any char that is not a word-constituent */ #define wordbeg 22 /* Succeeds if at word beginning */ #define wordend 23 /* Succeeds if at word end */ #define wordbound 24 /* Succeeds if at a word boundary */ #define notwordbound 25 /* Succeeds if not at a word boundary */ #define syntaxspec 26 /* Matches any character whose syntax is specified. */ /* followed by a byte which contains a syntax code, Sword or such like */ #define notsyntaxspec 27 /* Matches any character whose syntax differs from the specified. */ #ifndef SIGN_EXTEND_CHAR #define SIGN_EXTEND_CHAR(x) (x) #endif /* compile_pattern takes a regular-expression descriptor string in the user's format and converts it into a buffer full of byte commands for matching. pattern is the address of the pattern string size is the length of it. bufp is a struct re_pattern_buffer * which points to the info on where to store the byte commands. This structure contains a char * which points to the actual space, which should have been obtained with malloc. compile_pattern may use realloc to grow the buffer space. The number of bytes of commands can be found out by looking in the struct re_pattern_buffer that bufp pointed to, after compile_pattern returns. */ #define PATPUSH(ch) (*b++ = (char) (ch)) #define PATFETCH(c) \ {if (p == pend) goto end_of_pattern; \ c = * (unsigned char *) p++; \ if (translate) c = translate[c]; } #define PATFETCH_RAW(c) \ {if (p == pend) goto end_of_pattern; \ c = * (unsigned char *) p++; } #define PATUNFETCH p-- #ifdef MSDOS /* 90.03.28 by A.Shirahashi */ #define SHIFT_EXTEND 13 #else /* NOT MSDOS */ #define SHIFT_EXTEND 16 #endif /* MSDOS */ #define EXTEND_BUFFER \ { char *old_buffer = bufp->buffer; \ if (bufp->allocated == (1<allocated *= 2; \ if (bufp->allocated > (1<allocated = (1<buffer = (char *) realloc (bufp->buffer, bufp->allocated))) \ goto memory_exhausted; \ c = bufp->buffer - old_buffer; \ b += c; \ if (fixup_jump) \ fixup_jump += c; \ if (laststart) \ laststart += c; \ begalt += c; \ if (pending_exact) \ pending_exact += c; \ } static int store_jump (), insert_jump (); static int bcmp_translate(); /* 91.02.06 Add by S.Yoshida */ char * re_compile_pattern (pattern, size, bufp) char *pattern; int size; struct re_pattern_buffer *bufp; { register char *b = bufp->buffer; register char *p = pattern; char *pend = pattern + size; register unsigned c, c1; char *p1; unsigned char *translate = (unsigned char *) bufp->translate; /* address of the count-byte of the most recently inserted "exactn" command. This makes it possible to tell whether a new exact-match character can be added to that command or requires a new "exactn" command. */ char *pending_exact = 0; /* address of the place where a forward-jump should go to the end of the containing expression. Each alternative of an "or", except the last, ends with a forward-jump of this sort. */ char *fixup_jump = 0; /* address of start of the most recently finished expression. This tells postfix * where to find the start of its operand. */ char *laststart = 0; /* In processing a repeat, 1 means zero matches is allowed */ char zero_times_ok; /* In processing a repeat, 1 means many matches is allowed */ char many_times_ok; /* address of beginning of regexp, or inside of last \( */ char *begalt = b; /* Stack of information saved by \( and restored by \). Four stack elements are pushed by each \(: First, the value of b. Second, the value of fixup_jump. Third, the value of regnum. Fourth, the value of begalt. */ int stackb[40]; int *stackp = stackb; int *stacke = stackb + 40; int *stackt; /* Counts \('s as they are encountered. Remembered for the matching \), where it becomes the "register number" to put in the stop_memory command */ int regnum = 1; bufp->fastmap_accurate = 0; #ifndef SYNTAX_TABLE #ifndef emacs /* * Initialize the syntax table. */ init_syntax_once(); #endif #endif if (bufp->allocated == 0) { bufp->allocated = 28; if (bufp->buffer) /* EXTEND_BUFFER loses when bufp->allocated is 0 */ bufp->buffer = (char *) realloc (bufp->buffer, 28); else /* Caller did not allocate a buffer. Do it for him */ bufp->buffer = (char *) malloc (28); if (!bufp->buffer) goto memory_exhausted; begalt = b = bufp->buffer; } while (p != pend) { if (b - bufp->buffer > bufp->allocated - 10) /* Note that EXTEND_BUFFER clobbers c */ EXTEND_BUFFER; PATFETCH (c); switch (c) { case '$': /* $ means succeed if at end of line, but only in special contexts. If randonly in the middle of a pattern, it is a normal character. */ if (p == pend || (*p == '\\' && (p[1] == ')' || p[1] == '|'))) { PATPUSH (endline); break; } goto normal_char; case '^': /* ^ means succeed if at beg of line, but only if no preceding pattern. */ if (laststart) goto normal_char; PATPUSH (begline); break; case '*': case '+': case '?': /* If there is no previous pattern, char not special. */ if (!laststart) goto normal_char; /* If there is a sequence of repetition chars, collapse it down to equivalent to just one. */ zero_times_ok = 0; many_times_ok = 0; while (1) { zero_times_ok |= c != '+'; many_times_ok |= c != '?'; if (p == pend) break; PATFETCH (c); if (!(c == '*' || c == '+' || c == '?')) { PATUNFETCH; break; } } /* Now we know whether 0 matches is allowed, and whether 2 or more matches is allowed. */ if (many_times_ok) { /* If more than one repetition is allowed, put in a backward jump at the end. */ store_jump (b, maybe_finalize_jump, laststart - 3); b += 3; } insert_jump (on_failure_jump, laststart, b + 3, b); pending_exact = 0; b += 3; if (!zero_times_ok) { /* At least one repetition required: insert before the loop a skip over the initial on-failure-jump instruction */ insert_jump (dummy_failure_jump, laststart, laststart + 6, b); b += 3; } break; case '.': laststart = b; PATPUSH (anychar); break; case '[': if (b - bufp->buffer > bufp->allocated - 3 - (1 << BYTEWIDTH) / BYTEWIDTH) /* Note that EXTEND_BUFFER clobbers c */ EXTEND_BUFFER; laststart = b; if (*p == '^') PATPUSH (charset_not), p++; else PATPUSH (charset); p1 = p; PATPUSH ((1 << BYTEWIDTH) / BYTEWIDTH); /* Clear the whole map */ bzero (b, (1 << BYTEWIDTH) / BYTEWIDTH); /* Read in characters and ranges, setting map bits */ while (1) { PATFETCH (c); if (c == ']' && p != p1 + 1) break; if (*p == '-') { PATFETCH (c1); PATFETCH (c1); while (c <= c1) b[c / BYTEWIDTH] |= 1 << (c % BYTEWIDTH), c++; } else { b[c / BYTEWIDTH] |= 1 << (c % BYTEWIDTH); } } /* Discard any bitmap bytes that are all 0 at the end of the map. Decrement the map-length byte too. */ while (b[-1] > 0 && b[b[-1] - 1] == 0) b[-1]--; b += b[-1]; break; case '\\': if (p == pend) goto invalid_pattern; PATFETCH_RAW (c); switch (c) { case '(': if (stackp == stacke) goto nesting_too_deep; if (regnum < RE_NREGS) { PATPUSH (start_memory); PATPUSH (regnum); } *stackp++ = b - bufp->buffer; *stackp++ = fixup_jump ? fixup_jump - bufp->buffer + 1 : 0; *stackp++ = regnum++; *stackp++ = begalt - bufp->buffer; fixup_jump = 0; laststart = 0; begalt = b; break; case ')': if (stackp == stackb) goto unmatched_close; begalt = *--stackp + bufp->buffer; if (fixup_jump) store_jump (fixup_jump, jump, b); if (stackp[-1] < RE_NREGS) { PATPUSH (stop_memory); PATPUSH (stackp[-1]); } stackp -= 2; fixup_jump = 0; if (*stackp) fixup_jump = *stackp + bufp->buffer - 1; laststart = *--stackp + bufp->buffer; break; case '|': insert_jump (on_failure_jump, begalt, b + 6, b); pending_exact = 0; b += 3; if (fixup_jump) store_jump (fixup_jump, jump, b); fixup_jump = b; b += 3; laststart = 0; begalt = b; break; #ifdef emacs case '=': PATPUSH (at_dot); break; case 's': laststart = b; PATPUSH (syntaxspec); PATFETCH (c); PATPUSH (syntax_spec_code[c]); break; case 'S': laststart = b; PATPUSH (notsyntaxspec); PATFETCH (c); PATPUSH (syntax_spec_code[c]); break; #endif emacs case 'w': laststart = b; PATPUSH (wordchar); break; case 'W': laststart = b; PATPUSH (notwordchar); break; case '<': PATPUSH (wordbeg); break; case '>': PATPUSH (wordend); break; case 'b': PATPUSH (wordbound); break; case 'B': PATPUSH (notwordbound); break; case '`': PATPUSH (begbuf); break; case '\'': PATPUSH (endbuf); break; case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': c1 = c - '0'; if (c1 >= regnum) goto normal_char; for (stackt = stackp - 2; stackt > stackb; stackt -= 4) if (*stackt == c1) goto normal_char; laststart = b; PATPUSH (duplicate); PATPUSH (c1); break; default: goto normal_char; } break; default: normal_char: if (!pending_exact || pending_exact + *pending_exact + 1 != b || *pending_exact == 0177 || *p == '*' || *p == '^' || *p == '+' || *p == '?') { laststart = b; PATPUSH (exactn); pending_exact = b; PATPUSH (0); } PATPUSH (c); (*pending_exact)++; } } if (fixup_jump) store_jump (fixup_jump, jump, b); if (stackp != stackb) goto unmatched_open; bufp->used = b - bufp->buffer; return 0; invalid_pattern: return "Invalid regular expression"; unmatched_open: return "Unmatched \\("; unmatched_close: return "Unmatched \\)"; end_of_pattern: return "Premature end of regular expression"; nesting_too_deep: return "Nesting too deep"; too_big: return "Regular expression too big"; memory_exhausted: return "Memory exhausted"; } /* Store where `from' points a jump operation to jump to where `to' points. `opcode' is the opcode to store. */ static int store_jump (from, opcode, to) char *from, *to; char opcode; { from[0] = opcode; from[1] = (to - (from + 3)) & 0377; from[2] = (to - (from + 3)) >> 8; } /* Open up space at char FROM, and insert there a jump to TO. CURRENT_END gives te end of the storage no in use, so we know how much data to copy up. OP is the opcode of the jump to insert. If you call this function, you must zero out pending_exact. */ static int insert_jump (op, from, to, current_end) char op; char *from, *to, *current_end; { register char *pto = current_end + 3; register char *pfrom = current_end; while (pfrom != from) *--pto = *--pfrom; store_jump (from, op, to); } /* Given a pattern, compute a fastmap from it. The fastmap records which of the (1 << BYTEWIDTH) possible characters can start a string that matches the pattern. This fastmap is used by re_search to skip quickly over totally implausible text. The caller must supply the address of a (1 << BYTEWIDTH)-byte data area as bufp->fastmap. The other components of bufp describe the pattern to be used. */ VOID re_compile_fastmap (bufp) struct re_pattern_buffer *bufp; { unsigned char *pattern = (unsigned char *) bufp->buffer; int size = bufp->used; register char *fastmap = bufp->fastmap; register unsigned char *p = pattern; register unsigned char *pend = pattern + size; register int j, k; unsigned char *translate = (unsigned char *) bufp->translate; unsigned char *stackb[NFAILURES]; unsigned char **stackp = stackb; bzero (fastmap, (1 << BYTEWIDTH)); bufp->fastmap_accurate = 1; bufp->can_be_null = 0; while (p) { if (p == pend) { bufp->can_be_null = 1; break; } switch ((regexpcode) *p++) { case exactn: if (translate) fastmap[translate[p[1]]] = 1; else fastmap[p[1]] = 1; break; case begline: case before_dot: case at_dot: case after_dot: case begbuf: case endbuf: case wordbound: case notwordbound: case wordbeg: case wordend: continue; case endline: if (translate) fastmap[translate['\n']] = 1; else fastmap['\n'] = 1; bufp->can_be_null = 1; break; case finalize_jump: case maybe_finalize_jump: case jump: case dummy_failure_jump: bufp->can_be_null = 1; j = *p++ & 0377; j += SIGN_EXTEND_CHAR (*(char *)p++) << 8; p += j; if (j > 0) continue; /* Jump backward reached implies we just went through the body of a loop and matched nothing. Opcode jumped to should be an on_failure_jump. Just treat it like an ordinary jump. For a * loop, it has pushed its failure point already; if so, discard that as redundant. */ if ((regexpcode) *p != on_failure_jump) continue; p++; j = *p++ & 0377; j += SIGN_EXTEND_CHAR (*(char *)p++) << 8; p += j; if (stackp != stackb && *stackp == p) stackp--; continue; case on_failure_jump: j = *p++ & 0377; j += SIGN_EXTEND_CHAR (*(char *)p++) << 8; *++stackp = p + j; continue; case start_memory: case stop_memory: p++; continue; case duplicate: bufp->can_be_null = 1; fastmap['\n'] = 1; case anychar: for (j = 0; j < (1 << BYTEWIDTH); j++) if (j != '\n') fastmap[j] = 1; if (bufp->can_be_null) return; /* Don't return; check the alternative paths so we can set can_be_null if appropriate. */ break; case wordchar: for (j = 0; j < (1 << BYTEWIDTH); j++) if (SYNTAX (j) == Sword) fastmap[j] = 1; break; case notwordchar: for (j = 0; j < (1 << BYTEWIDTH); j++) if (SYNTAX (j) != Sword) fastmap[j] = 1; break; #ifdef emacs case syntaxspec: k = *p++; for (j = 0; j < (1 << BYTEWIDTH); j++) if (SYNTAX (j) == (enum syntaxcode) k) fastmap[j] = 1; break; case notsyntaxspec: for (j = 0; j < (1 << BYTEWIDTH); j++) if (SYNTAX (j) != (enum syntaxcode) k) fastmap[j] = 1; break; #endif emacs case charset: for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--) if (p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH))) { if (translate) fastmap[translate[j]] = 1; else fastmap[j] = 1; } break; case charset_not: /* Chars beyond end of map must be allowed */ for (j = *p * BYTEWIDTH; j < (1 << BYTEWIDTH); j++) if (translate) fastmap[translate[j]] = 1; else fastmap[j] = 1; for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--) if (!(p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH)))) { if (translate) fastmap[translate[j]] = 1; else fastmap[j] = 1; } break; } /* Get here means we have successfully found the possible starting characters of one path of the pattern. We need not follow this path any farther. Instead, look at the next alternative remembered in the stack. */ if (stackp != stackb) p = *stackp--; else break; } } /* Like re_search_2, below, but only one string is specified. */ int re_search (pbufp, string, size, startpos, range, regs) struct re_pattern_buffer *pbufp; char *string; int size, startpos, range; struct re_registers *regs; { return re_search_2 (pbufp, 0, 0, string, size, startpos, range, regs, size); } /* Like re_match_2 but tries first a match starting at index `startpos', then at startpos + 1, and so on. `range' is the number of places to try before giving up. If `range' is negative, the starting positions tried are startpos, startpos - 1, etc. It is up to the caller to make sure that range is not so large as to take the starting position outside of the input strings. The value returned is the position at which the match was found, or -1 if no match was found. */ int re_search_2 (pbufp, string1, size1, string2, size2, startpos, range, regs, mstop) struct re_pattern_buffer *pbufp; char *string1, *string2; int size1, size2; int startpos; register int range; struct re_registers *regs; int mstop; { register char *fastmap = pbufp->fastmap; register char *translate = pbufp->translate; int total = size1 + size2; /* Update the fastmap now if not correct already */ if (fastmap && !pbufp->fastmap_accurate) re_compile_fastmap (pbufp); while (1) { /* If a fastmap is supplied, skip quickly over characters that cannot possibly be the start of a match. Note, however, that if the pattern can possibly match the null string, we must test it at each starting point so that we take the first null string we get. */ if (fastmap && startpos < total && !pbufp->can_be_null) { if (range > 0) { register int lim = 0; register char *p; int irange = range; if (startpos < size1 && startpos + range >= size1) lim = range - (size1 - startpos); p = &(startpos >= size1 ? string2 - size1 : string1)[startpos]; if (translate) { while (range > lim && !fastmap[translate[*p++]]) range--; } else { while (range > lim && !fastmap[*p++]) range--; } startpos += irange - range; } else { register char c; if (startpos >= size1) c = string2[startpos - size1]; else c = string1[startpos]; if (translate ? !fastmap[translate[c]] : !fastmap[c]) goto advance; } } if (range >= 0 && startpos == total && fastmap && !pbufp->can_be_null) return -1; if (0 <= re_match_2 (pbufp, string1, size1, string2, size2, startpos, regs, mstop)) return startpos; #ifdef C_ALLOCA alloca (0); #endif /* C_ALLOCA */ advance: if (!range) break; if (range > 0) range--, startpos++; else range++, startpos--; } return -1; } #ifndef ng /* Ng never uses this */ #ifndef emacs /* emacs never uses this */ int re_match (pbufp, string, size, pos, regs) struct re_pattern_buffer *pbufp; char *string; int size, pos; struct re_registers *regs; { return re_match_2 (pbufp, 0, 0, string, size, pos, regs, size); } #endif /* emacs */ #endif /* ng */ /* Match the pattern described by `pbufp' against data which is the virtual concatenation of `string1' and `string2'. `size1' and `size2' are the sizes of the two data strings. Start the match at position `pos'. Do not consider matching past the position `mstop'. If pbufp->fastmap is nonzero, then it had better be up to date. The reason that the data to match is specified as two components which are to be regarded as concatenated is so that this function can be used directly on the contents of an Emacs buffer. -1 is returned if there is no match. Otherwise the value is the length of the substring which was matched. */ int re_match_2 (pbufp, string1, size1, string2, size2, pos, regs, mstop) struct re_pattern_buffer *pbufp; char *string1, *string2; int size1, size2; int pos; struct re_registers *regs; int mstop; { register char *p = pbufp->buffer; register char *pend = p + pbufp->used; /* End of first string */ char *end1; /* End of second string */ char *end2; /* Pointer just past last char to consider matching */ char *end_match_1, *end_match_2; register char *d, *dend; register int mcnt; char *translate = pbufp->translate; /* Failure point stack. Each place that can handle a failure further down the line pushes a failure point on this stack. It consists of two char *'s. The first one pushed is where to resume scanning the pattern; the second pushed is where to resume scanning the strings. If the latter is zero, the failure point is a "dummy". If a failure happens and the innermost failure point is dormant, it discards that failure point and tries the next one. */ char **stackb = (char **) alloca (2 * NFAILURES * sizeof (char *)); char **stackp = stackb, **stacke = &stackb[2 * NFAILURES]; /* Information on the "contents" of registers. These are pointers into the input strings; they record just what was matched (on this attempt) by some part of the pattern. The start_memory command stores the start of a register's contents and the stop_memory command stores the end. At that point, regstart[regnum] points to the first character in the register, regend[regnum] points to the first character beyond the end of the register, and regstart_segend[regnum] is either the same as regend[regnum] or else points to the end of the input string into which regstart[regnum] points. The latter case happens when regstart[regnum] is in string1 and regend[regnum] is in string2. */ char *regstart[RE_NREGS]; char *regstart_segend[RE_NREGS]; char *regend[RE_NREGS]; /* Set up pointers to ends of strings. Don't allow the second string to be empty unless both are empty. */ if (!size2) { string2 = string1; size2 = size1; string1 = 0; size1 = 0; } end1 = string1 + size1; end2 = string2 + size2; /* Compute where to stop matching, within the two strings */ if (mstop <= size1) { end_match_1 = string1 + mstop; end_match_2 = string2; } else { end_match_1 = end1; end_match_2 = string2 + mstop - size1; } /* Initialize \( and \) text positions to -1 to mark ones that no \( or \) has been seen for. */ for (mcnt = 0; mcnt < sizeof (regstart) / sizeof (*regstart); mcnt++) regstart[mcnt] = (char *) -1; /* `p' scans through the pattern as `d' scans through the data. `dend' is the end of the input string that `d' points within. `d' is advanced into the following input string whenever necessary, but this happens before fetching; therefore, at the beginning of the loop, `d' can be pointing at the end of a string, but it cannot equal string2. */ if (pos <= size1) d = string1 + pos, dend = end_match_1; else d = string2 + pos - size1, dend = end_match_2; /* Write PREFETCH; just before fetching a character with *d. */ #define PREFETCH \ while (d == dend) \ { if (dend == end_match_2) goto fail; /* end of string2 => failure */ \ d = string2; /* end of string1 => advance to string2. */ \ dend = end_match_2; } /* This loop loops over pattern commands. It exits by returning from the function if match is complete, or it drops through if match fails at this starting point in the input data. */ while (1) { if (p == pend) /* End of pattern means we have succeeded! */ { /* If caller wants register contents data back, convert it to indices */ if (regs) { regend[0] = d; regstart[0] = string1; for (mcnt = 0; mcnt < RE_NREGS; mcnt++) { if ((mcnt != 0) && regstart[mcnt] == (char *) -1) { regs->start[mcnt] = -1; regs->end[mcnt] = -1; continue; } if (regstart[mcnt] - string1 < 0 || regstart[mcnt] - string1 > size1) regs->start[mcnt] = regstart[mcnt] - string2 + size1; else regs->start[mcnt] = regstart[mcnt] - string1; if (regend[mcnt] - string1 < 0 || regend[mcnt] - string1 > size1) regs->end[mcnt] = regend[mcnt] - string2 + size1; else regs->end[mcnt] = regend[mcnt] - string1; } regs->start[0] = pos; } if (d - string1 >= 0 && d - string1 <= size1) return d - string1 - pos; else return d - string2 + size1 - pos; } /* Otherwise match next pattern command */ switch ((regexpcode) *p++) { /* \( is represented by a start_memory, \) by a stop_memory. Both of those commands contain a "register number" argument. The text matched within the \( and \) is recorded under that number. Then, \ turns into a `duplicate' command which is followed by the numeric value of as the register number. */ case start_memory: regstart[*p] = d; regstart_segend[*p++] = dend; break; case stop_memory: regend[*p] = d; if (regstart_segend[*p] == dend) regstart_segend[*p] = d; p++; break; case duplicate: { int regno = *p++; /* Get which register to match against */ register char *d2, *dend2; d2 = regstart[regno]; dend2 = regstart_segend[regno]; while (1) { /* Advance to next segment in register contents, if necessary */ while (d2 == dend2) { if (dend2 == end_match_2) break; if (dend2 == regend[regno]) break; d2 = string2, dend2 = regend[regno]; /* end of string1 => advance to string2. */ } /* At end of register contents => success */ if (d2 == dend2) break; /* Advance to next segment in data being matched, if necessary */ PREFETCH; /* mcnt gets # consecutive chars to compare */ mcnt = dend - d; if (mcnt > dend2 - d2) mcnt = dend2 - d2; /* Compare that many; failure if mismatch, else skip them. */ if (translate ? bcmp_translate (d, d2, mcnt, translate) : bcmp (d, d2, mcnt)) goto fail; d += mcnt, d2 += mcnt; } } break; case anychar: /* fetch a data character */ PREFETCH; /* Match anything but a newline. */ if ((translate ? translate[*d++] : *d++) == '\n') goto fail; break; case charset: case charset_not: { /* Nonzero for charset_not */ int not = 0; register int c; if (*(p - 1) == (char) charset_not) not = 1; /* fetch a data character */ PREFETCH; if (translate) c = translate [*(unsigned char *)d]; else c = *(unsigned char *)d; if (c < *p * BYTEWIDTH && p[1 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH))) not = !not; p += 1 + *p; if (!not) goto fail; d++; break; } case begline: if (d == string1 || d[-1] == '\n') break; goto fail; case endline: if (d == end2 || (d == end1 ? (size2 == 0 || *string2 == '\n') : *d == '\n')) break; goto fail; /* "or" constructs ("|") are handled by starting each alternative with an on_failure_jump that points to the start of the next alternative. Each alternative except the last ends with a jump to the joining point. (Actually, each jump except for the last one really jumps to the following jump, because tensioning the jumps is a hassle.) */ /* The start of a stupid repeat has an on_failure_jump that points past the end of the repeat text. This makes a failure point so that, on failure to match a repetition, matching restarts past as many repetitions have been found with no way to fail and look for another one. */ /* A smart repeat is similar but loops back to the on_failure_jump so that each repetition makes another failure point. */ case on_failure_jump: if (stackp == stacke) { char **stackx = (char **) alloca (2 * (stacke - stackb) * sizeof (char *)); bcopy (stackb, stackx, (stacke - stackb) * sizeof (char *)); stackp += stackx - stackb; stacke = stackx + 2 * (stacke - stackb); stackb = stackx; } mcnt = *p++ & 0377; mcnt += SIGN_EXTEND_CHAR (*p++) << 8; *stackp++ = mcnt + p; *stackp++ = d; break; /* The end of a smart repeat has an maybe_finalize_jump back. Change it either to a finalize_jump or an ordinary jump. */ case maybe_finalize_jump: mcnt = *p++ & 0377; mcnt += SIGN_EXTEND_CHAR (*p++) << 8; /* Compare what follows with the begining of the repeat. If we can establish that there is nothing that they would both match, we can change to finalize_jump */ if (p == pend) p[-3] = (char) finalize_jump; else if (*p == (char) exactn || *p == (char) endline) { register int c = *p == (char) endline ? '\n' : p[2]; register char *p1 = p + mcnt; /* p1[0] ... p1[2] are an on_failure_jump. Examine what follows that */ if (p1[3] == (char) exactn && p1[5] != c) p[-3] = (char) finalize_jump; else if (p1[3] == (char) charset || p1[3] == (char) charset_not) { int not = p1[3] == (char) charset_not; if (c < p1[4] * BYTEWIDTH && p1[5 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH))) not = !not; /* not is 1 if c would match */ /* That means it is not safe to finalize */ if (!not) p[-3] = (char) finalize_jump; } } p -= 2; if (p[-1] != (char) finalize_jump) { p[-1] = (char) jump; goto nofinalize; } /* The end of a stupid repeat has a finalize-jump back to the start, where another failure point will be made which will point after all the repetitions found so far. */ case finalize_jump: stackp -= 2; case jump: nofinalize: mcnt = *p++ & 0377; mcnt += SIGN_EXTEND_CHAR (*p++) << 8; p += mcnt; break; case dummy_failure_jump: if (stackp == stacke) { char **stackx = (char **) alloca (2 * (stacke - stackb) * sizeof (char *)); bcopy (stackb, stackx, (stacke - stackb) * sizeof (char *)); stackp += stackx - stackb; stacke = stackx + 2 * (stacke - stackb); stackb = stackx; } *stackp++ = 0; *stackp++ = 0; goto nofinalize; case wordbound: if (d == string1 /* Points to first char */ || d == end2 /* Points to end */ || (d == end1 && size2 == 0)) /* Points to end */ break; if ((SYNTAX (((unsigned char *)d)[-1]) == Sword) != (SYNTAX (d == end1 ? *(unsigned char *)string2 : *(unsigned char *)d) == Sword)) break; goto fail; case notwordbound: if (d == string1 /* Points to first char */ || d == end2 /* Points to end */ || (d == end1 && size2 == 0)) /* Points to end */ goto fail; if ((SYNTAX (((unsigned char *)d)[-1]) == Sword) != (SYNTAX (d == end1 ? *(unsigned char *)string2 : *(unsigned char *)d) == Sword)) goto fail; break; case wordbeg: if (d == end2 /* Points to end */ || (d == end1 && size2 == 0) /* Points to end */ || SYNTAX (*(unsigned char *) (d == end1 ? string2 : d)) != Sword) /* Next char not a letter */ goto fail; if (d == string1 /* Points to first char */ || SYNTAX (((unsigned char *)d)[-1]) != Sword) /* prev char not letter */ break; goto fail; case wordend: if (d == string1 /* Points to first char */ || SYNTAX (((unsigned char *)d)[-1]) != Sword) /* prev char not letter */ goto fail; if (d == end2 /* Points to end */ || (d == end1 && size2 == 0) /* Points to end */ || SYNTAX (d == end1 ? *(unsigned char *)string2 : *(unsigned char *)d) != Sword) /* Next char not a letter */ break; goto fail; #ifdef emacs case before_dot: if (((d - string2 <= (unsigned) size2) ? d - (char *) bf_p2 : d - (char *) bf_p1) <= point) goto fail; break; case at_dot: if (((d - string2 <= (unsigned) size2) ? d - (char *) bf_p2 : d - (char *) bf_p1) == point) goto fail; break; case after_dot: if (((d - string2 <= (unsigned) size2) ? d - (char *) bf_p2 : d - (char *) bf_p1) >= point) goto fail; break; case wordchar: mcnt = (int) Sword; goto matchsyntax; case syntaxspec: mcnt = *p++; matchsyntax: PREFETCH; if (SYNTAX (*(unsigned char *)d++) != (enum syntaxcode) mcnt) goto fail; break; case notwordchar: mcnt = (int) Sword; goto matchnotsyntax; case notsyntaxspec: mcnt = *p++; matchnotsyntax: PREFETCH; if (SYNTAX (*(unsigned char *)d++) == (enum syntaxcode) mcnt) goto fail; break; #else case wordchar: PREFETCH; if (SYNTAX (*(unsigned char *)d++) == 0) goto fail; break; case notwordchar: PREFETCH; if (SYNTAX (*(unsigned char *)d++) != 0) goto fail; break; #endif not emacs case begbuf: if (d == string1) /* Note, d cannot equal string2 */ break; /* unless string1 == string2. */ goto fail; case endbuf: if (d == end2 || (d == end1 && size2 == 0)) break; goto fail; case exactn: /* Match the next few pattern characters exactly. mcnt is how many characters to match. */ mcnt = *p++; if (translate) { do { PREFETCH; if (translate[*(unsigned char *)d++] != *p++) goto fail; } while (--mcnt); } else { do { PREFETCH; if (*d++ != *p++) goto fail; } while (--mcnt); } break; } continue; /* Successfully matched one pattern command; keep matching */ /* Jump here if any matching operation fails. */ fail: if (stackp != stackb) /* A restart point is known. Restart there and pop it. */ { if (!stackp[-2]) { /* If innermost failure point is dormant, flush it and keep looking */ stackp -= 2; goto fail; } d = *--stackp; p = *--stackp; if (d >= string1 && d <= end1) dend = end_match_1; } else break; /* Matching at this starting point really fails! */ } return -1; /* Failure to match */ } static int bcmp_translate (s1, s2, len, translate) char *s1, *s2; register int len; char *translate; { register char *p1 = s1, *p2 = s2; while (len) { if (translate [*p1++] != translate [*p2++]) return 1; len--; } return 0; } /* Entry points compatible with bsd4.2 regex library */ #ifndef ng #ifndef emacs static struct re_pattern_buffer re_comp_buf; char * re_comp (s) char *s; { if (!s) { if (!re_comp_buf.buffer) return "No previous regular expression"; return 0; } if (!re_comp_buf.buffer) { if (!(re_comp_buf.buffer = (char *) malloc (200))) return "Memory exhausted"; re_comp_buf.allocated = 200; if (!(re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH))) return "Memory exhausted"; } return re_compile_pattern (s, strlen (s), &re_comp_buf); } int re_exec (s) char *s; { int len = strlen (s); return 0 <= re_search (&re_comp_buf, s, len, 0, len, 0); } #endif /* emacs */ #endif /* ng */ #ifdef test #include /* Indexed by a character, gives the upper case equivalent of the character */ static char upcase[0400] = { 000, 001, 002, 003, 004, 005, 006, 007, 010, 011, 012, 013, 014, 015, 016, 017, 020, 021, 022, 023, 024, 025, 026, 027, 030, 031, 032, 033, 034, 035, 036, 037, 040, 041, 042, 043, 044, 045, 046, 047, 050, 051, 052, 053, 054, 055, 056, 057, 060, 061, 062, 063, 064, 065, 066, 067, 070, 071, 072, 073, 074, 075, 076, 077, 0100, 0101, 0102, 0103, 0104, 0105, 0106, 0107, 0110, 0111, 0112, 0113, 0114, 0115, 0116, 0117, 0120, 0121, 0122, 0123, 0124, 0125, 0126, 0127, 0130, 0131, 0132, 0133, 0134, 0135, 0136, 0137, 0140, 0101, 0102, 0103, 0104, 0105, 0106, 0107, 0110, 0111, 0112, 0113, 0114, 0115, 0116, 0117, 0120, 0121, 0122, 0123, 0124, 0125, 0126, 0127, 0130, 0131, 0132, 0173, 0174, 0175, 0176, 0177, 0200, 0201, 0202, 0203, 0204, 0205, 0206, 0207, 0210, 0211, 0212, 0213, 0214, 0215, 0216, 0217, 0220, 0221, 0222, 0223, 0224, 0225, 0226, 0227, 0230, 0231, 0232, 0233, 0234, 0235, 0236, 0237, 0240, 0241, 0242, 0243, 0244, 0245, 0246, 0247, 0250, 0251, 0252, 0253, 0254, 0255, 0256, 0257, 0260, 0261, 0262, 0263, 0264, 0265, 0266, 0267, 0270, 0271, 0272, 0273, 0274, 0275, 0276, 0277, 0300, 0301, 0302, 0303, 0304, 0305, 0306, 0307, 0310, 0311, 0312, 0313, 0314, 0315, 0316, 0317, 0320, 0321, 0322, 0323, 0324, 0325, 0326, 0327, 0330, 0331, 0332, 0333, 0334, 0335, 0336, 0337, 0340, 0341, 0342, 0343, 0344, 0345, 0346, 0347, 0350, 0351, 0352, 0353, 0354, 0355, 0356, 0357, 0360, 0361, 0362, 0363, 0364, 0365, 0366, 0367, 0370, 0371, 0372, 0373, 0374, 0375, 0376, 0377 }; main () { char pat[80]; struct re_pattern_buffer buf; struct re_registers regs; int i; char c; char fastmap[(1 << BYTEWIDTH)]; buf.allocated = 40; buf.buffer = (char *) malloc (buf.allocated); buf.fastmap = fastmap; buf.translate = upcase; while (1) { printf("Enter pattern\n"); gets (pat); if (*pat) { re_compile_pattern (pat, strlen(pat), &buf); for (i = 0; i < buf.used; i++) printchar (buf.buffer[i]); putchar ('\n'); printf ("%d allocated, %d used.\n", buf.allocated, buf.used); re_compile_fastmap (&buf); printf ("Allowed by fastmap: "); for (i = 0; i < (1 << BYTEWIDTH); i++) if (fastmap[i]) printchar (i); putchar ('\n'); } printf("enter string to search\n"); gets (pat); /* Now read the string to match against */ /* i = re_match (&buf, pat, strlen (pat), 0, 0); */ i = re_search (&buf, pat, strlen (pat), 0, strlen (pat), ®s); printf ("Match value %d.\n", i); for (i=0; i < RE_NREGS; i++) printf("%2d start %2d end %2d\n", i, regs.start[i], regs.end[i]); } } #ifdef NOTDEF print_buf (bufp) struct re_pattern_buffer *bufp; { int i; printf ("buf is :\n----------------\n"); for (i = 0; i < bufp->used; i++) printchar (bufp->buffer[i]); printf ("\n%d allocated, %d used.\n", bufp->allocated, bufp->used); printf ("Allowed by fastmap: "); for (i = 0; i < (1 << BYTEWIDTH); i++) if (bufp->fastmap[i]) printchar (i); printf ("\nAllowed by translate: "); if (bufp->translate) for (i = 0; i < (1 << BYTEWIDTH); i++) if (bufp->translate[i]) printchar (i); printf ("\nfastmap is%s accurate\n", bufp->fastmap_accurate ? "" : "n't"); printf ("can %s be null\n----------", bufp->can_be_null ? "" : "not"); } #endif printchar (c) char c; { if (c < 041 || c >= 0177) { putchar ('\\'); putchar (((c >> 6) & 3) + '0'); putchar (((c >> 3) & 7) + '0'); putchar ((c & 7) + '0'); } else putchar (c); } error (string) char *string; { puts (string); exit (1); } #endif /* test */ ng-1.5beta1/regex_e.h100644 1750 1750 10757 7126003714 13272 0ustar amurausers/* $Id: regex_e.h,v 1.1.1.1 2000/06/27 01:47:56 amura Exp $ */ /* Definitions for data structures callers pass the regex library. Copyright (C) 1985 Richard M. Stallman This program is distributed in the hope that it will be useful, but without any warranty. No author or distributor accepts responsibility to anyone for the consequences of using it or for whether it serves any particular purpose or works at all, unless he says so in writing. Permission is granted to anyone to distribute verbatim copies of this program's source code as received, in any medium, provided that the copyright notice, the nonwarraty notice above and this permission notice are preserved, and that the distributor grants the recipient all rights for further redistribution as permitted by this notice, and informs him of these rights. Permission is granted to distribute modified versions of this program's source code, or of portions of it, under the above conditions, plus the conditions that all changed files carry prominent notices stating who last changed them and that the derived material, including anything packaged together with it and conceptually functioning as a modification of it rather than an application of it, is in its entirety subject to a permission notice identical to this one. Permission is granted to distribute this program (verbatim or as modified) in compiled or executable form, provided verbatim redistribution is permitted as stated above for source code, and A. it is accompanied by the corresponding machine-readable source code, under the above conditions, or B. it is accompanied by a written offer, with no time limit, to distribute the corresponding machine-readable source code, under the above conditions, to any one, in return for reimbursement of the cost of distribution. Verbatim redistribution of the written offer must be permitted. Or, C. it is distributed by someone who received only the compiled or executable form, and is accompanied by a copy of the written offer of source code which he received along with it. Permission is granted to distribute this program (verbatim or as modified) in executable form as part of a larger system provided that the source code for this program, including any modifications used, is also distributed or offered as stated in the preceding paragraph. In other words, you are welcome to use, share and improve this program. You are forbidden to forbid anyone else to use, share and improve what you give them. Help stamp out software-hoarding! */ /* * $Log: regex_e.h,v $ * Revision 1.1.1.1 2000/06/27 01:47:56 amura * import to CVS * */ #ifndef RE_NREGS #define RE_NREGS 10 #endif /* This data structure is used to represent a compiled pattern. */ struct re_pattern_buffer { char *buffer; /* Space holding the compiled pattern commands. */ int allocated; /* Size of space that buffer points to */ int used; /* Length of portion of buffer actually occupied */ char *fastmap; /* Pointer to fastmap, if any, or zero if none. */ /* re_search uses the fastmap, if there is one, to skip quickly over totally implausible characters */ char *translate; /* Translate table to apply to all characters before comparing. Or zero for no translation. The translation is applied to a pattern when it is compiled and to data when it is matched. */ char fastmap_accurate; /* Set to zero when a new pattern is stored, set to one when the fastmap is updated from it. */ char can_be_null; /* Set to one by compiling fastmap if this pattern might match the null string. It does not necessarily match the null string in that case, but if this is zero, it cannot. */ }; /* Structure to store "register" contents data in. Pass the address of such a structure as an argument to re_match, etc., if you want this information back. start[i] and end[i] record the string matched by \( ... \) grouping i, for i from 1 to RE_NREGS - 1. start[0] and end[0] record the entire string matched. */ struct re_registers { int start[RE_NREGS]; int end[RE_NREGS]; }; extern char *re_compile_pattern (); /* Is this really advertised? */ extern VOID re_compile_fastmap (); extern int re_search (), re_search_2 (); extern int re_match (), re_match_2 (); /* 4.2 bsd compatibility (yuck) */ extern char *re_comp (); extern int re_exec (); #ifdef SYNTAX_TABLE extern char *re_syntax_table; #endif ng-1.5beta1/regex_j.c100644 1750 1750 164073 7276031741 13322 0ustar amurausers/* $Id: regex_j.c,v 1.2 2001/05/08 17:58:57 amura Exp $ */ /* Extended regular expression matching and search. Copyright (C) 1985 Free Software Foundation, Inc. NO WARRANTY BECAUSE THIS PROGRAM IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY NO WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING, FREE SOFTWARE FOUNDATION, INC, RICHARD M. STALLMAN AND/OR OTHER PARTIES PROVIDE THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL RICHARD M. STALLMAN, THE FREE SOFTWARE FOUNDATION, INC., AND/OR ANY OTHER PARTY WHO MAY MODIFY AND REDISTRIBUTE THIS PROGRAM AS PERMITTED BELOW, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY LOST PROFITS, LOST MONIES, OR OTHER SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS) THIS PROGRAM, EVEN IF YOU HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY. GENERAL PUBLIC LICENSE TO COPY 1. You may copy and distribute verbatim copies of this source file as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy a valid copyright notice "Copyright (C) 1985 Free Software Foundation, Inc."; and include following the copyright notice a verbatim copy of the above disclaimer of warranty and of this License. You may charge a distribution fee for the physical act of transferring a copy. 2. You may modify your copy or copies of this source file or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains or is a derivative of this program or any part thereof, to be licensed at no charge to all third parties on terms identical to those contained in this License Agreement (except that you may choose to grant more extensive warranty protection to some or all third parties, at your option). c) You may charge a distribution fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another unrelated program with this program (or its derivative) on a volume of a storage or distribution medium does not bring the other program under the scope of these terms. 3. You may copy and distribute this program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal shipping charge) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs. 4. You may not copy, sublicense, distribute or transfer this program except as expressly provided under this License Agreement. Any attempt otherwise to copy, sublicense, distribute or transfer this program is void and your rights to use the program under this License agreement shall be automatically terminated. However, parties who have received computer software programs from you with this License Agreement will not have their licenses terminated so long as such parties remain in full compliance. 5. If you wish to incorporate parts of this program into other free programs whose distribution conditions are different, write to the Free Software Foundation at 675 Mass Ave, Cambridge, MA 02139. We have not yet worked out a simple rule that can be stated here, but we will often permit this. We will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software. In other words, you are welcome to use, share and improve this program. You are forbidden to forbid anyone else to use, share and improve what you give them. Help stamp out software-hoarding! */ /* * $Log: regex_j.c,v $ * Revision 1.2 2001/05/08 17:58:57 amura * fix alloca() probrems with Turbo C * * Revision 1.1.1.1 2000/06/27 01:47:56 amura * import to CVS * */ /* To test, compile with -Dtest. This Dtestable feature turns this into a self-contained program which reads a pattern, describes how it compiles, then reads a string and searches for it. */ #ifdef emacs /* The `emacs' switch turns on certain special matching commands that make sense only in emacs. */ #include "config.h" #include "lisp.h" #include "buffer.h" #include "syntax.h" #else /* not emacs */ #ifdef MSDOS #include #include #if defined(_MSC_VER) && (_MSC_VER >= 600) #pragma intrinsic(memset,memcmp,memcpy,strcat,strcmp,strcpy,strlen) #endif #endif #if defined(MSDOS) && !defined(__GNUC__) #define SHIFT_EXTEND 13 #else #define SHIFT_EXTEND 16 #endif #ifndef __GNUC__ #if defined(USG) || defined(MSDOS) #define bcopy(s,d,n) memcpy((d),(s),(n)) #define bcmp(s1,s2,n) memcmp((s1),(s2),(n)) #define bzero(s,n) memset((s),0,(n)) #endif #endif /* Make alloca work the best possible way. */ #ifdef __GNUC__ #ifndef alloca #define alloca __builtin_alloca #endif #else #ifdef sparc #include #endif #endif /* * Define the syntax stuff, so we can do the \<...\> things. */ #ifndef Sword /* must be non-zero in some of the tests below... */ #define Sword 1 #endif #define SYNTAX(c) re_syntax_table[c] #ifdef SYNTAX_TABLE char *re_syntax_table; #else static char re_syntax_table[256]; static void init_syntax_once () { register int c; static int done = 0; if (done) return; bzero (re_syntax_table, sizeof re_syntax_table); for (c = 'a'; c <= 'z'; c++) re_syntax_table[c] = Sword; for (c = 'A'; c <= 'Z'; c++) re_syntax_table[c] = Sword; for (c = '0'; c <= '9'; c++) re_syntax_table[c] = Sword; done = 1; } #endif /* SYNTAX_TABLE */ #endif /* not emacs */ #include "regex_j.h" #ifdef MSDOS /* extern void * alloca(size_t); */ static void init_syntax_once(void ); int re_set_syntax(int syntax); char *re_compile_pattern(char *pattern,int size,struct re_pattern_buffer *bufp); static void store_jump(char *from,int opcode,char *to); static void insert_jump(int op,char *from,char *to,char *current_end); void re_compile_fastmap(struct re_pattern_buffer *bufp); int re_search(struct re_pattern_buffer *pbufp,char *string,int size,int startpos,int range,struct re_registers *regs); int re_search_2(struct re_pattern_buffer *pbufp,char *string1,int size1,char *string2,int size2,int startpos,int range,struct re_registers *regs,int mstop); int re_match(struct re_pattern_buffer *pbufp,char *string,int size,int pos,struct re_registers *regs); int re_match_2(struct re_pattern_buffer *pbufp,unsigned char *string1,int size1,unsigned char *string2,int size2,int pos,struct re_registers *regs,int mstop); static int bcmp_translate(unsigned char *s1,unsigned char *s2,int len,unsigned char *translate); char *re_comp(char *s); int re_exec(char *s); #endif /* MSDOS */ /* Number of failure points to allocate space for initially, when matching. If this number is exceeded, more space is allocated, so it is not a hard limit. */ #ifndef NFAILURES #define NFAILURES 80 #endif /* NFAILURES */ /* width of a byte in bits */ #define BYTEWIDTH 8 #ifdef UNSIGNED_CHAR #define SIGN_EXTEND_CHAR(x) ((x)&0200?~0377|(x):(x)) #endif #ifndef SIGN_EXTEND_CHAR #define SIGN_EXTEND_CHAR(x) (x) #endif static int obscure_syntax = 0; /* Specify the precise syntax of regexp for compilation. This provides for compatibility for various utilities which historically have different, incompatible syntaxes. The argument SYNTAX is a bit-mask containing the two bits RE_NO_BK_PARENS and RE_NO_BK_VBAR. */ int re_set_syntax (syntax) { int ret; ret = obscure_syntax; obscure_syntax = syntax; return ret; } /* re_compile_pattern takes a regular-expression string and converts it into a buffer full of byte commands for matching. PATTERN is the address of the pattern string SIZE is the length of it. BUFP is a struct re_pattern_buffer * which points to the info on where to store the byte commands. This structure contains a char * which points to the actual space, which should have been obtained with malloc. re_compile_pattern may use realloc to grow the buffer space. The number of bytes of commands can be found out by looking in the struct re_pattern_buffer that bufp pointed to, after re_compile_pattern returns. */ #ifdef KANJI #define UC(c) ((unsigned char)(c)) #define PATPUSH(ch) (*b++ = (char) (ch)) #define PATPUSH2(ch) {*b++ = (char)((ch) >> 8);*b++ = (char) (ch);} #define PATPUSHc(ch) {if ((ch) & 0xFF00) *b++ = (char)((ch) >> 8);\ *b++ = (char) (ch);} #define PATFETCH(c) \ {if (p == pend) goto end_of_pattern; \ c = * (unsigned char *) p++; \ if (ISKANJI(c)) {\ if (p == pend) goto end_of_pattern; \ c <<= 8;\ c += *(unsigned char *)p++;\ } else {\ if (translate) c = translate[c];\ }\ } #define PATFETCH_RAW(c) \ {if (p == pend) goto end_of_pattern; \ c = * (unsigned char *) p++; \ if (ISKANJI(c)) {\ if (p == pend) goto end_of_pattern; \ c <<= 8;\ c += *(unsigned char *)p++;\ }\ } #define PATUNFETCH(c) {if ((c) & 0xFF00) p--; p--;} #else /* !KANJI */ #define PATPUSH(ch) (*b++ = (char) (ch)) #define PATFETCH(c) \ {if (p == pend) goto end_of_pattern; \ c = * (unsigned char *) p++; \ if (translate) c = translate[c]; } #define PATFETCH_RAW(c) \ {if (p == pend) goto end_of_pattern; \ c = * (unsigned char *) p++; } #define PATUNFETCH p-- #endif /* !KANJI */ #define EXTEND_BUFFER \ { char *old_buffer = bufp->buffer; \ if (bufp->allocated == (1<allocated *= 2; \ if ((bufp->allocated > (1<allocated <= 0)) bufp->allocated = (1<buffer = (char *) realloc (bufp->buffer, bufp->allocated)) == 0) \ goto memory_exhausted; \ b = bufp->buffer + (int)(b - old_buffer); \ if (fixup_jump) \ fixup_jump = bufp->buffer + (int)(fixup_jump - old_buffer); \ if (laststart) \ laststart = bufp->buffer + (int)(laststart - old_buffer); \ begalt = bufp->buffer + (int)(begalt - old_buffer); \ if (pending_exact) \ pending_exact = bufp->buffer + (int)(pending_exact - old_buffer); \ } #ifndef MSDOS static void store_jump (), insert_jump (); #endif char * re_compile_pattern (pattern, size, bufp) char *pattern; int size; struct re_pattern_buffer *bufp; { register char *b = bufp->buffer; register char *p = pattern; char *pend = pattern + size; register unsigned c, c1; char *p1; unsigned char *translate = (unsigned char *) bufp->translate; /* address of the count-byte of the most recently inserted "exactn" command. This makes it possible to tell whether a new exact-match character can be added to that command or requires a new "exactn" command. */ char *pending_exact = 0; /* address of the place where a forward-jump should go to the end of the containing expression. Each alternative of an "or", except the last, ends with a forward-jump of this sort. */ char *fixup_jump = 0; /* address of start of the most recently finished expression. This tells postfix * where to find the start of its operand. */ char *laststart = 0; /* In processing a repeat, 1 means zero matches is allowed */ char zero_times_ok; /* In processing a repeat, 1 means many matches is allowed */ char many_times_ok; /* address of beginning of regexp, or inside of last \( */ char *begalt = b; /* Stack of information saved by \( and restored by \). Four stack elements are pushed by each \(: First, the value of b. Second, the value of fixup_jump. Third, the value of regnum. Fourth, the value of begalt. */ int stackb[40]; int *stackp = stackb; int *stacke = stackb + 40; int *stackt; /* Counts \('s as they are encountered. Remembered for the matching \), where it becomes the "register number" to put in the stop_memory command */ int regnum = 1; bufp->fastmap_accurate = 0; #ifndef emacs #ifndef SYNTAX_TABLE /* * Initialize the syntax table. */ init_syntax_once(); #endif #endif if (bufp->allocated == 0) { bufp->allocated = 28; if (bufp->buffer) /* EXTEND_BUFFER loses when bufp->allocated is 0 */ bufp->buffer = (char *) realloc (bufp->buffer, 28); else /* Caller did not allocate a buffer. Do it for him */ bufp->buffer = (char *) malloc (28); if (!bufp->buffer) goto memory_exhausted; begalt = b = bufp->buffer; } while (p != pend) { if (b - bufp->buffer > bufp->allocated - 20) /* Note that EXTEND_BUFFER clobbers c */ EXTEND_BUFFER; PATFETCH (c); switch (c) { case '$': if (obscure_syntax & RE_TIGHT_VBAR) { if (! (obscure_syntax & RE_CONTEXT_INDEP_OPS) && p != pend) goto normal_char; /* Make operand of last vbar end before this `$'. */ if (fixup_jump) store_jump (fixup_jump, jump, b); fixup_jump = 0; PATPUSH (endline); break; } /* $ means succeed if at end of line, but only in special contexts. If randomly in the middle of a pattern, it is a normal character. */ if (p == pend || *p == '\n' || (obscure_syntax & RE_CONTEXT_INDEP_OPS) || (obscure_syntax & RE_NO_BK_PARENS ? *p == ')' : *p == '\\' && p[1] == ')') || (obscure_syntax & RE_NO_BK_VBAR ? *p == '|' : *p == '\\' && p[1] == '|')) { PATPUSH (endline); break; } goto normal_char; case '^': /* ^ means succeed if at beg of line, but only if no preceding pattern. */ if (laststart && p[-2] != '\n' && ! (obscure_syntax & RE_CONTEXT_INDEP_OPS)) goto normal_char; if (obscure_syntax & RE_TIGHT_VBAR) { if (p != pattern + 1 && ! (obscure_syntax & RE_CONTEXT_INDEP_OPS)) goto normal_char; PATPUSH (begline); begalt = b; } else PATPUSH (begline); break; case '+': case '?': if (obscure_syntax & RE_BK_PLUS_QM) goto normal_char; handle_plus: case '*': /* If there is no previous pattern, char not special. */ if (!laststart && ! (obscure_syntax & RE_CONTEXT_INDEP_OPS)) goto normal_char; /* If there is a sequence of repetition chars, collapse it down to equivalent to just one. */ zero_times_ok = 0; many_times_ok = 0; for (;;) { zero_times_ok |= c != '+'; many_times_ok |= c != '?'; if (p == pend) break; PATFETCH (c); if (c == '*') ; else if (!(obscure_syntax & RE_BK_PLUS_QM) && (c == '+' || c == '?')) ; else if ((obscure_syntax & RE_BK_PLUS_QM) && c == '\\') { int c1; PATFETCH (c1); if (!(c1 == '+' || c1 == '?')) { #ifdef KANJI PATUNFETCH(c1); PATUNFETCH(c); #else PATUNFETCH; PATUNFETCH; #endif break; } c = c1; } else { #ifdef KANJI PATUNFETCH(c); #else PATUNFETCH; #endif break; } } /* Star, etc. applied to an empty pattern is equivalent to an empty pattern. */ if (!laststart) break; /* Now we know whether 0 matches is allowed, and whether 2 or more matches is allowed. */ if (many_times_ok) { /* If more than one repetition is allowed, put in a backward jump at the end. */ store_jump (b, maybe_finalize_jump, laststart - 3); b += 3; } insert_jump (on_failure_jump, laststart, b + 3, b); pending_exact = 0; b += 3; if (!zero_times_ok) { /* At least one repetition required: insert before the loop a skip over the initial on-failure-jump instruction */ insert_jump (dummy_failure_jump, laststart, laststart + 6, b); b += 3; } break; case '.': laststart = b; PATPUSH (anychar); break; case '[': #ifdef KANJI { char * BB; unsigned short tmp; while (b - bufp->buffer > bufp->allocated - 7) EXTEND_BUFFER; laststart = b; if (*p == '^') { PATPUSH (charset_not); p++; } else PATPUSH (charset); p1 = p; tmp = b - bufp->buffer; /* for char set list size */ b += 2; /*sizeof(short)*/ for (;;) { while (b - bufp->buffer > bufp->allocated - 10) EXTEND_BUFFER; PATFETCH(c) /* If awk, \ escapes characters inside [...]. */ if ((obscure_syntax & RE_AWK_CLASS_HACK) && c == '\\'){ PATFETCH(c1); PATPUSH(charset_list); PATPUSHc(c1); continue; } if (c == ']' && p != p1 + 1) break; if (*p == '-' && p[1] != ']') { PATFETCH (c1); /* junk '-' */ PATFETCH (c1); /* get 'to' */ PATPUSH (charset_fromto); PATPUSH2(c); PATPUSH2(c1); } else { PATPUSH(charset_list); PATPUSHc(c); } } PATPUSH(charset_end); BB = bufp->buffer + tmp; /* *(unsigned short *)BB = (b - BB) - sizeof(short); */ tmp = (b - BB) - 2; BB[0] = (tmp >> 8)&0xff; BB[1] = tmp & 0xff; } #else /* KANJI */ while (b - bufp->buffer > bufp->allocated - 3 - (1 << BYTEWIDTH) / BYTEWIDTH) /* Note that EXTEND_BUFFER clobbers c */ EXTEND_BUFFER; laststart = b; if (*p == '^') { PATPUSH (charset_not); p++; } else PATPUSH (charset); p1 = p; PATPUSH ((1 << BYTEWIDTH) / BYTEWIDTH); /* Clear the whole map */ bzero (b, (1 << BYTEWIDTH) / BYTEWIDTH); /* Read in characters and ranges, setting map bits */ for (;;) { PATFETCH (c); /* If awk, \ escapes characters inside [...]. */ if ((obscure_syntax & RE_AWK_CLASS_HACK) && c == '\\') { PATFETCH(c1); b[c1 / BYTEWIDTH] |= 1 << (c1 % BYTEWIDTH); continue; } if (c == ']' && p != p1 + 1) break; if (*p == '-' && p[1] != ']') { PATFETCH (c1); PATFETCH (c1); while (c <= c1) b[c / BYTEWIDTH] |= 1 << (c % BYTEWIDTH), c++; } else { b[c / BYTEWIDTH] |= 1 << (c % BYTEWIDTH); } } /* Discard any bitmap bytes that are all 0 at the end of the map. Decrement the map-length byte too. */ while ((int) b[-1] > 0 && b[b[-1] - 1] == 0) b[-1]--; b += b[-1]; #endif /* !KANJI */ break; case '(': if (! (obscure_syntax & RE_NO_BK_PARENS)) goto normal_char; else goto handle_open; case ')': if (! (obscure_syntax & RE_NO_BK_PARENS)) goto normal_char; else goto handle_close; case '\n': if (! (obscure_syntax & RE_NEWLINE_OR)) goto normal_char; else goto handle_bar; case '|': if (! (obscure_syntax & RE_NO_BK_VBAR)) goto normal_char; else goto handle_bar; case '\\': if (p == pend) goto invalid_pattern; PATFETCH_RAW (c); switch (c) { case '(': if (obscure_syntax & RE_NO_BK_PARENS) goto normal_backsl; handle_open: if (stackp == stacke) goto nesting_too_deep; if (regnum < RE_NREGS) { PATPUSH (start_memory); PATPUSH (regnum); } /* force flush 'pending_exact' */ pending_exact = 0; *stackp++ = (int)(b - bufp->buffer); *stackp++ = fixup_jump ? (int)(fixup_jump - bufp->buffer + 1): 0; *stackp++ = regnum++; *stackp++ = (int)(begalt - bufp->buffer); fixup_jump = 0; laststart = 0; begalt = b; break; case ')': if (obscure_syntax & RE_NO_BK_PARENS) goto normal_backsl; handle_close: if (stackp == stackb) goto unmatched_close; begalt = *--stackp + bufp->buffer; if (fixup_jump) store_jump (fixup_jump, jump, b); if (stackp[-1] < RE_NREGS) { PATPUSH (stop_memory); PATPUSH (stackp[-1]); } /* force flush 'pending_exact' */ pending_exact = 0; stackp -= 2; fixup_jump = 0; if (*stackp) fixup_jump = *stackp + bufp->buffer - 1; laststart = *--stackp + bufp->buffer; break; case '|': if (obscure_syntax & RE_NO_BK_VBAR) goto normal_backsl; handle_bar: insert_jump (on_failure_jump, begalt, b + 6, b); pending_exact = 0; b += 3; if (fixup_jump) store_jump (fixup_jump, jump, b); fixup_jump = b; b += 3; laststart = 0; begalt = b; break; #ifdef emacs case '=': PATPUSH (at_dot); break; case 's': laststart = b; PATPUSH (syntaxspec); PATFETCH (c); PATPUSH (syntax_spec_code[c]); break; case 'S': laststart = b; PATPUSH (notsyntaxspec); PATFETCH (c); PATPUSH (syntax_spec_code[c]); break; #endif /* emacs */ case 'w': laststart = b; PATPUSH (wordchar); break; case 'W': laststart = b; PATPUSH (notwordchar); break; case '<': PATPUSH (wordbeg); break; case '>': PATPUSH (wordend); break; case 'b': PATPUSH (wordbound); break; case 'B': PATPUSH (notwordbound); break; case '`': PATPUSH (begbuf); break; case '\'': PATPUSH (endbuf); break; case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': c1 = c - '0'; if (c1 >= regnum) goto normal_char; for (stackt = stackp - 2; stackt > stackb; stackt -= 4) if (*stackt == c1) goto normal_char; laststart = b; PATPUSH (duplicate); #ifdef KANJI PATPUSHc(c1); #else PATPUSH (c1); #endif break; case '+': case '?': if (obscure_syntax & RE_BK_PLUS_QM) goto handle_plus; default: normal_backsl: /* You might think it would be useful for \ to mean not to translate; but if we don't translate it it will never match anything. */ if (translate) c = translate[c]; goto normal_char; } break; default: normal_char: if (!pending_exact || pending_exact + *pending_exact + 1 != b || *pending_exact == 0177 || *p == '*' || *p == '^' || ((obscure_syntax & RE_BK_PLUS_QM) ? *p == '\\' && (p[1] == '+' || p[1] == '?') : (*p == '+' || *p == '?'))) { laststart = b; PATPUSH (exactn); pending_exact = b; PATPUSH (0); } #ifdef KANJI PATPUSHc(c); if (c & 0xFF00) (*pending_exact)++; #else PATPUSH (c); #endif (*pending_exact)++; } } if (fixup_jump) store_jump (fixup_jump, jump, b); if (stackp != stackb) goto unmatched_open; bufp->used = (int)(b - bufp->buffer); return 0; invalid_pattern: return "Invalid regular expression"; unmatched_open: return "Unmatched \\("; unmatched_close: return "Unmatched \\)"; end_of_pattern: return "Premature end of regular expression"; nesting_too_deep: return "Nesting too deep"; too_big: return "Regular expression too big"; memory_exhausted: return "Memory exhausted"; } /* Store where `from' points a jump operation to jump to where `to' points. `opcode' is the opcode to store. */ static void store_jump (from, opcode, to) char *from, *to; int opcode; { from[0] = opcode; from[1] = (char)((to - (from + 3)) & 0377); from[2] = (char)((to - (from + 3)) >> 8); } /* Open up space at char FROM, and insert there a jump to TO. CURRENT_END gives te end of the storage no in use, so we know how much data to copy up. OP is the opcode of the jump to insert. If you call this function, you must zero out pending_exact. */ static void insert_jump (op, from, to, current_end) int op; char *from, *to, *current_end; { register char *pto = current_end + 3; register char *pfrom = current_end; while (pfrom != from) *--pto = *--pfrom; store_jump (from, op, to); } /* Given a pattern, compute a fastmap from it. The fastmap records which of the (1 << BYTEWIDTH) possible characters can start a string that matches the pattern. This fastmap is used by re_search to skip quickly over totally implausible text. The caller must supply the address of a (1 << BYTEWIDTH)-byte data area as bufp->fastmap. The other components of bufp describe the pattern to be used. */ void re_compile_fastmap (bufp) struct re_pattern_buffer *bufp; { unsigned char *pattern = (unsigned char *) bufp->buffer; int size = bufp->used; register char *fastmap = bufp->fastmap; register unsigned char *p = pattern; register unsigned char *pend = pattern + size; register int j/*, k*/; unsigned char *translate = (unsigned char *) bufp->translate; unsigned char *stackb[NFAILURES]; unsigned char **stackp = stackb; bzero (fastmap, (1 << BYTEWIDTH)); bufp->fastmap_accurate = 1; bufp->can_be_null = 0; while (p) { if (p == pend) { #if 0 bufp->can_be_null = 1; break; #else if (stackp != stackb) { p = *stackp--; } else { bufp->can_be_null = 1; break; } #endif } #ifdef SWITCH_ENUM_BUG switch ((int) ((enum regexpcode) *p++)) #else switch ((enum regexpcode) *p++) #endif { case exactn: if (translate) fastmap[translate[p[1]]] = 1; else fastmap[p[1]] = 1; break; case begline: case before_dot: case at_dot: case after_dot: case begbuf: case endbuf: case wordbound: case notwordbound: case wordbeg: case wordend: continue; case endline: if (translate) fastmap[translate['\n']] = 1; else fastmap['\n'] = 1; if (bufp->can_be_null != 1) bufp->can_be_null = 2; break; case finalize_jump: case maybe_finalize_jump: case jump: case dummy_failure_jump: bufp->can_be_null = 1; j = *p++ & 0377; j += SIGN_EXTEND_CHAR (*(char *)p) << 8; p += j + 1; /* The 1 compensates for missing ++ above */ if (j > 0) continue; /* Jump backward reached implies we just went through the body of a loop and matched nothing. Opcode jumped to should be an on_failure_jump. Just treat it like an ordinary jump. For a * loop, it has pushed its failure point already; if so, discard that as redundant. */ if ((enum regexpcode) *p != on_failure_jump) continue; p++; j = *p++ & 0377; j += SIGN_EXTEND_CHAR (*(char *)p) << 8; p += j + 1; /* The 1 compensates for missing ++ above */ if (stackp != stackb && *stackp == p) stackp--; continue; case on_failure_jump: j = *p++ & 0377; j += SIGN_EXTEND_CHAR (*(char *)p) << 8; p++; *++stackp = p + j; continue; case start_memory: case stop_memory: p++; continue; case duplicate: bufp->can_be_null = 1; fastmap['\n'] = 1; case anychar: for (j = 0; j < (1 << BYTEWIDTH); j++) if (j != '\n') fastmap[j] = 1; if (bufp->can_be_null) return; /* Don't return; check the alternative paths so we can set can_be_null if appropriate. */ break; case wordchar: for (j = 0; j < (1 << BYTEWIDTH); j++) if (SYNTAX (j) == Sword) fastmap[j] = 1; break; case notwordchar: for (j = 0; j < (1 << BYTEWIDTH); j++) if (SYNTAX (j) != Sword) fastmap[j] = 1; break; #ifdef emacs case syntaxspec: k = *p++; for (j = 0; j < (1 << BYTEWIDTH); j++) if (SYNTAX (j) == (enum syntaxcode) k) fastmap[j] = 1; break; case notsyntaxspec: k = *p++; for (j = 0; j < (1 << BYTEWIDTH); j++) if (SYNTAX (j) != (enum syntaxcode) k) fastmap[j] = 1; break; #endif /* emacs */ case charset: #ifdef KANJI { unsigned char * PP; unsigned short c1, c2; for (PP = p + 2 /* sizeof(short) */;;) { if (*PP == (unsigned char) charset_end) { break; } else if (*PP == (unsigned char) charset_list) { ++PP; c1 = (unsigned short)*PP++; if (!ISKANJI(c1) && translate) { fastmap[translate[c1]] = 1; } else { fastmap[c1] = 1; } if (ISKANJI(c1)) PP++; } else if (*PP == (unsigned char) charset_fromto) { ++PP; if ((c1 = (*PP++) & 0xFF) == 0) /* not kanji */ c1 = (*PP) & 0xFF; ++PP; if ((c2 = (*PP++) & 0xFF) == 0) /* not kanji */ c2 = (*PP) & 0xFF; ++PP; for (; c1 <= c2; c1++) { if (!ISKANJI(c1) && translate) { fastmap[translate[c1]] = 1; } else { fastmap[c1] = 1; } } } else break; /* ??? */ } } #else /* !KANJI */ for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--) if (p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH))) { if (translate) fastmap[translate[j]] = 1; else fastmap[j] = 1; } #endif /* !KANJI */ break; case charset_not: #ifdef KANJI { unsigned char tmpmap[1 << BYTEWIDTH]; unsigned char * PP; unsigned short c1, c2; for (j = 0; j < (1 << BYTEWIDTH); j++) tmpmap[j] = 1; for (PP = p + 2 /* sizeof(short) */;;) { if (*PP == (unsigned char) charset_end) { break; } else if (*PP == (unsigned char) charset_list) { ++PP; c1 = (unsigned short)*PP++; if (!ISKANJI(c1)) { if (translate) tmpmap[translate[c1]] = 0; else tmpmap[c1] = 0; } if (ISKANJI(c1)) PP++; } else if (*PP == (unsigned char) charset_fromto) { ++PP; if ((c1 = (*PP++) & 0xFF) == 0) /* not kanji */ c1 = (*PP) & 0xFF; ++PP; if ((c2 = (*PP++) & 0xFF) == 0) /* not kanji */ c2 = (*PP) & 0xFF; ++PP; for (c1++; c1 < c2; c1++) { if (ISKANJI(c1)) tmpmap[c1] = 0; else { if (translate) tmpmap[translate[c1]] = 0; else tmpmap[c1] = 0; } } } else break; /* ??? */ } for (j = 0; j < (1 << BYTEWIDTH); j++) { fastmap[j] |= tmpmap[j]; } } #else /* !KANJI */ /* Chars beyond end of map must be allowed */ for (j = *p * BYTEWIDTH; j < (1 << BYTEWIDTH); j++) if (translate) fastmap[translate[j]] = 1; else fastmap[j] = 1; for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--) if (!(p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH)))) { if (translate) fastmap[translate[j]] = 1; else fastmap[j] = 1; } #endif break; } /* Get here means we have successfully found the possible starting characters of one path of the pattern. We need not follow this path any farther. Instead, look at the next alternative remembered in the stack. */ if (stackp != stackb) p = *stackp--; else break; } } /* Like re_search_2, below, but only one string is specified. */ int re_search (pbufp, string, size, startpos, range, regs) struct re_pattern_buffer *pbufp; char *string; int size, startpos, range; struct re_registers *regs; { return re_search_2 (pbufp, 0, 0, string, size, startpos, range, regs, size); } /* Like re_match_2 but tries first a match starting at index STARTPOS, then at STARTPOS + 1, and so on. RANGE is the number of places to try before giving up. If RANGE is negative, the starting positions tried are STARTPOS, STARTPOS - 1, etc. It is up to the caller to make sure that range is not so large as to take the starting position outside of the input strings. The value returned is the position at which the match was found, or -1 if no match was found, or -2 if error (such as failure stack overflow). */ int re_search_2 (pbufp, string1, size1, string2, size2, startpos, range, regs, mstop) struct re_pattern_buffer *pbufp; char *string1, *string2; int size1, size2; int startpos; register int range; struct re_registers *regs; int mstop; { register char *fastmap = pbufp->fastmap; register unsigned char *translate = (unsigned char *) pbufp->translate; int total = size1 + size2; int val; /* Update the fastmap now if not correct already */ if (fastmap && !pbufp->fastmap_accurate) re_compile_fastmap (pbufp); /* Don't waste time in a long search for a pattern that says it is anchored. */ if (pbufp->used > 0 && (enum regexpcode) pbufp->buffer[0] == begbuf && range > 0) { if (startpos > 0) return -1; else range = 1; } for (;;) { #ifdef KANJI if (startpos >= size1) { if (kpart(string2, &string2[startpos - size1]) == 2) goto advance; } else { if (kpart(string1, &string1[startpos]) == 2) goto advance; } #endif /* If a fastmap is supplied, skip quickly over characters that cannot possibly be the start of a match. Note, however, that if the pattern can possibly match the null string, we must test it at each starting point so that we take the first null string we get. */ if (fastmap && startpos < total && pbufp->can_be_null != 1) { if (range > 0) { register int lim = 0; register unsigned char *p; int irange = range; if (startpos < size1 && startpos + range >= size1) lim = range - (size1 - startpos); p = ((unsigned char *) &(startpos >= size1 ? string2 - size1 : string1)[startpos]); if (translate) { #ifdef KANJI for (;;) { if (range > lim && !fastmap[translate[*p]]) { if (ISKANJI(*p)) p++, range--; p++; range--; continue; } break; } #else while (range > lim && !fastmap[translate[*p++]]) range--; #endif } else { #ifdef KANJI for (;;) { if (range > lim && !fastmap[*p]) { if (ISKANJI(*p)) p++, range--; p++; range--; continue; } break; } #else while (range > lim && !fastmap[*p++]) range--; #endif } startpos += irange - range; } else { register unsigned char c; if (startpos >= size1) c = string2[startpos - size1]; else c = string1[startpos]; c &= 0xff; if (translate ? !fastmap[translate[c]] : !fastmap[c]) goto advance; } } if (range >= 0 && startpos == total && fastmap && pbufp->can_be_null == 0) return -1; val = re_match_2 (pbufp, (unsigned char *)string1, size1, (unsigned char *)string2, size2, startpos, regs, mstop); if (0 <= val) { if (val == -2) return -2; return startpos; } #ifdef C_ALLOCA alloca (0); #endif /* C_ALLOCA */ advance: if (!range) break; if (range > 0) range--, startpos++; else range++, startpos--; } return -1; } #ifndef ng /* Ng never uses this */ #ifndef emacs /* emacs never uses this */ int re_match (pbufp, string, size, pos, regs) struct re_pattern_buffer *pbufp; char *string; int size, pos; struct re_registers *regs; { return re_match_2 (pbufp, 0, 0, (unsigned char *)string, size, pos, regs, size); } #endif /* emacs */ #endif /* ng */ /* Maximum size of failure stack. Beyond this, overflow is an error. */ #ifdef MSDOS int re_max_failures = 500; #else int re_max_failures = 2000; #endif static int bcmp_translate(); /* Match the pattern described by PBUFP against data which is the virtual concatenation of STRING1 and STRING2. SIZE1 and SIZE2 are the sizes of the two data strings. Start the match at position POS. Do not consider matching past the position MSTOP. If pbufp->fastmap is nonzero, then it had better be up to date. The reason that the data to match are specified as two components which are to be regarded as concatenated is so this function can be used directly on the contents of an Emacs buffer. -1 is returned if there is no match. -2 is returned if there is an error (such as match stack overflow). Otherwise the value is the length of the substring which was matched. */ int re_match_2 (pbufp, string1, size1, string2, size2, pos, regs, mstop) struct re_pattern_buffer *pbufp; unsigned char *string1, *string2; int size1, size2; int pos; struct re_registers *regs; int mstop; { register unsigned char *p = (unsigned char *) pbufp->buffer; register unsigned char *pend = p + pbufp->used; /* End of first string */ unsigned char *end1; /* End of second string */ unsigned char *end2; /* Pointer just past last char to consider matching */ unsigned char *end_match_1, *end_match_2; register unsigned char *d, *dend; register int mcnt; unsigned char *translate = (unsigned char *) pbufp->translate; /* Failure point stack. Each place that can handle a failure further down the line pushes a failure point on this stack. It consists of two char *'s. The first one pushed is where to resume scanning the pattern; the second pushed is where to resume scanning the strings. If the latter is zero, the failure point is a "dummy". If a failure happens and the innermost failure point is dormant, it discards that failure point and tries the next one. */ unsigned char *initial_stack[2 * NFAILURES]; unsigned char **stackb = initial_stack; unsigned char **stackp = stackb, **stacke = &stackb[2 * NFAILURES]; /* Information on the "contents" of registers. These are pointers into the input strings; they record just what was matched (on this attempt) by some part of the pattern. The start_memory command stores the start of a register's contents and the stop_memory command stores the end. At that point, regstart[regnum] points to the first character in the register, regend[regnum] points to the first character beyond the end of the register, regstart_seg1[regnum] is true iff regstart[regnum] points into string1, and regend_seg1[regnum] is true iff regend[regnum] points into string1. */ unsigned char *regstart[RE_NREGS]; unsigned char *regend[RE_NREGS]; unsigned char regstart_seg1[RE_NREGS], regend_seg1[RE_NREGS]; /* Set up pointers to ends of strings. Don't allow the second string to be empty unless both are empty. */ if (!size2) { string2 = string1; size2 = size1; string1 = 0; size1 = 0; } end1 = string1 + size1; end2 = string2 + size2; /* Compute where to stop matching, within the two strings */ if (mstop <= size1) { end_match_1 = string1 + mstop; end_match_2 = string2; } else { end_match_1 = end1; end_match_2 = string2 + mstop - size1; } /* Initialize \) text positions to -1 to mark ones that no \( or \) has been seen for. */ for (mcnt = 0; mcnt < sizeof (regend) / sizeof (*regend); mcnt++) regend[mcnt] = (unsigned char *) -1; /* `p' scans through the pattern as `d' scans through the data. `dend' is the end of the input string that `d' points within. `d' is advanced into the following input string whenever necessary, but this happens before fetching; therefore, at the beginning of the loop, `d' can be pointing at the end of a string, but it cannot equal string2. */ if (pos <= size1) d = string1 + pos, dend = end_match_1; else d = string2 + pos - size1, dend = end_match_2; /* Write PREFETCH; just before fetching a character with *d. */ #define PREFETCH \ while (d == dend) \ { if (dend == end_match_2) goto fail; /* end of string2 => failure */ \ d = string2; /* end of string1 => advance to string2. */ \ dend = end_match_2; } /* This loop loops over pattern commands. It exits by returning from the function if match is complete, or it drops through if match fails at this starting point in the input data. */ #ifdef KANJI #define GETJCP(d) (ISKANJI(*d) ? (d+=2,((d[-2]) << 8)|(d[-1] & 0377)):(*d++ & 0377)) #define GETJC(d) (ISKANJI(*d) ? (((*d) << 8)|(d[1] & 0377)):(*d & 0377)) #endif for (;;) { if (p == pend) /* End of pattern means we have succeeded! */ { /* If caller wants register contents data back, convert it to indices */ if (regs) { regs->start[0] = pos; if (dend == end_match_1) regs->end[0] = (int)(d - string1); else regs->end[0] = (int)(d - string2) + size1; for (mcnt = 1; mcnt < RE_NREGS; mcnt++) { if (regend[mcnt] == (unsigned char *) -1) { regs->start[mcnt] = -1; regs->end[mcnt] = -1; continue; } if (regstart_seg1[mcnt]) regs->start[mcnt] = (int)(regstart[mcnt] - string1); else regs->start[mcnt] = (int)(regstart[mcnt] - string2) +size1; if (regend_seg1[mcnt]) regs->end[mcnt] = (int)(regend[mcnt] - string1); else regs->end[mcnt] = (int)(regend[mcnt] - string2) + size1; } } if (dend == end_match_1) return ((int)(d - string1) - pos); else return (int)(d - string2) + size1 - pos; } /* Otherwise match next pattern command */ #ifdef SWITCH_ENUM_BUG switch ((int) ((enum regexpcode) *p++)) #else switch ((enum regexpcode) *p++) #endif { /* \( is represented by a start_memory, \) by a stop_memory. Both of those commands contain a "register number" argument. The text matched within the \( and \) is recorded under that number. Then, \ turns into a `duplicate' command which is followed by the numeric value of as the register number. */ case start_memory: regstart[*p] = d; regstart_seg1[*p++] = (unsigned char)(dend == end_match_1); break; case stop_memory: regend[*p] = d; regend_seg1[*p++] = (unsigned char)(dend == end_match_1); break; case duplicate: { int regno = *p++; /* Get which register to match against */ register unsigned char *d2, *dend2; d2 = regstart[regno]; dend2 = ((regstart_seg1[regno] == regend_seg1[regno]) ? regend[regno] : end_match_1); for (;;) { /* Advance to next segment in register contents, if necessary */ while (d2 == dend2) { if (dend2 == end_match_2) break; if (dend2 == regend[regno]) break; d2 = string2, dend2 = regend[regno]; /* end of string1 => advance to string2. */ } /* At end of register contents => success */ if (d2 == dend2) break; /* Advance to next segment in data being matched, if necessary */ PREFETCH; /* mcnt gets # consecutive chars to compare */ mcnt = (int)(dend - d); if (mcnt > (int)(dend2 - d2)) mcnt = (int)(dend2 - d2); /* Compare that many; failure if mismatch, else skip them. */ if (translate ? bcmp_translate (d, d2, mcnt, translate) : bcmp (d, d2, mcnt)) goto fail; d += mcnt, d2 += mcnt; } } break; case anychar: /* fetch a data character */ PREFETCH; /* Match anything but a newline. */ #ifdef KANJI if (ISKANJI(*d) && d[1]) { d++; PREFETCH; d++; break; } #endif if ((translate ? translate[*d++] : *d++) == '\n') goto fail; break; case charset: case charset_not: #ifdef KANJI { /* Nonzero for charset_not */ int not = 0; unsigned short f, c, pc1, pc2; unsigned char * PP; if (*(p - 1) == (unsigned char) charset_not) not = 1; /* fetch a data character */ PREFETCH; c = (unsigned short) GETJC(d); if (translate && ((c & 0xFF00) == 0)) c = (unsigned short) translate [*d]; for (PP = p + 2 /*sizeof(short)*/; ;) { if ((f = *PP++) == (unsigned char) charset_end) { break; } else if (f == (unsigned char) charset_list) { pc1 = GETJCP(PP); if (c == pc1) { not = !not; break; } else { continue; } } else if (f == (unsigned char) charset_fromto) { pc1 = (*PP++) << 8; pc1 += *PP++; pc2 = (*PP++) << 8; pc2 += *PP++; if ((pc1 <= c) && (c <= pc2)) { not = !not; break; } else { continue; } } else break; } /* p += sizeof(short) + *(short *)p; */ p += 2 + (((p[0]<<8) + (p[1]&0xff))&0xffff); if (!not) goto fail; if (ISKANJI(*d)) d++; d++; } break; #else /* !KANJI */ { /* Nonzero for charset_not */ int not = 0; register int c; if (*(p - 1) == (unsigned char) charset_not) not = 1; /* fetch a data character */ PREFETCH; if (translate) c = translate [*d]; else c = *d; if (c < *p * BYTEWIDTH && p[1 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH))) not = !not; p += 1 + *p; if (!not) goto fail; d++; break; } #endif /* !KANJI */ case begline: #if 0 if (d == string1 || d[-1] == '\n') #else if (d == string1) #endif break; goto fail; case endline: #if 0 if (d == end2 || (d == end1 ? (size2 == 0 || *string2 == '\n') : *d == '\n')) #else if (d == end2 || (d == end1 && size2 == 0)) #endif break; goto fail; /* "or" constructs ("|") are handled by starting each alternative with an on_failure_jump that points to the start of the next alternative. Each alternative except the last ends with a jump to the joining point. (Actually, each jump except for the last one really jumps to the following jump, because tensioning the jumps is a hassle.) */ /* The start of a stupid repeat has an on_failure_jump that points past the end of the repeat text. This makes a failure point so that, on failure to match a repetition, matching restarts past as many repetitions have been found with no way to fail and look for another one. */ /* A smart repeat is similar but loops back to the on_failure_jump so that each repetition makes another failure point. */ case on_failure_jump: if (stackp == stacke) { unsigned char **stackx; if (stacke - stackb > re_max_failures * 2) return -2; stackx = (unsigned char **) alloca (2 * (int)(stacke - stackb) * sizeof (char *)); bcopy (stackb, stackx, (int)(stacke - stackb) * sizeof (char *)); stackp = stackx + (int)(stackp - stackb); stacke = stackx + 2 * (int)(stacke - stackb); stackb = stackx; } mcnt = *p++ & 0377; mcnt += SIGN_EXTEND_CHAR (*(char *)p) << 8; p++; *stackp++ = mcnt + p; *stackp++ = d; break; /* The end of a smart repeat has an maybe_finalize_jump back. Change it either to a finalize_jump or an ordinary jump. */ case maybe_finalize_jump: mcnt = *p++ & 0377; mcnt += SIGN_EXTEND_CHAR (*(char *)p) << 8; p++; { register unsigned char *p2 = p; /* Compare what follows with the begining of the repeat. If we can establish that there is nothing that they would both match, we can change to finalize_jump */ while (p2 != pend && (*p2 == (unsigned char) stop_memory || *p2 == (unsigned char) start_memory)) p2++; if (p2 == pend) { p[-3] = (unsigned char) finalize_jump; } else if (*p2 == (unsigned char) exactn || *p2 == (unsigned char) endline) { register int c = *p2 == (unsigned char) endline ? '\n' : p2[2]; register unsigned char *p1 = p + mcnt; /* p1[0] ... p1[2] are an on_failure_jump. Examine what follows that */ if (p1[3] == (char) exactn && p1[5] != (char)c) p[-3] = (unsigned char) finalize_jump; else if (p1[3] == (unsigned char) charset || p1[3] == (unsigned char) charset_not) { int not = p1[3] == (unsigned char) charset_not; #ifdef KANJI unsigned short f, pc1, pc2; unsigned char * PP; if (ISKANJI(c)) c = (c << 8) + (p2[3] & 0xFF); for (PP = p1 + 4 + 2 /* sizeof(short) */; ;) { if ((f = *PP++) == (unsigned char) charset_end) { break; } else if (f == (unsigned char) charset_list) { pc1 = GETJCP(PP); if (c == pc1) { not = !not; break; } else { continue; } } else if (f == (unsigned char) charset_fromto) { pc1 = (*PP++) << 8; pc1 += *PP++; pc2 = (*PP++) << 8; pc2 += *PP++; if ((pc1 <= c) && (c <= pc2)) { not = !not; break; } else { continue; } } else break; } #else if (c < p1[4] * BYTEWIDTH && p1[5 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH))) not = !not; #endif /* not is 1 if c would match */ /* That means it is not safe to finalize */ if (!not) p[-3] = (unsigned char) finalize_jump; } } } p -= 2; if (p[-1] != (unsigned char) finalize_jump) { p[-1] = (unsigned char) jump; goto nofinalize; } /* The end of a stupid repeat has a finalize-jump back to the start, where another failure point will be made which will point after all the repetitions found so far. */ case finalize_jump: if (d == stackp[-1]) { goto fail; } stackp -= 2; case jump: nofinalize: mcnt = *p++ & 0377; mcnt += SIGN_EXTEND_CHAR (*(char *)p) << 8; p += mcnt + 1; /* The 1 compensates for missing ++ above */ break; case dummy_failure_jump: if (stackp == stacke) { unsigned char **stackx = (unsigned char **) alloca (2 * (int)(stacke - stackb) * sizeof (char *)); bcopy (stackb, stackx, (int)(stacke - stackb) * sizeof (char *)); stackp = stackx + (int)(stackp - stackb); stacke = stackx + 2 * (int)(stacke - stackb); stackb = stackx; } *stackp++ = 0; *stackp++ = 0; goto nofinalize; case wordbound: if (d == string1 /* Points to first char */ || d == end2 /* Points to end */ || (d == end1 && size2 == 0)) /* Points to end */ break; if ((SYNTAX (d[-1]) == Sword) != (SYNTAX (d == end1 ? *string2 : *d) == Sword)) break; goto fail; case notwordbound: if (d == string1 /* Points to first char */ || d == end2 /* Points to end */ || (d == end1 && size2 == 0)) /* Points to end */ goto fail; if ((SYNTAX (d[-1]) == Sword) != (SYNTAX (d == end1 ? *string2 : *d) == Sword)) goto fail; break; case wordbeg: if (d == end2 /* Points to end */ || (d == end1 && size2 == 0) /* Points to end */ || SYNTAX (* (d == end1 ? string2 : d)) != Sword) /* Next char not a letter */ goto fail; if (d == string1 /* Points to first char */ || SYNTAX (d[-1]) != Sword) /* prev char not letter */ break; goto fail; case wordend: if (d == string1 /* Points to first char */ || SYNTAX (d[-1]) != Sword) /* prev char not letter */ goto fail; if (d == end2 /* Points to end */ || (d == end1 && size2 == 0) /* Points to end */ || SYNTAX (d == end1 ? *string2 : *d) != Sword) /* Next char not a letter */ break; goto fail; #ifdef emacs case before_dot: if (((d - string2 <= (unsigned) size2) ? d - bf_p2 : d - bf_p1) <= point) goto fail; break; case at_dot: if (((d - string2 <= (unsigned) size2) ? d - bf_p2 : d - bf_p1) == point) goto fail; break; case after_dot: if (((d - string2 <= (unsigned) size2) ? d - bf_p2 : d - bf_p1) >= point) goto fail; break; case wordchar: mcnt = (int) Sword; goto matchsyntax; case syntaxspec: mcnt = *p++; matchsyntax: PREFETCH; if (SYNTAX (*d++) != (enum syntaxcode) mcnt) goto fail; break; case notwordchar: mcnt = (int) Sword; goto matchnotsyntax; case notsyntaxspec: mcnt = *p++; matchnotsyntax: PREFETCH; if (SYNTAX (*d++) == (enum syntaxcode) mcnt) goto fail; break; #else case wordchar: PREFETCH; if (SYNTAX (*d++) == 0) goto fail; break; case notwordchar: PREFETCH; if (SYNTAX (*d++) != 0) goto fail; break; #endif /* not emacs */ case begbuf: if (d == string1) /* Note, d cannot equal string2 */ break; /* unless string1 == string2. */ goto fail; case endbuf: if (d == end2 || (d == end1 && size2 == 0)) break; goto fail; case exactn: /* Match the next few pattern characters exactly. mcnt is how many characters to match. */ mcnt = *p++; if (translate) { do { PREFETCH; #ifdef KANJI if (ISKANJI(*d) && mcnt > 1) { if (*d++ != *p++) goto fail; --mcnt; PREFETCH; if (*d++ != *p++) goto fail; } else if (translate[*d++] != *p++) goto fail; #else if (translate[*d++] != *p++) goto fail; #endif } while (--mcnt); } else { do { PREFETCH; if (*d++ != *p++) goto fail; } while (--mcnt); } break; } continue; /* Successfully matched one pattern command; keep matching */ /* Jump here if any matching operation fails. */ fail: if (stackp != stackb) /* A restart point is known. Restart there and pop it. */ { if (!stackp[-2]) { /* If innermost failure point is dormant, flush it and keep looking */ stackp -= 2; goto fail; } d = *--stackp; p = *--stackp; if (d >= string1 && d <= end1) dend = end_match_1; } else break; /* Matching at this starting point really fails! */ } return -1; /* Failure to match */ } static int bcmp_translate (s1, s2, len, translate) unsigned char *s1, *s2; register int len; unsigned char *translate; { register unsigned char *p1 = s1, *p2 = s2; while (len) { if (translate [*p1++] != translate [*p2++]) return 1; len--; } return 0; } /* Entry points compatible with bsd4.2 regex library */ #ifndef ng #ifndef emacs static struct re_pattern_buffer re_comp_buf; char * re_comp (s) char *s; { if (s == (char *)0 || *s == '\0') { if (!re_comp_buf.buffer) return "No previous regular expression"; return 0; } if (!re_comp_buf.buffer) { if ((re_comp_buf.buffer = (char *) malloc (200)) == 0) return "Memory exhausted"; re_comp_buf.allocated = 200; if ((re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH)) == 0) return "Memory exhausted"; } return re_compile_pattern (s, strlen (s), &re_comp_buf); } int re_exec (s) char *s; { int len = strlen (s); return 0 <= re_search (&re_comp_buf, s, len, 0, len, 0); } #endif /* emacs */ #endif /* ng */ #ifdef test #include /* Indexed by a character, gives the upper case equivalent of the character */ static char upcase[0400] = { 000, 001, 002, 003, 004, 005, 006, 007, 010, 011, 012, 013, 014, 015, 016, 017, 020, 021, 022, 023, 024, 025, 026, 027, 030, 031, 032, 033, 034, 035, 036, 037, 040, 041, 042, 043, 044, 045, 046, 047, 050, 051, 052, 053, 054, 055, 056, 057, 060, 061, 062, 063, 064, 065, 066, 067, 070, 071, 072, 073, 074, 075, 076, 077, 0100, 0101, 0102, 0103, 0104, 0105, 0106, 0107, 0110, 0111, 0112, 0113, 0114, 0115, 0116, 0117, 0120, 0121, 0122, 0123, 0124, 0125, 0126, 0127, 0130, 0131, 0132, 0133, 0134, 0135, 0136, 0137, 0140, 0101, 0102, 0103, 0104, 0105, 0106, 0107, 0110, 0111, 0112, 0113, 0114, 0115, 0116, 0117, 0120, 0121, 0122, 0123, 0124, 0125, 0126, 0127, 0130, 0131, 0132, 0173, 0174, 0175, 0176, 0177, 0200, 0201, 0202, 0203, 0204, 0205, 0206, 0207, 0210, 0211, 0212, 0213, 0214, 0215, 0216, 0217, 0220, 0221, 0222, 0223, 0224, 0225, 0226, 0227, 0230, 0231, 0232, 0233, 0234, 0235, 0236, 0237, 0240, 0241, 0242, 0243, 0244, 0245, 0246, 0247, 0250, 0251, 0252, 0253, 0254, 0255, 0256, 0257, 0260, 0261, 0262, 0263, 0264, 0265, 0266, 0267, 0270, 0271, 0272, 0273, 0274, 0275, 0276, 0277, 0300, 0301, 0302, 0303, 0304, 0305, 0306, 0307, 0310, 0311, 0312, 0313, 0314, 0315, 0316, 0317, 0320, 0321, 0322, 0323, 0324, 0325, 0326, 0327, 0330, 0331, 0332, 0333, 0334, 0335, 0336, 0337, 0340, 0341, 0342, 0343, 0344, 0345, 0346, 0347, 0350, 0351, 0352, 0353, 0354, 0355, 0356, 0357, 0360, 0361, 0362, 0363, 0364, 0365, 0366, 0367, 0370, 0371, 0372, 0373, 0374, 0375, 0376, 0377 }; main (argc, argv) int argc; char **argv; { static char pat[1024]; struct re_pattern_buffer buf; int i; char fastmap[(1 << BYTEWIDTH)]; char * emessage; re_set_syntax(RE_SYNTAX_AWK); /* Allow a command argument to specify the style of syntax. */ if (argc > 1) obscure_syntax = atoi (argv[1]); buf.allocated = 40; buf.buffer = (char *) malloc (buf.allocated); buf.fastmap = fastmap; buf.translate = (char *)0;/*upcase;*/ buf.translate = (char *)upcase; for (;;) { *pat = 0; gets (pat); if (*pat) { if (emessage = re_compile_pattern (pat, strlen(pat), &buf)) { printf("%s\n", emessage); continue; } for (i = 0; i < buf.used; i++) printchar (buf.buffer[i]); putchar ('\n'); printf ("%d allocated, %d used.\n", buf.allocated, buf.used); re_compile_fastmap (&buf); printf ("Allowed by fastmap: "); for (i = 0; i < (1 << BYTEWIDTH); i++) if (fastmap[i]) printchar (i); putchar ('\n'); } gets (pat); /* Now read the string to match against */ i = re_match (&buf, pat, strlen (pat), 0, 0); printf ("Match value %d.\n", i); } } #ifdef NOTDEF print_buf (bufp) struct re_pattern_buffer *bufp; { int i; printf ("buf is :\n----------------\n"); for (i = 0; i < bufp->used; i++) printchar (bufp->buffer[i]); printf ("\n%d allocated, %d used.\n", bufp->allocated, bufp->used); printf ("Allowed by fastmap: "); for (i = 0; i < (1 << BYTEWIDTH); i++) if (bufp->fastmap[i]) printchar (i); printf ("\nAllowed by translate: "); if (bufp->translate) for (i = 0; i < (1 << BYTEWIDTH); i++) if (bufp->translate[i]) printchar (i); printf ("\nfastmap is%s accurate\n", bufp->fastmap_accurate ? "" : "n't"); printf ("can %s be null\n----------", bufp->can_be_null ? "" : "not"); } #endif printchar (c) char c; { if (c < 041 || c >= 0177) { #if 0 putchar ('\\'); putchar ('\\'); putchar (((c >> 6) & 3) + '0'); putchar (((c >> 3) & 7) + '0'); putchar ((c & 7) + '0'); #else printf("\\x%02x", (unsigned char)c); #endif } else putchar (c); } error (string) char *string; { puts (string); exit (1); } #endif /* test */ ng-1.5beta1/regex_j.h100644 1750 1750 31455 7126003714 13275 0ustar amurausers/* $Id: regex_j.h,v 1.1.1.1 2000/06/27 01:47:56 amura Exp $ */ /* Definitions for data structures callers pass the regex library. Copyright (C) 1985 Free Software Foundation, Inc. NO WARRANTY BECAUSE THIS PROGRAM IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY NO WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING, FREE SOFTWARE FOUNDATION, INC, RICHARD M. STALLMAN AND/OR OTHER PARTIES PROVIDE THIS PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL RICHARD M. STALLMAN, THE FREE SOFTWARE FOUNDATION, INC., AND/OR ANY OTHER PARTY WHO MAY MODIFY AND REDISTRIBUTE THIS PROGRAM AS PERMITTED BELOW, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY LOST PROFITS, LOST MONIES, OR OTHER SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS) THIS PROGRAM, EVEN IF YOU HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY. GENERAL PUBLIC LICENSE TO COPY 1. You may copy and distribute verbatim copies of this source file as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy a valid copyright notice "Copyright (C) 1985 Free Software Foundation, Inc."; and include following the copyright notice a verbatim copy of the above disclaimer of warranty and of this License. You may charge a distribution fee for the physical act of transferring a copy. 2. You may modify your copy or copies of this source file or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains or is a derivative of this program or any part thereof, to be licensed at no charge to all third parties on terms identical to those contained in this License Agreement (except that you may choose to grant more extensive warranty protection to some or all third parties, at your option). c) You may charge a distribution fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another unrelated program with this program (or its derivative) on a volume of a storage or distribution medium does not bring the other program under the scope of these terms. 3. You may copy and distribute this program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal shipping charge) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs. 4. You may not copy, sublicense, distribute or transfer this program except as expressly provided under this License Agreement. Any attempt otherwise to copy, sublicense, distribute or transfer this program is void and your rights to use the program under this License agreement shall be automatically terminated. However, parties who have received computer software programs from you with this License Agreement will not have their licenses terminated so long as such parties remain in full compliance. 5. If you wish to incorporate parts of this program into other free programs whose distribution conditions are different, write to the Free Software Foundation at 675 Mass Ave, Cambridge, MA 02139. We have not yet worked out a simple rule that can be stated here, but we will often permit this. We will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software. In other words, you are welcome to use, share and improve this program. You are forbidden to forbid anyone else to use, share and improve what you give them. Help stamp out software-hoarding! */ /* * $Log: regex_j.h,v $ * Revision 1.1.1.1 2000/06/27 01:47:56 amura * import to CVS * */ /* Define number of parens for which we record the beginnings and ends. This affects how much space the `struct re_registers' type takes up. */ #ifndef RE_NREGS #define RE_NREGS 10 #endif /* These bits are used in the obscure_syntax variable to choose among alternative regexp syntaxes. */ /* 1 means plain parentheses serve as grouping, and backslash parentheses are needed for literal searching. 0 means backslash-parentheses are grouping, and plain parentheses are for literal searching. */ #define RE_NO_BK_PARENS 1 /* 1 means plain | serves as the "or"-operator, and \| is a literal. 0 means \| serves as the "or"-operator, and | is a literal. */ #define RE_NO_BK_VBAR 2 /* 0 means plain + or ? serves as an operator, and \+, \? are literals. 1 means \+, \? are operators and plain +, ? are literals. */ #define RE_BK_PLUS_QM 4 /* 1 means | binds tighter than ^ or $. 0 means the contrary. */ #define RE_TIGHT_VBAR 8 /* 1 means treat \n as an _OR operator 0 means treat it as a normal character */ #define RE_NEWLINE_OR 16 /* 0 means that a special characters (such as *, ^, and $) always have their special meaning regardless of the surrounding context. 1 means that special characters may act as normal characters in some contexts. Specifically, this applies to: ^ - only special at the beginning, or after ( or | $ - only special at the end, or before ) or | *, +, ? - only special when not after the beginning, (, or | */ #define RE_CONTEXT_INDEP_OPS 32 /* 0 means that \ before anything inside [ and ] is taken as a real \. 1 means that such a \ escapes the following character This is a special case for AWK. */ #define RE_AWK_CLASS_HACK 64 /* Now define combinations of bits for the standard possibilities. */ #define RE_SYNTAX_POSIX_EGREP (RE_NO_BK_PARENS | RE_NO_BK_VBAR \ | RE_CONTEXT_INDEP_OPS) #define RE_SYNTAX_AWK (RE_SYNTAX_POSIX_EGREP | RE_AWK_CLASS_HACK) #define RE_SYNTAX_EGREP (RE_SYNTAX_POSIX_EGREP | RE_NEWLINE_OR) #define RE_SYNTAX_GREP (RE_BK_PLUS_QM | RE_NEWLINE_OR) #define RE_SYNTAX_EMACS 0 /* This data structure is used to represent a compiled pattern. */ struct re_pattern_buffer { char *buffer; /* Space holding the compiled pattern commands. */ int allocated; /* Size of space that buffer points to */ int used; /* Length of portion of buffer actually occupied */ char *fastmap; /* Pointer to fastmap, if any, or zero if none. */ /* re_search uses the fastmap, if there is one, to skip quickly over totally implausible characters */ char *translate; /* Translate table to apply to all characters before comparing. Or zero for no translation. The translation is applied to a pattern when it is compiled and to data when it is matched. */ char fastmap_accurate; /* Set to zero when a new pattern is stored, set to one when the fastmap is updated from it. */ char can_be_null; /* Set to one by compiling fastmap if this pattern might match the null string. It does not necessarily match the null string in that case, but if this is zero, it cannot. 2 as value means can match null string but at end of range or before a character listed in the fastmap. */ }; /* Structure to store "register" contents data in. Pass the address of such a structure as an argument to re_match, etc., if you want this information back. start[i] and end[i] record the string matched by \( ... \) grouping i, for i from 1 to RE_NREGS - 1. start[0] and end[0] record the entire string matched. */ struct re_registers { int start[RE_NREGS]; int end[RE_NREGS]; }; /* These are the command codes that appear in compiled regular expressions, one per byte. Some command codes are followed by argument bytes. A command code can specify any interpretation whatever for its arguments. Zero-bytes may appear in the compiled regular expression. */ enum regexpcode { unused, exactn, /* followed by one byte giving n, and then by n literal bytes */ begline, /* fails unless at beginning of line */ endline, /* fails unless at end of line */ jump, /* followed by two bytes giving relative address to jump to */ on_failure_jump, /* followed by two bytes giving relative address of place to resume at in case of failure. */ finalize_jump, /* Throw away latest failure point and then jump to address. */ maybe_finalize_jump, /* Like jump but finalize if safe to do so. This is used to jump back to the beginning of a repeat. If the command that follows this jump is clearly incompatible with the one at the beginning of the repeat, such that we can be sure that there is no use backtracking out of repetitions already completed, then we finalize. */ dummy_failure_jump, /* jump, and push a dummy failure point. This failure point will be thrown away if an attempt is made to use it for a failure. A + construct makes this before the first repeat. */ anychar, /* matches any one character */ charset, /* matches any one char belonging to specified set. First following byte is # bitmap bytes. Then come bytes for a bit-map saying which chars are in. Bits in each byte are ordered low-bit-first. A character is in the set if its bit is 1. A character too large to have a bit in the map is automatically not in the set */ #ifdef KANJI charset_list, /* char set list */ charset_fromto, /* follow 4 bytes form_to bound */ charset_end, /* end of char set */ #endif charset_not, /* similar but match any character that is NOT one of those specified */ start_memory, /* starts remembering the text that is matched and stores it in a memory register. followed by one byte containing the register number. Register numbers must be in the range 0 through NREGS. */ stop_memory, /* stops remembering the text that is matched and stores it in a memory register. followed by one byte containing the register number. Register numbers must be in the range 0 through NREGS. */ duplicate, /* match a duplicate of something remembered. Followed by one byte containing the index of the memory register. */ before_dot, /* Succeeds if before dot */ at_dot, /* Succeeds if at dot */ after_dot, /* Succeeds if after dot */ begbuf, /* Succeeds if at beginning of buffer */ endbuf, /* Succeeds if at end of buffer */ wordchar, /* Matches any word-constituent character */ notwordchar, /* Matches any char that is not a word-constituent */ wordbeg, /* Succeeds if at word beginning */ wordend, /* Succeeds if at word end */ wordbound, /* Succeeds if at a word boundary */ notwordbound, /* Succeeds if not at a word boundary */ syntaxspec, /* Matches any character whose syntax is specified. followed by a byte which contains a syntax code, Sword or such like */ notsyntaxspec /* Matches any character whose syntax differs from the specified. */ }; extern char *re_compile_pattern (); /* Is this really advertised? */ extern void re_compile_fastmap (); extern int re_search (), re_search_2 (); extern int re_match (), re_match_2 (); /* 4.2 bsd compatibility (yuck) */ extern char *re_comp (); extern int re_exec (); #ifdef SYNTAX_TABLE extern char *re_syntax_table; #endif ng-1.5beta1/region.c100644 1750 1750 23742 7303476061 13136 0ustar amurausers/* $Id: region.c,v 1.3 2001/05/25 15:37:21 amura Exp $ */ /* * Region based commands. * The routines in this file * deal with the region, that magic space * between "." and mark. Some functions are * commands. Some functions are just for * internal use. */ /* * $Log: region.c,v $ * Revision 1.3 2001/05/25 15:37:21 amura * now buffers have only one mark (before windows have one mark) * * Revision 1.2 2001/02/18 17:07:27 amura * append AUTOSAVE feature (but NOW not work) * * Revision 1.1.1.1 2000/06/27 01:47:56 amura * import to CVS * */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include "def.h" #ifdef UNDO #include "undo.h" #endif int getregion pro((REGION*)); static int setsize pro((REGION*,RSIZE)); #ifdef CHGMISC /* 97.11.10 by M.Suzuki */ copywordregion(f, n) { setmark(f, n); forwword(f,n); return copyregion(f, n); } #endif /* CHGMISC */ /* * Kill the region. Ask "getregion" * to figure out the bounds of the region. * Move "." to the start, and kill the characters. */ /*ARGSUSED*/ killregion(f, n) { register int s; REGION region; #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ if ((s=getregion(®ion)) != TRUE) return (s); if ((lastflag&CFKILL) == 0) /* This is a kill type */ kdelete(); /* command, so do magic */ thisflag |= CFKILL; /* kill buffer stuff. */ curwp->w_dotp = region.r_linep; curwp->w_doto = region.r_offset; return (ldelete(region.r_size, KFORW)); } #ifdef CLIPBOARD extern int send_clipboard(void); extern int receive_clipboard(void); #endif /* CLIPBOARD */ /* * Copy all of the characters in the * region to the kill buffer. Don't move dot * at all. This is a bit like a kill region followed * by a yank. */ /*ARGSUSED*/ copyregion(f, n) { register LINE *linep; register int loffs; register int s; REGION region; VOID kdelete(); if ((s=getregion(®ion)) != TRUE) return s; if ((lastflag&CFKILL) == 0) /* Kill type command. */ kdelete(); thisflag |= CFKILL; linep = region.r_linep; /* Current line. */ loffs = region.r_offset; /* Current offset. */ while (region.r_size--) { if (loffs == llength(linep)) { /* End of line. */ if ((s=kinsert('\n', KFORW)) != TRUE) return (s); linep = lforw(linep); loffs = 0; } else { /* Middle of line. */ if ((s=kinsert(lgetc(linep, loffs), KFORW)) != TRUE) return s; ++loffs; } } #ifdef CLIPBOARD send_clipboard(); #endif /* CLIPBOARD */ return TRUE; } /* * Copy all of the characters in the * buffer to the kill buffer. Don't move dot * at all. This is a bit like a kill region followed * by a yank for whole buffer. */ /*ARGSUSED*/ copybuffer(f, n) { register LINE *linep, *elinep; register int loffs; register int s; VOID kdelete(); kdelete(); thisflag |= CFKILL; elinep = curbp->b_linep; linep = lforw(elinep); loffs = 0; while (1) { if (loffs == llength(linep)) { /* End of line. */ linep = lforw(linep); if (linep == elinep) { break; } loffs = 0; s = kinsert('\n', KFORW); if (s != TRUE) { return s; } } else { /* Middle of line. */ s = kinsert(lgetc(linep, loffs), KFORW); if (s != TRUE) { return s; } loffs++; } } #ifdef CLIPBOARD send_clipboard(); #endif /* CLIPBOARD */ ewprintf("Done"); return TRUE; } /* * Lower case region. Zap all of the upper * case characters in the region to lower case. Use * the region code to set the limits. Scan the buffer, * doing the changes. Call "lchange" to ensure that * redisplay is done in all buffers. */ /*ARGSUSED*/ lowerregion(f, n) { register LINE *linep; register int loffs; register int c; register int s; REGION region; #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ if ((s=getregion(®ion)) != TRUE) return s; #ifdef UNDO undo_reset(curbp); /* this function cannot undo */ #endif lchange(WFHARD); linep = region.r_linep; loffs = region.r_offset; while (region.r_size--) { if (loffs == llength(linep)) { linep = lforw(linep); loffs = 0; } else { c = lgetc(linep, loffs); if (ISUPPER(c) != FALSE) lputc(linep, loffs, TOLOWER(c)); ++loffs; } } return TRUE; } /* * Upper case region. Zap all of the lower * case characters in the region to upper case. Use * the region code to set the limits. Scan the buffer, * doing the changes. Call "lchange" to ensure that * redisplay is done in all buffers. */ /*ARGSUSED*/ upperregion(f, n) { register LINE *linep; register int loffs; register int c; register int s; REGION region; VOID lchange(); #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ if ((s=getregion(®ion)) != TRUE) return s; #ifdef UNDO undo_reset(curbp); /* this function cannot undo */ #endif lchange(WFHARD); linep = region.r_linep; loffs = region.r_offset; while (region.r_size--) { if (loffs == llength(linep)) { linep = lforw(linep); loffs = 0; } else { c = lgetc(linep, loffs); if (ISLOWER(c) != FALSE) lputc(linep, loffs, TOUPPER(c)); ++loffs; } } return TRUE; } /* * This routine figures out the bound of the region * in the current window, and stores the results into the fields * of the REGION structure. Dot and mark are usually close together, * but I don't know the order, so I scan outward from dot, in both * directions, looking for mark. The size is kept in a long. At the * end, after the size is figured out, it is assigned to the size * field of the region structure. If this assignment loses any bits, * then we print an error. This is "type independent" overflow * checking. All of the callers of this routine should be ready to * get an ABORT status, because I might add a "if regions is big, * ask before clobberring" flag. */ getregion(rp) register REGION *rp; { register LINE *flp; register LINE *blp; register long fsize; /* Long now. */ register long bsize; BUFFER *bp = curwp->w_bufp; if (bp->b_markp == NULL) { ewprintf("No mark set in this window"); return (FALSE); } if (curwp->w_dotp == bp->b_markp) { /* "r_size" always ok. */ rp->r_linep = curwp->w_dotp; if (curwp->w_doto < bp->b_marko) { rp->r_offset = curwp->w_doto; rp->r_size = (RSIZE) (bp->b_marko-curwp->w_doto); } else { rp->r_offset = bp->b_marko; rp->r_size = (RSIZE) (curwp->w_doto-bp->b_marko); } return TRUE; } flp = blp = curwp->w_dotp; /* Get region size. */ bsize = curwp->w_doto; fsize = llength(flp)-curwp->w_doto+1; while (lforw(flp)!=curbp->b_linep || lback(blp)!=curbp->b_linep) { if (lforw(flp) != curbp->b_linep) { flp = lforw(flp); if (flp == bp->b_markp) { rp->r_linep = curwp->w_dotp; rp->r_offset = curwp->w_doto; return (setsize(rp, (RSIZE) (fsize+bp->b_marko))); } fsize += llength(flp)+1; } if (lback(blp) != curbp->b_linep) { blp = lback(blp); bsize += llength(blp)+1; if (blp == bp->b_markp) { rp->r_linep = blp; rp->r_offset = bp->b_marko; return (setsize(rp, (RSIZE) (bsize-bp->b_marko))); } } } ewprintf("Bug: lost mark"); /* Gak! */ return FALSE; } /* * Set size, and check for overflow. */ static int setsize(rp, size) register REGION *rp; register RSIZE size; { rp->r_size = size; if (rp->r_size != size) { ewprintf("Region is too large"); return FALSE; } return TRUE; } #ifdef PREFIXREGION /* * Implements one of my favorite keyboard macros; put a string at the * beginning of a number of lines in a buffer. The quote string is * settable by using set-prefix-string. Great for quoting mail, which * is the real reason I wrote it, but also has uses for creating bar * comments (like the one you're reading) in C code. */ #define PREFIXLENGTH 40 static char prefix_string[PREFIXLENGTH] = { '>', '\0' }; /* * Prefix the region with whatever is in prefix_string. * Leaves dot at the beginning of the line after the end * of the region. If an argument is given, prompts for the * line prefix string. */ /*ARGSUSED*/ prefixregion(f, n) { register int s; register LINE *first, *last; register int nline; REGION region; char *prefix = prefix_string; #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ if ((f == TRUE) && ((s = setprefix(FFRAND, 1)) != TRUE)) return s; /* get # of lines to affect */ if ((s = getregion(®ion)) != TRUE) return (s); first = region.r_linep; last = (first == curwp->w_dotp) ? curbp->b_markp : curwp->w_dotp; for (nline = 1; first != last; nline++) first = lforw(first); /*move to beginning of region */ curwp->w_dotp = region.r_linep; curwp->w_doto = region.r_offset; /* for each line, go to beginning and insert the prefix string */ while (nline--) { (VOID) gotobol(FFRAND, 1); #ifdef UNDO if (undoptr != NULL) { if (*undoptr != NULL) (*undoptr)->u_type = UDNONE; prefix = prefix_string; if (*prefix) (VOID) linsert(1, *prefix++); for (; *prefix; prefix++) { undoptr = undobefore; (VOID) linsert(1, *prefix); } } else #endif for (prefix = prefix_string; *prefix; prefix++) (VOID) linsert(1, *prefix); (VOID) forwline(FFRAND, 1); } (VOID) gotobol(FFRAND, 1); return TRUE; } /* * Set prefix string. */ /*ARGSUSED*/ setprefix(f, n) { char buf[PREFIXLENGTH]; register int s; if (prefix_string[0] == '\0') s = ereply("Prefix string: ",buf,sizeof buf); else s = ereply("Prefix string (default %s): ", buf,sizeof buf,prefix_string); if (s == TRUE) (VOID) strcpy(prefix_string, buf); if ((s == FALSE) && (prefix_string[0] != '\0')) /* CR -- use old one */ s = TRUE; return s; } #endif ng-1.5beta1/search.c100644 1750 1750 51263 7303476061 13117 0ustar amurausers/* $Id: search.c,v 1.4 2001/05/25 15:37:21 amura Exp $ */ /* * Search commands. * The functions in this file implement the * search commands (both plain and incremental searches * are supported) and the query-replace command. * * The plain old search code is part of the original * MicroEMACS "distribution". The incremental search code, * and the query-replace code, is by Rich Ellison. */ /* * $Log: search.c,v $ * Revision 1.4 2001/05/25 15:37:21 amura * now buffers have only one mark (before windows have one mark) * * Revision 1.3 2001/01/05 14:07:05 amura * first implementation of Hojo Kanji support * * Revision 1.2 2000/07/22 17:54:09 amura * fix typo bug * * Revision 1.1.1.1 2000/06/27 01:47:56 amura * import to CVS * */ /* 90.01.29 Modified for Ng 1.0 by S.Yoshida */ /* 91.11.23 C-w command in isearch was added by bsh. You need to #define */ /* IS_ENHANCE to enable this. */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include "def.h" #ifndef NO_MACRO #include "macro.h" #endif #define SRCH_BEGIN (0) /* Search sub-codes. */ #define SRCH_FORW (-1) #define SRCH_BACK (-2) #define SRCH_NOPR (-3) #define SRCH_ACCM (-4) #define SRCH_MARK (-5) #ifdef IS_ENHANCE /* Search sub-codes for C-w in isearch. * It means LEN bytes of chars are added to pattern. */ #define SRCH_CHUNK_BASE (-6) #define SRCH_CHUNK(len,fail) (-(len*2)+SRCH_CHUNK_BASE-((fail)!=0)) #define SRCH_CHUNK_LEN(code) ((-(code)+SRCH_CHUNK_BASE)/2) #define SRCH_CHUNK_FAIL(code) ((-(code)+SRCH_CHUNK_BASE)%2) #endif typedef struct { int s_code; LINE *s_dotp; int s_doto; } SRCHCOM; static SRCHCOM cmds[NSRCH]; static int cip; int srch_lastdir = SRCH_NOPR; /* Last search flags. */ static VOID is_cpush(); static VOID is_lpush(); static VOID is_pop(); static int is_peek(); static VOID is_undo(); static int is_find(); static VOID is_prompt(); static VOID is_dspl(); static int eq(); #ifndef IS_ENHANCE #define is_fail(code) ((code)==SRCH_ACCM) #else static int is_fail(); static int is_addword(); #endif #ifdef IS_ENHANCE /* casefoldsearch: Does search ignore case ? */ #ifdef REGEX extern int casefoldsearch; /* Defined in re_search.c */ #else int casefoldsearch = TRUE; #endif #endif /* * Search forward. * Get a search string from the user, and search for it, * starting at ".". If found, "." gets moved to just after the * matched characters, and display does all the hard stuff. * If not found, it just prints a message. */ /*ARGSUSED*/ forwsearch(f, n) { register int s; if ((s=readpattern("Search")) != TRUE) return s; if (forwsrch() == FALSE) { ewprintf("Search failed: \"%s\"", pat); return FALSE; } srch_lastdir = SRCH_FORW; return TRUE; } /* * Reverse search. * Get a search string from the user, and search, starting at "." * and proceeding toward the front of the buffer. If found "." is left * pointing at the first character of the pattern [the last character that * was matched]. */ /*ARGSUSED*/ backsearch(f, n) { register int s; if ((s=readpattern("Search backward")) != TRUE) return (s); if (backsrch() == FALSE) { ewprintf("Search failed: \"%s\"", pat); return FALSE; } srch_lastdir = SRCH_BACK; return TRUE; } /* * Search again, using the same search string * and direction as the last search command. The direction * has been saved in "srch_lastdir", so you know which way * to go. */ /*ARGSUSED*/ searchagain(f, n) { if (srch_lastdir == SRCH_FORW) { if (forwsrch() == FALSE) { ewprintf("Search failed: \"%s\"", pat); return FALSE; } return TRUE; } if (srch_lastdir == SRCH_BACK) { if (backsrch() == FALSE) { ewprintf("Search failed: \"%s\"", pat); return FALSE; } return TRUE; } ewprintf("No last search"); return FALSE; } /* * Use incremental searching, initially in the forward direction. * isearch ignores any explicit arguments. */ /*ARGSUSED*/ forwisearch(f, n) { return isearch(SRCH_FORW); } /* * Use incremental searching, initially in the reverse direction. * isearch ignores any explicit arguments. */ /*ARGSUSED*/ backisearch(f, n) { return isearch(SRCH_BACK); } /* * Incremental Search. * dir is used as the initial direction to search. * ^S switch direction to forward * ^R switch direction to reverse * ^Q quote next character (allows searching for ^N etc.) * exit from Isearch * undoes last character typed. (tricky job to do this correctly). * ^W copy word from DOT. * other ^ set mark, exit search * Metakeys set mark, exit search * else accumulate into search string */ isearch(dir) { register int c; register LINE *clp; register int cbo; register int success; int pptr; char opat[NPAT]; VOID ungetkey(); #ifdef KANJI /* 90.01.29 by S.Yoshida */ register int kanji1st = 0; /* It is only KANJI 1st byte. */ #endif /* KANJI */ #ifndef NO_MACRO if(macrodef) { ewprintf("Can't isearch in macro"); return FALSE; } #endif for (cip=0; cipw_dotp; cbo = curwp->w_doto; is_lpush(); is_cpush(SRCH_BEGIN); success = TRUE; is_prompt(dir, TRUE, success); #ifdef FEPCTRL /* 90.11.26 by K.Takano */ fepmode_off(); #endif for (;;) { update(); c = getkey(FALSE); switch (c) { case CCHR('['): #ifdef EMACS_QUERY_KEYS case CCHR('M'): #endif /* EMACS_QUERY_KEYS */ srch_lastdir = dir; curwp->w_bufp->b_markp = clp; curwp->w_bufp->b_marko = cbo; ewprintf("Mark set"); return (TRUE); case CCHR('G'): if (success != TRUE) { while (is_fail(is_peek())) is_undo(&pptr, &dir); success = TRUE; is_prompt(dir, pptr < 0, success); break; } curwp->w_dotp = clp; curwp->w_doto = cbo; curwp->w_flag |= WFMOVE; srch_lastdir = dir; (VOID) ctrlg(FFRAND, 0); (VOID) strcpy(pat, opat); return ABORT; case CCHR(']'): case CCHR('S'): if (dir == SRCH_BACK) { dir = SRCH_FORW; is_lpush(); is_cpush(SRCH_FORW); success = TRUE; } if (success==FALSE && dir==SRCH_FORW) break; is_lpush(); pptr = strlen(pat); (VOID) forwchar(FFRAND, 1); if (is_find(SRCH_FORW) != FALSE) is_cpush(SRCH_MARK); else { (VOID) backchar(FFRAND, 1); ttbeep(); success = FALSE; } is_prompt(dir, pptr < 0, success); break; case CCHR('R'): if (dir == SRCH_FORW) { dir = SRCH_BACK; is_lpush(); is_cpush(SRCH_BACK); success = TRUE; } if (success==FALSE && dir==SRCH_BACK) break; is_lpush(); pptr = strlen(pat); (VOID) backchar(FFRAND, 1); if (is_find(SRCH_BACK) != FALSE) is_cpush(SRCH_MARK); else { (VOID) forwchar(FFRAND, 1); ttbeep(); success = FALSE; } is_prompt(dir, pptr < 0, success); break; case CCHR('H'): case CCHR('?'): is_undo(&pptr, &dir); if (!is_fail(is_peek())) success = TRUE; is_prompt(dir, pptr < 0, success); break; case CCHR('\\'): case CCHR('Q'): c = (char) getkey(FALSE); goto addchar; #ifndef EMACS_QUERY_KEYS case CCHR('M'): c = CCHR('J'); goto addchar; #endif /* !EMACS_QUERY_KEYS */ #ifdef IS_ENHANCE case CCHR('W'): { int chunklen; int optr = pptr; if (pptr == -1) pptr = 0; if (pptr == 0) success = TRUE; if( (chunklen = is_addword(pptr,dir)) == 0 ){ pptr = optr; ttbeep(); } else { pptr += chunklen; is_lpush(); if (!success) /* already failed */ is_cpush(SRCH_CHUNK(chunklen,1)); else { if (is_find(dir)) is_cpush(SRCH_CHUNK(chunklen,0)); else { success = FALSE; ttbeep(); is_cpush(SRCH_CHUNK(chunklen,1)); } } } is_prompt(dir, FALSE, success); } break; #endif default: if (ISCTRL(c)) { ungetkey(c); curwp->w_bufp->b_markp = clp; curwp->w_bufp->b_marko = cbo; ewprintf("Mark set"); curwp->w_flag |= WFMOVE; return TRUE; } /* and continue */ is_prompt(dir, FALSE, success); case CCHR('I'): case CCHR('J'): addchar: if (pptr == -1) pptr = 0; if (pptr == 0) success = TRUE; pat[pptr++] = c; if (pptr == NPAT) { ewprintf("Pattern too long"); return FALSE; } pat[pptr] = '\0'; #ifdef KANJI /* 90.01.29 by S.Yoshida */ if (kanji1st != 0) { /* If the KANJI 1st byte exists, */ /* we believe 'c' is KANJI 2nd byte. */ kanji1st--; } else if (ISKANJI(c)) { /* When there is only KANJI 1st */ /* byte, we don't search a patern. */ #ifdef HOJO_KANJI if (ISHOJO(c)) kanji1st = 2; else #endif kanji1st = 1; break; } #endif /* KANJI */ is_lpush(); if (success != FALSE) { if (is_find(dir) != FALSE) is_cpush(c); else { success = FALSE; ttbeep(); is_cpush(SRCH_ACCM); } } else is_cpush(SRCH_ACCM); is_prompt(dir, FALSE, success); } } /*NOTREACHED*/ } static VOID is_cpush(cmd) register int cmd; { if (++cip >= NSRCH) cip = 0; cmds[cip].s_code = cmd; } static VOID is_lpush() { register int ctp; ctp = cip+1; if (ctp >= NSRCH) ctp = 0; cmds[ctp].s_code = SRCH_NOPR; cmds[ctp].s_doto = curwp->w_doto; cmds[ctp].s_dotp = curwp->w_dotp; } static VOID is_pop() { if (cmds[cip].s_code != SRCH_NOPR) { curwp->w_doto = cmds[cip].s_doto; curwp->w_dotp = cmds[cip].s_dotp; curwp->w_flag |= WFMOVE; cmds[cip].s_code = SRCH_NOPR; } if (--cip <= 0) cip = NSRCH-1; } static int is_peek() { return cmds[cip].s_code; } /* this used to always return TRUE (the return value was checked) */ static VOID is_undo(pptr, dir) register int *pptr; register int *dir; { register int redo = FALSE ; switch (cmds[cip].s_code) { case SRCH_BEGIN: case SRCH_NOPR: *pptr = -1; case SRCH_MARK: break; case SRCH_FORW: *dir = SRCH_BACK; redo = TRUE; break; case SRCH_BACK: *dir = SRCH_FORW; redo = TRUE; break; default: #ifdef IS_ENHANCE if(cmds[cip].s_code < 0){ int len = SRCH_CHUNK_LEN(cmds[cip].s_code); *pptr -= len; pat[*pptr] = '\0'; break; } #endif case SRCH_ACCM: *pptr -= 1; #ifdef HUMAN68K /* 90.11.16 Sawayanagi Yosirou */ if (ISKANJI(pat[*pptr])) *pptr -= 1; #endif /* HUMAN68K */ if (*pptr < 0) *pptr = 0; pat[*pptr] = '\0'; break; } is_pop(); if (redo) is_undo(pptr, dir); } static int is_find(dir) register int dir; { register int plen, odoto; register LINE *odotp ; #ifdef KANJI /* 90.01.29 by S.Yoshida */ register int clen; /* Character length (not byte len). */ register int i; #endif /* KANJI */ odoto = curwp->w_doto; odotp = curwp->w_dotp; plen = strlen(pat); #ifdef KANJI /* 90.01.29 by S.Yoshida */ for (i = 0, clen = 0; i < plen; i++, clen++) { if (ISKANJI(pat[i])) { #ifdef HOJO_KANJI if (ISHOJO(pat[i])) i++; #endif i++; } } #endif /* KANJI */ if (plen != 0) { if (dir==SRCH_FORW) { #ifdef KANJI /* 90.01.29 by S.Yoshida */ /* Backward char with "character" */ /* length, not "byte" length. */ for (i = 0; i < clen; i++) { (VOID) backchar(FFARG | FFRAND, 1); } #else /* NOT KANJI */ (VOID) backchar(FFARG | FFRAND, plen); #endif /* KANJI */ if (forwsrch() == FALSE) { curwp->w_doto = odoto; curwp->w_dotp = odotp; return FALSE; } return TRUE; } if (dir==SRCH_BACK) { #ifdef KANJI /* 90.01.29 by S.Yoshida */ /* forward char with "character" */ /* length, not "byte" length. */ for (i = 0; i < clen; i++) { (VOID) forwchar(FFARG | FFRAND, 1); } #else /* NOT KANJI */ (VOID) forwchar(FFARG | FFRAND, plen); #endif /* KANJI */ if (backsrch() == FALSE) { curwp->w_doto = odoto; curwp->w_dotp = odotp; return FALSE; } return TRUE; } ewprintf("bad call to is_find"); return FALSE; } return FALSE; } /* * If called with "dir" not one of SRCH_FORW * or SRCH_BACK, this routine used to print an error * message. It also used to return TRUE or FALSE, * depending on if it liked the "dir". However, none * of the callers looked at the status, so I just * made the checking vanish. */ static VOID is_prompt(dir, flag, success) { if (dir == SRCH_FORW) { if (success != FALSE) is_dspl("I-search", flag); else is_dspl("Failing I-search", flag); } else if (dir == SRCH_BACK) { if (success != FALSE) is_dspl("I-search backward", flag); else is_dspl("Failing I-search backward", flag); } else ewprintf("Broken call to is_prompt"); } /* * Prompt writing routine for the incremental search. * The "prompt" is just a string. The "flag" determines * whether pat should be printed. */ static VOID is_dspl(prompt, flag) char *prompt; { if (flag != FALSE) ewprintf("%s: ", prompt); else ewprintf("%s: %s", prompt, pat); } #ifdef IS_ENHANCE static int is_fail(code) { return code == SRCH_ACCM || code <= SRCH_CHUNK_BASE && SRCH_CHUNK_FAIL(code); } #endif static int is_addword(pptr,dir) { int oo = curwp->w_doto; LINE *op = curwp->w_dotp; int co = oo; LINE *cp = op; int chunklen, len; if( dir == SRCH_BACK ){ /* skip common prefix */ int i; for(i=0; i < pptr; ++i ){ if(curwp->w_doto >= llength(curwp->w_dotp)){ /* meet EOL */ if( pat[i] != CCHR('J') ) break; } else { int c; c =lgetc(curwp->w_dotp,curwp->w_doto); #ifdef KANJI #ifdef HOJO_KANJI if( ISHOJO(c) ) { if ( c != CHARMASK(pat[i]) || lgetc(curwp->w_dotp, curwp->w_doto+1) != CHARMASK(pat[i+1]) || lgetc(curwp->w_dotp, curwp->w_doto+2) != CHARMASK(pat[i+2]) ) break; i += 2; } else #endif if( ISKANJI(c) ){ if( c != CHARMASK(pat[i]) || lgetc(curwp->w_dotp, curwp->w_doto+1) != CHARMASK(pat[i+1]) ) break; ++i; } else if( !eq(c,CHARMASK(pat[i])) ) break; #endif } if( !forwchar(FFRAND,1) ) break; } cp = curwp->w_dotp; co = curwp->w_doto; } if( !forwword(FFRAND, 1) ) /* Skip one word */ return FALSE; /* * Copy string between (cp,co) and dot to pat. * There should be some utility subroutine to do it. */ chunklen = 0; while( cp != curwp->w_dotp ){ len = llength(cp) - co; if( len > NPAT-pptr-2 ) /* room for '\n' and '\0' */ goto patfull; strncpy(&pat[pptr], ltext(cp)+co, len); pptr += len; pat[pptr++] = '\n'; chunklen += len+1; cp = lforw(cp); co = 0; } len = curwp->w_doto - co; if( len > NPAT-pptr-2 ) goto patfull; strncpy(&pat[pptr], ltext(cp)+co, len); pptr += len; pat[pptr] = '\0'; chunklen += len; curwp->w_doto = oo; curwp->w_dotp = op; return chunklen; patfull: curwp->w_doto = oo; curwp->w_dotp = op; ewprintf("Pattern too long"); return 0; } /* * Query Replace. * Replace strings selectively. Does a search and replace operation. */ /*ARGSUSED*/ queryrepl(f, n) { register int s; register int rcnt = 0; /* Replacements made so far */ register int plen; /* length of found string */ char news[NPAT]; /* replacement string */ #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ #ifndef NO_MACRO if(macrodef) { ewprintf("Can't query replace in macro"); return FALSE; } #endif if ((s=readpattern("Query replace")) != TRUE) return (s); if ((s=ereply("Query replace %s with: ",news, NPAT, pat)) == ABORT) return (s); if (s == FALSE) news[0] = '\0'; ewprintf("Query replacing %s with %s:", pat, news); plen = strlen(pat); /* * Search forward repeatedly, checking each time whether to insert * or not. The "!" case makes the check always true, so it gets put * into a tighter loop for efficiency. */ while (forwsrch() == TRUE) { retry: update(); switch (getkey(FALSE)) { case ' ': #ifdef EMACS_QUERY_KEYS case 'y': case 'Y': #endif /* EMACS_QUERY_KEYS */ if (lreplace((RSIZE) plen, news, f) == FALSE) return (FALSE); rcnt++; break; case '.': if (lreplace((RSIZE) plen, news, f) == FALSE) return (FALSE); rcnt++; goto stopsearch; case CCHR('G'): /* ^G or ESC */ (VOID) ctrlg(FFRAND, 0); case CCHR('['): #ifdef EMACS_QUERY_KEYS case CCHR('M'): #endif /* EMACS_QUERY_KEYS */ goto stopsearch; case '!': do { if (lreplace((RSIZE) plen, news, f) == FALSE) return (FALSE); rcnt++; } while (forwsrch() == TRUE); goto stopsearch; case CCHR('H'): case CCHR('?'): /* To not replace */ #ifdef EMACS_QUERY_KEYS case 'n': case 'N': #endif /* EMACS_QUERY_KEYS */ break; default: ewprintf(" replace, [.] rep-end, don't, [!] repl rest quit"); goto retry; } } stopsearch: curwp->w_flag |= WFHARD; update(); if (rcnt == 0) ewprintf("(No replacements done)"); else if (rcnt == 1) ewprintf("(1 replacement done)"); else ewprintf("(%d replacements done)", rcnt); return TRUE; } /* * This routine does the real work of a * forward search. The pattern is sitting in the external * variable "pat". If found, dot is updated, the window system * is notified of the change, and TRUE is returned. If the * string isn't found, FALSE is returned. */ forwsrch() { register LINE *clp; register int cbo; register LINE *tlp; register int tbo; char *pp; register int c; #ifdef KANJI /* 90.01.29 by S.Yoshida */ register int kanji2nd = 0; /* Now on a KANJI 2nd byte. */ #endif /* KANJI */ clp = curwp->w_dotp; cbo = curwp->w_doto; for(;;) { if (cbo == llength(clp)) { if((clp = lforw(clp)) == curbp->b_linep) break; cbo = 0; c = CCHR('J'); } else c = lgetc(clp, cbo++); #ifdef KANJI /* 90.01.29 by S.Yoshida */ if (kanji2nd != 0) { /* We believe 'c' is KANJI 2nd byte. */ kanji2nd--; continue; /* Don't check with KANJI 2nd byte. */ } else if (ISKANJI(c)) { /* 'c' is KANJI 1st byte. */ #ifdef HOJO_KANJI if (ISHOJO(c)) kanji2nd = 2; else #endif kanji2nd = 1; /* Next byte is KANJI 2nd. */ } #endif /* KANJI */ if (eq(c, pat[0]) != FALSE) { tlp = clp; tbo = cbo; pp = &pat[1]; while (*pp != 0) { if (tbo == llength(tlp)) { tlp = lforw(tlp); if (tlp == curbp->b_linep) goto fail; tbo = 0; c = CCHR('J'); } else c = lgetc(tlp, tbo++); if (eq(c, *pp++) == FALSE) goto fail; } curwp->w_dotp = tlp; curwp->w_doto = tbo; curwp->w_flag |= WFMOVE; return TRUE; } fail: ; } return FALSE; } /* * This routine does the real work of a * backward search. The pattern is sitting in the external * variable "pat". If found, dot is updated, the window system * is notified of the change, and TRUE is returned. If the * string isn't found, FALSE is returned. */ backsrch() { register LINE *clp; register int cbo; register LINE *tlp; register int tbo; register int c; register char *epp; register char *pp; #ifdef KANJI /* 90.01.29 by S.Yoshida */ register int kanji1st = 0; /* Now on a KANJI 1st byte. */ #endif /* KANJI */ for (epp = &pat[0]; epp[1] != 0; ++epp) ; clp = curwp->w_dotp; cbo = curwp->w_doto; for (;;) { if (cbo == 0) { clp = lback(clp); if (clp == curbp->b_linep) return FALSE; cbo = llength(clp)+1; } if (--cbo == llength(clp)) c = CCHR('J'); else c = lgetc(clp,cbo); #ifdef KANJI /* 90.01.29 by S.Yoshida */ if (kanji1st != 0) { /* We believe 'c' is KANJI 1st byte. */ kanji1st--; continue; /* Don't check with KANJI 1st byte. */ } else if (ISKANJI(c)) { /* 'c' is KANJI 2nd byte. */ #ifdef HOJO_KANJI if (ISHOJO(c)) kanji1st = 2; else #endif kanji1st = 1; /* Next byte is KANJI 1st. */ } #endif /* KANJI */ if (eq(c, *epp) != FALSE) { tlp = clp; tbo = cbo; pp = epp; while (pp != &pat[0]) { if (tbo == 0) { tlp = lback(tlp); if (tlp == curbp->b_linep) goto fail; tbo = llength(tlp)+1; } if (--tbo == llength(tlp)) c = CCHR('J'); else c = lgetc(tlp,tbo); if (eq(c, *--pp) == FALSE) goto fail; } curwp->w_dotp = tlp; curwp->w_doto = tbo; curwp->w_flag |= WFMOVE; return TRUE; } fail: ; } /*NOTREACHED*/ } /* * Compare two characters. * The "bc" comes from the buffer. * It has its case folded out. The * "pc" is from the pattern. */ static int eq(bc, pc) register int bc, pc; { bc = CHARMASK(bc); pc = CHARMASK(pc); if (bc == pc) return TRUE; #ifdef IS_ENHANCE if(!casefoldsearch) return FALSE; #endif if (ISUPPER(bc)) return TOLOWER(bc) == pc; if (ISUPPER(pc)) return bc == TOLOWER(pc); return FALSE; } /* * Read a pattern. * Stash it in the external variable "pat". The "pat" is * not updated if the user types in an empty line. If the user typed * an empty line, and there is no old pattern, it is an error. * Display the old pattern, in the style of Jeff Lomicka. There is * some do-it-yourself control expansion. */ readpattern(prompt) char *prompt; { register int s; char tpat[NPAT]; if (pat[0] == '\0') s = ereply("%s: ", tpat, NPAT, prompt); else s = ereply("%s: (default %s) ", tpat, NPAT, prompt, pat); if (s == TRUE) /* Specified */ (VOID) strcpy(pat, tpat); else if (s==FALSE && pat[0]!=0) /* CR, but old one */ s = TRUE; return s; } ng-1.5beta1/shell.c100644 1750 1750 2655 7244000517 12733 0ustar amurausers/* $Id: shell.c,v 1.2 2001/02/18 17:07:27 amura Exp $ */ /* * Shell commands. * The file contains the command * processor, shell-command * written by Kaoru Maeda. */ /* * $Log: shell.c,v $ * Revision 1.2 2001/02/18 17:07:27 amura * append AUTOSAVE feature (but NOW not work) * * Revision 1.1.1.1 2000/06/27 01:47:56 amura * import to CVS * */ #include "config.h" /* 91.01.10 by S.Yoshida */ #include "def.h" #ifndef NO_SHELL /*ARGSUSED*/ shellcmnd(f, n) { char buf[CMDLINELENGTH]; char *result; extern char *call_process(); extern int isetmark(),gotobob(); int s; BUFFER *bp, *obp; WINDOW *wp, *owp; WINDOW *popbuf(); s = ereply("Shell command: ", buf, sizeof buf); if (s != TRUE) return s; if ((f & FFARG) == 0) { if ((bp = bfind("*Shell Command Output*", TRUE)) == NULL) return FALSE; if ((wp = popbuf(bp)) == NULL) return FALSE; bp->b_flag &= ~BFCHG; /* Blow away old. */ if (bclear(bp) != TRUE) return FALSE; obp = curbp; owp = curwp; curbp = bp; curwp = wp; } if ((result = call_process(buf, NULL)) == NULL) return FALSE; isetmark(); ewprintf(result); s = insertfile(result, (char *)NULL); if((f & FFARG) == 0) { (VOID) gotobob(0, 1); bp->b_dotp = wp->w_dotp; bp->b_doto = wp->w_doto; curbp = obp; curwp = owp; #ifdef AUTOSAVE /* 96.12.24 by M.Suzuki */ bp->b_flag &= ~(BFCHG | BFACHG); #else bp->b_flag &= ~BFCHG; #endif /* AUTOSAVE */ } unlink(result); return s; } #endif ng-1.5beta1/skg.c100644 1750 1750 55131 7276036452 12441 0ustar amurausers/* $Id: skg.c,v 1.9 2001/05/08 18:38:34 amura Exp $ */ /* - For Kg Ver.4.1.0 - */ /* Simple Kanji Generator functions for MicroGnuEmacs(Kg) */ /* for AMIGA series with ANS,DaiGokai(above ver.0.40). */ /* original written by Hirokazu Konish */ /* rewrite for All ports and some patched by amura */ /* * $Log: skg.c,v $ * Revision 1.9 2001/05/08 18:38:34 amura * Make dictionary index when SKG start, for speed up dictionary searching * * Revision 1.8 2001/05/04 19:15:31 amura * correct handling of this/lastflag * * Revision 1.7 2001/05/04 17:52:02 amura * Make skg_init() and skg_finish(), and rewrite some routine for secure issue * * Revision 1.6 2001/04/30 14:59:49 amura * rewrite to speed up and bugfix * * Revision 1.5 2000/12/14 18:06:24 amura * filename length become flexible * * Revision 1.4 2000/11/16 14:31:13 amura * fix some typos which cause compile error when using * strict ANSI-C compiler (ex ACK, gcc-1.x) * * Revision 1.3 2000/10/02 16:13:46 amura * ignore mouse event in minibuffer editing * * Revision 1.2 2000/06/27 01:59:42 amura * small bugfix * * Revision 1.1.1.1 2000/06/27 01:47:56 amura * import to CVS * */ #include "config.h" /* 93.10.25 by H.Konishi */ #ifdef INCLUDE_SKG #include "def.h" #include "key.h" #ifndef NO_MACRO #include "macro.h" #endif #ifdef UNDO #include "undo.h" #endif #ifdef AMIGA_FAST_FILE # undef FILE #endif #ifdef MOUSE extern int allow_mouse_event; #endif #define DIC_BUFFER_SIZE 512 #define KEY_BUFFER_SIZE 80 #define KANA_MAXLEN ((3*2)+1) #define ROMAN_MAXLEN 5 #define DIC_INDEX_SIZE 10 #define MAX_TARGET 5 /* Key String for Searcing Dictionary */ typedef struct { unsigned char hiragana[KANA_MAXLEN]; int length; int flg; } DICKEYSTR; static DICKEYSTR dickeystr[KEY_BUFFER_SIZE]; /* Roman -> Kana convertion table */ typedef struct { unsigned char roman[ROMAN_MAXLEN]; unsigned char kana[KANA_MAXLEN]; char _dummy[8 - (ROMAN_MAXLEN+KANA_MAXLEN)%8]; /* for dword align */ } ROMANTBL; static ROMANTBL *romantbl; static ROMANTBL *romantbl_end; int romantbl_size; /* Dictionary file (opening while SKG active for speed reason) */ static FILE *dicfile; /* Dictionary Index */ typedef struct { unsigned char key[2]; long position; } DICINDEX; static DICINDEX dicindex[DIC_INDEX_SIZE]; static DICINDEX *end_of_dicindex; typedef unsigned char WORDLIST[DIC_BUFFER_SIZE]; /* Kanji-Charactors (EUC code only!) */ #define HIRA_SMALL_TSU "\xA4\xC3" #define KATA_SMALL_TSU "\xA5\xC3" #define HIRA_A "\xA4\xA2" #define H_MODE 0 /* Hiragana MODE */ #define A_MODE 1 /* Ank MODE,or NOT-Convert MODE */ #define SKG_CONV 0 #define SKG_NOCONV 1 #define SKG_QUIT 2 #define SKG_INSERT 0 /* Must not same value with SKG_QUIT */ #define DEFAULT_ROMANNAME "SKG-ROMAN" #define DEFAULT_DICNAME "SKG-JISYO" /* SKG running flag */ static int in_skg = FALSE; char *romanname = NULL; char *dicname = NULL; extern int isetmark(); static int skg_init(); static VOID skg_finish(); static int skg_input_string(); static VOID skg_text_insert(); static int skg_convert_string(); static VOID skg_display_prompt(); static VOID search_dictionary(); static VOID target_display(); static VOID setup_keystring(); static int compare_keystring(); #define skip_entry(f) do { \ register int c; \ while((c=fgetc(f)) != '\n'); \ } while(/*CONSTCOND*/0) /* * Primitive functions for Strings */ /* Clear Key Buffer String */ #define clear_string(str) (str[0] = '\0') /* Clear Dictinary Buffer String */ #define clear_list(str) (str[0] = '\0') static long get_size(fp) FILE *fp; { long size; fseek(fp, 0L, SEEK_END); size = ftell(fp); rewind(fp); return size; } /* Comparing Two Strings */ static int compare_string(s1, s2) register char *s1, *s2; { while (*s2) if (*s1++ != *s2++) return FALSE; return TRUE; } /* Append char to string */ static char * strcat_c(s, c) char *s; int c; { register char *p = s; while (*p) p++; *p++ = (char)c; *p = '\0'; return s; } static int make_dicindex(fp) FILE *fp; { int i; int k1, k2, old_k1, old_k2; long diff, pos; diff = get_size(fp) / DIC_INDEX_SIZE; for (i=1; ikey[0] > first_key || ptr->key[1] > second_key) ptr--; fseek(dicfile, ptr->position, SEEK_SET); } /* Scanf for Dictionary File, with First Character Comparing */ /* */ /* Return Code is, which EOF(=?), or 0 */ /* is complete. return EOF). */ /* k1,k2 is First Character in Key String. In not matching, */ /* skip entry.ZENKAKU-Code consists of 2 bytes. */ static int get_scanf(k1, k2, f, key, kanji) int k1, k2; FILE *f; register char *key, *kanji; { register int rbuf; register char *p; int got_space = FALSE; next_entry: /* Checking First Character */ p = key; if ((rbuf=fgetc(f)) == EOF) return FALSE; /* If Not Matching Character k1, Skip This Entry */ if (rbuf != (unsigned char)k1) { /* this Entry is too big, finish searching dictionary */ if (rbuf > (unsigned char)k1) return FALSE; skip_entry(f); goto next_entry; } /* Stock read character to s1[] */ *p++ = (char)rbuf; /* Checking Second Character */ if (k2 != 0x00) { /* Case of Key String is Not 1 char */ if ((rbuf=fgetc(f)) == EOF) return FALSE; /* If Next Character is SPACE, Skip Comparing to k2 */ if (rbuf == ' ') got_space = TRUE; else { if (rbuf != (unsigned char)k2) { /* this Entry is too big, finish searching dictionary */ if (rbuf > (unsigned char)k2) return FALSE; /* If Not Matching Character k2, Skip This Entry */ skip_entry(f); goto next_entry; } *p++ = (char)rbuf; } } /* Next to get Dictionary entry. */ while (!got_space) { /* get keystring, Until EOF,or SPACE */ if ((rbuf=fgetc(f)) == EOF) return EOF; if (rbuf == ' ') got_space = TRUE; else *p++ = (char)rbuf; } /* Terminate key */ *p = '\0'; /* Next Get Dictionary Entry */ while (TRUE) { if ((rbuf=fgetc(f)) == EOF) return EOF; if (rbuf == '\n') break; else *kanji++ = (char)rbuf; } *kanji = '\0'; return TRUE; } skginput(f, n) { char istr[KEY_BUFFER_SIZE]; char dstr[KEY_BUFFER_SIZE]; int mode = H_MODE; int s; #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return FALSE; } #endif /* READONLY */ if (in_skg) return FALSE; /* If Not Exist files what need, Quit. */ if (skg_init() == FALSE) return FALSE; in_skg = TRUE; #ifdef UNDO undoptr = NULL; #endif clear_string(istr); /* Clear Input Buffer. */ while (TRUE) /* Skg Loop */ { s = skg_input_string(&mode, istr); if (s == SKG_QUIT) break; /* Exit This Loop */ if (strlen(istr) == 0) /* If Null String, Insert NewLine */ { isetmark(); lnewline(); } if (s == SKG_NOCONV) { /* This means Inserting without Kanji Converting */ skg_text_insert(istr, mode); ewprintf("Insert...."); clear_string(istr); } else /* Insert with Kanji Converting */ { if (skg_convert_string(mode, istr, dstr) == SKG_INSERT) { /* A_MODE means without KANA-Converting */ skg_text_insert(dstr, A_MODE); ewprintf("Insert...."); clear_string(istr); } clear_string(dstr); } } /* Skg Loop END */ ewprintf("Quit..."); skg_finish(); in_skg = FALSE; return TRUE; } static int convert_to_hiragana(dstr, keystr, size) char *dstr, *keystr; { register char *ptr = keystr; clear_string(dstr); while (*ptr) { register ROMANTBL *romanptr = romantbl; while (romanptr < romantbl_end) { if (compare_string(ptr, romanptr->roman)) { strcat(dstr, romanptr->kana); ptr += strlen(romanptr->roman); break; } romanptr++; } if (romanptr == romantbl_end && *ptr) { if (*ptr == *(ptr+1)) /* for SOKUON */ { if (ISUPPER(*ptr)) strcat(dstr, KATA_SMALL_TSU); else strcat(dstr, HIRA_SMALL_TSU); ptr++; } else /* cannot convert to KANA */ { strcat(dstr, ptr); return FALSE; } } } return TRUE; } static int skg_init() { int i,c; FILE *romanfile; ROMANTBL *romanptr; char bufstr[KANA_MAXLEN], bufkey[ROMAN_MAXLEN]; /* Open dictionary file */ dicfile = fopen((dicname!=NULL) ? dicname : DEFAULT_DICNAME , "rb"); if (dicfile == NULL) { ewprintf("Can't Open Dictionary File..."); return FALSE; } ewprintf("Initialize Dictionary Index..."); if (make_dicindex(dicfile) == FALSE) { ewprintf("Can't Make Dictionary Index..."); fclose(dicfile); return FALSE; } /* Loading Roman->Kana table */ romanfile = fopen((romanname!=NULL) ? romanname : DEFAULT_ROMANNAME, "r"); if (romanfile == NULL) { fclose(dicfile); ewprintf("Can't Open Roman Table File..."); return FALSE; } /* counting entrys */ i = 0; while ((c=fgetc(romanfile)) != EOF) if (c == '\n') i++; /* make Roman->Kana table */ romanptr = romantbl = (ROMANTBL*)malloc(sizeof(ROMANTBL)*i); rewind(romanfile); romantbl_size = 0; while (romanptr<(romantbl+i) && fscanf(romanfile, "%s %s", bufkey, bufstr) != EOF) { if (bufkey[0]=='\0' || bufstr[0]=='\0') continue; strncpy(romanptr->roman, bufkey, ROMAN_MAXLEN); romanptr->roman[ROMAN_MAXLEN-1] = '\0'; strncpy(romanptr->kana, bufstr, KANA_MAXLEN); romanptr->kana[KANA_MAXLEN-1] = '\0'; romanptr++; romantbl_size++; clear_string(bufkey); clear_string(bufstr); } romantbl_end = romantbl + romantbl_size; fclose(romanfile); return TRUE; } static VOID skg_finish() { fclose(dicfile); free(romantbl); romantbl_size = 0; } static VOID skg_text_insert(insert_str, mode) char *insert_str; int mode; { register int c; static char bufstr[KEY_BUFFER_SIZE]; register char *p = bufstr; clear_string(bufstr); isetmark(); if (mode == A_MODE) strncpy(bufstr, insert_str, sizeof(bufstr)); else convert_to_hiragana(bufstr, insert_str, sizeof(bufstr)); bufstr[sizeof(bufstr)-1] = '\0'; while ((c=*p++)!='\0' && c!='\n') { #ifndef NO_MACRO if(macrodef && macrocount < MAXMACRO) macrocount++; #endif key.k_chars[0] = c; key.k_count = 1; #ifdef UNDO ublock_open(curbp); #endif selfinsert(FFRAND, 1); #ifdef UNDO ublock_close(curbp); #endif /* Flag reset */ lastflag = thisflag; thisflag = 0; } update(); } static int skg_input_string(mode, istr) int *mode; register char *istr; { register int c; skg_display_prompt(istr, *mode); /* Display SKG-Prompt on MiniBuffer */ update(); /* Display Current Cursor */ ttwait(); while (TRUE) { #ifdef MOUSE allow_mouse_event = TRUE; #endif c = getkey(FALSE); #ifdef MOUSE allow_mouse_event = FALSE; #endif switch(c) { /* Ret-Key, Insert String without Kanji-Converting */ case CCHR('M'): return SKG_NOCONV; /* C-g, Abort. If istr NULL,then quit skg-mode. */ case CCHR('G'): if (strlen(istr) == 0) { clear_string(istr); return SKG_QUIT; } /* Else Clear istr. */ else clear_string(istr); break; case ' ': if (strlen(istr) == 0) { strcpy (istr, " "); return SKG_NOCONV; } return SKG_CONV; case CCHR('\\'): *mode = (*mode == A_MODE) ? H_MODE : A_MODE; break; case CCHR('H') : case CCHR('?') : if (strlen(istr) != 0) { istr[strlen(istr)-1] = '\0'; break; } /*FALLTHRU*/ default : if (c==(c&0xFF) && !ISCTRL((char)c)) strcat_c(istr, c); else if (strlen(istr) == 0) { ungetkey(c); if (doin() != TRUE) { ttbeep(); #ifdef KANJI kgetkeyflush(); #endif #ifndef NO_MACRO macrodef = FALSE; #endif ttwait(); } /* Flag reset */ lastflag = thisflag; thisflag = 0; } else { ttbeep(); ewprintf("Help: RET = Insert, SPC = Convert," " ^G = Quit, ^\\ = Mode"); ttwait(); } } skg_display_prompt(istr, *mode); if (strlen(istr) == 0) update(); } return SKG_NOCONV; /* this is dummy! */ } static char * next_target(dictionary_list, target, dstr) WORDLIST dictionary_list; register char *target, *dstr; { if (target == NULL) target = dictionary_list + 1; else { target++; if (*target=='\0' || *target == '\n' || *target == '\r') target = dictionary_list + 1; } while (*target != '/') *dstr++ = *target++; *dstr = '\0'; return target; } static char * prev_target(dictionary_list, target, dstr) WORDLIST dictionary_list; register char *target, *dstr; { if (target == (char *)dictionary_list) target = dictionary_list + strlen(dictionary_list) - 1; for (target-- ; *target != '/' ; target--); if (target == (char *)dictionary_list) target = dictionary_list + strlen(dictionary_list) - 1; for (target-- ; *target != '/' ; target--); target++; while (*target != '/') *dstr++ = *target++; *dstr = '\0'; return target; } static int skg_convert_string(mode, istr, dstr) int mode; char *istr,*dstr; { WORDLIST dictionary_list; static char rstr[KEY_BUFFER_SIZE]; register char *target; int c; search_dictionary(mode, istr, dictionary_list, rstr); clear_string(dstr); target = next_target(dictionary_list, NULL, dstr); target_display(dstr, rstr); for (;;) { switch (c = getkey(FALSE)) { case CCHR('G'): case CCHR('H'): case CCHR('?'): (VOID)ctrlg(FFRAND, 0); return SKG_QUIT; case CCHR('M'): strcat(dstr , rstr); return SKG_INSERT; case CCHR('N'): case ' ': target = next_target(dictionary_list, target, dstr); target_display(dstr, rstr); break; case CCHR('P'): target = prev_target(dictionary_list, target, dstr); target_display(dstr, rstr); break; case CCHR('L'): update(); ttwait(); break; default: if (!ISCTRL(c)) { ungetkey(c); strcat(dstr, rstr); return SKG_INSERT; } ttbeep(); ewprintf("Help: RET=Insert, SPC ^N = Next, " "^P = Prev, ^G = Quit, ^L = Location"); ttwait(); break; } } return SKG_QUIT; } static VOID target_display(dstr, rstr) char *dstr,*rstr; { ewprintf("Skg[--]?|%s|%s", dstr, rstr); } static VOID skg_display_prompt(istr, mode) char *istr; int mode; { static char bufstr[KEY_BUFFER_SIZE]; if (mode == A_MODE) ewprintf("Skg[*a]:%s", istr); else { convert_to_hiragana(bufstr, istr, sizeof(bufstr)); ewprintf("Skg[" HIRA_A "]:%s", bufstr); } } static char * dic_next_target(target, dstr) char *target; char *dstr; { target++; if (*target == '\0' || *target == '\n') return NULL; while (*target != '\0' && *target != '/') *dstr++ = *target++; *dstr = '\0'; return target; } /*XXX*/ static char * makedic(tlist, trest, rlength, result) char *tlist, *trest; int rlength; char *result; { register char *p; static char tmpstr[KEY_BUFFER_SIZE]; clear_string(tmpstr); clear_list(result); for (p=dic_next_target(tlist, tmpstr); p != NULL; p=dic_next_target(p, tmpstr)) { strcat(tmpstr, trest); if (strlen(result)+strlen(tmpstr)+1 > DIC_BUFFER_SIZE) break; strncat(result, tmpstr, strlen(tmpstr)-rlength); strcat(result , "/"); clear_string(tmpstr); } return result; } static struct { char list[DIC_BUFFER_SIZE]; char rest[KEY_BUFFER_SIZE]; } ctarget[MAX_TARGET]; static VOID clear_ctarget() { register int i; for (i=0; i 1) { int i; if (target_number < match_strings) i = MAX_TARGET - 1; else i = target_number - 2; for (; i>=0; i--) { ewprintf( "Concatenate..." ); makedic(ctarget[i].list, ctarget[i].rest, strlen(rstr), tmplist); if (strlen(dlist)+strlen(tmplist)+1 > DIC_BUFFER_SIZE) break; strcat(dlist, tmplist); } } } return; } static VOID setup_keystring(mode, keystr) int mode; register char *keystr; { register DICKEYSTR *dickeyptr = dickeystr; if (mode == A_MODE) { while (*keystr) { dickeyptr->hiragana[0] = *keystr++; dickeyptr->hiragana[1] = '\0'; dickeyptr->length = 1; dickeyptr->flg = TRUE; dickeyptr++; } } else { char *keystr_end = keystr+strlen(keystr); register char *ptr = keystr; while (ptr < keystr_end) { register ROMANTBL *romanptr = romantbl; while (romanptr < romantbl_end) { if (compare_string(ptr, romanptr->roman)) { int len = strlen(romanptr->roman); strcpy(dickeyptr->hiragana, romanptr->kana); dickeyptr->length = len; dickeyptr->flg = TRUE; dickeyptr++; ptr += len; break; } romanptr++; } if (romanptr == romantbl_end) { if (ptr < keystr_end) { if (*ptr != *(ptr+1)) break; if (ISUPPER(*ptr)) strcpy(dickeyptr->hiragana , KATA_SMALL_TSU); else strcpy(dickeyptr->hiragana , HIRA_SMALL_TSU); dickeyptr->length = 1; dickeyptr->flg = TRUE; dickeyptr++; ptr++; } } } while (ptr < keystr_end) { dickeyptr->hiragana[0] = *ptr++; dickeyptr->hiragana[1] = '\0'; dickeyptr->length = 1; dickeyptr->flg = FALSE; dickeyptr++; } } /* end mark */ dickeyptr->hiragana[0] = '\0'; dickeyptr->length = 0; dickeyptr->flg = FALSE; } static char * convert_to_n_hiragana(dstr, keystr, length) char *dstr; register char *keystr; int length; { register int cpnt,clen,klen; int cmode; register DICKEYSTR *dickeyptr; clear_string(dstr); cpnt = 0; klen = 0; clen = length / 2; cmode = length % 2; dickeyptr = dickeystr; while (klen < clen) { if (!dickeyptr->flg) break; strcat(dstr, dickeyptr->hiragana); cpnt += dickeyptr->length; klen += strlen(dickeyptr->hiragana) / 2; dickeyptr++; } if (klen < clen) { strcat(dstr, &keystr[cpnt]); cpnt += strlen(&keystr[cpnt]); } else { if (cmode && keystr[cpnt]!='\0') strcat_c(dstr, keystr[cpnt]); } return (&keystr[cpnt]); } static int compare_keystring(istr, tmpstr, tmprstr, mode) char *istr, *tmpstr, *tmprstr; int mode; { char cstr[KEY_BUFFER_SIZE]; clear_string(tmprstr); if (mode == A_MODE) { if (compare_string(istr, tmpstr)) { strcpy(tmprstr, &istr[strlen(tmpstr)]); return TRUE; } else return FALSE; } else { istr = convert_to_n_hiragana(cstr, istr, strlen(tmpstr)); if (compare_string(cstr, tmpstr)) { convert_to_hiragana(tmprstr, istr, sizeof(tmprstr)); return TRUE; } else return FALSE; } } skg_set_romanname(f, n) { char file[NFILEN]; int s; if (in_skg) { ewprintf("Cannot change Dictionary while SKG is running"); return FALSE; } #ifdef EXTD_DIR ensurecwd(); edefset(curbp->b_cwd); #endif #ifndef NO_FILECOMP if ((s = eread("SKG roman-kana dictionary: ", file, NFILEN, EFNEW|EFFILE|EFCR)) != TRUE) #else if ((s = ereply("SKG roman-kana dictionary : ", file, NFILEN)) != TRUE) #endif return s; if (romanname) free(romanname); if ((romanname=malloc(strlen(file)+1)) == NULL) { ewprintf("Cannot allocate %d bytes", strlen(file)+1); return FALSE; } strcpy(romanname, file); return TRUE; } skg_set_dicname(f, n) { char file[NFILEN]; int s; if (in_skg) { ewprintf("Cannot change Dictionary while SKG is running"); return FALSE; } #ifdef EXTD_DIR ensurecwd(); edefset(curbp->b_cwd); #endif #ifndef NO_FILECOMP if ((s = eread("SKG kana-kanji dictionary: ", file, NFILEN, EFNEW|EFFILE|EFCR)) != TRUE) #else if ((s = ereply("SKG kana-kanji dictionary : ", file, NFILEN)) != TRUE) #endif return s; if (dicname) free(dicname); if ((dicname=malloc(strlen(file)+1)) == NULL) { ewprintf("Cannot allocate %d bytes", strlen(file)+1); return FALSE; } strcpy(dicname, file); return TRUE; } #endif ng-1.5beta1/undo.c100644 1750 1750 16005 7201137370 12604 0ustar amurausers/* $Id: undo.c,v 1.8 2000/11/05 01:59:20 amura Exp $ */ /* * Undo support routine. * The functions in this file * are a general set of undo support utilities. */ /* * $Log: undo.c,v $ * Revision 1.8 2000/11/05 01:59:20 amura * ploblem with big undo is fixed * * Revision 1.7 2000/11/04 13:44:58 amura * undo memory exception is more safety * * Revision 1.6 2000/09/01 19:43:10 amura * change undo buffer memory allocation strategy for speed * * Revision 1.5 2000/07/22 20:49:38 amura * more secure run insert * * Revision 1.4 2000/07/18 18:59:57 amura * fixed never end loop on do_undo with arguments * * Revision 1.3 2000/07/16 15:47:06 amura * undo bug on autofill fixed * * Revision 1.2 2000/06/27 01:49:45 amura * import to CVS * * Revision 1.1 2000/06/01 05:36:42 amura * Initial revision * */ #include "config.h" #include "def.h" #ifdef UNDO #include "undo.h" #ifndef UBLOCK #define UBLOCK 32 #endif UNDO_DATA **undoptr; UNDO_DATA **undostart; UNDO_DATA **undobefore; static int undofirst; VOID ublock_open(bp) register BUFFER *bp; { if (undoptr != NULL) panic("bug: ublock openning error"); undoptr = undostart = &bp->b_ustack[bp->b_utop]; undobefore = bp->b_ulast; if ((curbp->b_flag&BFCHG) == 0) /* First change */ undofirst = TRUE; else undofirst = FALSE; } VOID ublock_close(bp) register BUFFER *bp; { if (undoptr == NULL) return; if (undoptr != undostart) { bp->b_ulast = undobefore; ublock_clear(undoptr); if (undofirst && *undostart!=NULL) (*undostart)->u_type |= UDFIRST; bp->b_utop++; if (bp->b_utop > UNDOSIZE) bp->b_utop = 0; if (bp->b_ubottom == bp->b_utop) { bp->b_ubottom++; if (bp->b_ubottom > UNDOSIZE) bp->b_ubottom = 0; } } undoptr = NULL; } VOID undo_clean(bp) BUFFER *bp; { int i; UNDO_DATA **undo = bp->b_ustack; for (i=0; iu_size) free(up->u_buffer); upold = up; up = up->u_next; free(upold); } *upp = NULL; } int undo_balloc(undo, size) register UNDO_DATA *undo; register RSIZE size; { char *newbuffer; /* For memory save, too big undo buffer is turncate */ if (undo->u_sizeu_size) undo_bfree(undo); if (undo->u_size < size) { size = (size + UBLOCK - 1) / UBLOCK * UBLOCK; #ifdef MALLOCROUND MALLOCROUND(size); #endif if (size < undo->u_size) { ewprintf("Undo buffer too BIG!"); ttwait(); undo_clean(curbp); undoptr = NULL; return FALSE; } if (undo->u_size) { free(undo->u_buffer); undo->u_size = 0; } newbuffer = malloc(size); if (newbuffer == NULL) { ewprintf("Can't get %ld Bytes / Undo buffer clear", size); ttwait(); undo_clean(curbp); undoptr = NULL; return FALSE; } undo->u_buffer = newbuffer; undo->u_size = size; } return TRUE; } int undo_bgrow(undo, size) register UNDO_DATA *undo; RSIZE size; { char *newbuffer; RSIZE newsize = (undo->u_used + size); if (newsize < size) { ewprintf("Undo buffer too BIG!"); ttwait(); undo_clean(curbp); undoptr = NULL; return FALSE; } if (newsize > undo->u_size) { size = (newsize + UBLOCK - 1) / UBLOCK * UBLOCK; #ifdef MALLOCROUND MALLOCROUND(size); #endif if (size < newsize) size = newsize; newbuffer = malloc(size); if (newbuffer == NULL) { ewprintf("Can't get %ld Bytes / Undo buffer clear"); ttwait(); undo_clean(curbp); undoptr = NULL; return FALSE; } if (undo->u_size) { bcopy(undo->u_buffer, newbuffer, undo->u_used); free(undo->u_buffer); } undo->u_buffer = newbuffer; undo->u_size = size; } return TRUE; } int do_undo(f, n) { register char *p; register int i; register LINE* lp; UNDO_DATA *undo,*undoend; int firstcheck = FALSE; extern int twiddle(); ewprintf("Undo!"); if (n < 0) return FALSE; undoptr = NULL; while (n--) { if (curbp->b_utop == curbp->b_ubottom) { ewprintf("No more undo data"); ttbeep(); return TRUE; } curbp->b_utop--; if (curbp->b_utop < 0) curbp->b_utop = UNDOSIZE; undoend = NULL; while (1) { undo = curbp->b_ustack[curbp->b_utop]; if (undo == undoend) break; while (undo->u_next != undoend) undo = undo->u_next; undoend = undo; lp = lforw(curbp->b_linep); for (i=undo->u_dotlno; i>0; i--) { if (lp == curbp->b_linep) break; lp = lforw(lp); } if (i != 0) { ewprintf("undo data error : line missing %d:%d", undo->u_dotlno, undo->u_doto); undo_reset(curbp); return FALSE; } if (llength(lp) < undo->u_doto) { ewprintf("undo data error : offset missing %d:%d", undo->u_dotlno, undo->u_doto); undo_reset(curbp); return FALSE; } curwp->w_dotp = lp; curwp->w_doto = undo->u_doto; if (undo->u_type & UDFIRST) firstcheck = TRUE; switch (undo->u_type & UDMASK) { case UDDEL: case UDBS: if (undo->u_size) { p = undo->u_buffer; for (i=0; iu_used; i++,p++) { if (*p == '\n') lnewline(); else linsert(1, *p); } } else { p = undo->u_code; if (*p == '\n') lnewline(); else { linsert(1, *p++); if (*p) linsert(1, *p); } } if ((undo->u_type&UDMASK) == UDDEL) { lp = lforw(curbp->b_linep); for (i=undo->u_dotlno; i>0; i--) { if (lp == curbp->b_linep) break; lp = lforw(lp); } curwp->w_dotp = lp; curwp->w_doto = undo->u_doto; } break; #if UDINSNL != UDINS case UDINSNL: #endif case UDINS: ldelete(undo->u_used, KNONE); break; case UDTWIDDLE: twiddle(FFRAND, 1); curwp->w_dotp = lp; curwp->w_doto = undo->u_doto; break; case UDOVER: i = 0; while (curwp->w_doto < llength(lp) && i < undo->u_used) lputc(lp, curwp->w_doto++, undo->u_buffer[i++]); if (i != undo->u_used) { ewprintf("do_undo: overwrite data error"); return FALSE; } if (undo->u_code[0]) { if (curwp->w_doto >= llength(lp)) { ewprintf("do_undo: overwrite data error"); undo_reset(curbp); return FALSE; } lputc(lp, curwp->w_doto, undo->u_code[0]); } curwp->w_doto = undo->u_doto; lchange(WFEDIT); break; case UDREPL: curwp->w_doto += undo->u_used; if (llength(lp) < curwp->w_doto) { ewprintf("do_undo: replace data error"); undo_reset(curbp); return FALSE; } lreplace(undo->u_used, undo->u_buffer, TRUE); break; case UDNONE: default: panic("bug: do_undo"); } } } if (firstcheck) { WINDOW *wp; curbp->b_flag &= ~BFCHG; for (wp = wheadp; wp != NULL; wp = wp->w_wndp) { if (wp->w_bufp == curbp) { wp->w_flag |= WFMODE; if(wp != curwp) wp->w_flag |= WFHARD; } } } return TRUE; } #endif ng-1.5beta1/undo.h100644 1750 1750 5257 7201137370 12600 0ustar amurausers/* $Id: undo.h,v 1.7 2000/11/05 01:59:20 amura Exp $ */ /* * Undo supports: Ng 1.4(upto beta4) support undo like emacs. * This undo is not support redo. and not perfect now. * * by MURAMATSU Atsushi */ /* * $Log: undo.h,v $ * Revision 1.7 2000/11/05 01:59:20 amura * ploblem with big undo is fixed * * Revision 1.6 2000/11/04 13:44:58 amura * undo memory exception is more safety * * Revision 1.5 2000/07/22 20:49:38 amura * more secure run insert * * Revision 1.4 2000/07/20 12:45:18 amura * support undo with auto-fill mode * * Revision 1.3 2000/07/16 15:50:32 amura * undo bug on autofill fixed * rewrite macro functions * * Revision 1.2 2000/06/27 01:49:45 amura * import to CVS * * Revision 1.1 2000/06/01 05:21:24 amura * Initial revision * */ #define UDNONE 0 #define UDDEL 1 #define UDBS 2 #define UDINS 3 #define UDINSNL 3 /* this is backward compatibirity */ #define UDOVER 5 #define UDTWIDDLE 6 #define UDREPL 7 #define UDMASK 0x0F #define UDFIRST 0x10 typedef struct UNDO_DATA { int u_type; int u_dotlno; short u_doto; RSIZE u_size; char u_code[2]; struct UNDO_DATA* u_next; RSIZE u_used; char *u_buffer; } UNDO_DATA; extern UNDO_DATA** undoptr; extern UNDO_DATA** undostart; extern UNDO_DATA** undobefore; /* undo support functions */ VOID ublock_open pro((register BUFFER *)); VOID ublock_close pro((register BUFFER *)); VOID ublock_clear pro((register UNDO_DATA **)); VOID undo_clean pro((BUFFER*)); int undo_balloc pro((register UNDO_DATA*, register RSIZE)); int undo_bgrow pro((register UNDO_DATA*, register RSIZE)); /* undo support functions (implemented by macro for SPEED) */ #define isundo() (undoptr != NULL) #define undo_check(_bp) ((_bp)->b_utop != (_bp)->b_ubottom) #define undo_reset(_bp) ((void)((_bp)->b_ubottom = (_bp)->b_utop = 0, \ (_bp)->b_ulast = NULL)) #define undo_setup(_u) do { \ if (undoptr != NULL) { \ if (*undoptr == NULL) { \ *undoptr = malloc(sizeof(UNDO_DATA)); \ if (*undoptr == NULL) { \ ewprintf("undo_setup: No memory"); \ ttwait(); \ undo_clean(curbp); \ undoptr = NULL; \ (_u) = NULL; \ } else \ bzero(*undoptr, sizeof(UNDO_DATA)); \ } \ if (undoptr != NULL) \ (_u) = *undoptr; \ } \ } while (/*CONSTCOND*/0) #define undo_finish(_n) do { \ undobefore = undoptr; \ undoptr = (_n); \ } while (/*CONSTCOND*/0) #define undo_type(_u) ((_u)->u_type & UDMASK) #define undo_bfree(_u) do { \ if ((_u)->u_size) { \ free((_u)->u_buffer); \ (_u)->u_size = 0; \ } \ } while (/*CONSTCOND*/0) /* in line.c */ int get_lineno pro((BUFFER*, LINE*)); ng-1.5beta1/version.c100644 1750 1750 34163 7632242733 13341 0ustar amurausers/* $Id: version.c,v 1.12.2.1 2003/03/08 01:22:35 amura Exp $ */ /* * This file contains the string that get written * out by the emacs-version command. */ /* * $Log: version.c,v $ * Revision 1.12.2.1 2003/03/08 01:22:35 amura * NOTAB is always enabled * * Revision 1.12 2001/05/28 19:02:02 amura * edit to 1.5alpha3 * * Revision 1.11 2001/03/09 16:17:22 amura * edit to 1.5alpha2 * * Revision 1.10 2001/01/20 18:17:13 amura * edit to 1.5alpha1 * * Revision 1.9 2001/01/05 14:07:05 amura * first implementation of Hojo Kanji support * * Revision 1.8 2000/11/16 14:27:00 amura * edit to 1.4.2 release * * Revision 1.7 2000/10/02 16:29:55 amura * can display some Amiga configuration * * -- snip -- * * Revision 1.1 1999/05/19 04:17:24 amura * Initial revision * */ /* 90.01.29 Modified for Ng 1.0 by S.Yoshida */ #include "config.h" /* 90.12.20 by S.Yoshida */ #ifdef ADDFUNC /* 90.12.28 by S.Yoshida */ #include "def.h" #else /* NOT ADDFUNC */ #define TRUE 1 /* include "def.h" when things get more complicated */ #endif /* ADDFUNC */ #define VERSION "1.5beta1" #ifdef KANJI # define PROGNAME "Ng" # define FORMERLY "[Nihongo Mg]" #else # define PROGNAME "Mg++" # define FORMERLY "(formerly MicroGnuEmacs Adv.)" #endif #if defined(MSDOS) # if defined(IBMPC) # ifdef TCCONIO # define TARGET "for IBM PC/TCCONIO" # else # define TARGET "for IBM PC" # endif # elif defined(PC9801) # ifdef TCCONIO # define TARGET "for PC-9801/TCCONIO" # else # define TARGET "for PC-9801" # endif # else # define TARGET "for MS-DOS" # endif #elif defined(AMIGA) # ifdef V2 # define TARGET "for AmigaDOS 2+" # else # define TARGET "for AmigaDOS 1+" # endif #elif defined(WIN) # define TARGET "for Win32 Ver.0.5.24" #endif #ifdef TARGET char version[] = PROGNAME " " VERSION " " TARGET " " FORMERLY ; #else char version[] = PROGNAME " " VERSION " " FORMERLY ; #endif /* * Display the version. All this does * is copy the version string onto the echo line. */ /*ARGSUSED*/ showversion(f, n) int f, n; { ewprintf(version); return TRUE; } #ifdef ADDFUNC /* 90.12.28 by S.Yoshida */ #ifndef NO_BACKUP static char *backup_msg = "\tBACKUP\t\t(Enable backup files)"; #endif #ifdef CURSOR_POS static char *cursor_pos_msg = "\tCURSOR_POS\t(Cursor locates on next CHR after POINT)"; #endif #ifdef C_MODE static char *c_mode_msg = "\tC_MODE\t\t(Enable \"c-mode\" functions)"; #endif #ifdef BUFFER_MODE static char *buffer_mode_msg = "\tBUFFER_MODE\t(Enable \"Buffer Menu\" mode)"; #endif #ifdef NEW_COMPLETE static char *complete_msg = "\tCOMPLETE\t(Enable new version completion)"; #endif #ifndef NO_DIR # ifdef EXTD_DIR static char *dir_msg = "\tDIR\t\t(Enable buffer local directory change)"; # else static char *dir_msg = "\tDIR\t\t(Enable directory change functions)"; # endif #endif #endif /* ADD_FUNC */ #ifndef NO_DIRED static char *dired_msg = "\tDIRED\t\t(Enable \"dired\" mode functions)"; #endif #ifndef NO_DPROMPT static char *prompt_msg = "\tDPROMPT\t\t(Enable delayed prompt)"; #endif #ifdef FEPCTRL static char *fepctrl_msg = "\tFEPCTRL\t\t(Enable FEP auto control)"; #endif #ifndef NO_FILECOMP static char *filecomp_msg = "\tFILECOMP\t(Enable file name completion)"; #endif #ifdef FILLPREFIX static char *fillprefix_msg = "\tFILLPREFIX\t(Enable fill prefix function)"; #endif #ifdef HANKANA static char *hankana_msg = "\tHANKANA\t\t(Enable Hankaku KANA handling)"; #endif #ifndef NO_HELP static char *help_msg = "\tHELP\t\t(Enable help)"; #endif #ifdef KANJI static char *kanji_msg = "\tKANJI\t\t(Enable KANJI handling)"; #endif #ifdef KINSOKU static char *kinsoku_msg = "\tKINSOKU\t\t(Enable KINSOKU handling)"; #endif #ifndef NO_MACRO static char *macro_msg = "\tMACRO\t\t(Enable keyboard macros)"; #endif #ifdef DO_METAKEY static char *metakey_msg = "\tMETAKEY\t\t(Enable META key input)"; #endif #ifdef PREFIXREGION static char *prefixregion_msg = "\tPREFIXREGION\t(Enable \"prefix-region\")"; #endif #ifdef READONLY static char *readonly_msg = "\tREADONLY\t(Enable read-only buffer mode)"; #endif #ifdef REGEX # ifdef REGEX_JAPANESE static char *regex_msg = "\tREGEX\t\t(Enable Japanese regular expression)"; # else static char *regex_msg = "\tREGEX\t\t(Enable regular expression functions)"; # endif #endif #ifndef NO_SHELL static char *shell_msg = "\tSHELL\t\t(Enable shell-command function)"; #endif #ifndef NO_STARTUP static char *startup_msg = "\tSTARTUP\t\t(Enable startup files)"; #endif #ifdef ADDFUNC static char *addfunc_msg = "\tADDFUNC\t\t(Enable misc functions)"; #endif #ifdef VARIABLE_TAB static char *vartab_msg = "\tVARIABLE_TAB\t(Enable buffer-local tabwidth)"; #endif #ifdef ADDOPT static char *addopt_msg = "\tADDOPT\t\t(Enable additional startup option)"; #endif #ifdef CLIPBOARD static char *clipboard_msg = "\tCLIPBOARD\t(Enable yank-buffer to/from clipboard)"; #endif #ifdef MINIBUF_EDIT static char *minibuf_msg = "\tMINIBUF_EDIT\t(Enable minibuffer edit)"; #endif #ifdef CANNA static char *canna_msg = "\tCANNA\t\t(Enable CANNA)"; #endif #ifdef NEXTLINE static char *nextline_msg = "\tNEXTLINE\t(Enable \"next-line-add-newlines\")"; #endif #ifdef UNDO static char *undo_msg = "\tUNDO\t\t(Enable undo)"; #endif #ifdef DROPFILES static char *dropfiles_msg = "\tDROPFILES\t(Enable Drag&Drop)"; #endif #ifdef HOJO_KANJI static char *hojokan_msg = "\tHOJO_KANJI\t(Enable Hojo KANJI handling)"; #endif /* Dec.20,1992 Add by H.Ohkubo */ #ifdef AMIGA #ifndef V2 # ifdef V11 static char *v1_msg = "\tV11\t\t(Enable AmigaDOS Ver.1.1)"; # else static char *v1_msg = "\tV1\t\t(Enable AmigaDOS Ver.1.x)"; # endif #endif #ifdef DO_MENU static char *menu_msg = "\tDO_MENU\t\t(Enable menu selection)"; #endif #ifdef BROWSER static char *browser_msg = "\tBROWSER\t\t(Enable to present a menu of file)"; #endif #ifdef MOUSE static char *mouse_msg = "\tMOUSE\t\t(Enable to use mouse)"; #endif #ifdef FKEYS static char *fkeys_msg = "\tFKEYS\t\t(Enable to use function keys)"; #endif #ifdef DO_ICONIFY static char *iconify_msg = "\tDO_ICONIFY\t(Enable iconify)"; #endif #ifdef CHANGE_COLOR static char *color_msg = "\tCOLOR\t\t(Enable to color setting)"; #endif #ifdef CHANGE_FONT static char *font_msg = "\tFONT\t\t(Enable to font setting)"; #endif #ifdef USE_ARP static char *arp_msg = "\tARP\t\t(using ARP.Library)"; #endif #ifdef REXX static char *rexx_msg = "\tREXX\t\t(Enable to use AREXX)"; #endif #ifdef ASL static char *asl_msg = "\tASL\t\t(Enable to use ASL Filerequester)"; #endif #endif /* AMIGA */ /* * Display the Ng version, compile time options. */ /*ARGSUSED*/ showngversion(f, n) int f, n; { register BUFFER *bp; register WINDOW *wp; char line[80]; if ((bp = bfind("*" PROGNAME " Version*", TRUE)) == NULL) return FALSE; if (bclear(bp) != TRUE) return FALSE; bp->b_flag &= ~BFCHG; /* Blow away old. */ #ifdef READONLY bp->b_flag |= BFRONLY; #endif if (bclear(bp) != TRUE) return FALSE; strcpy(line, PROGNAME " version:"); if (addline(bp, line) == FALSE) return FALSE; sprintf(line, "\t%s", version); if (addline(bp, line) == FALSE) return FALSE; strcpy(line, "Compile time options:"); if (addline(bp, line) == FALSE) return FALSE; #ifndef NO_BACKUP strcpy(line, backup_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifdef CURSOR_POS strcpy(line, cursor_pos_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifdef C_MODE strcpy(line, c_mode_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifdef BUFFER_MODE strcpy(line, buffer_mode_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifdef NEW_COMPLETE strcpy(line, complete_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifndef NO_DIR strcpy(line, dir_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifndef NO_DIRED strcpy(line, dired_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifndef NO_DPROMPT strcpy(line, prompt_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifdef FEPCTRL strcpy(line, fepctrl_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifndef NO_FILECOMP strcpy(line, filecomp_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifdef FILLPREFIX strcpy(line, fillprefix_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifdef HANKANA strcpy(line, hankana_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifndef NO_HELP strcpy(line, help_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifdef KANJI strcpy(line, kanji_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifdef KINSOKU strcpy(line, kinsoku_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifndef NO_MACRO strcpy(line, macro_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifdef DO_METAKEY strcpy(line, metakey_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifdef PREFIXREGION strcpy(line, prefixregion_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifdef READONLY strcpy(line, readonly_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifdef REGEX strcpy(line, regex_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifndef NO_SHELL strcpy(line, shell_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifndef NO_STARTUP strcpy(line, startup_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifdef ADDFUNC strcpy(line, addfunc_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifdef VARIABLE_TAB strcpy(line, vartab_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifdef ADDOPT strcpy(line, addopt_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifdef CLIPBOARD strcpy(line, clipboard_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifdef MINIBUF_EDIT strcpy(line, minibuf_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifdef CANNA strcpy(line, canna_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifdef NEXTLINE strcpy(line, nextline_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifdef UNDO strcpy(line, undo_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifdef DROPFILES strcpy(line, dropfiles_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifdef HOJO_KANJI strcpy(line, hojokan_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifdef AMIGA /* Dec.20,1992 By H.Ohkubo */ #ifndef V2 strcpy(line, v1_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifdef DO_MENU strcpy(line, menu_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifdef BROWSER strcpy(line, browser_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifdef MOUSE strcpy(line, mouse_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifdef FKEYS strcpy(line, fkeys_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifdef DO_ICONIFY strcpy(line, iconify_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifdef CHANGE_COLOR strcpy(line, color_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifdef CHANGE_FONT strcpy(line, font_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifdef USE_ARP strcpy(line, arp_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifdef REXX strcpy(line, rexx_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #ifdef ASL strcpy(line, asl_msg); if (addline(bp, line) == FALSE) return FALSE; #endif #endif /* AMIGA */ if ((wp = popbuf(bp)) == NULL) return FALSE; bp->b_dotp = lforw(bp->b_linep); /* put dot at beginning of buffer */ bp->b_doto = 0; wp->w_dotp = bp->b_dotp; /* fix up if window already on screen */ wp->w_doto = bp->b_doto; return TRUE; } /* * Print the Ng version to the stdout. */ printversion() { #ifdef WIN32 char buf[ 128 ], *ptr = buf ; extern void MessageOut( const char * ) ; sprintf(ptr, PROGNAME " version:\n"); ptr += strlen( ptr ) ; sprintf(ptr, "\t%s\n", version); MessageOut( buf ) ; #else /* WIN32 */ printf(PROGNAME " version:\n"); printf("\t%s\n", version); #endif /* WIN32 */ return TRUE; } /* * Print the Ng compile time options. */ printoptions() { #ifndef WIN32 printf("Compile time options:\n"); #ifndef NO_BACKUP printf("%s\n", backup_msg); #endif #ifdef CURSOR_POS printf("%s\n", cursor_pos_msg); #endif #ifdef C_MODE printf("%s\n", c_mode_msg); #endif #ifdef BUFFER_MODE printf("%s\n", buffer_mode_msg); #endif #ifdef NEW_COMPLETE printf("%s\n", complete_msg); #endif #ifndef NO_DIR printf("%s\n", dir_msg); #endif #ifndef NO_DIRED printf("%s\n", dired_msg); #endif #ifndef NO_DPROMPT printf("%s\n", prompt_msg); #endif #ifdef FEPCTRL printf("%s\n", fepctrl_msg); #endif #ifndef NO_FILECOMP printf("%s\n", filecomp_msg); #endif #ifdef FILLPREFIX printf("%s\n", fillprefix_msg); #endif #ifdef HANKANA printf("%s\n", hankana_msg); #endif #ifndef NO_HELP printf("%s\n", help_msg); #endif #ifdef KANJI printf("%s\n", kanji_msg); #endif #ifdef KINSOKU printf("%s\n", kinsoku_msg); #endif #ifndef NO_MACRO printf("%s\n", macro_msg); #endif #ifdef DO_METAKEY printf("%s\n", metakey_msg); #endif #ifdef PREFIXREGION printf("%s\n", prefixregion_msg); #endif #ifdef READONLY printf("%s\n", readonly_msg); #endif #ifdef REGEX printf("%s\n", regex_msg); #endif #ifndef NO_SHELL printf("%s\n", shell_msg); #endif #ifndef NO_STARTUP printf("%s\n", startup_msg); #endif #ifdef VARIABLE_TAB printf("%s\n", vartab_msg); #endif #ifdef ADDOPT printf("%s\n", addopt_msg); #endif #ifdef CLIPBOARD printf("%s\n", clipboard_msg); #endif #ifdef MINIBUF_EDIT printf("%s\n", minibuf_msg); #endif #ifdef CANNA printf("%s\n", canna_msg); #endif #ifdef NEXTLINE printf("%s\n", nextline_msg); #endif #ifdef UNDO printf("%s\n", undo_msg); #endif #ifdef DROPFILES printf("%s\n", dropfiles_msg); #endif #ifdef HOJO_KANJI printf("%s\n", hojokan_msg); #endif #ifdef AMIGA /* Dec.20,1992 By H.Ohkubo */ #ifndef V2 printf("%s\n", v1_msg); #endif #ifdef DO_MENU printf("%s\n", menu_msg); #endif #ifdef BROWSER printf("%s\n", browser_msg); #endif #ifdef MOUSE printf("%s\n", mouse_msg); #endif #ifdef FKEYS printf("%s\n", fkeys_msg); #endif #ifdef DO_ICONIFY printf("%s\n", iconify_msg); #endif #ifdef CHANGE_COLOR printf("%s\n", color_msg); #endif #ifdef CHANGE_FONT printf("%s\n", font_msg); #endif #ifdef USE_ARP printf("%s\n", arp_msg); #endif #ifdef REXX printf("%s\n", rexx_msg); #endif #ifdef ASL printf("%s\n", asl_msg); #endif #endif /* AMIGA */ #endif /* WIN32 */ return TRUE; } ng-1.5beta1/window.c100644 1750 1750 24471 7303476025 13162 0ustar amurausers/* $Id: window.c,v 1.2 2001/05/25 15:36:53 amura Exp $ */ /* * Window handling. */ /* * $Log: window.c,v $ * Revision 1.2 2001/05/25 15:36:53 amura * now buffers have only one mark (before windows have one mark) * * Revision 1.1.1.1 2000/06/27 01:47:55 amura * import to CVS * */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include "def.h" /* * Reposition dot in the current * window to line "n". If the argument is * positive, it is that line. If it is negative it * is that line from the bottom. If it is 0 the window * is centered (this is what the standard redisplay code * does). If GOSREC is undefined, default is 0, so it acts like GNU. * If GOSREC is defined, with no argument it defaults to 1 * and works like in Gosling. */ /*ARGSUSED*/ reposition(f, n) { #ifndef GOSREC curwp->w_force = (f & FFARG) ? (n>=0 ? n+1 : n) : 0; #else curwp->w_force = n; #endif curwp->w_flag |= WFFORCE; sgarbf = TRUE; return TRUE; } /* * Refresh the display. A call is made to the * "ttresize" entry in the terminal handler, which tries * to reset "nrow" and "ncol". They will, however, never * be set outside of the NROW or NCOL range. If the display * changed size, arrange that everything is redone, then * call "update" to fix the display. We do this so the * new size can be displayed. In the normal case the * call to "update" in "main.c" refreshes the screen, * and all of the windows need not be recomputed. * Note that when you get to the "display unusable" * message, the screen will be messed up. If you make * the window bigger again, and send another command, * everything will get fixed! */ /*ARGSUSED*/ refresh(f, n) { register WINDOW *wp; register int oldnrow; register int oldncol; oldnrow = nrow; oldncol = ncol; ttresize(); if (nrow!=oldnrow || ncol!=oldncol) { wp = wheadp; /* Find last. */ while (wp->w_wndp != NULL) wp = wp->w_wndp; if (nrow < wp->w_toprow+3) { /* Check if too small. */ ewprintf("Display unusable"); return (FALSE); } wp->w_ntrows = nrow-wp->w_toprow-2; sgarbf = TRUE; update(); ewprintf("New size %d by %d", nrow, ncol); } else sgarbf = TRUE; return TRUE; } /* * The command to make the next * window (next => down the screen) * the current window. There are no real * errors, although the command does * nothing if there is only 1 window on * the screen. */ /*ARGSUSED*/ nextwind(f, n) { register WINDOW *wp; if ((wp=curwp->w_wndp) == NULL) wp = wheadp; curwp = wp; curbp = wp->w_bufp; return TRUE; } #ifdef GOSMACS /* not in Gnu Emacs */ /* * This command makes the previous * window (previous => up the screen) the * current window. There arn't any errors, * although the command does not do a lot * if there is 1 window. */ /*ARGSUSED*/ prevwind(f, n) { register WINDOW *wp1; register WINDOW *wp2; wp1 = wheadp; wp2 = curwp; if (wp1 == wp2) wp2 = NULL; while (wp1->w_wndp != wp2) wp1 = wp1->w_wndp; curwp = wp1; curbp = wp1->w_bufp; return TRUE; } #endif /* * This command makes the current * window the only window on the screen. * Try to set the framing * so that "." does not have to move on * the display. Some care has to be taken * to keep the values of dot and mark * in the buffer structures right if the * distruction of a window makes a buffer * become undisplayed. */ /*ARGSUSED*/ onlywind(f, n) { register WINDOW *wp; register LINE *lp; register int i; while (wheadp != curwp) { wp = wheadp; wheadp = wp->w_wndp; if (--wp->w_bufp->b_nwnd == 0) { wp->w_bufp->b_dotp = wp->w_dotp; wp->w_bufp->b_doto = wp->w_doto; } free((char *) wp); } while (curwp->w_wndp != NULL) { wp = curwp->w_wndp; curwp->w_wndp = wp->w_wndp; if (--wp->w_bufp->b_nwnd == 0) { wp->w_bufp->b_dotp = wp->w_dotp; wp->w_bufp->b_doto = wp->w_doto; } free((char *) wp); } lp = curwp->w_linep; i = curwp->w_toprow - curwp->w_lines; while (i>0 && lback(lp)!=curbp->b_linep) { lp = lback(lp); i -= countlines(lp); } if (i > 0) i = 0; if (i < 0) i = -i; curwp->w_toprow = 0; curwp->w_ntrows = nrow-2; /* 2 = mode, echo. */ curwp->w_linep = lp; curwp->w_lines = i; curwp->w_flag |= WFMODE|WFHARD; return TRUE; } /* * Split the current window. A window * smaller than 3 lines cannot be split. * The only other error that is possible is * a "malloc" failure allocating the structure * for the new window. */ /*ARGSUSED*/ splitwind(f, n) { register WINDOW *wp; register LINE *lp; register int ntru; register int ntrd; int ntrl; int lines; WINDOW *wp1, *wp2; if (curwp->w_ntrows < 3) { ewprintf("Cannot split a %d line window", curwp->w_ntrows); return (FALSE); } if ((wp = (WINDOW *)malloc(sizeof(WINDOW))) == NULL) { ewprintf("Can't get %d", sizeof(WINDOW)); return (FALSE); } ++curbp->b_nwnd; /* Displayed twice. */ wp->w_bufp = curbp; wp->w_dotp = curwp->w_dotp; wp->w_doto = curwp->w_doto; wp->w_flag = 0; wp->w_force = 0; ntru = (curwp->w_ntrows-1) / 2; /* Upper size */ ntrl = (curwp->w_ntrows-1) - ntru; /* Lower size */ lp = curwp->w_linep; ntrd = - curwp->w_lines; while (lp != curwp->w_dotp) { ntrd += countlines(lp); lp = lforw(lp); } { int x,y; ntrd += colrow(lp, curwp->w_doto, &x, &y); } lp = curwp->w_linep; lines = curwp->w_lines; if (ntrd <= ntru) { /* Old is upper window. */ if (ntrd == ntru) { /* Hit mode line. */ if ( countlines(lp) > lines+1 ) { ++lines; } else { lp = lforw(lp); lines=0; } } curwp->w_ntrows = ntru; wp->w_wndp = curwp->w_wndp; curwp->w_wndp = wp; wp->w_toprow = curwp->w_toprow+ntru+1; wp->w_ntrows = ntrl; } else { /* Old is lower window */ wp1 = NULL; wp2 = wheadp; while (wp2 != curwp) { wp1 = wp2; wp2 = wp2->w_wndp; } if (wp1 == NULL) wheadp = wp; else wp1->w_wndp = wp; wp->w_wndp = curwp; wp->w_toprow = curwp->w_toprow; wp->w_ntrows = ntru; ++ntru; /* Mode line. */ curwp->w_toprow += ntru; curwp->w_ntrows = ntrl; ntru += lines; while (ntru > 0) { ntru -= countlines(lp); if (ntru < 0) break; lp = lforw(lp); } if (ntru < 0) ntru = countlines(lp) + ntru; lines = ntru; } curwp->w_linep = lp; /* Adjust the top lines */ wp->w_linep = lp; /* if necessary. */ curwp->w_lines = lines; wp->w_lines = lines; curwp->w_flag |= WFMODE|WFHARD; wp->w_flag |= WFMODE|WFHARD; return TRUE; } /* * Enlarge the current window. * Find the window that loses space. Make * sure it is big enough. If so, hack the window * descriptions, and ask redisplay to do all the * hard work. You don't just set "force reframe" * because dot would move. */ /*ARGSUSED*/ enlargewind(f, n) { register WINDOW *adjwp; register LINE *lp; register int i; if (n < 0) return shrinkwind(f, -n); if (wheadp->w_wndp == NULL) { ewprintf("Only one window"); return FALSE; } if ((adjwp=curwp->w_wndp) == NULL) { adjwp = wheadp; while (adjwp->w_wndp != curwp) adjwp = adjwp->w_wndp; } if (adjwp->w_ntrows <= n) { ewprintf("Impossible change"); return FALSE; } if (curwp->w_wndp == adjwp) { /* Shrink below. */ lp = adjwp->w_linep; for (i=n+adjwp->w_lines; i>0 && lp!=adjwp->w_bufp->b_linep; ) { i -= countlines(lp); if (i < 0) break; lp = lforw(lp); } if (i>0) i=countlines(lp)-1; /* LAST row */ if (i<0) i=countlines(lp)+i; adjwp->w_linep = lp; adjwp->w_lines = i; adjwp->w_toprow += n; } else { /* Shrink above. */ lp = curwp->w_linep; for (i=n-curwp->w_lines; i>0 && lback(lp)!=curbp->b_linep; ){ lp = lback(lp); i -= countlines(lp); } if (i>0) i= 0; if (i<0) i= -i; curwp->w_linep = lp; curwp->w_lines = i; curwp->w_toprow -= n; } curwp->w_ntrows += n; adjwp->w_ntrows -= n; curwp->w_flag |= WFMODE|WFHARD; adjwp->w_flag |= WFMODE|WFHARD; return TRUE; } /* * Shrink the current window. * Find the window that gains space. Hack at * the window descriptions. Ask the redisplay to * do all the hard work. */ shrinkwind(f, n) { register WINDOW *adjwp; register LINE *lp; register int i; if (n < 0) return enlargewind(f, -n); if (wheadp->w_wndp == NULL) { ewprintf("Only one window"); return FALSE; } /* * Bit of flakiness - KRANDOM means it was an internal call, and * to be trusted implicitly about sizes. */ if ( !(f & FFRAND) && curwp->w_ntrows <= n) { ewprintf("Impossible change"); return (FALSE); } if ((adjwp=curwp->w_wndp) == NULL) { adjwp = wheadp; while (adjwp->w_wndp != curwp) adjwp = adjwp->w_wndp; } if (curwp->w_wndp == adjwp) { /* Grow below. */ lp = adjwp->w_linep; for (i=n-adjwp->w_lines; i>0 && lback(lp)!=adjwp->w_bufp->b_linep; ) { lp = lback(lp); i -= countlines(lp); } if (i>0) i = 0; if (i<0) i = -i; adjwp->w_linep = lp; adjwp->w_lines = i; adjwp->w_toprow -= n; } else { /* Grow above. */ lp = curwp->w_linep; for (i=n + curwp->w_lines; i>0 && lp!=curbp->b_linep;) { i -= countlines(lp); if (i<0) break; lp = lforw(lp); } if (i>0) i=countlines(lp)-1; /* LAST row */ if (i<0) i=countlines(lp)+i; curwp->w_linep = lp; curwp->w_lines = i; curwp->w_toprow += n; } curwp->w_ntrows -= n; adjwp->w_ntrows += n; curwp->w_flag |= WFMODE|WFHARD; adjwp->w_flag |= WFMODE|WFHARD; return (TRUE); } /* * Delete current window. Call shrink-window to do the screen * updating, then throw away the window. */ /*ARGSUSED*/ delwind(f, n) { register WINDOW *wp, *nwp; wp = curwp; /* Cheap... */ /* shrinkwind returning false means only one window... */ if (shrinkwind(FFRAND, wp->w_ntrows + 1) == FALSE) return FALSE; if (--wp->w_bufp->b_nwnd == 0) { wp->w_bufp->b_dotp = wp->w_dotp; wp->w_bufp->b_doto = wp->w_doto; } /* since shrinkwind did't crap out, we know we have a second window */ if (wp == wheadp) wheadp = curwp = wp->w_wndp; else if ((curwp = wp->w_wndp) == NULL) curwp = wheadp; curbp = curwp->w_bufp; for (nwp = wheadp; nwp != NULL; nwp = nwp->w_wndp) if (nwp->w_wndp == wp) { nwp->w_wndp = wp->w_wndp; break ; } free((char *) wp); return TRUE; } /* * Pick a window for a pop-up. * Split the screen if there is only * one window. Pick the uppermost window that * isn't the current window. An LRU algorithm * might be better. Return a pointer, or * NULL on error. */ WINDOW * wpopup() { register WINDOW *wp; if (wheadp->w_wndp == NULL && splitwind(FFRAND, 0) == FALSE) return NULL; wp = wheadp; /* Find window to use */ while (wp!=NULL && wp==curwp) wp = wp->w_wndp; return wp; } ng-1.5beta1/word.c100644 1750 1750 23224 7225352412 12615 0ustar amurausers/* $Id: word.c,v 1.3 2001/01/05 14:07:06 amura Exp $ */ /* * Word mode commands. * The routines in this file * implement commands that work word at * a time. There are all sorts of word mode * commands. */ /* * $Log: word.c,v $ * Revision 1.3 2001/01/05 14:07:06 amura * first implementation of Hojo Kanji support * * Revision 1.2 2000/06/27 01:49:45 amura * import to CVS * * Revision 1.1 2000/06/01 05:36:12 amura * Initial revision * */ /* 90.01.29 Modified for Ng 1.0 by S.Yoshida */ #include "config.h" /* 90.12.20 by S.Yoshida */ #include "def.h" #ifdef UNDO #include "undo.h" #endif #ifdef HOJO_KANJI #define CHAR_LENGTH() (ishojo() ? 3 : (iskanji() ? 2 : 1)) #else #define CHAR_LENGTH() (iskanji() ? 2 : 1) #endif /* * Move the cursor backward by * "n" words. All of the details of motion * are performed by the "backchar" and "forwchar" * routines. */ /*ARGSUSED*/ backword(f, n) { if (n < 0) return forwword(f | FFRAND, -n); if (backchar(FFRAND, 1) == FALSE) return FALSE; while (n--) { while (inword() == FALSE) { if (backchar(FFRAND, 1) == FALSE) return TRUE; } #ifdef KANJI /* 90.01.29 by S.Yoshida */ initcategory(0); /* Set category of start char. */ while (inword() != FALSE && incategory()) { #else /* NOT KANJI */ while (inword() != FALSE) { #endif /* KANJI */ if (backchar(FFRAND, 1) == FALSE) return TRUE; } } return forwchar(FFRAND, 1); } /* * Move the cursor forward by * the specified number of words. All of the * motion is done by "forwchar". */ /*ARGSUSED*/ forwword(f, n) { if (n < 0) return backword(f | FFRAND, -n); while (n--) { while (inword() == FALSE) { if (forwchar(FFRAND, 1) == FALSE) return TRUE; } #ifdef KANJI /* 90.01.29 by S.Yoshida */ initcategory(1); /* Set category of start char. */ while (inword() != FALSE && incategory()) { #else /* NOT KANJI */ while (inword() != FALSE) { #endif /* KANJI */ if (forwchar(FFRAND, 1) == FALSE) return TRUE; } } return TRUE; } /* * Move the cursor forward by * the specified number of words. As you move, * convert any characters to upper case. */ /*ARGSUSED*/ upperword(f, n) { register int c; #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ if (n < 0) return FALSE; #ifdef UNDO undo_reset(curbp); /* this function cannot undo */ #endif while (n--) { while (inword() == FALSE) { if (forwchar(FFRAND, 1) == FALSE) return TRUE; } #ifdef KANJI /* 90.01.29 by S.Yoshida */ initcategory(1); /* Set category of start char. */ while (inword() != FALSE && incategory()) { #else /* NOT KANJI */ while (inword() != FALSE) { #endif /* KANJI */ c = lgetc(curwp->w_dotp, curwp->w_doto); if (ISLOWER(c) != FALSE) { c = TOUPPER(c); lputc(curwp->w_dotp, curwp->w_doto, c); lchange(WFHARD); } if (forwchar(FFRAND, 1) == FALSE) return TRUE; } } return TRUE; } /* * Move the cursor forward by * the specified number of words. As you move * convert characters to lower case. */ /*ARGSUSED*/ lowerword(f, n) { register int c; #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ if (n < 0) return FALSE; #ifdef UNDO undo_reset(curbp); /* this function cannot undo */ #endif while (n--) { while (inword() == FALSE) { if (forwchar(FFRAND, 1) == FALSE) return TRUE; } #ifdef KANJI /* 90.01.29 by S.Yoshida */ initcategory(1); /* Set category of start char. */ while (inword() != FALSE && incategory()) { #else /* NOT KANJI */ while (inword() != FALSE) { #endif /* KANJI */ c = lgetc(curwp->w_dotp, curwp->w_doto); if (ISUPPER(c) != FALSE) { c = TOLOWER(c); lputc(curwp->w_dotp, curwp->w_doto, c); lchange(WFHARD); } if (forwchar(FFRAND, 1) == FALSE) return TRUE; } } return TRUE; } /* * Move the cursor forward by * the specified number of words. As you move * convert the first character of the word to upper * case, and subsequent characters to lower case. Error * if you try and move past the end of the buffer. */ /*ARGSUSED*/ capword(f, n) { register int c; VOID lchange(); #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ if (n < 0) return FALSE; #ifdef UNDO undo_reset(curbp); /* this function cannot undo */ #endif while (n--) { while (inword() == FALSE) { if (forwchar(FFRAND, 1) == FALSE) return TRUE; } #ifdef KANJI /* 90.01.29 by S.Yoshida */ initcategory(1); /* Set category of start char. */ if (inword() != FALSE && incategory()) { #else /* NOT KANJI */ if (inword() != FALSE) { #endif /* KANJI */ c = lgetc(curwp->w_dotp, curwp->w_doto); if (ISLOWER(c) != FALSE) { c = TOUPPER(c); lputc(curwp->w_dotp, curwp->w_doto, c); lchange(WFHARD); } if (forwchar(FFRAND, 1) == FALSE) return TRUE; #ifdef KANJI /* 90.01.29 by S.Yoshida */ while (inword() != FALSE && incategory()) { #else /* NOT KANJI */ while (inword() != FALSE) { #endif /* KANJI */ c = lgetc(curwp->w_dotp, curwp->w_doto); if (ISUPPER(c) != FALSE) { c = TOLOWER(c); lputc(curwp->w_dotp, curwp->w_doto, c); lchange(WFHARD); } if (forwchar(FFRAND, 1) == FALSE) return TRUE; } } } return TRUE; } /* * Kill forward by "n" words. */ /*ARGSUSED*/ delfword(f, n) { register RSIZE size; register LINE *dotp; register int doto; #ifdef KANJI /* 90.01.29 by S.Yoshida */ register RSIZE s; /* Delete char size. */ #endif /* KANJI */ #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ if (n < 0) return FALSE; if ((lastflag&CFKILL) == 0) /* Purge kill buffer. */ kdelete(); thisflag |= CFKILL; dotp = curwp->w_dotp; doto = curwp->w_doto; size = 0; while (n--) { while (inword() == FALSE) { #ifdef KANJI /* 90.01.29 by S.Yoshida */ s = CHAR_LENGTH(); #endif /* KANJI */ if (forwchar(FFRAND, 1) == FALSE) goto out; /* Hit end of buffer. */ #ifdef KANJI /* 90.01.29 by S.Yoshida */ size += s; #else /* NOT KANJI */ ++size; #endif /* KANJI */ } #ifndef KANJI /* 90.01.29 by S.Yoshida */ while (inword() != FALSE) { #else /* KANJI */ initcategory(1); /* Set category of start char. */ while (inword() != FALSE && incategory()) { s = CHAR_LENGTH(); #endif /* KANJI */ if (forwchar(FFRAND, 1) == FALSE) goto out; /* Hit end of buffer. */ #ifdef KANJI /* 90.01.29 by S.Yoshida */ size += s; #else /* NOT KANJI */ ++size; #endif /* KANJI */ } } out: curwp->w_dotp = dotp; curwp->w_doto = doto; return (ldelete(size, KFORW)); } /* * Kill backwards by "n" words. The rules * for success and failure are now different, to prevent * strange behavior at the start of the buffer. The command * only fails if something goes wrong with the actual delete * of the characters. It is successful even if no characters * are deleted, or if you say delete 5 words, and there are * only 4 words left. I considered making the first call * to "backchar" special, but decided that that would just * be wierd. Normally this is bound to "M-Rubout" and * to "M-Backspace". */ /*ARGSUSED*/ delbword(f, n) { register RSIZE size; VOID kdelete(); #ifdef READONLY /* 91.01.05 by S.Yoshida */ if (curbp->b_flag & BFRONLY) { /* If this buffer is read-only, */ warnreadonly(); /* do only displaying warning. */ return TRUE; } #endif /* READONLY */ if (n < 0) return FALSE; if ((lastflag&CFKILL) == 0) /* Purge kill buffer. */ kdelete(); thisflag |= CFKILL; if (backchar(FFRAND, 1) == FALSE) return (TRUE); /* Hit buffer start. */ #ifdef KANJI /* 90.01.29 by S.Yoshida */ size = CHAR_LENGTH(); #else /* NOT KANJI */ size = 1; /* One deleted. */ #endif /* KANJI */ while (n--) { while (inword() == FALSE) { if (backchar(FFRAND, 1) == FALSE) goto out; /* Hit buffer start. */ #ifdef KANJI /* 90.01.29 by S.Yoshida */ size += CHAR_LENGTH(); #else /* NOT KANJI */ ++size; #endif /* KANJI */ } #ifdef KANJI /* 90.01.29 by S.Yoshida */ initcategory(0); /* Set category of start char. */ while (inword() != FALSE && incategory()) { #else /* NOT KANJI */ while (inword() != FALSE) { #endif /* KANJI */ if (backchar(FFRAND, 1) == FALSE) goto out; /* Hit buffer start. */ #ifdef KANJI /* 90.01.29 by S.Yoshida */ size += CHAR_LENGTH(); #else /* NOT KANJI */ ++size; #endif /* KANJI */ } } #ifdef KANJI /* 90.01.29 by S.Yoshida */ size -= CHAR_LENGTH(); #endif /* KANJI */ if (forwchar(FFRAND, 1) == FALSE) return FALSE; --size; /* Undo assumed delete. */ out: return ldelete(size, KBACK); } /* * Return TRUE if the character at dot * is a character that is considered to be * part of a word. The word character list is hard * coded. Should be setable. */ inword() { /* can't use lgetc in ISWORD due to bug in OSK cpp */ #ifdef KANJI /* 90.01.29 by S.Yoshida */ register int c; if (curwp->w_doto == llength(curwp->w_dotp)) { return FALSE; } c = lgetc(curwp->w_dotp, curwp->w_doto); if (ISKANJI(c)) { #ifdef HOJO_KANJI if (ISHOJO(c)) { curwp->w_doto++; c = lgetc(curwp->w_dotp, curwp->w_doto); } #endif return(iskword(c, lgetc(curwp->w_dotp, curwp->w_doto + 1))); } else { return (ISWORD(c)); } #else /* NOT KANJI */ return curwp->w_doto != llength(curwp->w_dotp) && ISWORD(curwp->w_dotp->l_text[curwp->w_doto]); #endif /* KANJI */ } ng-1.5beta1/docs/ 40755 1750 1750 0 7642273674 12325 5ustar amurausersng-1.5beta1/docs/CHANGES.doc100644 1750 1750 11161 7641664631 14175 0ustar amurausers# $Id: CHANGES.1_5,v 1.5.2.5 2003/03/30 22:03:05 amura Exp $ ============================================================================== CHANGES.doc for Ng (Nihongo micro Gnu emacs) 村松 篤 (amura@tomato.sakura.ne.jp) ============================================================================== ************************************************************************** このファイルには、1.5alpha0 以降の変更点を記載します。 Ng 1.4.2 までの変更 履歴は CHANGES.1_4 を、Ng 1.3L 以前の履歴は CHANGES.1_3 御覧ください。 ************************************************************************** [全版共通] a) minibuffer に履歴機能を追加しました。 (角川さんの patch を元に改変) b) 複数の window を開けている時に、window の移動、ファイル名の補間等 した時に落ちるバグを修正しました。 これは、Ng 1.5alpha3 の d) の変更で入ってしまったバグです。 c) query-replace で、漢字の文字列をそれより短い奇数バイトの文字列で置 換すると、バッファの内容がおかしくなるバグを修正。 [UNIX 版] d) canna で変換中の候補一覧が表示されないバグを修正。 [AMIGA 版] e) コンパイルできなくなっていたのを修正。 これは、Ng 1.5alpha3 の d) の変更で入ってしまったバグです。 [Human68k 版] f) autosave 機能の動作確認をしました。 g) libc を使ってコンパイルできるように修正。 ------------------------------------------------------------------------------ [全版共通] a) Simple Kanji Generator を改良しました。かなり高速化されています。 b) buffer-list の表示がおかしかったのを直しました。 c) line-number-mode を追加しました。これは、モードラインに現在カー ソルがある論理行番号を表示する物です。 (松浦さんの patch を参考にしました) d) mark の扱いを変更しました。今までは window に対して一つの mark を管理していましたが、これからは buffer に対して一つの mark を管 理するようになりました。(この新しい方針は GNU Emacs と同じです) [WIN32 版] e) Visual C++ でコンパイル出来なくなっていたのを修正しました。 f) autosave 機能を実装しました。ただし、今の実装は結構いい加減です。 [MSDOS 版] g) Turbo C/C++ でコンパイルした時、不特定時にハングアップする事があ る問題を修正しました。(alloca()のプロトタイプが入っていなかった のが原因です) ------------------------------------------------------------------------------ [全版共通] a) autosave 機能を実装しました。autosave 機能の実現に当たって、鈴木 氏の Ng-1.3.1L6 からかなりのコードを頂いています。現在のところ、 UNIX、AMIGA、MSDOS版で動作します。HUMAN68K版は実装したのですが動 作確認していません。WIN32版はまだ実装していません。(ちなみに BSD、 SysV版は今後も実装する気はありません) b) 他にも、鈴木氏の Ng-1.3.1L6 を参考にいくつか手が入っています。 (一部関数/変数の static 化、startup file のエラーメッセージ等) c) dir.c を機種依存部と共通部に分離しました。 [UNIX 版] d) select(2) を使用しないようにコンパイルした時、ttwait() 関数がうま く動かない事がある問題を修正しました。 ------------------------------------------------------------------------------ [全版共通] a) 画面バッファを動的に確保するようにしました。これにより、おおきな 画面の端末でも端末いっぱい使う事が出来るようになります。 [MSDOS, WIN32 版] b) JIS 補助漢字に対応していない部分があったので修正しました。 [WIN32 版] c) Borland C++ でコンパイル出来なくなっていたのを修正しました。 ------------------------------------------------------------------------------ [全版共通] a) JIS 補助漢字に対応しました。ただし、fill-mode、正規表現は未対応 です。 b) ファイル名の内部での扱いを変更しました。かなり長いファイル名でも 問題なく扱えます。 c) delete-char、delete-backward-char をした後 Undo すると落ちるバ グを取りました。これは 1.4.2 で入れてしまったバグです。 d) 厳格な ANSI-C コンパイラで問題を起こす表記を変更しました。また echo.c 内の内部関数名を変更しました。(この関数名の変更により、 HP-UX で正常にコンパイルできない問題が解決しました) [UNIX 版] e) BSD 版と SystemV 版を統合し、GNU autoconf を使って configure ス クリプトを生成するようにしました。BSD 版と SystemV 版は未だ存在 しますが、1.5 正式版では削除する予定です。 f) termios を改善しました。いままでうまく動かなかったシステムでも 動く事が期待されます。 g) dired を改良しました。シンボリックリンクが正しく扱えるようにな り、ルートディレクトリを開く時に問題が起きなくなりました。 [UNIX, WIN32, MSDOS, Human68k 版] h) ファイル名補完時に、~ をホームディレクトリとして認識するように なりました。(Thanks to Sahf さん) ng-1.5beta1/docs/CHANGES.1_3100644 1750 1750 15120 7126003723 13774 0ustar amurausers# $Id: CHANGES.1_3,v 1.1.1.1 2000/06/27 01:48:03 amura Exp $ ============================================================================== CHANGES.doc for Ng (Micro Nemacs) 1.3 1991.01.25 吉田茂樹 (shige@iamas.ac.jp) 1.3Lまで (修正加筆) 2000.03.22 村松 篤 (amura@ma3.seikyou.ne.jp) ============================================================================== *註 これは佐々木 茂彦氏による unofficial patch ですが、非常によく使わ れているので、こちらに記述いたします。  Ng 1.3LのNg 1.3.1用のパッチです。次の点が改良されます。 [全版共通] a) 半角カナを処理できます。 半角カナを含んだファイルをロードしたりキーボードから入力しても ハングアップもしくはコアダンプしません。普通の漢字などと同様に 自由に編集することができます。漢字に対応していない機能は半角カナ も使用できません。 b) 編集文書に含まれる長い行をおりたたんで表示します。 画面の横幅を越える長さの行を編集する時Emacs風に行をおりたたんで 表示します。 次の行に継続している行は最後尾に'\'がつきます。全角文字がちょうど 行の最後付近にあると調整のため'\'がふたつ付くこともあります。 c) その他 ファイル読込み時の漢字コード自動判別の誤認率が上がりました。 特に半角カナを含むShift JISのファイルをEUCと誤認される確率が かなり高くなっています。各漢字コードの特性より抜本的解決は困難で す。 [MS-DOS 版、Human68k 版] d) 漢字ファイル名をサポートします。 ------------------------------------------------------------------------------ Ng 1.3 から Ng 1.3.1 では、以下の変更がされています。 [全版共通] a) コンパイラによってエラーになる書き方を修正した。 b) 低機能端末時のコンパイルに関する注意を追加した。 c) Buffer List バッファを (N)emacs に合わせて Read Only にした。 d) 各 "*XXXX*" バッファの内容を書き換えてしまうと、次にそのバッファ が表示される時に、"kill anyway?" と聞かれるのを修正した。 e) Read Only バッファで編集しようとする時に、ワーニングメッセージと 一緒にベルを鳴らすようにした。 [UNIX 版] f) コンパイル時の注意に関するドキュメントの記述を追加した。 g) alloca() に関する Makefile のマクロを追加した。 h) dired 時に、確実に /bin/ls を使うようにした。これは、System V + BSD という環境を持っているマシンでは、/bin/ls 以外の ls が存在し、 それによって正しく動作しない事があるからである。 i) System V リリース 2.X でコンパイルできるようにした。 [MS-DOS 版] j) コンパイル時の注意に関するドキュメントの記述を追加した。 k) デフォルトで J-3100 版を作るようになっていたのを、MS-DOS 版にした。 l) ファイル名補完候補一覧にパス名がつくのを修正した。 m) MS-C 用の linkfile を一部修正した。 n) termcap を一部修正した。 [Human68K 版] o) バックアップファイル名を "*.bak" にした。 p) 細かいバグフィックス。 ------------------------------------------------------------------------------ Ng 1.2 から Ng 1.3 への主な変更点は次の通りです。 [全版共通] a) C モードを追加し、".c", ".h" で終わっているファイルを読み込んだ時 に、自動的に C モードになるようにした。 b) fill-prefix 機能を追加した。 c) read-only バッファモードを追加した。 d) shell-command を追加した。 e) ファイル名などの補完で、補完可能候補を *Completions* バッファに表 示するようにした。 f) モードラインの漢字コードニーモニックの表示を Nemacs 3.3.2 に合わ せた。 g) Ng のバージョン、コンパイル時オプションを表示する -v, -c コマンド ラインオプション、ng-version コマンドを追加した。 h) find-file, 他、でディレクトリを指定した時に、自動的に dired を起 動するようにした。 i) Mg 2a のバグを直した。 ・デフォルトに存在しない prefix を使ったキーマップをしている時に、 apropos を実行すると core dump する。 ・insert-buffer 時にデフォルトバッファ名が正しく表示されない。 ・save-some-buffers した後モード行の ** が直らない事がある。 ・write-file 時にバッファ名が変わらない。 j) コンパイル時オプションを整理し、Makefile から config.h に移した。 k) 漢字コード変換ルーチンを関数からマクロに変更した。 [UNIX 版] l) Mg 2a のバグを直した。 ・dired の copy (c) 機能が正常に動作しない。 ・TIOCGWINSZ を持つ System V マシンで正常にコンパイルできない。 [MS-DOS 版] m) FEP 自動制御ライブラリを利用して、FEP の自動制御機能を追加した。 n) バックアップファイル名を、".bak" を拡張子に持つ物に変更した。 o) カレントドライブが "a:" の時に、"\file" と "a:\file" を同じファイ ルとして認識しないバグを修正した。 p) J-3100 版で、Ng 内でカーソルの形状を設定できるようにした。 q) MS-C 5.1 付属の make 用の makefile.msc を追加した。 r) MS-C 6.0, Turbo-C 1.5, Turbo-C++ でもコンパイルできるようにした。 s) termcap ルーチンを termlib/*.c から jstevie で使用されている termcap.c に変更した。 [Human68K 版] t) SHARP X68000 の Human68K 版を追加した。 ------------------------------------------------------------------------------ Ng 1.1 から Ng 1.2 への主な変更点は次の通りです。 [全版共通] a) ファイル名の入力をするときに、C-i (TAB) による補完機能を使えるよ うにした。 [MS-DOS 版] b) ドライブ名、ディレクトリ名、ファイル名を全て小文字で表示するよう に変更した。 c) 東芝 J-3100、NEC PC-9801 専用のバージョンを追加した。 d) J-3100, PC-9801 版で C-SPC による NUL の入力ができるようにした。 e) PC-9801 版の画面描画を高速にした。 f) 正規表現ルーチンを正常に動作するようにした。ただし、日本語は未対 応。 g) 最大の画面サイズを 80 文字× 25 行にした。 h) Turbo-C 2.0 でコンパイルできるようにした。 ------------------------------------------------------------------------------ Ng 1.0 から Ng 1.1 への主な変更点は次の通りです。 [全版共通] a) count-lines-page と count-lines-region コマンドを追加した。 b) デフォルトで bsmap-mode を使用できるようにした。 c) Mg 2a の仕様により、Nemacs (GNU emacs) の動作と異なっていたところ を、Nemacs (GNU emacs) の動作に近くなるように修正した。 ・引き数なしの set-fill-column で設定される値。 ・次行が空白行の場合の newline の動作。 d) Mg 2a のバグを直した。 ・バックアップファイルを作成する際、ファイルのモードを変更してし まう。 ・バッファが一つだけの時に kill-buffer を実行すると core dump す る場合がある。 ・初期設定ファイル中で "\^\\" が解釈できない。 [UNIX 版] e) SIGWINCH の処理を追加して、ウィンドウサイズの変更に自動的に対応す るようにした。 [MS-DOS 版] f) MS-DOS 版を追加した。使用コンパイラは MS-C 5.1。 ------------------------------------------------------------------------------ [UNIX 版] a) Mg 2a をベースに Nemacs 3.2.3 に合わせて日本語化した Ng を作成し た。 ng-1.5beta1/docs/CHANGES.1_4100644 1750 1750 26713 7205301565 14012 0ustar amurausers# $Id: CHANGES.1_4,v 1.7 2000/11/17 19:13:57 amura Exp $ ============================================================================== CHANGES.new for Ng (Nihongo micro Gnu emacs) 村松 篤 (amura@ma3.seikyou.ne.jp) ============================================================================== ************************************************************************** このファイルには、1.3L 以降の変更点を記載します。 Ng 1.3L までの変更履歴は CHANGES.doc を御覧ください。 ************************************************************************** ------------------------------------------------------------------------------ [全版共通] a) 大きなリージョンをカットした時に発生する Undo の bug を取りまし た。また、多少の高速化もしました。本質的な改良はありませんが、実 用上問題となる部分はほぼ無くなったと思います。 b) コンパイラによってはエラーとなる typo を直しました。 [WIN32 版] c) Tillanosoft さんの Ng for Win32 0.5版 を前面的にマージしました。 これにより、TtyView::PutLine() の bugfix、メニューバーの追加、コ マンドバーの追加 (WinCE のみ) 等が行われました。 [AMIGA 版] d) input.device の Open 処理の bug を修正しました。 ------------------------------------------------------------------------------ [全版共通] a) ライセンスが変更されました。詳しくは LICENSE を御覧ください。 b) c-mode の大きな bug を取りました。 c) 従来、ファイルに関連していないバッファを kill-buffer する際も、 kill しても良いか確認を行なっていましたが、GNU Emacs と同様に確認 なしで kill するようにしました (Tillanosoft(今井 透)さん / Ng for Win32 0.5版より) d) fill-paragraph が無限ループをひき起こしたり、改行で終らないバッ ファ末の段落では末尾の数文字を消してしまうなどの問題を修正しまし た。これらの問題は 10 年間もの長い間、バグのまま放っておかれてい たようです。 (Tillanosoft(今井 透)さん / Ng for Win32 0.5版より) [UNIX 版?] e) 不適切なマクロ定義により Cygwin 環境でファイルの取り扱いに問題が 発生していたのを修正しました。 [WIN32 版] f) ttyctrl.cpp 内の TtyView::PutLine() を 1.4beta5 以前の物に戻しま した。こちらの方が高速ですが、大きな文字がずれます。これは、 1.4beta6のコードが buggy であったための暫定的な処置です。 g) shell-command がまともに動くようになりました。また、Win9x,NTにお ける iconify-frame の動作がほかのアプリと同じになりました。 (Sahf Ivyfieldさんの patch) h) suspend-emacs の実装。実際にはサスペンドではなくシェルを呼び出し ます。 i) config.h で EMACS_STYLE_BACKUP を undef すると、バックアップファ イル名が Windows の流儀になります。これは VFAT を使っているシステ ムでは Emacs 流のバックアップファイル名では問題を起こすためです。 [MSDOS 版] j) Turbo C ダイレクトコンソール I/O を多少高速化しました。 [AMIGA 版] k) 復活しました。ただし再実装されたソースの都合上、アイコン化の挙 動、メニューの表示等が 1.4beta6 以前とは異なります。詳しくは README.Ami をご覧ください。 ------------------------------------------------------------------------------ [全版共通] a) 大きな領域の yank が速くなりました。これは undo 対応コードに対策 を施したためです。 [WIN32,MSDOS,Human68k 版] b) 漢字ファイル対応でやり残していた部分を修正しました。 [AMIGA 版] c) 一時的に配布を取り止めます。これは AMIGA 版のソースコード内に、 ソースコードに書かれた配布/使用条件と反して使われていたソースが 見付かったためです。AMIGA 版はこれらのソースの代わりとなるものを 作り終えたのち、配布を再開したいと思います。 ------------------------------------------------------------------------------ [全版共通] a) auto-fill mode での undo が正常に動作するようになりました。 b) その他細かい定数などの修正。 [UNIX 版] c) System V、4.4BSD 以前の BSD ででるコンパイルエラーを修正した。 d) オプション VTCURSOR が、入力コードが JIS 以外でも有効になります。 この結果、インクリメンタルサーチ時のカーソルキーの挙動がより自然 なものとなりました。(ただし、カーソルのキーコードは*ハードコード* されています) [Human68K 版] e) EMACS style の Backup での不具合を修正。 f) XF1、XF2 を META key として認識するように改良。 [WIN32 版] g) IME で漢字を入力する時、インラインで変換するようになった。 h) TTY 周りの改良。標準フォント以外でもカーソル位置がずれなくなっ た。 i) Drag & Drop のサポート。Ng のウインドウにファイルを Drag & Drop することで、ファイルを開く事が出来ます。 (Thanks to Sahf Ivyfieldさん) ------------------------------------------------------------------------------ [全版共通] a) beta4 における SKG の大きな不具合を直しました。この不具合は undo を実装する過程で混入しました。 [UNIX 版] b) ジョブコントロール可否のチェックを、beta2 以前の方法に戻しました。 Ng がシェル以外から起動されたときに、必ずジョブコントロール不可 と判断してしまうためです。(コード自体は残っていますが無効にされ ています) ------------------------------------------------------------------------------ [全版共通] a) undo をサポートしました。ただし、{up,down}case-* の undo はできま せん。(この制限は Ng の内部構造に起因します) 完全にテストされたわ けではありません (特にメモリが足りない時の挙動が未確認です) の で、安定していないと困る方は config.h のマクロ UNDO を undef して ください。 (もっとも、私の環境では安定して動作します) b) キーボードマクロで、SKG を経由して入力した文字が記録されない不具合 を修正。 c) モードラインが消える不具合の修正。 [UNIX 版] d) {Free,Net,Open}BSD でコンパイルするとき、警告がでないようにソース を変更。(BSD/OS は未確認) (Thanks to 北川 拓郎さん) e) キーボードマクロで、CANNA を経由して入力した文字が記録されない不具 合を修正。 [WIN32 版] f) ディレクトリを扱う時にカレントドライブを考慮するように改良。 ------------------------------------------------------------------------------ [全版共通] a) バッファのパーセント表示まわりの不具合を修正。 b) vtputc 関数での致命的な不具合を修正。(Ng 1.4 でエンバグ) c) その他、細かな修正。 [UNIX 版] d) System V で画面 resize の直後に suspend すると、画面の更新が止まる 不具合を修正。 e) Linux の Distribution によっては、画面 resize に追随しない不具合を 修正。 f) ジョブコントロール可否のチェックを、POSIX に沿ったものに変更。 (Thanks to 若林さん) g) その他、System V 版で細かな修正。 [MSDOS 版] h) 前回の m) の修正でコンパイル出来なくなっていたのを修正。 [Human68K 版] i) 再びコンパイル出来るようになった。 j) ASK68k の理不尽な仕様に対応。 [Win32 版] k) Borland C++ 5.5 でコンパイル出来るようにした。(木原 英人さんの patch) 他の Borland C++、C-Builder でのコンパイルは未確認です。 ------------------------------------------------------------------------------ [全版共通] a) Query Replace のキー操作が GNU Emacs 19 以降に近くなりました。 1.3 以前と同様にしたければ config.h のマクロ EMACS_QUERY_KEYS を 無効にしてください。(新保さんからの patch) b) compile、next-error コマンドの追加。ただし、next-error は GNU Emacs そっくりというわけではありません。(小柳 洋一さんの patch を 元に改変) c) c-indent-region コマンドの追加。(小柳 洋一さんの patch) d) ファイルに結び付いていないバッファのカレントディレクトリとして、 起動時のディレクトリを保持するようになりました。 e) load、set-skg-{roman,kanji}-dictionary コマンドでファイル名補完が 効くようにしました。 f) 空のバッファで newline した時の bug を fix しました。これは、1.3 にもあった bug で、おそらく mg 2a に由来します。 g) VARIABLE_TAB 周りの bugfix。beta1 よりまともに動くはずです。 h) 表面化しなかったが、問題を起こすかも知れない表現の変更。具体的には is.. 関数を使わなくなりました。 i) コンパイルする時、問題となった表記、typo を fix。 [UNIX 版] j) ミニバッファで CANNA が使えるようになりました。これはテスト実装 で、MINIBUF_EDIT が有効になっている時のみ使用できます。また、イ ンクリメンタルサーチ中は使えません。C-\\、C-O でトグルです。(モー ドラインは変化*しません*) k) system() の返り値の評価法の変更 (十代田 浩児さんの patch) [MSDOS 版] l) Turbo C ダイレクトコンソール I/O を正式サポートしました。(コード 自体は beta1 からありましたが、buggy でした) これを使うと、DOS ジェネリックではなくなるので注意してください。 (コンパイルに使用する Turbo/Borland C/C++ によって、動作する機種 が変化します) m) 30bios/VText などの多行環境のために最大画面サイズを変更した。 (十代田 浩児さんの patch) ------------------------------------------------------------------------------ 名称が 1.4 となっていますが、吉田氏はいっさい関わっていません。 amuraがいろいろなパッチを独自にまとめて改良したものです。 以降、文面がくどくなるので人物の敬称を略させて頂きます。 * 2000/09/31 追記 i) j) を書き忘れ/間違えていました。Tillanosoft さん、ごめんさない。 [全版共通] a) C モードを改良した。今では、c-argdecl-indent 以外の定義されてい る変数全てが動作する。 b) バッファごとに表示タブ幅を変更できるようになった。 c) Simple Kanji Generator の追加。Ng 単体で日本語が入力できる。 d) 指定行へのジャンプするコマンドラインオプションの追加。 e) GNU Emacs のように、バッファごとにカレントディレクトリを保持する ようになった。 f) Buffer-menu モードをもっと本物っぽくした。 g) dired 周りの Bugfix h) find-alternate-file、copy-buffer-as-kill などの便利なコマンドの 追加。 i) 起動直後のファンクションの実行をするコマンドラインオプションの追 加。 j) 表示している部分が全体の何%ぐらいの位置にあたるかをモードラインに 表示するようにした。 k) インクリメンタルサーチ中の C-w を追加した。 l) インクリメンタルサーチでも set-case-fold-search の設定が有効となる ようにした。 m) goto-matching-fence、zap-to-char の追加 n) C モードでの中括弧のブリンクの追加。 o) C-x ` (next-error) の代用品 jump-to-error の追加。 p) minibuffer で GNU Emacs のように編集が出来る。 q) 設定ファイルを変更できるコマンドラインオプション -I の追加 r) Ng の動作を変更する next-line-add-newlines、use-c-mode の追加。 [UNIX版] s) 多くの UNIX で dired がまともに動作するようにした。 t) 入力コードを JIS にしたときでも、ファンクションキーが使える。 また、テンキーをアプリケーションモードに切り替えるようになった。 u) spawn.c で問題となる記述を変更。 v) CANNA サーバーと直接お話ができるようにした。 [MS-DOS 版] w) FEPCTRL ライブラリを最新版のバージョン 1.5 に変更。 x) J3100 版を IBMPC 版と名称変更した。 y) PC9801 版 で細かい変更。 [WIN32 版] z) Win32 版を追加した。 Win32 に準拠したOS (Windows 95/98, Windows NT 4.0,Windows CE) で動作します。 この版は伊藤 栄一郎が Ng 1.3L を英語版 WinCE に移植したものを、 Tillanosoft(今井 透)が日本語版 Win32 汎用に書き直したものです。 ただし、現状では IME 経由ではうまく日本語が入力できない場合があ ります。 [AMIGA 版] A) AMIGA 版を追加した。 Classic AMIGA もしくは UAE で動作します。 この版は H.Ohokubo が Ng 1.3.1 を AMIGA に移植したものを、小西 宏和、amura(村松 篤)が改良したものです。 ng-1.5beta1/docs/CHANGES.Ami100644 1750 1750 3722 7126003723 14105 0ustar amurausers# $Id: CHANGES.Ami,v 1.1.1.1 2000/06/27 01:48:03 amura Exp $ Kg 4.2.0 (KANgee) --- Alternative 日本語 Micro Emacs(Ng) with GUI Remote BOX, K A N G E E "Kanji Alterntive Nihongo Gnus Emacs-like Editor." Amiga用 日本語エディタ "カン・ジィ"("ケージー"とも呼ぶ) です。 基本的にNgといっしょですが、以下のような不届きな拡張を施してあります。 (1) 簡易日本語入力変換(SKG)を組込んでいる。(みんな使わないでしょう^^;) (2) ASL Requesterによるファイル Read/Write/Insert をサポート。 (3) Intuition Window によるGUI操作(Remote Box)を組込んでいる。 ここでは、Kg4.2から組込んだ(3)を説明します。これは、Emacs系のコマンドが なかなか習得できない方のためのお手軽リモコンGUIウィンドゥです。 MENU で "ASL req."の Remote Box をマウスで選択すると、 画面中央ちょい右上に Kg Remote Box というタイトルのウィンドウが 現われます。だいたい下の図のような感じのものです。 +---------------------------------------+ | goto: [______________] [ SetFont ] | | [ Top ][ Up ][ PgUp ] [SplitWindow] | | [|<][<<][<][>][>>][>|] [NextWindow ] | | [Bottom][Down][PgDown] [CloseWindow] | | | | [Redraw][Show][BORDER] [Done] | +---------------------------------------+ 各ガジェットの説明は不要だと思います。クリックしてみて下されば判ると 思います。RemoteBox からぬけるには[Done]をクリックしてください。 [SetFont]に関しては、説明が必要です。[Set Font]をすると、ボーダーが消 えてしまうと思います。そうしたら、[BORDER]というボタンを何度かクリック してみてください。そうすれば、ボーダーが表示されるようになります。 何かわかったことが ありましたら、連絡してください。 小 西 宏 和 (TGK0186) ------------------------ Commodore Amiga 4000/040 USER, JAC02372 @ niftyserve.or.jp "Horse 'N' Deer Co.", JAPAN Amiga Community, TAKAI. ng-1.5beta1/docs/CHANGES.W32100644 1750 1750 25261 7126003723 13774 0ustar amurausers# $Id: CHANGES.W32,v 1.1.1.1 2000/06/27 01:48:03 amura Exp $ Ng for Win32 変更履歴 by Tillanosoft 0.4 1999.6.7 β4版 0.3 版からの変更点として以下があります。 1. Windows 95/98 サポート Windows 95/98 上で動作する版も公開します。このバイナリ(Ng.exe)は Windows NT でも動作します。これにともない、Windows NT でしか動かな いもののサポートは取りやめます。 2. Buffer Menu モードのサポート C-x C-b(list-buffers)で表示されるバッファ一覧は fundamental モード で表示されており、そのバッファ一覧上でのバッファの選択や削除はサポー トされていませんでした。0.4 版では、GNU Emacs で見られる Buffer Menu モードのうち、中心となる機能をサポートしました。 具体的には SUPDOC.N32.txt をご参照ください。 3. list-buffers での半角カタカナバッファ名の乱れの修正 C-x C-b(list-buffers)で表示されるバッファ一覧に半角カタカナのバッファ 名のものが含まれると表示が乱れていたのを修正しました。 4. NT 版でのコマンドライン引数の不具合の解消 NT 版でコマンドラインh引数を受け付けないという問題がありましたが、 これを解消いたしました。 5. copy-buffer-as-kill の追加 バッファの内容すべてを kill buffer にコピーするコマンド copy-buffer-as-kill を追加しました。なお、copy-buffer-as-kill は Ng 独自のコマンドであり、Windows のカットバッファを介して他のアプリケー ションにバッファの内容を簡単に渡すことを目的に実装しました。 0.3 1999.5.20 β3版 0.2 版からの変更点として以下があります。 1. コマンドラインでの日本語ファイル名のあつかいの修正 コマンドラインで日本語のファイル名を与えると、そのファイルがうまく 開けない問題がありましたが、これを修正しました。 2. Windows NT 版対応 Windows NT 上で動作する版も公開します。このバイナリ(Ng.exe)は残念な がら Windows 95/98では動作しません。 3. Font 指定機能 (Windows NT 版のみ) M-x configure 内にフォントの指定機能を入れました。この機能が使える のは今のところ Windows NT 版のみです。 4. find-alternate-file のサポート find-alternate-file をサポートしました。find-alternate-file は間違っ て目的のファイルと異なったファイルを開いてしまったときなどに、別の ファイルを同じバッファで読み込みなおすためのコマンドです。通常はC-x C-v にマップされています。 5. dired-flag-backup-files のサポート dired-flag-backup-files をサポートしました。dired-flag-backup-files は Ng が作成したバックアップファイル(ファイル名の末尾が「~」のもの) に対して削除用の印を付けるコマンドです。通常「~」キーにマップされて います。 6. 画面サイズの変更に対応 (CE 2.0 以降) Windows CE 2.0 以降ではタスクバーを自動的に隠す設定を選択することが できますが、自動的に隠すか隠さないかを Ng 起動後に変更した場合に Ng の画面サイズも自動的に変更されるようにしました。 7. find-file からの dired 起動についての修正 find-file でフォルダを開こうとすると dired が起動するようになってい ますが、フォルダ名の最後に「\」が含まれると dired が起動せず、ファ イルが開いたときのような振る舞いをしていました。これを修正し、かな らず dired が起動するようにしました。 8. 空フォルダの dired の修正その 2 dired の対象としてファイルがまったく含まれないフォルダを与えると dired が起動しないという問題があり、0.2 版で修正しましたが、0.2 で 修正されたのは本体メモリ上に存在する空フォルダに対してのみで、フラッ シュカード上の空フォルダはあいかわらず dired できていませんでした。 これを修正しました。 9. その他細かい問題の修正 その他、ソフトウェア記述上の効率関連の修正等を行っています。 0.2 1999.4.21 β2版 configure 項目の追加など 0.1 版からの変更点でもっともご注意いただきたいのは、ctrlmap-mode が ng.ini の記述からなくなったことです。代わりに 0.2 版からは、 configure で設定する項目として「コントロールキーの英数キーへの割り当 て」があります。ng.ini に対する ctrlmap-mode の記述は 0.2 版からはエ ラーになりますのでご注意ください。 本件を含めて 0.1 版からの変更点として以下があります。 1. ctrlmap-mode の削除 同様の設定は M-x configure によって呼び出されるプロパティシートにて 行うようになリました。これにより ctrlmap-mode の ng.ini への記述は エラーとなりますのでご注意ください。 2. configure のプロパティシート化 0.1 版では M-x configure を実行した場合出て来るウィンドウは単なるダ イアログボックスでしたが、0.2 版からは複数のシートを持つプロパティ シートとなります。 3. ビープ音(configure) ビープ音が出るようにしました。ビープ音として任意のサウンドを割り当 てることが可能です。ビープ音の割り当ては M-x configure にて行います。 4. ファイル名の強制小文字変換の廃止 Ng for Win32 ver 0.1 までは DOS 版の Ng の流れをくみ、ファイル名は すべて小文字で取り扱っておりました。しかし、実際には Windows CE は ファイル名をつけるときに大文字小文字を区別するためこの処理を行わな いようにしました。 (小文字化の処理は、たとえば、EmLog および EmTerm にて記事を投稿する ときに障害になっていました。) 5. コマンドラインオプション -f の追加 コマンドラインオプションとして -f オプションを追加しました。-f オプ ションは Ng の起動直後に指定されたコマンドを実行するためのものです。 たとえば -f yank を指定することにより Ng 起動後、カットバッファに存 在するテキストを Ng に貼り付けます。 (このオプションは実は EmLog で -f yank したいがために追加しました。) 6. dired における 2000 年問題対応 dired の画面でファイルの更新時刻の年の部分が下2桁であらわされていま したが、これを4桁表示に修正しました。 7. 空フォルダの dired ファイルがまったく存在しないフォルダに対して dired ができないように なっていましたが、これをできるようにしました。 8. dired まわりのメモリリーク、リソースリークの修正 dired まわりに軽微なメモリリークおよびリソースリークがあったのを修 正しました。 9. 無効だった一部コントロールキーの有効化 C-^, C-_, C-@ が入力できませんでしたが、これらのコントロールキーを 入力できるようにしました。 10. バージョン表記の修正 v0.1 版で ng-version 等でのバージョン表記を変更していましたが、表記 が二重になるなど、おかしくなっていました。これを直しました。 0.1 1999.4.15 日本語版 Windows CE 対応β1版 このバージョンは伊藤栄一郎氏の Ng for WinCE 0.12 をベースにしていま す。Ng for WinCE 0.12 からの変更点は以下のとおりです。 1. 日本語版 Windows CE に対応 kctrl.dll も必要なくなっています。 2. IME制御 日本語入力モードのときに C-x o のようなキーストロークを入力しても 「o」が「お」になったりしません(set-fep-control)。 3. IMEのオンオフ機能のEmacs Lispコマンドへの割り当て これにより 任意のキーでIMEのオンオフができます。たとえば Canna に見 られるように C-o に割り当てることも可能です(toggle-fep)。 4. 英数キーをコントロールキーとして取り扱える 多少制限がありますが、 英数キーをコントロールキーとして取り扱えます (ctrlmap-mode)。 5. バッファごとのカレントディレクトリ管理 Ng はカレントディレクトリとして、全バッファ共通の1つのディレクトリ を参照していました。Ng for Win32 では GNU Emacs で見られるように、 バッファごとに別々にカレントディレクトリを管理するようにしました。 6. find-file 等でカレントディレクトリの表示 find-file 等でファイルを指定するときは、カレントディレクトリのファ イルをパスなしで指定するか、フルパスをすべて入力する必要がありまし たが、GNU Emacs が行っているように、カレントディレクトリをデフォル トパスとして表示するようにしました。対象となる機能は以下です。 cd, find-file, find-file-other-window, find-file-readonly, write-file, insert-file, dired, dired-other-window, dired-copy-file, dired-rename-file 7. ng.iniファイルのパス指定 ng.ini を任意のフォルダに置いておけるようにしました(configure)。 8. ペンによるカーソル移動に対応 ペン(スタイラス)で画面をタップすることにより編集対象バッファを変更 したり(複数バッファが同時に表示されている場合)、カーソルを移動した りできるようになりました。 9. 表示している部分の全体に対する位置表示 表示している部分が全体の何%ぐらいの位置にあたるかを モードラインに 表示するようにしました。 10. dired-do-shell-command の実装 dired モードからプログラムを起動できるようにしました。たとえば、 dired で .htm ファイル上にカーソルがある時に dired-do-shell-command を実行すると Internet Explorer が起動しそのファイルが表示されます。 11. dired-view-file の実装 dired モードで、対象ファイル上で 「v」を打つことで、読み込み専用モー ドでファイルを開けるようにしました。 12. dired モードでは IME をオフにするように変更 dired モードに入る直前に IME がオンだった場合、dired を実行したとき にオフ になるようにしました。これにより dired 中に「f」を打鍵したと き等にIMEに 入力がとられるのを防ぐことができます。(よそのバッファに 行ってそこで日本語オンにして dired バッファに戻るとオンのままなので、 実はちょっといまいち)。 13. バックアップファイル機能 伊藤氏の移植ではバックアップファイル機能が使えないようになっていま したが、これを使えるようにしました。なお、 バックアップファイルは末 尾に「~」がついたものになります。 バックアップファイルを残さないよ うにも設定できます。 14. Home, End キーの割り当て変更 それぞれバッファ頭、バッファ末へカーソルが移動するようになっていま したが、最近の Windows のエディタのしきたりにしたがって、行頭行末へ 移動するように割り当て直しました。 15. Del キーの認識 Del キー(Shift + BS)を認識するようにしました。 16. M-Spc の割り当て変更 伊藤氏により M-Spc が、かな漢字変換機能のオンオフに 割り当てられて いましたが、もとの just-one-space に割り当てを戻しました。 17. ミニバッファメッセージの消去 ミニバッファに書かれたメッセージがなかなか消えなかったのですが、次 のキー入力で消えるようにしました。 18. kill-region の問題の修正 kill-region が Windows のクリップボードを使うように伊藤氏によりプロ グラムされていますが、大きな領域を対象にするとフリーズするような感 じになっていました。これを直しました。 19. ミニバッファへの漢字表示不正問題の修正 ミニバッファに漢字が正しく表示されない問題を修正しました。 ファイル 名が漢字のバッファを kill-buffer したときや、 インクリメンタルサー チで漢字文字列をサーチしたときに、ミニバッファへの表示が正しく行わ れていませんでした。 20. suspend-emacs の実装 suspend-emacs が何もしないようになっていましたが、これを実装しまし た。suspend-emacs を実行すると Ng for Win32 の画面がバックグラウン ド側に送られます。 21. Ng 1.3.1 の修正の取り込み Ng 1.3.1 で改善された以下の点が Ng 1.3L で元に戻されていたので、そ の修正を再度適用しました。 (1) Buffer List バッファを Emacs に合わせて Read Only にした。 (2) 各 "*XXXX*" バッファの内容を書き換えてしまうと、次にそのバッファ が表示される時に、"kill anyway?" と聞かれるのを修正した。 (3) Read Only バッファで編集しようとする時に、ワーニングメッセージと 一緒にベルを鳴らすようにした。 ただし、(3) は実際には Ng for Win32 の 0.1 版ではベル自身がまだ動作 しません。 22. コンパイル時の Warning の除去 コンパイル時に 500 以上にものぼる Warning が発生していましたがこれ を修正しました。初期化を行ってない変数の使用など、比較的問題が大き いものもありました。 23. アイコンを変更しました。 以上 ng-1.5beta1/docs/Ng.FAQ100644 1750 1750 13073 7304520252 13321 0ustar amurausers# $Id: Ng.FAQ,v 1.4 2001/05/28 19:02:02 amura Exp $ Ng Frequently Asking Questions and answers Q : Ngとはなんですか。 A : Ngは正式名称を「Micro Nemacs」といいます。名前の通り、GNU Nemacs に似たコンパクトなスクリーンエディタです。もちろん、日本語に対応 しています。 Q : Ngは誰が作りましたか? A : Ngの開発には、非常に多くの人が関わっています。 microEmacs * Dave ConroyがmicroEmacs v30を作りました。 Mg (formally MicroGnuEmacs) * Dave BrowerがmicroEmacs v30を元にmg 1a/bを作りました。 * Bob Larson、Mic Kaczmarczik、Mike Meyer、Sandra Loosemore、 Michael、Portuesi、Stephen Walton、Marion Hakansonたちがmg 2a にバージョンアップさせました。 Ng (formally MicroNemacs or 日本語MicroGnuEmacs) * 吉田茂樹がmg 2aを日本語化・機能追加し、Ngとしました。また MS-DOSへ移植しました。 * 高野和博がPC-9801版、C モード、FEP 自動制御機能を作りました。 * 白橋明弘がPC-9801高速版を作り、Turbo-C に対応させました。 * 前田薫がファイル名補完機能、shell-command 機能を付け、細かな バグ修正を行いました。 * 太田純がtermcapライブラリ、FEP 自動制御ライブラリを作り、 Turbo-C 1.5/++ に対応させました。 * 澤柳喜郎がX68000に移植し、新しい版の補完機能を付け加えました。 * H.OhkuboがAMIGAに移植(mg 2bからの再移植)をしました。 * 小西宏和が、AMIGA版を改良し、SKGを付け加えました。 * 伊藤栄一郎がWinCE英語版に移植しました。 * 今井透がWin32日本語版に移植し、いくつかのバグを解消しました。 また、dir周りを改良しました。 * 黒木玄がキーボード周りを改良しました。 * 別所博之がzap-to-char、jump-errorなど便利な機能を付け足しま した。 * 村松篤が、undo機能を付け、C モードを改良し、いくつかの機能を 付け足しました。 また、Ng 1.4をまとめました。 現在の保守は村松篤が行っています。 Q : Ngはどのようなコンピューターで使えますか。 A : 現在 Ng がサポートしているのは * AmigaOS (Classic AMIGA / UnixAmigaEmulator) * Human 68k (X680x0 / 零式?) * MS-DOS (PC-9801, IBM PC, J-3100, etc.) * Unix (SunOS, *BSD, Mach, Solaris, IRIX, HP-UX, Linux, etc.) * Win32 (Win95/98/Me, WinNT/2000, WinCE) です。また、元となったmg 2aでは AtariST, Primos, VMS, OS-9/68k もサポートしていたので、これらの機種には比較的楽に移植できるで しょう。(でも AtariST, Primos は日本語が表示できません) Q : Ng を友人にコピーして構いませんか。 A : はい、どんどんコピーしてください。 現在 Ng のソースコードの大部分には BSD-style license が適用され ています。詳しくは LICENSE をご覧ください。 ただし、re_search.c、regex_[ej].[ch]、sys/win32 以下のファイル には GNU GPL が適用されていますので注意してください。何らかの事 情で GPL に従えないときは、regex_[ej].[ch] と re_search.c を空 のファイルと置き換え、sys/win32 以下を削除して配布、使用してく ださい。 Q : なんでこんなへんてこなキーアサインなの? A : コンピュータの世界では標準である GNU Emacs に準拠しています。 たぶん、今まで使っていたエディタが変だったのでしょう ;-( Q : SKG とは何ですか A : Simple Kanji Generator function の略です。Ng 専用の簡素な日本語 入力で、NEmacs/mule で使われる SKK を参考に開発されました。日本 語が簡単に入力できない環境では重宝するでしょう。 SKG は小西宏和さんによって開発され、KANgee (Amiga 版 Ng を元に 拡張されたエディタ) に付け加えられました。 Q : MS-DOS でコンパイルしようとすると Link 時にエラーが出ます。 A : MS-DOS ではソースコードが大きすぎてコンパイルできない事がありま す。特に Borland の処理系ではデータセグメントが全部で64Kバイト に制限されているのため比較的エラーが出やすいです。 使わない機能をいくつか削ってください。 * 普段 FEP を使っているのなら、SKG はいらないでしょう。 * あなたが C でプログラムを作らないのならば、C モードはいらない でしょう。 * 正規表現をあまり使わなければ、はずしてみましょう。または日本 語非対応の正規表現機能を使いましょう。 * Borland の処理系を使っているのならば、TCCONIO を使った方がコー ドが小さくなります。(termcap.c を使わなくなるためです) ただ し、この時は MS-DOS 汎用ではなくなるので注意しましょう。 * 最期の手段として、ttydef.h のマクロ GOSLING を undef すれば、 少しコードが小さくなります。(ただし、表示が少し遅くなります) Q : 1.3/1.3L よりも置換やカット&ペーストが遅くなったのですが... A : これは Undo をサポートしたためです。現在の Ng の Undo は、効率よ りも実装の容易さを優先しています。そのため、メモリ効率、速度とも 非常に悪いです。もし、今の Ng のメモリ効率、実行速度の悪さに我慢 できないのならば、Undo を使わない設定にして再コンパイルしてくだ さい。(そうすれば、少なくとも Ng 1.3L と同じメモリ消費量、速度に なります) Q : Windows 9x で使うと、セーブしたファイルが無くなることがあります。 A : たぶん、実際には無くなっていません。バックアップファイル (末尾に ~ がついているファイル) を覗いてみてください。そのファイルが最期 にセーブしたものです。 この奇妙な挙動は VFAT ファイルシステムのせいです。VFAT では hogehoge~ というファイルが hogehoge という名前でオープンできてし まうのです X-< Win9x で使用する時は EMACS_BACKUP_STYLE を undef して使う方が良い でしょう。 Q : xxx という機能はなぜ無いのですか。 A : 開発者が使わない、もしくは実装が面倒だからでしょう。要望が多ければ 実装されるかもしれません。最も確実に機能を追加させる方法は、Patch を作って開発者まで送ることです ;-) ただし Ng は micro であることに主眼をおいているので、次のような 物は永遠に実装しないつもりです。 * Emacs Lisp (Mock Lisp 程度なら実装される可能性はあります) * XEmacs の様な Graphics Support Q : このファイルにある質問は、本当によく聞かれますか。 A : もちろん、このような質問を実際に受けたことはほとんどありません。FAQ とはそういうものらしいです 8-) ng-1.5beta1/docs/Ng.doc100644 1750 1750 65737 7641664631 13513 0ustar amurausers# $Id: Ng.doc,v 1.5.2.2 2003/03/30 22:03:05 amura Exp $ ============================================================================== Ng.doc for Ng (Micro Nemacs) 1.3 1991.01.25 吉田茂樹 (shige@iamas.ac.jp) 1.5 (修正加筆) 2003.04.01 村松 篤 (amura@tomato.sakura.ne.jp) ============================================================================== 1. Ng について 2. インストール 3. 日本語文字コード 3.1. 基本項目 3.2. 新規バッファ作成 3.3. ファイル入出力 3.4. キーボード入力 3.5. 画面表示 4. Ng の日本語機能 4.1. 基本項目 4.2. 単語 4.3. 行詰め 4.4. 上書き 5. Ng のその他の機能 5.1. バージョン表示 5.2. C モード 6. カスタマイズ 7. Nemacs との比較 8. バグ、その他 ------------------------------------------------------------------------------ 1. Ng について Ng (Micro Nemacs) は、Mg (MicroGnuEmacs) をベースにした日本語エディタで、 Nemacs (日本語 GNU emacs) に似た操作感を実現しています。 プログラム名の "Ng" は、"Nihongo Mg" または "Nemacs like Mg" の略ですが、 正式名称は "Micro Nemacs" とします。(Ng は "No Good" の略ではありません :-) 最新の Ng のバージョンは Ng 1.5 で、これは Mg 2a をベースにしていて、 Nemacs 3.3.2 に準拠しています。 Ng は Nemacs 同様以下の特徴を持っています。 1) ASCII 文字列と日本語 (かなや漢字など) 文字列が混じった文書を作成し編 集できます。また、JIS 1 バイトカタカナの使用も可能となっています。 2) ファイル入出力、画面表示、キーボード入力のそれぞれに、独立した日本語 コード体系を設定することができます。使用できるコード体系は、JIS、シフ ト JIS、EUC の 3 つです。 Ng 1.5 は BSD 系の UNIX と System V 系の UNIX および MS-DOS, SHARP X68000 上の Human68k, Microsoft Win32 (Windows CE, Windowns 95/98/NT4.0/2000), Commodore AMIGA 上の AmigaOS で 利用できます。それ以外の OS では利用できません。 なお、Ng 1.5 には Mg 2a で配布されたファイルのうち、Ng 1.5 が利用できる OS でのコンパイルに必要なファイルだけが含まれています。Mg 2a で配布され たオリジナルファイルのうち、Ng 1.5 でサポートしていない atari, osk, vms 用のファイルが必要な方は、別途入手して下さい。 2. インストール 基本的な make の方法は README.Ng の "Make & Install" を見て下さい。 Ng で日本語を扱うためには、コンパイル時に KANJI オプションをつけてコンパ イルしないといけません。また、禁則処理を行うためには同じく KINSOKU オプ ションをつけてコンパイルする必要があります。デフォルトでは KANJI および、 KINSOKU の両方をつけてコンパイルするようになっています。 漢字コードの初期値は、kinit.h で設定されています。必要に応じて変更して下 さい。デフォルトでは、以下のようになっています。(各内部変数の意味は 3. 以降の説明を参照して下さい) Ng 1.4 から fileio 時のエスケープシーケンスのデフォルトが変更されました。 (でも普段使う分には意識する必要はありません) 変数 AMIGA/UNIX MS-DOS/Win32/Human68k ------------------------------------------------------------------- default-kanji-fileio-code: NIL NIL kanji-expected-code: T T kanji-input-code: EUC SJIS kanji-display-code: EUC SJIS to-kanji-fileio: 'B' to-kanji-display: '@' to-ascii-fileio: 'B' to-ascii-display: 'J' to-kana-fileio: '7' to-kana-display: '7' 3. 日本語文字コード 3.1. 基本項目 Ng 1.5 では、JIS、シフト JIS、EUC の 3 つの日本語コード体系を扱うことが できますが、プログラム (バッファ) 内部では全て EUC で取扱いを行い、必要 に応じてコード変換を行っています。 また、ファイル入出力、画面表示、キーボード入力のそれぞれについて、独立に 日本語コードを設定することができます。 なお、今後日本語コードのことを、漢字コードまたは単にコードと呼ぶこともあ ります。 バッファ漢字コード: Ng 1.5 がバッファの内部コードとして使用する漢字コード。実際 には EUC を使用している。 ファイル漢字コード: ディスク上のファイルに格納されている漢字コード。 キーボード漢字コード: キーボードからの入力コードとして予期する漢字コード。 画面漢字コード: バッファの文字列を端末に表示する際の漢字コード。 それぞれの漢字コードが現在どのように設定されているかは、モードラインの "-EE" の表示で知ることができます。"-EE" は左から「そのバッファのファイル 漢字コード (kanji-fileio-code)」、「キーボード漢字コード (kanji-input-code)」、「画面漢字コード (kanji-display-code)」を表します。 -----Ng: *scratch* (-EE:fundamental)--All----------- ||| バッファのファイル漢字コード -----+|| キーボード漢字コード --------------+| 画面漢字コード ---------------------+ 「ファイル漢字コード」は各バッファごとに異なった設定ができますが、「キー ボード漢字コード」と「画面漢字コード」はどのバッファでも同じものになりま す。 "-EE"が表す記号の意味は以下の通りです。 - 未定義。漢字コードが特定されていない。(ファイル漢字コードのみ) N 無変換。コード変換を行わないで、入出力を行う。 S シフト JIS コード。 J JIS コード。 E EUC。 Ng 1.5 が保持している漢字コードに関する値には、上記の 3 つを含めて以下の ものがあります。これらは kanji-fileio-code 以外、いずれも全てのバッファ で共通の値を持っています。 これらの値を確認するには、list-kanji-codes-briefly (C-x C-k c) コマンド か、list-kanji-codes (C-x C-k C) コマンドを実行して下さい。 <<内部変数>> default-kanji-fileio-code: 新しく作られるバッファのファイル漢字コード。 kanji-expected-code: ファイル入力時に予期する漢字コード。 kanji-fileio-code: ファイル入出力時に使用される漢字コード。ただし、ファイル入力 時には kanji-expected-code の方が優先される。 kanji-input-code: キーボードからの入力時に予期する漢字コード。 kanji-display-code: 画面表示時に使用される漢字コード。 to-kanji-fileio: ファイル出力時の漢字選択エスケープシークエンスの最後の文字。 to-ascii-fileio: ファイル出力時の ASCII 選択エスケープシークエンスの最後の文 字。 to-kana-fileio: ファイル出力時の 1byte カナ文字選択エスケープシークエンスの 方法。 to-kanji-display: 画面出力時の漢字選択エスケープシークエンスの最後の文字。 to-ascii-display: 画面出力時の ASCII 選択エスケープシークエンスの最後の文字。 to-kana-display: 画面出力時の 1byte カナ文字選択エスケープシークエンスの方法。 <<コマンド>> list-kanji-codes-briefly: そのバッファの現在の漢字コードに関する値をミニバッファに表示 する。デフォルトでは C-x C-k c にバインドされている。 list-kanji-codes: そのバッファの現在の漢字コードに関する値を *Kanji Codes* バッ ファに表示する。デフォルトでは C-x C-k C にバインドされてい る。 3.2. 新規バッファ作成 新しくバッファが作成されるときには、defauto-kanji-fileio-code、 kanji-input-code、kanji-display-code の値がそのバッファの値として設定さ れます。 <<内部変数>> default-kanji-fileio-code: 新しく作られるバッファのファイル漢字コード。 kanji-input-code: キーボードからの入力時に予期する漢字コード。 kanji-display-code: 画面表示時に使用される漢字コード。 <<コマンド>> set-default-fileio-code: default-kanji-fileio-code を設定する。以下の値を指定できる。 nil / NIL 未設定 0 / noconv / NOCONV 無変換 1 / shift-jis / SHIFT-JIS シフト JIS コード 2 / jis / JIS JIS コード 3 / euc / EUC EUC 3.3. ファイル入出力 ファイル入出力時の漢字コードの扱いは、入力と出力では少し異なっています。 ファイルからの入力時には、kanji-expected-code と kanji-fileio-code を参 照して、漢字コードの特定と変換が行われます。また、ファイルへの出力時には kanji-fileio-code のみを参照して漢字コードの変換が行われます。 ファイル入力時の漢字コードの指定は以下のようになります。 [kanji-expected-code] NIL T No-conv S-JIS JIS EUC [kanji-fileio-code] - (NIL) File File Noconv S-JIS JIS EUC N (No-conversion) Noconv File Noconv S-JIS JIS EUC S (Shift-JIS) S-JIS File Noconv S-JIS JIS EUC J (JIS) JIS File Noconv S-JIS JIS EUC E (EUC) EUC File Noconv S-JIS JIS EUC 凡例 File ファイル中のコードを調べて判定する。 Noconv 無変換で読み込む。 S-JIS シフト JIS コードとして読み込む。 JIS JIS コードとして読み込む。 EUC EUC として読み込む。 ファイル入力時に読み込むバッファの kanji-fileio-code が未設定 (-, NIL) の場合は、ファイルを読み込んだ時に指定された漢字コードを kanji-fileio-code に設定します。 JIS コードを指定した場合、漢字選択エスケープシークエンスとして ESC-$-@ と ESC-$-B の両方を認識します。また、ASCII 選択エスケープシークエンスと して ESC-(-J と ESC-(-B、ESC-(-H のいずれも認識します。 ファイル入力時の find-file (C-x C-f), find-file-other-window (C-x 4 C-f) コマンドに引き数を与えることで、kanji-expected-code を一時的に変更するこ とができます。kanji-expected-code を恒久的に変更したい場合は、 set-kanji-expected-code で変更してください。 C-u - C-x (4) C-f kanji-expected-code を NIL にして読み込む。 C-u C-x (4) C-f kanji-expected-code を T にして読み込む。 C-u 0 C-x (4) C-f kanji-expected-code を無変換にして読み込む。 C-u 1 C-x (4) C-f kanji-expected-code をシフト JIS にする。 C-u 2 C-x (4) C-f kanji-expected-code を JIS にして読み込む。 C-u 3 C-x (4) C-f kanji-expected-code を EUC にして読み込む。 ファイル出力時の漢字コードの指定は以下のようになります。 [kanji-fileio-code] - (NIL) 無変換で書き出す。(実際には EUC になる) N (No-conversion) 無変換で書き出す。(実際には EUC になる) S (Shift-JIS) シフト JIS コードに変換して書き出す。 J (JIS) JIS コードに変換して書き出す。 E (EUC) EUC に変換して書き出す。(実際には無変換) JIS コードを指定した場合、漢字選択エスケープシークエンスの最後の文字は to-kanji-fileio で指定されたものを、ASCII 選択エスケープシークエンスの最 後の文字は to-ascii-fileio で指定されたものを使用します。 <<内部変数>> kanji-expected-code: ファイル入力時に予期する漢字コード。 kanji-fileio-code: ファイル入出力時に使用される漢字コード。ただし、ファイル入力 時には kanji-expected-code の方が優先される。 to-kanji-fileio: ファイル出力時の漢字選択エスケープシークエンスの最後の文字。 to-ascii-fileio: ファイル出力時の ASCII 選択エスケープシークエンスの最後の文 字。 to-kana-fileio: ファイル出力時の 1byte カナ文字選択エスケープシークエンスの 方法。 <<コマンド>> set-kanji-expected-code: kanji-expected-code を設定する。以下の値を指定できる。 nil /NIL kanji-fileio-code の値 t / T 自動判定 0 / noconv / NOCONV 無変換 1 / shift-jis / SHIFT-JIS シフト JIS コード 2 / jis / JIS JIS コード 3 / euc / EUC EUC set-default-fileio-code: default-kanji-fileio-code を設定する。以下の値を指定できる。 nil /NIL 未設定 0 / noconv / NOCONV 無変換 1 / shift-jis / SHIFT-JIS シフト JIS コード 2 / jis / JIS JIS コード 3 / euc / EUC EUC change-default-fileio-code: default-kanji-fileio-code を変更する。このコマンドを実行する たびに以下の順に変更される。デフォルトでは C-x C-k F にバイ ンドされている。 NIL -> NOCONV -> SHIFT-JIS -> JIS -> EUC -> NIL set-kanji-fileio-code: kanji-fileio-code を設定する。以下の値を指定できる。 nil /NIL 未設定 0 / noconv / NOCONV 無変換 1 / shift-jis / SHIFT-JIS シフト JIS コード 2 / jis / JIS JIS コード 3 / euc / EUC EUC change-fileio-code: kanji-fileio-code を変更する。このコマンドを実行するたびに以 下の順に変更される。デフォルトでは C-x C-k f にバインドされ ている。 NIL -> NOCONV -> SHIFT-JIS -> JIS -> EUC -> NIL set-to-ascii-fileio: to-ascii-fileio を設定する。以下の値を指定できる。 66 / B ESC-(-B 74 / J ESC-(-J 72 / H ESC-(-H set-to-kanji-fileio: to-kanji-fileio を設定する。以下の値を指定できる。 64 / @ ESC-$-@ 66 / B ESC-$-B set-to-kana-fileio: to-kana-fileio を設定する。以下の値を指定できる。 55 / 7 SO / SI 56 / 8 through 73 / I ESC-(-I 3.4. キーボード入力 キーボードからの入力時には、kanji-input-code を参照して、漢字コードの変 換が行われます。 キーボードからの入力時の漢字コードの指定は以下のようになります。 [kanji-input-code] N (No-conversion) 無変換で入力する。 S (Shift-JIS) シフト JIS コードと想定して入力する。 J (JIS) JIS コードと想定して入力する。 E (EUC) EUC と想定して入力する。(実際には無変換) JIS コードを指定した場合、漢字選択エスケープシークエンスとして ESC-$-@ と ESC-$-B の両方を認識します。また、ASCII 選択エスケープシークエンスと して ESC-(-J と ESC-(-B、ESC-(-H のいずれも認識します。1 byte カナ選択エ スケープシーケンスは ESC-(-I のみ使用できます。また、8bit目が立っている コードも全て 1byte カナとして扱われます(いわゆる 8bit JIS)。 SI/SO を使っ た 1byte カナ入力はサポートしないので注意してください。(C-p、C-o と区別 できないからです) <<内部変数>> kanji-input-code: キーボードからの入力時に予期する漢字コード。 <<コマンド>> set-kanji-input-code: kanji-input-code を設定する。以下の値を指定できる。 0 / noconv / NOCONV 無変換 1 / shift-jis / SHIFT-JIS シフト JIS コード 2 / jis / JIS JIS コード 3 / euc / EUC EUC change-input-code: kanji-input-code を変更する。このコマンドを実行するたびに以 下の順に変更される。デフォルトでは C-x C-k i にバインドされ ている。 NOCONV -> SHIFT-JIS -> JIS -> EUC -> NOCONV 3.5. 画面表示 画面への出力時には、kanji-display-code を参照して、漢字コードの変換が行 われます。 画面に表示する時の漢字コードの指定は以下のようになります。 [kanji-display-code] N (No-conversion) 無変換で表示する。(実際には EUC になる) S (Shift-JIS) シフト JIS コードに変換して表示する。 J (JIS) JIS コードに変換して表示する。 E (EUC) EUC に変換して表示する。(実際には無変換) JIS コードを指定した場合、漢字選択エスケープシークエンスの最後の文字は to-kanji-display で指定されたものを、ASCII 選択エスケープシークエンスの 最後の文字は to-ascii-display で指定されたものを使用します。 <<内部変数>> kanji-display-code: 画面表示時に使用される漢字コード。 to-kanji-display: 画面出力時の漢字選択エスケープシークエンスの最後の文字。 to-ascii-display: 画面出力時の ASCII 選択エスケープシークエンスの最後の文字。 to-kana-display: 画面出力時の 1byte カナ文字選択エスケープシークエンスの方法。 <<コマンド>> set-kanji-display-code: kanji-display-code を変更する。以下の値を指定できる。 0 / noconv / NOCONV 無変換 1 / shift-jis / SHIFT-JIS シフト JIS コード 2 / jis / JIS JIS コード 3 / euc / EUC EUC change-display-code: kanji-display-code を変更する。このコマンドを実行するたびに 以下の順に変更される。デフォルトでは C-x C-k d にバインドさ れている。 NOCONV -> SHIFT-JIS -> JIS -> EUC -> NOCONV set-to-ascii-display: to-ascii-display を設定する。以下の値を指定できる。 66 / B ESC-(-B 74 / J ESC-(-J 72 / H ESC-(-H set-to-kanji-display: to-kanji-display を設定する。以下の値を指定できる。 64 / @ ESC-$-@ 66 / B ESC-$-B set-to-kana-display: to-kana-display を設定する。以下の値を指定できる。 55 / 7 SO / SI 56 / 8 8bit through 73 / I ESC-(-I 4. Ng の日本語機能 4.1. 基本項目 Ng 1.5 では、以下の機能に対して日本語が扱えるようになっています。 ○文字の挿入 (文字、文字列、ファイル、行頭文字列)。 ○カーソルの移動 (文字、単語、行)。 ○文字の削除 (文字、単語、リージョン)。 ○文字の検索 (サーチ、インクリメンタルサーチ)。 ○文字の置換 (query-replace)。 ○文字の転換 (transpose-chars)。 ○行詰め (fill-paragraph)。 ○自動行詰め (auto-fill-mode)。 ○上書き (overwrite-mode)。 ○正規表現による検索、置換。 また、MS-DOS, Human68k, Win32 では、以下の機能もサポートされています。 ○日本語のファイル名。 その他の機能については、日本語を扱った場合の動作の保証はしません。 4.2. 単語 Ng 1.5 では、単語を単位としたカーソルの移動、文字列の削除には、以下のよ うな日本語を含めた場合の「単語」を扱うように拡張されています。 単語: ASCII コードにおける「単語」。 同一のカテゴリーに属する日本語文字が連続しているもの。 および、これらに 1 文字以上の「ひらがな」が続いているもの。 また、日本語文字のカテゴリーとしては以下のものがあります。 記号: 漢字コードの区点が 1, 2, 8 区のうち、「ひらがな」「カタカナ」 「漢字」に含まれないもの。 英数字: 漢字コードの区点が 3 区のもの。 ひらがな: 漢字コードの区点が 4 区のものと、「ヽ」「ヾ」「ゝ」「ゞ」。 カタカナ: 漢字コードの区点が 5 区のものと、「ー」。 ギリシャ文字: 漢字コードの区点が 6 区のもの。 ロシア文字: 漢字コードの区点が 7 区のもの。 漢字: 漢字コードの区点が 16 区以上のものと、「仝」「々」「〆」 「〇」。 4.3. 行詰め Ng 1.5 では、日本語を含む段落を行詰めする場合、以下のような規則に従いま す。 1) 基本的に 1 行のカラム数は fill column (set-fill-column で設定され る値) を越えない。 2) 行末で分離され得るのは、空白文字、タブ、通常の日本語文字の前後、 である。 3) 英単語および日本語文字の前の文字が、行末禁則文字である場合、その 文字間は行末で分離されない。 4) 英単語および日本語文字の後の文字が、行頭禁則文字である場合、その 文字間は行末で分離されない。fill column を越える部分が行頭禁則文 字であるかぎり、その行は fill column を越えて長くなる。 行頭禁則文字とは、句読点「、」「。」や閉じ括弧「)」などのように行の先頭 に来るべきではない文字のことを指します。また、行末禁則文字とは、開き括弧 「(」などのように行の最後に来るべきではない文字のことを指します。 行頭禁則文字のリストは内部変数 kinsoku-bol-chars に、行末禁則文字のリス トは内部変数 kinsoku-eol-chars に保存されています。これらの値を見るには、 list-kinsoku-chars コマンドを実行してください。また、禁則文字リストに文 字を追加するには add-kinsoku-bol-chars および add-kinsoku-eol-chars コマ ンドを、禁則文字リストから文字を削除するには delete-kinsoku-bol-chars お よび delete-kinsoku-eol-chars コマンドを実行してください。 <<内部変数>> kinsoku-bol-chars: 行頭禁則文字リスト。初期値は以下の通り: !'),-.:;?]_}~、。,.・:;?!゛゜´`¨^ ̄_ヽヾゝゞ〃仝 々〆〇ー―‐/\〜‖|…‥’”)〕]}〉》」』】°′″℃ぁぃ ぅぇぉっゃゅょゎァィゥェォッャュョヮヵヶ kinsoku-eol-chars: 行末禁則文字リスト。初期値は以下の通り: ([{‘“(〔[{〈《「『【°′″℃@§ <<コマンド>> list-kinsoku-chars: 禁則文字リストを *Kinsoku Chars* バッファに表示する。 add-kinsoku-bol-chars: 行頭禁則文字リストに行頭禁則文字を追加する。同時に複数の文字 の追加ができる。 add-kinsoku-eol-chars: 行末禁則文字リストに行末禁則文字を追加する。同時に複数の文字 の追加ができる。 delete-kinsoku-bol-chars: 行頭禁則文字リストから行頭禁則文字を削除する。同時に複数の文 字の削除ができる。 delete-kinsoku-eol-chars: 行末禁則文字リストから行末禁則文字を削除する。同時に複数の文 字の削除ができる。 4.4. 上書き Ng 1.5 では、上書きモードの場合以下のように動作します。 文字が入力された事により、日本語文字の 2 バイト目だけが残るような場 合には、その 2 バイト目は ASCII コードの空白文字に置き換えられる。 5. Ng のその他の機能 5.1. バージョン表示 Ng 1.3 以降から、Ng のバージョン、コンパイル時オプションを表示させる機能 が追加になりました。 Ng の起動中は以下のコマンドを実行します。 ng-version Ng の起動中に Ng のバージョン、コンパイル時オプショ ンを知る事ができる。 Ng を起動しないで知りたい時は、次のようにコマンドラインから実行します。 ng -v Ng を起動しないで、Ng のバージョンを知る事ができる。 ng -c Ng を起動しないで、Ng のバージョン、コンパイル時オプ ションを知る事ができる。 なお、表示されるコンパイル時オプション名は、実際のコンパイル時オプション 名の省略形になっているものがありますので注意して下さい。 5.2. C モード Ng 1.5 では C モードのサブセットが利用できます。利用できる機能は、 コマンド キー 内容 ---------------------------------------------------------------- c-mode C モード c-indent-command TAB インデントの自動調整 c-newline-and-indent C-j 改行とインデントの自動調整 electric-c-brace 括弧の挿入とインデントの自動調整 electric-c-brace-blink }, { 括弧の挿入とインデントの自動調整 対応する括弧の表示 electric-c-semi : ':' の挿入とインデントの自動調整 electric-c-terminator ; ';' の挿入とインデントの自動調整 です。 以下のコマンドでは、ファイル名が ".c"、".C"、".cpp"、".cxx" または ".h"、 ".hpp"、".hxx" で終わっている場合、読み込んだバッファが自動的に C モード になります。 コマンド キーバインド ---------------------------------------------------------------- find-alternate-file C-x C-v find-file C-x C-f find-file-other-window C-x 4 C-f, C-x 4 f find-file-read-only C-x C-r dired-find-file e, f (dired モード時) dired-find-file-other-window o (dired モード時) この動作は use-c-mode コマンドで有効 / 無効の設定ができます。 本来の Nemacs (および GNU emacs) では、C モードをカスタマイズするための 変数がいくつか用意されていますが、Ng 1.5 には「変数」を扱う機能がありま せんので、その値を設定するために、以下のようなコマンドが用意されています。 コマンド 内容 ------------------------------------------------------------------- set-c-argdecl-indent c-argdecl-indent の値の設定 set-c-auto-newline c-auto-newline モードの設定 set-c-brace-imaginary-offset c-brace-imaginary-offset の値の設定 set-c-brace-offset c-brace-offset の値の設定 set-c-continued-brace-offset c-continued-brace-offset の値の設定 set-c-continued-statement-offset c-continued-statement-offset の値の 設定 set-c-indent-level c-indent-level の値の設定 set-c-label-offset c-label-offset の値の設定 set-c-tab-always-indent c-tab-always-indent モードの設定 list-c-mode-variables C モード変数の値の表示 各変数の意味は、以下の通りですが、値だけは設定できても実際にはまだサポー トされていない変数もあります。各変数の意味をより詳しく知りたい時は GNU emacs のマニュアルをご覧下さい。 変数 意味 (デフォルト) -------------------------------------------------------------------- c-argdecl-indent 関数の引き数宣言の字下げ量 (5) c-auto-newline '{', '}', ':', ';' が入力された時に、自動的 に改行するかどうかのフラグ (nil) c-brace-imaginary-offset 他の文の後ろにある '{' がこの行の先頭からど れだけ右にあると考えるかの量 (0) c-brace-offset '{' で始まる行に追加する字下げ量 (0) c-continued-brace-offset 前の文に継続する '{' で始まる行に追加する字 下げ量(0) c-continued-statement-offset 前の文に継続する文に追加する字下げ量 (2) c-indent-level ブロック内の文の字下げ量 (2) c-label-offset ラベル、case、default 行に追加する字下げ量 (-2) c-tab-always-indent TAB を常にインデント調整トリガーにするかど うかのフラグ (t) これらのうち以下のものはまだサポートされていません。 c-argdecl-indent 5.3. Ng 1.4 以降で追加された起動オプション (1) -f コマンド名 Ng 1.5 起動直後に「コマンド名」で指定したコマンドを実行します。 たとえば -f yank を指定することにより Ng 起動後、カットバッファに存 在するテキストを Ng に貼り付けます。 (2) -I ファイル名 Ng 1.5 の初期設定ファイルとして「ファイル名」で指定したファイルを使 用します。 (3) +行数 Ng 1.5 起動時にファイル名の前に +行数 を追加すると、そのファイルを開 いたあと、指定された行に直ちに移動します。 6. カスタマイズ 6.1. 全版共通の設定 Ng 1.5 では、起動時に自動的にコマンドを実行させることにより、自分の好み の設定にすることができます。起動時に実行させたいコマンドは、ホームディレ クトリの .ng という初期設定ファイルに記述しておきます。(MS-DOS, Human68k 版では ng.ini、 Amiga 版では S:ng-startup という名前になります) この初期設定ファイルはコマンドラインオプション -I で起動時に変更できます。 初期設定ファイルに記述するコマンドは、Emacs Lisp に似た書式を用います。 以下にいくつかの初期設定の例を示しておきます。 C-h と DEL を入れ換える: (bsmap-mode) または: (global-set-key "\^h" 'delete-backward-char) (global-set-key "\^?" 'help-help) C-\ でもマークの設定ができるようにする: (global-set-key "\^\\" 'set-mark-command) 入力漢字コードと画面漢字コードをシフト JIS にする: (set-kanji-input-code 'shift-jis) (set-kanji-display-code 'shift-jis) 行頭禁則文字から「ぁぃぅぇぉ」を削る: (delete-kinsoku-bol-chars "ぁぃぅぇぉ") 括弧の対応を自動的に表示させる: (global-set-key ")" 'blink-matching-paren-hack) (global-set-key "}" 'blink-matching-paren-hack) (global-set-key "]" 'blink-matching-paren-hack) ESC C-s/C-r で正規表現検索をするようにする: (global-set-key "\^[\^s" 're-search-forward) (global-set-key "\^[\^r" 're-search-backward) C モードの変数を一般的な C 言語のスタイルに合わせる: (set-c-argdecl-indent 0) (set-c-continued-statement-offset 8) (set-c-indent-level 8) (set-c-label-offset -4) (set-c-tab-always-indent nil) 6.2 Windows 関連の設定 (configure) Ng 1.5 では、コマンド configure が Tillanosoft氏により追加されています。 configure は Windows 関連のさまざまな設定を行うためのコマンドです。 現状、以下の設定が行えます。 (1) 利用する ng.ini ファイルの絶対パスの指定 (2) コントロールキーの英数キーへのマッピング Ng 1.5 ではコントロールキーを「英数」キーにマッピングする機能が Tillanosoft氏 により追加されました。 *注意* Win95/NT ではうまく動作しない事が確認されています。キー入力で不具 合が発生したら、この機能を OFF にしてください。 configure で設定したコントロールキーの「英数」キーへの割り当ては Ng 内でのみ有効で、他のアプリケーションでは利用できません。また、 IME の各種操作時も利用できませんので注意してください。 Ng 1.5 では、GNU Emacs ユーザの多くが VT100 並びのキーボードに慣 れ親しんでいることを考慮して本機能を提供しておりますが、本来コン トロールキーのマッピング機能は、モバイルギアシリーズで提供されて いるように、ハードベンダレベルで提供されるべきものです。各ベンダ がコントロールキーの入れ替え機能を今後提供されることを期待します。 (3) ビープ音 (4) フォントの設定 (95/98/NT 版のみ) configure 機能を利用するには M-x configure RET のようにして呼び出して ください。 7. Nemacs との比較 Ng 1.5 は Nemacs 3.3.2 に似た機能を実現していますが、以下の点が Nemacs とは異なっています。これらには、Mg 2a と GNU emacs との違いから来るもの もあります。 a) 日本語を扱うモードかどうかのフラグ kanji-flag とそれに関するコマ ンドがない。Ng 1.5 は常に日本語を扱うモードになっている。 b) プロセス間通信に関する変数やコマンドがない。 c) JIS コード入力に関するコマンド kanji-jis-start, kanji-jis-end, jis-code-input がない。JIS コード入力時の漢字/ASCII 選択エスケー プシークエンスは、内部に組み込みになっていてバインドの変更はでき ない。 d) set-kanji-input-code などの漢字コードを設定するコマンドには、正確 な Emacs Lisp の形式で引き数を与えなくても解釈する。 e) x-set-kfont コマンドがない。 f) convert-region-kanji-code, kanji-delete-region コマンドがない。 g) 日本語文字のカテゴリーの分け方が簡単になっている。 h) インクリメンタルサーチでは、C-k を入れなくても日本語文字を入力で きる。 i) 本来の意味での「変数」がないため、禁則文字リストを保存している変 数の内容確認、リストの変更のために新しいコマンドを追加した。 j) kinsoku-nobashi-limit がない。 k) 行揃え機能がない。 l) ピクチャモード、矩形領域処理、略称展開機能がない。 m) Emacs Lisp に関する機能と関数がない。 n) undo に制限がある。({up,down}case-* の undo は不可能。また、undo 可能回数はコンパイル時に設定し、redo は一切できない) o) C モードがマイナーモードになっている。使える機能はサブセットであ る。動作が異なる部分がある。 p) いわゆる 1byte カナを使用する事ができる。 8. バグ、その他 現在判っている Ng のバグは以下の通りです。 a) JIS コード入力時に入力された通常の ESC は、続いて入力される文字に より、漢字選択/ASCII 選択エスケープシークエンスではない事が確定す るまで有効にはならない。 b) fill-prefix 文字列および、それを含めた英単語 1 つの長さが、 fill-column より長い場合、動作が保証されない。(core dump または hung up) c) 日本語と英単語の間に ' ' がある状態での fill-word, fill-paragraph の動作がおかしい時がある。 ng-1.5beta1/docs/Ng.ref100644 1750 1750 117476 7304520253 13523 0ustar amurausers# $Id: Ng.ref,v 1.3 2001/05/28 19:02:03 amura Exp $ ============================================================================== Ng.ref for Ng (Micro Nemacs) 1.3 1991.01.25 吉田茂樹 (shige@iamas.ac.jp) 1.5 (修正加筆) 2000.05.26 村松 篤 (amura@ma3.seikyou.ne.jp) ============================================================================== Ng レファレンスガイド -------------------------------------------------------------------------- 0. 記号の説明 1. Ng の起動 2. Ng の終了 3. ファイル 4. ヘルプ 5. 移動 6. 削除 7. 挿入 8. 検索 9. 置換 10. マーク 11. ウィンドウ 12. バッファ 13. 文字変換 14. 整形 15. コマンド 16. キーマップ 17. ディレクトリエディタ 18. C モード 19. Buffer Menu モード 20. 漢字 21. SKG (Simple Kanji Generator) 22. その他 A. アルファベット順コマンド一覧 B. コンパイル時オプション別コマンド一覧 ========================================================================== ここに説明してあるコマンドは、Ng のコンパイル時オプションを全て指定した 時のものです。お使いの Ng の設定によっては利用できないものもあります。 コンパイル時オプションに依存するコマンドの一覧は、B. をご覧下さい。 ============================================================================== 0. 記号の説明 -------------------------------------------------------------------------- C-x コントロールキーを押しながら、x キーを押す。 C-x x C-x を押した後、x キーを押す。 C-x C-y C-x を押した後、C-y を押す。 ESC x ESC キーを押した後、x キーを押す。M-x と表すこともある。 ESC C-x ESC キーを押した後、C-x を押す。 -------------------------------------------------------------------------- ESC エスケープコード (/C-[) DEL DEL コード (/127) SPC スペース (' ') RET リターンコード (//C-m) LFD ラインフィードコード (C-j) NUL ヌルコード (C-@/C-SPC) ============================================================================== 1. Ng の起動 -------------------------------------------------------------------------- コマンドラインから ng と入力する。引き数にファイルを指定することもできる。 -v オプションを付けると Ng のバージョンの表示だけを行う。 -c オプションを付けると Ng のバージョンとコンパイル時オプションの表示だけ を行う。 -f [func] オプションを付けると Ng 起動後直ちに func を実行する。 -I [file] オプションを付けると Ng は初期化ファイルとして file を使う。 +数字 をファイル名の前に付けると、ファイルを開いた後、指定された行に移動す る。 ============================================================================== 2. Ng の終了 -------------------------------------------------------------------------- save-buffers-kill-emacs C-x C-c バッファ書き出し後終了 suspend-emacs C-z Ng の一時停止 ============================================================================== 3. ファイル -------------------------------------------------------------------------- ファイル名を入力する時に C-i (TAB) のファイル名補完機能が使える。 -------------------------------------------------------------------------- find-file C-x C-f ファイルの読み込み find-alternate-file C-x C-v 別ファイルの読み込み find-file-other-window C-x 4 C-f, 他ウィンドウへのファイルの C-x 4 f 読み込み find-file-read-only C-x C-r 書き込み禁止モードでのファ イルの読み込み insert-file C-x i ファイル内容の挿入 make-backup-files バックアップ作成モード変更 save-buffer C-x C-s 現在のバッファ内容の書き出し save-some-buffers C-x s 変更済みバッファの書き出し write-file C-x C-w 指定ファイルへの書き出し keyboard-quit C-g コマンドの中断 ============================================================================== 4. ヘルプ -------------------------------------------------------------------------- help C-h ヘルプ help-help C-h C-h ヘルプのヘルプ apropos C-h a コマンド一覧の表示 describe-bindings C-h b キーバインド一覧の表示 describe-key-briefly C-h c バインドコマンドの確認 keyboard-quit C-g コマンドの中断 ============================================================================== 5. 移動 -------------------------------------------------------------------------- forward-char C-f カーソルの一文字前進 backward-char C-b カーソルの一文字後退 forward-word ESC f カーソルの一単語前進 backward-word ESC b カーソルの一単語後退 end-of-line C-e 行の終わりへの移動 beginning-of-line C-a 行の先頭への移動 next-line C-n 次行への移動 previous-line C-p 前行への移動 forward-paragraph ESC ] カーソルの一段落前進 backward-paragraph ESC [ カーソルの一段落後退 scroll-up C-v 上方向スクロール scroll-down ESC v 下方向スクロール scroll-other-window ESC C-v 他ウィンドウの上スクロール end-of-buffer ESC > バッファの終わりへの移動 beginning-of-buffer ESC < バッファの先頭への移動 goto-line 指定行への移動 goto-matching-fence 対応する括弧への移動 jump-to-error カーソル行のタグへジャンプ next-line-add-newlines バッファの最後で next-line し た時、新しい行を作成する ============================================================================== 6. 削除 -------------------------------------------------------------------------- delete-char C-d 一文字削除 delete-backward-char DEL 一文字後退削除 kill-word ESC d カーソル以降の一単語削除 backward-kill-word ESC DEL 一単語後退削除 kill-line C-k カーソル以降の一行削除 kill-paragraph 一段落削除 kill-region C-w リージョン内削除 copy-region-as-kill ESC w KILL バッファへの保存 copy-buffer-as-kill KILL バッファへのバッファの 内容全ての保存 delete-horizontal-space ESC \ 空白文字の削除 delete-blank-lines C-x C-o 空白行の削除 zap-to-char ESC z 指定文字の手前まで削除 ============================================================================== 7. 挿入 -------------------------------------------------------------------------- self-insert-command 一文字挿入 (通常の文字挿入) quoted-insert C-q 非表示文字の挿入 insert 文字列挿入 open-line C-o 空白行の挿入 yank C-y KILL バッファ内容の挿入 insert-buffer バッファ内容の挿入 insert-file C-x i ファイル内容の挿入 insert-with-wrap 行詰め挿入 prefix-region 接頭文字列挿入 set-prefix-string 接頭文字列の設定 overwrite-mode 上書きモードの on/off ============================================================================== 8. 検索 -------------------------------------------------------------------------- isearch-forward C-s 先方向への会話型検索 isearch-backward C-r 後方向への会話型検索 search-forward ESC s 次方向文字列検索 search-backward ESC r 後方向文字列検索 search-again 再検索 re-search-forward 次方向正規表現文字列検索 re-search-backward 後方向正規表現文字列検索 re-search-again 正規表現文字列再検索 set-case-fold-search 大小文字区別検索セット keyboard-quit C-g コマンドの中断 ============================================================================== 9. 置換 -------------------------------------------------------------------------- query-replace ESC % 会話型文字列置換 query-replace-regexp 会話型正規表現文字列置換 SPC, y, Y 置換実施後次の候補へ DEL, n, N 置換しないで次の候補へ ESC, C-m 置換の終了 C-g 置換の中断 ============================================================================== 10. マーク -------------------------------------------------------------------------- set-mark-command NUL マークの設定 exchange-point-and-mark C-x C-x ポイントとマークの交換 ============================================================================== 11. ウィンドウ -------------------------------------------------------------------------- recenter C-l カーソル行の中央移動 redraw-display 画面の再表示 split-window-vertically C-x 2 ウィンドウの分割 other-window C-x o 次ウィンドウへの移動 scroll-other-window ESC C-v 他ウィンドウの上スクロール delete-window C-x 0 現在のウィンドウの消去 delete-other-windows C-x 1 他のウィンドウの消去 enlarge-window C-x ^ 現在のウィンドウの拡大 shrink-window 現在のウィンドウの縮小 ============================================================================== 12. バッファ -------------------------------------------------------------------------- list-buffers C-x C-b バッファリストの表示 switch-to-buffer C-x b 対象バッファの変更 switch-to-buffer-other-window C-x 4 b 他ウィンドウの対象バッファ変更 kill-buffer C-x k バッファの削除 insert-buffer バッファ内容の挿入 not-modified ESC ~ 内容変更フラグの解除 toggle-read-only C-x C-q 書き込み禁止モードのトグル set-default-mode デフォルトモードの設定 save-buffer C-x C-s 現在のバッファ内容の書き出し save-some-buffers C-x s 内容変更済みバッファの書き出し keyboard-quit C-g コマンドの中断 ============================================================================== 13. 文字変換 -------------------------------------------------------------------------- downcase-word ESC l 単語の小文字変換 upcase-word ESC u 単語の大文字変換 capitalize-word ESC c 単語の先頭の大文字変換 downcase-region C-x C-l リージョン内の小文字変換 upcase-region C-x C-u リージョン内の大文字変換 transpose-chars C-t 文字転換 ============================================================================== 14. 整形 -------------------------------------------------------------------------- fill-paragraph ESC q 段落内の行詰め set-fill-column C-x f 行詰め長さの設定 set-fill-prefix C-x . 行詰め時行頭文字列の設定 auto-fill-mode 自動行詰めモードの on/off insert-with-wrap 行詰め挿入 newline RET 改行 newline-and-indent LFD インデント付き改行 auto-indent-mode 自動インデントの on/off just-one-space ESC SPC 空白を一文字にする ============================================================================== 15. コマンド -------------------------------------------------------------------------- execute-extended-command ESC x コマンドの実行 start-kbd-macro C-x ( キーボードマクロ定義の開始 end-kbd-macro C-x ) キーボードマクロの定義終了 call-last-kbd-macro C-x e キーボードマクロの実行 eval-expression 入力コマンドの評価 eval-current-buffer バッファ内のコマンドの評価 load コマンドファイルの読み込み keyboard-quit C-g コマンドの中断 ============================================================================== 16. キーマップ -------------------------------------------------------------------------- define-key キーマップの定義 global-set-key キーバインド設定 global-unset-key キーバインド解除 local-set-key バッファ固有キーバインド設定 local-unset-key バッファ固有キーバインド解除 bsmap-mode C-h と DEL との変換モード meta-key-mode META キーの入力の on/off ============================================================================== 17. ディレクトリエディタ -------------------------------------------------------------------------- ディレクトリ名を入力する時に C-i (TAB) のディレクトリ名補完機能が使える。 -------------------------------------------------------------------------- dired C-x d ディレクトリエディタモード dired-backup-unflag DEL 上方移動をしながらファイル 削除マークを消す dired-copy-file c ファイルのコピー dired-do-deletions x ファイル削除の実行 dired-do-shell-command ファイルの実行 dired-find-file e, f ファイルの読み込み dired-find-file-other-window o 他ウィンドウへのファイルの 読み込み dired-flag-backup-files ~ バックアップに削除マーク dired-flag-file-deleted d, C-d ファイル削除マークを付ける dired-other-window 他ウィンドウでのディレクト リエディタモード dired-rename-file r ファイルの名前変更 dired-unflag u ファイル削除マークを消す dired-view-file v ファイルの参照 ============================================================================== 18. C モード -------------------------------------------------------------------------- use-c-mode ファイル読み込み時、自動的に C モードに入る事の許可 c-mode C モード c-indent-command TAB インデントの自動調整 c-indent-region region内のインデントの自動調整 c-newline-and-indent LFD 改行とインデントの自動調整 electric-c-brace 括弧の挿入とインデントの自 動調整 electric-c-brace-blink }, { 括弧の挿入とインデントの自 動調整、対応する括弧の表示 electric-c-semi : ':' の挿入とインデントの自 動調整 electric-c-terminator ; ';' の挿入とインデントの自 動調整 list-c-mode-variables C モード変数の値の表示 set-c-argdecl-indent c-argdecl-indent の値の設定 set-c-auto-newline c-auto-newline モードの設定 set-c-brace-imaginary-offset c-brace-imaginary-offset の 値の設定 set-c-brace-offset c-brace-offset の値の設定 set-c-continued-brace-offset c-continued-brace-offset の 値の設定 set-c-continued-statement-offset c-continued-statement-offset の値の設定 set-c-indent-level c-indent-level の値の設定 set-c-label-offset c-label-offset の値の設定 set-c-tab-always-indent c-tab-always-indent モード の設定 ============================================================================== 19. Buffer Menu モード -------------------------------------------------------------------------- Buffer-menu-this-window f バッファの選択 Buffer-menu-delete d 削除マークの付与 Buffer-menu-unmark u 削除マークの取り消し Buffer-menu-execute x マークされたバッファを実際に 削除 ============================================================================== 20. 漢字 -------------------------------------------------------------------------- list-kanji-codes C-x C-k C 漢字コード設定の表示 list-kanji-codes-briefly C-x C-k c 漢字コード設定の確認 change-default-fileio-code C-x C-k F デフォルトファイルコードの変更 change-fileio-code C-x C-k f ファイル漢字コードの変更 change-input-code C-x C-k i キーボード入力漢字コードの変更 change-display-code C-x C-k d 画面表示漢字コードの変更 set-default-fileio-code デフォルトファイルコードの設定 set-kanji-expected-code 想定ファイル漢字コードの設定 set-kanji-fileio-code ファイル漢字コードの設定 set-kanji-display-code 画面表示漢字コードの設定 set-kanji-input-code キーボード入力漢字コードの設定 set-to-kanji-fileio ファイル用漢字選択文字の設定 set-to-ascii-fileio ファイル用 ASCII 選択文字の設定 set-to-kanji-display 画面用漢字選択文字の設定 set-to-ascii-display 画面用 ASCII 選択文字の設定 list-kinsoku-chars 禁則文字リストの表示 add-kinsoku-bol-chars 行頭禁則文字リストへの追加 add-kinsoku-eol-chars 行末禁則文字リストへの追加 delete-kinsoku-bol-chars 行頭禁則文字リストからの削除 delete-kinsoku-eol-chars 行末禁則文字リストからの削除 set-fep-control FEP/IME 自動制御モードの設定 change-fep-control FEP/IME 自動制御モードの変更 fep-toggle C-\ FEP/IME のオンオフ ============================================================================== 21. SKG (Simple Kanji Generator) -------------------------------------------------------------------------- skg-input ESC C-k SKG を使った日本語入力モード (入力モード) SPC 変換(候補選択モードへ) RET 無変換(入力バッファの内容をそ のままテキストにインサート) C-g SKGの終了。 (入力バッファに文字列がある場 合、クリアする) C-\ ANK/ひらがな入力モード切替 (候補選択モード) RET 現在、表示されている候補をイ ンサート。 SPC 次候補 C-n 次候補(SPCと同じ) C-p 前候補 C-g 入力モードへ戻る。 set-skg-roman-dictionary SKG 用のローマ字-かな変換辞書 ファイルの設定 set-skg-kanji-dictionary SKG 用のかな-漢字変換辞書ファ イルの設定 ============================================================================== 22. その他 -------------------------------------------------------------------------- blink-matching-paren 対応括弧表示モードの on/off blink-matching-paren-hack 対応する括弧表示の実行 configure Windows 関連の設定 count-lines-page C-x l バッファ内の行数の報告 count-lines-region ESC = リージョン内の行数の報告 count-matches 正規表現に一致する行の数 count-non-matches 正規表現に一致しない行の数 delete-matching-lines 正規表現に一致する行の削除 delete-non-matching-lines 正規表現に一致しない行の削除 undo C-x u, C-_ アンドゥ emacs-version Ng バージョンの表示 ng-version Ng バージョンの詳細の表示 pwd 現在のディレクトリ表示 cd ディレクトリの移動 what-cursor-position C-x = カーソル位置の文字種類表示 shell-command ESC ! シェルコマンドの実行 j31-set-cursor IBMPC のカーソル設定 ibmpc-set-cursor IBMPC のカーソル設定 set-tab-width タブ幅の設定 set-default-tab-width デフォルトのタブ幅の設定 set-c-tab-width C モード時のタブ幅の設定 compile プログラムのコンパイル next-error コンパイルのエラー行へ Jump line-number-mode モードラインに行番号を表示 set-autosave-interval autosave する間隔の設定 amiga-iconify AMIGA アイコン化 amiga-menu AMIGA メニューの使用可否 amiga-mode-background AMIGA モードラインの背景色 amiga-mode-foreground AMIGA モードラインの文字色 amiga-mode-rendition AMIGA モードラインの描画モード amiga-set-font AMIGA 使用フォント amiga-text-background AMIGA テキストの背景色 amiga-text-foreground AMIGA テキストの文字色 amiga-text-rendition AMIGA テキストの描画モード amiga-toggle-boarder AMIGA ボーダーの ON/OFF amiga-zoom-mode AMIGA ウインドウズーム ============================================================================== A. アルファベット順コマンド一覧 ============================================================================== add-kinsoku-bol-chars 行頭禁則文字リストへの追加 add-kinsoku-eol-chars 行末禁則文字リストへの追加 amiga-iconify AMIGA アイコン化 amiga-menu AMIGA メニューの使用可否 amiga-mode-background AMIGA モードラインの背景色 amiga-mode-foreground AMIGA モードラインの文字色 amiga-mode-rendition AMIGA モードラインの描画モード amiga-set-font AMIGA 使用フォント amiga-text-background AMIGA テキストの背景色 amiga-text-foreground AMIGA テキストの文字色 amiga-text-rendition AMIGA テキストの描画モード amiga-toggle-boarder AMIGA ボーダーの ON/OFF amiga-zoom-mode AMIGA ウインドウズーム apropos C-h a コマンドの表示 (ヘルプ) auto-fill-mode 自動行詰めモードの on/off auto-indent-mode 自動インデントの on/off Buffer-menu-delete d 削除マークの付与 Buffer-menu-execute x マークされたバッファを削除 Buffer-menu-this-window f バッファの選択 Buffer-menu-unmark u 削除マークの取り消し backward-char C-b カーソルの一文字後退 backward-kill-word ESC DEL 一単語後退削除 backward-paragraph ESC [ カーソルの一段落後退 backward-word ESC b カーソルの一単語後退 beginning-of-buffer ESC < バッファの先頭への移動 beginning-of-line C-a 行の先頭への移動 blink-matching-paren 対応括弧表示モードの on/off blink-matching-paren-hack 対応する括弧表示の実行 bsmap-mode C-h と DEL との変換モード c-indent-command TAB インデントの自動調整 c-indent-region region内のインデントの自動調整 c-mode C モード c-newline-and-indent LFD 改行とインデントの自動調整 call-last-kbd-macro C-x e キーボードマクロの実行 capitalize-word ESC c 単語の先頭の大文字変換 cd ディレクトリの移動 change-default-fileio-code C-x C-k F デフォルトファイルコードの変更 change-display-code C-x C-k d 画面表示漢字コードの変更 change-fep-control FEP 自動制御モードの変更 change-fileio-code C-x C-k f ファイル漢字コードの変更 change-input-code C-x C-k i キーボード入力漢字コードの変更 compile プログラムのコンパイル configure Windows 関連の設定 copy-buffer-as-kill KILL バッファへのバッファ内容 全ての保存 copy-region-as-kill ESC w KILL バッファへの保存 count-lines-page C-x l バッファ内の行数の報告 count-lines-region ESC = リージョン内の行数の報告 count-matches 正規表現に一致する行の数 count-non-matches 正規表現に一致しない行の数 define-key キーマップの定義 delete-backward-char DEL 一文字後退削除 delete-blank-lines C-x C-o 空白行の削除 delete-char C-d 一文字削除 delete-horizontal-space ESC \ 空白文字の削除 delete-kinsoku-bol-chars 行頭禁則文字リストからの削除 delete-kinsoku-eol-chars 行末禁則文字リストからの削除 delete-matching-lines 正規表現に一致する行の削除 delete-non-matching-lines 正規表現に一致しない行の削除 delete-other-windows C-x 1 他のウィンドウの消去 delete-window C-x 0 現在のウィンドウの消去 describe-bindings C-h b キーバインド一覧の表示 describe-key-briefly C-h c バインドコマンドの確認 dired C-x d ディレクトリエディタモード dired-backup-unflag DEL 上方移動をしながらファイル 削除マークを消す dired-copy-file c ファイルのコピー dired-do-deletions x ファイル削除の実行 dired-do-shell-command ファイルの実行 dired-find-file e, f ファイルの読み込み dired-find-file-other-window o 他ウィンドウへのファイルの 読み込み dired-flag-backup-files ~ バックアップに削除マーク dired-flag-file-deleted d, C-d ファイル削除マークを付ける dired-other-window 他ウィンドウでのディレクト リエディタモード dired-rename-file r ファイルの名前変更 dired-unflag u ファイル削除マークを消す dired-view-file v ファイルの参照 downcase-region C-x C-l リージョン内の小文字変換 downcase-word ESC l 単語の小文字変換 electric-c-brace }, { 括弧の挿入とインデントの自 動調整 electric-c-brace-blink 括弧の挿入とインデントの自 動調整、対応する括弧の表示 electric-c-semi : ':' の挿入とインデントの自 動調整 electric-c-terminator ; ';' の挿入とインデントの自 動調整 emacs-version Ng バージョンの表示 end-kbd-macro C-x ) キーボードマクロの定義終了 end-of-buffer ESC > バッファの終わりへの移動 end-of-line C-e 行の終わりへの移動 enlarge-window C-x ^ 現在のウィンドウの拡大 eval-current-buffer バッファ内のコマンドの評価 eval-expression 入力コマンドの評価 exchange-point-and-mark C-x C-x ポイントとマークの交換 execute-extended-command ESC x コマンドの実行 fep-toggle C-\ FEP/IME のオンオフ fill-paragraph ESC q 段落内の行詰め find-alternate-file C-x C-v 別ファイルの読み込み find-file C-x C-f ファイルの読み込み find-file-other-window C-x 4 C-f, 他ウィンドウへのファイルの C-x 4 f 読み込み find-file-read-only C-x C-r 書き込み禁止モードでのファ イルの読み込み forward-char C-f カーソルの一文字前進 forward-paragraph ESC ] カーソルの一段落前進 forward-word ESC f カーソルの一単語前進 global-set-key キーバインド設定 global-unset-key キーバインド解除 goto-line 指定行への移動 goto-matching-fence 対応する括弧への移動 help C-h ヘルプ help-help C-h C-h ヘルプのヘルプ ibmpc-set-cursor IBMPC のカーソル設定 insert 文字列挿入 insert-buffer バッファ内容の挿入 insert-file C-x i ファイル内容の挿入 insert-with-wrap 行詰め挿入 isearch-backward C-r 後方向への会話型検索 isearch-forward C-s 先方向への会話型検索 j31-set-cursor IBMPC のカーソル設定 jump-to-error カーソル行のタグへジャンプ just-one-space ESC SPC 空白を一文字にする keyboard-quit C-g コマンドの中断 kill-buffer C-x k バッファの削除 kill-line C-k カーソル以降の一行削除 kill-paragraph 一段落削除 kill-region C-w リージョン内削除 kill-word ESC d カーソル以降の一単語削除 line-number-mode モードラインに行番号を表示 list-buffers C-x C-b バッファリストの表示 list-c-mode-variables C モード変数の値の表示 list-kanji-codes C-x C-k C 漢字コード設定の表示 list-kanji-codes-briefly C-x C-k c 漢字コード設定の確認 list-kinsoku-chars 禁則文字リストの表示 load コマンドファイルの読み込み local-set-key バッファ固有キーバインド設定 local-unset-key バッファ固有キーバインド解除 make-backup-files バックアップ作成モード変更 meta-key-mode META キーの入力の on/off newline RET 改行 newline-and-indent LFD インデント付き改行 next-error コンパイルのエラー行へ Jump next-line C-n 次行への移動 next-line-add-newlines バッファの最後で next-line し た時、新しい行を作成する ng-version Ng バージョンの詳細の表示 not-modified ESC ~ 内容変更フラグの解除 open-line C-o 空白行の挿入 other-window C-x o 次ウィンドウへの移動 overwrite-mode 上書きモードの on/off prefix-region 接頭文字挿入 previous-line C-p 前行への移動 pwd 現在のディレクトリ表示 query-replace ESC % 会話型文字列置換 query-replace-regexp 会話型正規表現文字列置換 quoted-insert C-q 非表示文字の挿入 re-search-again 正規表現文字列再検索 re-search-backward 後方向正規表現文字列検索 re-search-forward 次方向正規表現文字列検索 recenter C-l カーソル行の中央移動 redraw-display 画面の再表示 save-buffer C-x C-s 現在のバッファ内容の書き出し save-buffers-kill-emacs C-x C-c バッファ書き出し後終了 save-some-buffers C-x s 内容変更済みバッファの書き出し scroll-down ESC v 下方向スクロール scroll-other-window ESC C-v 他ウィンドウの上スクロール scroll-up C-v 上方向スクロール search-again 再検索 search-backward ESC r 後方向文字列検索 search-forward ESC s 次方向文字列検索 set-autosave-interval autosave する間隔の設定 set-c-argdecl-indent c-argdecl-indent の値の設定 set-c-auto-newline c-auto-newline モードの設定 set-c-brace-imaginary-offset c-brace-imaginary-offset の 値の設定 set-c-brace-offset c-brace-offset の値の設定 set-c-continued-brace-offset c-continued-brace-offset の 値の設定 set-c-continued-statement-offset c-continued-statement-offset の値の設定 set-c-indent-level c-indent-level の値の設定 set-c-label-offset c-label-offset の値の設定 set-c-tab-always-indent c-tab-always-indent モード set-c-tab-width C モード時のタブ幅の設定 set-case-fold-search 大小文字区別検索セット set-default-fileio-code デフォルトファイルコードの設定 set-default-mode デフォルトモードの設定 set-default-tab-width デフォルトのタブ幅の設定 set-fep-control FEP 自動制御モードの設定 set-fill-column C-x f 行詰め長さの設定 set-fill-prefix C-x . 行詰め時行頭文字列の設定 set-kanji-display-code 画面表示漢字コードの設定 set-kanji-expected-code 想定ファイル漢字コードの設定 set-kanji-fileio-code ファイル漢字コードの設定 set-kanji-input-code キーボード入力漢字コードの設定 set-mark-command NUL マークの設定 set-prefix-string 接頭文字列の設定 set-skg-kanji-dictionary SKG 用のかな-漢字変換辞書ファ イルの設定 set-skg-roman-dictionary SKG 用のローマ字-かな変換辞書 ファイルの設定 set-tab-width タブ幅の設定 set-to-ascii-display 画面用 ASCII 選択文字の設定 set-to-ascii-fileio ファイル用 ASCII 選択文字の設定 set-to-kanji-display 画面用漢字選択文字の設定 set-to-kanji-fileio ファイル用漢字選択文字の設定 shell-command ESC ! シェルコマンドの実行 shrink-window 現在のウィンドウの縮小 skg-input ESC C-k SKG を使った日本語入力モード split-window-vertically C-x 2 ウィンドウの分割 start-kbd-macro C-x ( キーボードマクロ定義の開始 suspend-emacs C-z Ng の一時停止 switch-to-buffer C-x b 対象バッファの変更 switch-to-buffer-other-window C-x 4 b 他ウィンドウの対象バッファ変更 toggle-read-only C-x C-q 書き込み禁止モードのトグル transpose-chars C-t 文字転換 undo C-x u アンドゥ upcase-region C-x C-u リージョン内の大文字変換 upcase-word ESC u 単語の大文字変換 use-c-mode ファイル読み込み時、自動的に C モードに入る事の許可 what-cursor-position C-x = カーソル位置の文字種類表示 write-file C-x C-w 指定ファイルへの書き出し yank C-y KILL バッファ内容の挿入 zap-to-char ESC z 指定文字の手前まで削除 ============================================================================== B. コンパイル時オプション別コマンド一覧 ============================================================================== 以下に示してあるのは、各コンパイル時オプションの設定に依存するコマンド です。NO_XXXX オプションに依存するコマンドは define されていない時、そ の他のオプションに依存するコマンドは define されている時にだけ有効にな ります。 ========================================================================== a. NO_BACKUP -------------------------------------------------------------------------- make-backup-files バックアップ作成モード変更 ========================================================================== b. C_MODE -------------------------------------------------------------------------- use-c-mode ファイル読み込み時、自動的に C モードに入る事の許可 c-indent-command TAB インデントの自動調整 c-indent-region region内のインデントの自動調整 c-mode C モード c-newline-and-indent LFD 改行とインデントの自動調整 electric-c-brace 括弧の挿入とインデントの自 動調整 electric-c-brace-blink }, { 括弧の挿入とインデントの自 動調整、対応する括弧の表示 electric-c-semi : ':' の挿入とインデントの自 動調整 electric-c-terminator ; ';' の挿入とインデントの自 動調整 list-c-mode-variables C モード変数の値の表示 set-c-argdecl-indent c-argdecl-indent の値の設定 set-c-auto-newline c-auto-newline モードの設定 set-c-brace-imaginary-offset c-brace-imaginary-offset の 値の設定 set-c-brace-offset c-brace-offset の値の設定 set-c-continued-brace-offset c-continued-brace-offset の 値の設定 set-c-continued-statement-offset c-continued-statement-offset の値の設定 set-c-indent-level c-indent-level の値の設定 set-c-label-offset c-label-offset の値の設定 set-c-tab-always-indent c-tab-always-indent モード の設定 ========================================================================== c. NO_DIR -------------------------------------------------------------------------- cd ディレクトリの移動 pwd 現在のディレクトリ表示 ========================================================================== d. NO_DIRED -------------------------------------------------------------------------- dired C-x d ディレクトリエディタモード dired-backup-unflag DEL 上方移動をしながらファイル 削除マークを消す dired-copy-file c ファイルのコピー dired-do-shell-command ファイルの実行 dired-do-deletions x ファイル削除の実行 dired-find-file e, f ファイルの読み込み dired-find-file-other-window o 他ウィンドウへのファイルの 読み込み dired-flag-backup-files ~ バックアップに削除マーク dired-flag-file-deleted d, C-d ファイル削除マークを付ける dired-other-window 他ウィンドウでのディレクト リエディタモード dired-rename-file r ファイルの名前変更 dired-unflag u ファイル削除マークを消す dired-view-file v ファイルの参照 ========================================================================== e. FILLPREFIX -------------------------------------------------------------------------- set-fill-prefix C-x . 行詰め時行頭文字列の設定 ========================================================================== f. NO_HELP -------------------------------------------------------------------------- apropos C-h a コマンド一覧の表示 describe-bindings C-h b キーバインド一覧の表示 describe-key-briefly C-h c バインドコマンドの確認 help C-h ヘルプ help-help C-h C-h ヘルプのヘルプ ========================================================================== g. KANJI -------------------------------------------------------------------------- change-default-fileio-code C-x C-k F デフォルトファイルコードの変更 change-display-code C-x C-k d 画面表示漢字コードの変更 change-fileio-code C-x C-k f ファイル漢字コードの変更 change-input-code C-x C-k i キーボード入力漢字コードの変更 list-kanji-codes C-x C-k C 漢字コード設定の表示 list-kanji-codes-briefly C-x C-k c 漢字コード設定の確認 set-default-fileio-code デフォルトファイルコードの設定 set-kanji-display-code 画面表示漢字コードの設定 set-kanji-expected-code 想定ファイル漢字コードの設定 set-kanji-fileio-code ファイル漢字コードの設定 set-kanji-input-code キーボード入力漢字コードの設定 set-to-ascii-display 画面用 ASCII 選択文字の設定 set-to-ascii-fileio ファイル用 ASCII 選択文字の設定 set-to-kanji-display 画面用漢字選択文字の設定 set-to-kanji-fileio ファイル用漢字選択文字の設定 fep-toggle C-\ FEP/IME のオンオフ ========================================================================== h. KINSOKU -------------------------------------------------------------------------- add-kinsoku-bol-chars 行頭禁則文字リストへの追加 add-kinsoku-eol-chars 行末禁則文字リストへの追加 delete-kinsoku-bol-chars 行頭禁則文字リストからの削除 delete-kinsoku-eol-chars 行末禁則文字リストからの削除 list-kinsoku-chars 禁則文字リストの表示 ========================================================================== i. NO_MACRO -------------------------------------------------------------------------- call-last-kbd-macro C-x e キーボードマクロの実行 end-kbd-macro C-x ) キーボードマクロの定義終了 start-kbd-macro C-x ( キーボードマクロ定義の開始 ========================================================================== j. DO_METAKEY -------------------------------------------------------------------------- meta-key-mode META キーの入力の on/off ========================================================================== k. PREFIXREGION -------------------------------------------------------------------------- prefix-region 接頭文字列挿入 set-prefix-string 接頭文字列の設定 ========================================================================== l. READONLY -------------------------------------------------------------------------- find-file-read-only C-x C-r 書き込み禁止モードでのファ イルの読み込み toggle-read-only C-x C-q 書き込み禁止モードのトグル ========================================================================== m. REGEX -------------------------------------------------------------------------- count-matches 正規表現に一致する行の数 count-non-matches 正規表現に一致しない行の数 delete-matching-lines 正規表現に一致する行の削除 delete-non-matching-lines 正規表現に一致しない行の削除 query-replace-regexp 会話型正規表現文字列置換 re-search-again 正規表現文字列再検索 re-search-backward 後方向正規表現文字列検索 re-search-forward 次方向正規表現文字列検索 set-case-fold-search 大小文字区別検索セット ========================================================================== n. NO_SHELL -------------------------------------------------------------------------- shell-command ESC ! シェルコマンドの実行 ========================================================================== o. NO_STARTUP -------------------------------------------------------------------------- eval-expression 入力コマンドの評価 eval-current-buffer バッファ内のコマンドの評価 load コマンドファイルの読み込み ========================================================================== p. IBMPC -------------------------------------------------------------------------- ibmpc-set-cursor IBMPC のカーソル設定 j31-set-cursor IBMPC のカーソル設定 ========================================================================== q. BUFFER_MODE -------------------------------------------------------------------------- Buffer Menu モード Buffer-menu-this-window f バッファの選択 Buffer-menu-delete d 削除マークの付与 Buffer-menu-unmark u 削除マークの取り消し Buffer-menu-execute x マークされたバッファを削除 ========================================================================== r. VARIABLE_TAB -------------------------------------------------------------------------- set-tab-width タブ幅の設定 set-default-tab-width デフォルトのタブ幅の設定 set-c-tab-width C モード時のタブ幅の設定 ========================================================================== s. AMIGA (さらに細かいコンパイルオプションによる設定が可能) -------------------------------------------------------------------------- amiga-iconify AMIGA アイコン化 amiga-menu AMIGA メニューの使用可否 amiga-mode-background AMIGA モードラインの背景色 amiga-mode-foreground AMIGA モードラインの文字色 amiga-mode-rendition AMIGA モードラインの描画モード amiga-set-font AMIGA 使用フォント amiga-text-background AMIGA テキストの背景色 amiga-text-foreground AMIGA テキストの文字色 amiga-text-rendition AMIGA テキストの描画モード amiga-toggle-boarder AMIGA ボーダーの ON/OFF amiga-zoom-mode AMIGA ウインドウズーム ========================================================================== t. INCLUDE_SKG -------------------------------------------------------------------------- skg-input ESC C-k SKG を使った日本語入力モード set-skg-roman-dictionary SKG 用のローマ字-かな変換辞書 ファイルの設定 set-skg-kanji-dictionary SKG 用のかな-漢字変換辞書ファ イルの設定 ========================================================================== u. GOMATCH -------------------------------------------------------------------------- goto-matching-fence 対応する括弧への移動 ========================================================================== v. ZAPTOCHAR or ZAPTOC_A -------------------------------------------------------------------------- zap-to-char ESC z 指定文字の手前まで削除 ========================================================================== w. JUMPERR -------------------------------------------------------------------------- jump-to-error カーソル行のタグへジャンプ compile プログラムのコンパイル next-error コンパイルのエラー行へ Jump ========================================================================== x. NEXTLINE -------------------------------------------------------------------------- next-line-add-newlines バッファの最後で next-line し た時、新しい行を作成する ========================================================================== x. UNDO -------------------------------------------------------------------------- undo C-x u, C-_ アンドゥ ========================================================================== y. AUTOSAVE -------------------------------------------------------------------------- set-autosave-interval autosave する間隔の設定 ============================================================================== ng-1.5beta1/docs/Ng.tut100644 1750 1750 63455 7126003723 13540 0ustar amurausers ============================== Ng (Micro Nemacs) 入門編 ============================== 注意: この入門編で実際にいろいろな操作を試してみる前に、この文書の バックアップを作っておく事をお勧めします。 注意: この入門編は、「習うより慣れろ」をモットーに作成されています。 ">>" から始まる行は、その時何をすべきかを指示しています。 Ng のコマンドを入力するときには、一般的にコントロール・キー (キー・トッ プに、CTRL あるいは、CTL と書いてある) やメタ・キー (普通、エスケープ・キー を使う) が使われます。そこで、CONTROL とか META とか書く代わりに、次のような 記号を使うことにします。 C-<文字> コントロール・キーを押したまま、<文字> キーを押します。例え ば、C-f は、コントロール・キーを押しながら f のキーを押すこ とを意味します。 >> それでは、C-v (View Next Screen; 次の画面を見る) をタイプしてみて 下さい。次の画面に進むことができます。 ESC <文字> エスケープ・キーを押してから離し、それから <文字> キーを押 します。 注意: <文字> は、大文字でも小文字でもコマンドとしては同じ意味にな ります。 重要です: Ng を終了させたい時は、C-x C-c をタイプします。なお、Ng を csh から起動している場合、サスペンドする (一時的に止める) ことが出来ます。Ng をサスペンドするには、C-z をタイプします。 さて、これからは、一画面分読み終えたら、C-v を入力して行って下さい。 前の画面と次の画面とでは、表示される内容に何行文かの重なりがあります。 これは、表示されている内容が連続していることがすぐ判るようにするためです。 まずは、ファイルの中を移動して行く方法を知る必要があります。C-v によっ て先に進むことはもう判りました。元に戻るには、ESC v をタイプします。 >> ESC v と C-v を使って、前後に移動することを何回か試してみなさい。 要約 ==== ファイルを画面毎に見て行くには、次のコマンドを使います。 C-v 前に一画面分進む ESC v 後ろに一画面分戻る C-l 画面を書き直す。このとき、元カーソルのあった行が画面の中央に くるようにする >> 今カーソルがどこにあるか、その近くにどんなテキストが書かれているか を覚えなさい。C-l をタイプし、カーソルがどこに移動したか、その近く のテキストはどうなったかを調べてみなさい。 基本的なカーソルの制御 ====================== 画面毎の移動はできるようになりました。今度は、画面の中で、特定の場所に 移動するための方法を憶えましょう。これにはいくつかのやり方があります。一つの 方法は、前 (previous) 次 (next) 先 (forward) 後 (backward) に移動するコマン ドを使うことです。これらのコマンドはそれぞれ、C-p, C-n, C-f, C-b に割り当て られており、現在の場所から新しい場所にカーソルを移動させます。図で書けば、 前の行,C-p : : 後の文字,C-b .... 現在のカーソル位置 .... 先の文字,C-f : : 次の行,C-n これらは、それぞれ、Previous, Next, Backward, Forward の頭文字になって いるので、憶えやすいでしょう。これらは、基本的なカーソル移動コマンドであり、 いつでも使うものです。 >> C-n を何回かタイプし、(今、あなたが読んでいる) この行までカーソル を移動させなさい。 >> C-f を使って行の中ほどに移動し、C-p で何行か上に移動してみなさい。 カーソルの位置の変化に注意しなさい。 >> 行の先頭で C-b をタイプしてみなさい。カーソルはどこに移動しますか? さらにもう少し C-b をタイプし、今度は C-f で行末の方に戻りなさい。 カーソルが行末を越えるとどうなりますか? 画面の先頭や末尾を越えてカーソルを移動させようとすると、その方向にある テキストが移動して来て、カーソルは常に画面内にあるようにされます。 >> C-n を使って、カーソルを画面の下端より下に移動させてみなさい。何が 起こりましたか? カーソルの位置はどう変りましたか? 一文字単位の移動ではまどろっこしいと思うなら、単語単位で移動することも できます。ESC f で一単語分先に進み、ESC b で一単語分前に戻ります。 注意: 日本語については、単語の切れ目を認識することはできませんが、 疑似的な文節を単語の切れ目としています。 >> ESC f や ESC b を何回かタイプしてみなさい。C-f や C-b と併用してみ なさい。 C-f や C-b に対する、ESC f や ESC b の類似性に注目しましょう。多くの場 合、ESC <文字> は文書関係の処理に使われ、一方 C-<文字> はそれよりももっと基 本的な対象 (文字とか行とか) に対する操作に使われます。 C-a と C-e も知っていて便利なコマンドです。C-a はカーソルを行の先頭に移 動させ、C-e は行の末尾に移動させます。 >> C-a を2回、それから C-e を2回入力してみなさい。これらのコマンド を2回以上繰返しても、カーソルはそれ以上移動しないことに注意。 あと二つ、簡単なカーソル移動コマンドがあります。ファイルの先頭に移動す る ESC < と、ファイルの末尾に移動する ESC > です。 テキスト中でカーソルの存在する位置を「ポイント」と呼びます。言いかえれ ば、カーソルは、テキストのどこにポイントがあるかを画面上で示しているのです。 以下に単純な移動操作について要約します。このなかには、単語や行単位での 移動コマンドも含まれています。 C-f 一文字先に進む C-b 一文字後に戻る ESC f 一単語先に進む ESC b 一単語後に戻る C-n 次の行に移動 C-p 前の行に移動 ESC ] 段落の終わりに移動 ESC [ 段落の先頭に移動 C-a 行の最初に移動 C-e 行の最後に移動 ESC < ファイルの最初に移動 ESC > ファイルの最後に移動 >> 各々のコマンドを試してみなさい。これらのコマンドは、最もしばしば使 われるものです。最後の二つでは、この場所とは離れたところに移動する ので、C-v や ESC v を使ってここに戻って来るようにしなさい。 Ng の他のコマンドと同様に、これらのコマンドには、繰り返しの回数を指定す る引数を与えることができます。そのためには、コマンドを入力する前に、C-u に続 いて繰り返す回数を入力します。 例えば、C-u 8 C-f とすると、8文字分先に移動します。 >> C-n あるいは C-p に適当な引数を指定して、一回の移動でなるべくこの 行の近くに来るようにしてみなさい。 C-v や ESC v については少し違います。この場合、指定された数の行だけ画面 を移動することになります。 >> C-u 3 C-v と入力してみなさい。 元に戻るには、C-u 3 ESC v を使えばよいのです。 中止コマンド ============ C-g というコマンドで、入力を必要とするようなコマンドを中止することがで きます。例えば、引数を入力している途中や、2つ以上のキー入力を必要とするコマ ンドを入力している最中に、それをやめたくなったら、C-g を使えば良いのです。 >> C-u 100 をタイプして引数を100に設定し、C-g をタイプしなさい。そ のあとで C-f をタイプしてみなさい。何文字移動しましたか?もし間違っ て ESC を入力してしまった時も、C-g を入力すれば取り消せます。 エラー ====== 時には、Ng で許されていない操作をしてしまうことがあります。例えば、コマ ンドの定義されていないコントロール・キーを入力してしまった時には、Ng はベル を鳴らし、さらに、画面の一番下に、何が悪かったかを表示します。 Ng のバージョンによっては、この入門編に書かれていることを実行できない場 合があり得ます。その様な場合には、エラーメッセージが表示されますから、何かカー ソル移動キーを押して、その次の部分に進んで下さい。 ウィンドウ ========== Ng は幾つものウィンドウを持つことと、そのそれぞれに対してテキストを表示 することができます。ヘルプや、幾つかのコマンドからの出力を表示するために現れ た余分なウィンドウを消すために、次のコマンドを知る必要があります。 C-x 1 ウィンドウを1つにする。 C-x 1 は、他のウィンドウを消して、カーソルのあるウィンドウを、画面全体 に広げます。 >> カーソルをこの行に持ってきて、C-u 0 C-l とタイプします。 >> C-h a C-m とタイプしなさい。新しいウィンドウがコマンド一覧を表示す るために現れると同時に、このウィンドウがどのように縮むかを観察しな さい。(ただし、MS-DOS 版では a C-m とタイプする) >> C-x 1 とタイプして、ドキュメントの現われていたウィンドウを消しなさ い。 挿入と削除 ========== テキストをタイプしたければ、単にそれをタイプするだけで構いません。目に 見える文字 ('A','7','*','あ'など) は Ng によってテキストであるとみなされ、そ のまま挿入されます。行の終わりは改行文字で表され、これを入力するには をタイプします。 直前に入力した文字を削除するには、 を入力します。 は、 キーボードで「Delete」と書いてあるキーを押して入力します。「Delete」のかわり に「Rubout」と書いてあるかも知れません。より一般的には、 は、現在カー ソルのある位置の直前の文字を削除します。(ただし、MS-DOS 版では <= や キー 等または C-h を入力する) >> 文字をいくつかタイプし、それからそれらを を使って削除しな さい。 >> 右マージンを越えるまでテキストをタイプしなさい。テキストが一行の幅 以上に長くなると、その行だけ左にスクロールして「継続」されます。左 端にある '$' 記号は、その行が継続されていることを表しています。Ng は、現在編集中の位置が見えるように行をスクロールします。画面の右あ るいは左の端にある '$' 記号は、その方向に行がまだ続いていることを 表しています。 これは、文章で説明するより実際にやった方がよく判るでしょう。 >> 先ほど入力した、継続された行の上にカーソルをもっていき、C-d でテキ ストを削除して、テキストが一行に収まるようにしてみなさい。継続を表 す '$' 記号は消えましたね。 >> カーソルを行の先頭に移動し、 を入力しなさい。これはその行 の直前の行区切りを削除するので、その行が前の行とつながってしまいま す。つながった行が画面の幅より長くなると、継続の表示がされるでしょ う。 >> を押して、もう一度行区切りを挿入しなさい。 Ng のほとんどのコマンドは、繰り返しの回数を与えることができます。このこ とは、文字の挿入についても当てはまります。 >> C-u 8 * と入力してみなさい。どうなりましたか。 二つの行の間に空白行を作りたい場合には、二番目の行の先頭に行き、C-o を 入力します。 >> 適当な行の先頭に行き、そこで C-o を入力してみなさい。 これで、Ng で、テキストを入力し、また間違いを修正するもっとも基本的な方 法を学んだことになります。文字と同じ様に、単語や行も削除することができます。 削除操作について要約すると次のようになります。 カーソルの直前の文字を削除 (MS-DOS 版では <=, , C-h 等) C-d カーソルの位置にある文字を削除 ESC カーソルの直前の単語を削除 (MS-DOS 版では ESC <= 等) ESC d カーソル位置以降にある単語を削除 C-k カーソル位置から行末までを削除 何かを削除した後で、それを元に戻したくなることがあります。Ng は、一文字 よりも大きい単位で削除を行った時には、削除した内容を保存しておきます。元に戻 すには、C-y を使います。注意したいのは、C-y を削除を行った場所だけではなく、 どこにでも出来ることです。C-y は、保存されたテキストを現在カーソルのある場所 に挿入するためのコマンドですから、これを使ってテキストの移動を行うことができ ます。 削除を行うコマンドには、"Delete" コマンドと、"Kill" コマンドとがありま す。"Kill" コマンドでは削除されたものは保存されますが、"Delete" コマンドでは 保存されません。ただし、繰り返し回数が与えられると、保存されます。 >> C-n を2回ほどタイプして、画面の適当な場所に移動しなさい。そして、 C-k で、その行を削除しなさい。 一回目の C-k でその行の内容が削除され、もう一度 C-k を入力すると、その 行自身が削除されます。もし、C-k に繰り返し回数を指定した場合には、その回数だ けの行が (内容と行自身とが同時に) 削除されます。 今削除されたテキストは、保存されているので、それを取り出すことができま す。そのためには、C-y をタイプします。 >> C-y を試してみなさい。 C-k を何度も続けて行うと、削除されるテキストは、まとめて保存され、C-y で、その全てが取り出されます。 >> C-k を何度もタイプしてみなさい。 >> テキストを取り出すには、C-y です。カーソルを数行下に移動させ、もう 一度 C-y をタイプしてみなさい。これでテキストのコピーができるわけ です。 現在何かのテキストが保存されていて、さらに他のテキストを削除するとどう なるでしょうか。C-y は、もっとも最近削除されたものを取り出します。 >> 行を削除し、カーソルを移動させ、別の行を削除しなさい。C-y を行うと、 2番目の行が得られます。 取り消し (UNDO) =============== Ng は保存したテキストを取り出すこと以外には、実行したコマンドの取り消し はできません。なるべく注意してコマンドを使いましょう。 ファイル ======== テキストへの変更を永久的にするためには、それをファイルに保存しなければ なりません。保存されないと、ほどこした変更は、Ng を終了すると同時に失われて しまいます。 いま見ているファイルに対して、あなたの編集を行ったものを書き込みます。 いま見ているファイルとは、簡単にいえば編集しているファイル自体のことです。 あなたがファイルをセーブ (保存する) するまで、今までの変更は編集してい るファイルに書き込まれる事はありません。それは、あなたがそのように行いたくな いのに、途中まで変更を加えたものが勝手に書き込まれるような事がないようにです。 セーブを行った後でさえ変更したものが間違っていた時のために Ng は名前を 変えてオリジナルのファイルを残します。 備考: ただし、この機能が使えないようになっている場合もあります。 画面の下の方を見ると、このような感じでモードラインが表示されていると思 います。 (例) --**-Ng: Ng.tut (JJJ:fundamental)------------ この Ng チュートリアルのコピーは Ng.tut と呼ばれています。ファイルをファ インド (ファイルを見つけてバッファに読み込むこと) すると、Ng.tut の部分に表 示されます。例えば、new-file という名前のファイルをファインドしたならば、 "Ng: new-file" というモードラインになるでしょう。 注意: モードラインについては後ほど説明します。少しお待ちを。 ファイルをファインドしたり、セーブしたりするコマンドは、これまでのもの とは違い、2つの文字からなっています。C-x に続いて入力する文字が、ファイルに 対して行う操作を表します。 もう一つこれまでのものと違う点は、ファインドの時、ファイル名を Ng に問 われます。このことを、端末から引数を読み込んでくるコマンドと言っています。 注意: この場合はファイル名です。 C-x C-f ファイルを見つける (ファインドする) Ng はファイル名を聞いてきます。それは、画面の下の行に現れます。ファイル 名を指定している部分は、ミニバッファと呼ばれるものです。ミニバッファはこの様 な使われ方をします。ファイル名に続いて、リターンキーを押すと、ミニバッファに 表示されている内容はもう必要ではなくなるので消えてしまいます。 >> C-x C-f とタイプした後に C-g とタイプして下さい。ミニバッファの内 容を取り消し、また、C-x C-f コマンドも取り消します。と言う訳で、何 もファイルを見つけるようなことはしません。 今度はファイルをセーブしてみましょう。今までの変更を保存するためには次 のようなコマンドを使います。 C-x C-s ファイルをセーブする Ng の内容はファイルに書き出されます。セーブする時、オリジナルのファイル は新しい名前をつけられて残されているので内容は失われません。その新しい名前は オリジナルのファイルの名前に '~' をつけたものです。(MS-DOS 版では、拡張子が ".bak" になる。ただし、デフォルトではバックアップファイルは作られない) セーブが終わると、Ng はセーブしたファイルの名前を表示します。 >> C-x C-s とタイプしてチュートリアルのコピーをセーブして下さい。その 時、画面の下の方に "Wrote ...../Ng.tut" と表示されます。 新しいファイルを作る時は、あたかも以前からあったファイルをファインドす るようなフリをします。そうして、そのファインドしたファイルにタイプしていきま す。 ファイルをセーブしようとした時に初めて、Ng は今まで編集していた内容をファ イルの中に書き込みます。 バッファ ======== もし、2番目のファイルを C-x C-f で取り出すと、1番目のファイルは Ng 内 部に残ります。Ng 内部にある、ファイルからテキストを読み込んで保存しているも のはバッファと呼ばれます。ファイルを取り出す時には、Ng 内部に新しいバッファ が作られます。 Ng の中に保存しているバッファのリストを見るには、次のようにタイプします。 C-x C-b (バッファリストの表示) >> C-x C-b とタイプしなさい。それぞれのバッファがどのように名前を持っ ているか、そして、どのようなファイル名をつけているのか観察しなさい。 バッファにはファイルと一致ないものもあります。たとえば、"*Buffer List*" というファイルはありません。これは C-x C-b によって作られたバッファリストに 対してのバッファです。 あなたが見ている Ng ウィンドウ内にあるどんなテキストも、いずれかのバッ ファ内にあります。 >> バッファリストを消すため C-x 1 とタイプしなさい。 もし、あるファイルのテキストに変更を行なってから、他のファイルを取り出 したとしたら、最初のファイルはセーブされていません。その変更は Ng 内部のファ イルと対応するバッファの中だけに行なわれています。 2番目のファイルに対応するバッファを作ったり、エディットしたりしても、 1番目のファイルに対応するバッファには何も影響を与えません。これはとても使い 易く、また、1番目のファイルに対応するバッファを取っておくために役に立つ方法 です。 C-x C-s でバッファをセーブするために C-x C-f でバッファを切り替えるのは 厄介です。そこで次のコマンドを使います。 C-x s 現在あるバッファをセーブする。 C-x s は内容が変更された全てのバッファをファイルにセーブします。この時、 ひとつひとつの (セーブされるべき) バッファに対して、セーブするか、しないかを y か n で問われます。この表示は画面の下の行に表示されます。例えば、このよう にです。 Save file /usr/private/yours/Ng.tut? (y or n) コマンドの拡張 ============== エディタには、コントロール・キーやメタ・キーで入力できるものよりもずっ と多くのコマンドがあります。これらを扱うためには、拡張 (eXtend) コマンドを使 います。それには、以下の2つの種類があります。 C-x 文字による拡張。続けて一文字を入力します。 ESC x 名前による拡張。続けてコマンドの名前を入力します。 これらは一般に、便利だけれども、これまで見てきたものほど頻繁には用いら れないコマンドのためのものです。C-x C-f (ファインド) や C-x C-s (セーブ) は この仲間です。他に、C-x C-c (エディタの終了) もそうです。 C-z は Ng を抜けるのに良く使われる方法です。Ng を終了することなく、一旦、 csh のレベルに戻るには一番良い方法と言えるでしょう。C-z を行なわれても Ng は ストップしているだけで、内容が破壊されるということはありません。 注意: ただし X-window で行なっている場合、もしくは使用しているシェ ルが sh の時は、この限りではありません。 C-x コマンドは、たくさんあります。すでに学んだものは以下のものです。 C-x C-f ファイルの編集 (Find)。 C-x C-s ファイルの保存 (Save)。 C-x C-b バッファリストの表示。 C-x C-c エディタを終了する。ファイルの保存は、自動的には行われません。 しかし、もしファイルが変更されていれば、ファイルの保存をする のかどうかを聞いてきます。保存して終了する普通の方法は、C-x C-s C-x C-c とすることです。 名前による拡張コマンドには、あまり使われないものや、特定のモードでしか 使わないものなどがあります。例として、"apropos" をとりあげます。このコマンド はキーワードを入力させ、それにマッチする全てのコマンドの名前を表示します。 ESC x とタイプすると、スクリーンの下に "M-x" が表示されます。これに対して、 実行するコマンドの名前 (今の場合、"apropos") を入力します。"apr" まで入力し た後スペースを入れれば、後の部分は自動的に補われます。この後、キーワードを聞 かれますから、知りたい文字列をタイプします。なお、キーワードを入れないと、全 てのコマンドが表示されます。 >> ESC x をタイプし、続けて、"apropos" あるいは "apr" とタイプします。次に、"kanji" とタイ プします。 現れた「ウィンドウ」を消すには、C-x 1 とタイプします。 モードライン ============ もしゆっくりとコマンドを打ったならば、画面の下底のエコーエリアと呼ばれ る場所に打ったものが表示されます。エコーエリアは画面の一番下の行です。そのす ぐ上の行は、モードラインと呼ばれています。モードラインはこんな風に表示されて いるでしょう。 --**-Ng: Ng.tut (JJJ:fundamental)------------ 注意: あなたが使っている Ng のモードラインと違うかも知れないけど、 慌てないように。 この行によって多くの有用な情報が得られます。 左の方では、あなたが見ているファイル名を表示しています。また、その左が "-----Ng:" ではなく "--**-Ng:" になっている時は、そのバッファの内容が変更さ れていることを示しています。 モードラインの小括弧の中は、漢字コード体系に関するフラグの状態と、今ど んなモードに入っているかを示しています。 Ng は、ファイル入出力、キーボード入力、画面出力について、それぞれ独立に 漢字コードを指定させることが出来、小括弧の中の ":" の左の漢字コード体系に関 するフラグでその状態を表示します。 >> モードライン上に "JJJ", "SSS", "EEE" か "'JSEN-'いずれかの組み合わ せ" が表示されているかどうか確認しなさい。 "JJJ" は順に、ファイル入出力、キーボード入力、画面表示、の漢字コードを 示しており、J は JIS、S はシフト JIS、E は EUC、N は無変換、- は未定を意味し ています。どの漢字コードを使用するかは、その表示によって表されます。 漢字コードの切り替えは、Ng 全体に対して有効ですが、ファイル入出力につい てはそれぞれのバッファについてのみ有効です。それぞれの漢字コードを変更するコ マンドには、次のようなものがあります。 C-x C-k f ファイル入出力漢字コードを切り替える。 C-x C-k i キーボード入力漢字コードを切り替える。 C-x C-k d 画面出力漢字コードを切り替える。 >> C-x C-k f を数回繰り返して実行してみなさい。その時モードラインの "JJJ" がどのように変わるかに注意しなさい。 モードラインの小括弧の中の ":" の右は、今どんなモードに入っているかを示 しています。現在は、デフォルトの fundamental に入っています。 Ng は幾つかのメジャーモードを持っています。どんな時でも必ずいずれかのメ ジャーモードの状態になっています。それぞれのメジャーモードは幾つかのコマンド を全く違う振る舞いにしてしまいます。 検索 ===== ファイル内で、前方又は後方に、文字列を探す事ができます。検索を始めるコ マンドは、カーソル位置以降を検索するならば C-s、カーソル位置以前ならば C-r です。C-s をタイプすると、エコーエリアに "I-search:" という文字列がプロンプ トとして表示されます。ESC を押すと、終了できます。 >> C-s で検索が始まります。それから、ゆっくりと1文字ずつ "cursor" と いう単語を入力します。1文字入力するごとに、カーソルは、どんな動き をしますか? >> もう1度 C-s をタイプすると、次の "cursor" を見つけられます。 >> を4回入力して、カーソルの動きを見なさい。 >> ESC を押して、終了します。 探したい文字列をタイプ中でも、タイプした文字部分だけで、検索を始めます。 次の文字を探すには、再び C-s をタイプします。もし、文字列が存在しなかったら、 メッセージが表示されます。C-g でも終了できます。 検索実行中に を入力すると、検索文字列の1番後ろの文字が消えま す。そして、カーソルは、前回の位置に戻ります。たとえば、"cu" とタイプして、 最初の "cu" の位置にカーソルが動いたとします。ここで を入力すると、 サーチラインの 'u' が消え、カーソルは、'u' をタイプする前に、カーソルがあっ た 'c' の位置に、移動します。(ただし、MS-DOS 版では <=, , C-h 等になる) 検索実行中に、C-s や C-r 以外のコントロール文字をタイプすると、検索は 終了します。 C-s は、現在のカーソル位置以降に出てくる検索文字列を探します。もし、前 の方を探したかったら、C-r をタイプすることで、逆方向検索ができます。C-s と C-r は、検索の方向が反対なだけで、全て同じ働きをします。 ヘルプ ====== Ng には、たくさんの役に立つ機能があり、ここで、すべてを説明することは、 不可能です。しかし、まだ知らない多くの機能を学ぶためには、 と呼ばれる C-h をタイプすることで、おおまかな情報を手に入れることができます。(ただし、 MS-DOS 版では キーになる) 使い方は、C-h をタイプし、続いて必要なオプションを1文字タイプします。 タイプできるのは a, b, c のいずれかです。もし、C-h をタイプしてから気が変わっ たら、C-g をタイプすれば、取り消すことができます。 最も基本的なものは、C-h c です。これに続いてキーを入力すると、そのコマ ンドについての短い説明を表示します。 >> C-h c C-p とタイプしてみなさい。"C-p runs the command previous- line" のようなメッセージが表示されるはずです。 見たことはあるが、覚えてはいないコマンドも思い出せるのです。C-x C-s の ような複数で1つのコマンドも C-h c の後ろに続けられます。 他にも役に立つオプションがあります。 C-h a キーワードを入力すると、名前にそのキーワードを含む、全ての コマンドを表示します。これらのコマンドはすべてESC x で実行 できます。 >> C-h a file とタイプし、 を押しなさい。名前に "file" という 文字を持つ全てのコマンドを表示します。また、find-file や write-file という名の C-x C-f や C-x C-w のようなコマンドも表示さ れます。 C-h b キーに割り当てられている全てのコマンドの名前が表示されます。 >> C-h b とタイプしなさい。 おわりに ======== 忘れずに: 終了するには、C-x C-c とします。 この入門編は、まったくの初心者にもわかりやすいようにと意図しています。 ですから、もし何かわかりにくい点があったなら、一人で愚痴を言うのではなく、文 句をつけて下さい。 Ng は Nemacs と同じように使える、より軽いエディタです。Ng では Nemacs ほど強力な機能は使えませんが、基本的な使い方を覚えるにはちょうどよい教材になっ ています。そして、もし Nemacs を何日かでも使ってみれば、それをやめてしまうこ となどできなくなるでしょう。最初は戸惑うかも知れません。しかし、それはどんな エディタでも同様です。Nemacs のように、非常に多くのことができる場合には特に そうでしょう。そして、Nemacs では、実際、何でもできるのですから。 謝辞 ===== この文書は、JUNET で流された "日本語 MicroEMACS (kemacs) 入門編" を GNU Emacs (NEmacs) の Tutorial 用に書き換えたものを、さらに Ng 用に書き換えたも のです。 Jonathan Payne による "JOVE Tutorial" (19 January 86) を変更したもので あり、それはもともとは、CCA-UNIXのSteve Zimmerman によって変更された、 MIT の "Teach-Emacs" 入門編 (31 October 85) を (さらに) 変更したもので した。 Update - February 1986 by Dana Hoggatt. Update - December 1986 by Kim Leburg. Update/Translate - July 1987 by SANETO Takanori GNU Emacs 版での「特別な謝辞」 ============================== 最初にこれの日本語訳を作られた、SANETO Takanoriさん。この文章はGMW + Wnn + NEmacsを使って書きました。そのような素晴らしいプログラムを作った方々 へ感謝の意を表したいと思います。翻訳とか、入力とかを色々と手伝ってくれた、 藤原祥子さん、どうもありがとう。 誤訳、嘘、その他、の文責は、以下の者にあります。 鈴木裕信 hironobu@sra.co.jp Update/Add - December 1987 by Hironobu Suzuki Update/Add November 1989 by Ken'ichi Handa Ng 版に当たってのさらなる謝辞 ============================= 大元の日本語版を作られた實藤隆則さん、GNU Emacs 版を作られた鈴木裕信さ ん、そしてもちろん Nemacs の作者である半田剣一さん、「たまご」の作者の戸村哲 さん、に感謝します。また、このドキュメントを作成することのできる、様々な環境 を実現してくれた先人達に感謝します。 Ng 版での文責は、以下の者にあります。 吉田茂樹 shige@csk.CO.JP Update - February 1990 by Shigeki Yoshida Update - January 1991 by Shigeki Yoshida ng-1.5beta1/docs/README100644 1750 1750 17505 7126003723 13311 0ustar amurausersMg 2a README May 15, 1988 Mg (mg) is a Public Domain EMACS style editor. It is "broadly" compatible with GNU Emacs, the latest creation of Richard M. Stallman, Chief GNUisance and inventor of Emacs. GNU Emacs (and other portions of GNU as they are released) are essentially free, (there are handling charges for obtaining it) and so is Mg. You may never have to learn another editor. (But probably will, at least long enough to port Mg...) Mg was formerly named MicroGnuEmacs, the name change was done at the request of Richard Stallman. Mg is not associated with the GNU project, and most of it does not have the copyright restrictions present in GNU Emacs. (However, some of the system dependent modules and the regular expression module do have copyright notices, specificly the VMS/primos termcap routines and the amiga specific routines. Look at the source code for exact copyright restrictions.) The Mg authors individually may or may not agree with the opinions expressed by Richard Stallman in "The GNU Manifesto". To avoid GNU copyright restrictions, replace the re_search.c, regex.h and regex.c files with empty files. Documentation of Mg is in the TeX file mg.tex. This should be formatted with the TeX text formatter and printed. A start twords a mg programmers guied in in mgprog.doc, and some of the changes from 1b are mentioned briefly in mg2a.change. This program is intended to be a small, fast, and portable editor for people who can't (or don't want to) run real Emacs thing for one reason or another. It is compatible with GNU because there shouldn't be any reason to learn more than one Emacs flavor. We have excised most MicroEMACS features that were incompatible with the big brother, and added missing features that seemed essential. There are at least two other major versions of MicroEMACS in circulation. One comes from Daniel Lawrence, (based on an old version from Dave Conroy) and is several versions have been posted to usenet. It uses a 3.x version numbering scheme, and the latest I know about is 3.9i. It has some features not found in Mg, missing others, is bigger, and is incompatible with GNU Emacs. It might be a better choice for you if you *must* have something not present here and can't run GNU. Another variety uses a different numbering scheme, and is up to v30. This also comes from mod.sources, and is the latest version from the original MicroEMACS author Dave Conroy. Mg is derived from this version, and for the most part has replaced it. Mg is continuing to diverge from other MicroEmacs varients. Significant modifacations would me nessisary to adapt code from either the 3.x strains or v30. Command functions and key mapping, for instance, are completely different. This is the third distribution release of Mg. (It went through four beta releases to iron out the changes made by the various authors.) Prior releases were known as MicroGnuEmacs 1a and MicroGnuEmacs 1b. Beyond the work of Dave Conroy, author of the original public domain v30, the current version contains the work of: blarson@ecla.usc.edu Bob Larson mic@emx.utexas.edu Mic Kaczmarczik mwm@violet.berkeley.edu Mike Meyer sandra@cs.utah.edu Sandra Loosemore mp1u+@andrew.cmu.edu Michael Portuesi RCKG01M@CALSTATE.BITNET Stephen Walton hakanson@mist.cs.orst.edu Marion Hakanson People who have worked on previos versions of Mg: rtech!daveb@sun.com Dave Brower These systems are known to work in the current version: 4.2 & 4.3 BSD Unix, SunOs 3.2, Ultrix-32 System V OS9/68k VMS Amiga Primos Atari ST Ms-Dos support is planned, but did not get done in time for this release. (Jeff Siegal was the one doing it.) The Ms-Dos files will probably be distributed seperatly when it becomes available. Cpm/68k support was dropped due to compiler bugs. Eunice support was dropped because of lack of interest. Mg 1b does support those systems. One change to late to make it into mg.tex is readding bsmap-mode (only if BSMAP is #defined when compiling). This is a toggle that controls input mapping to exchange the ^H (backspace) and DEL characters. Like GNU emacs input keymaps, it is not displayed on the mode line and will cause them to be treated as each other for echoing. (With bsmap-mode enabled, DEL will echo ^H in the echo line.) How to Make a Mg --------------------------- On UNIX at least, it's easy. (Note that even on these systems you may want to change a compile time option.) If you have BSD UNIX, do: ln sys/bsd/Makefile . make For System V, do: ln sys/sysv/Makefile . make There are several other directories under sys: osk, vms, amiga, atari, prime. You should follow the directions contained therein to make one of those versions. For most systems (everyting except the amiga, and atari currently), the termcap terminal definition is used. There is a readme file in the default subdirectory of the sys directory explaining what entries are used and how. (Termcap is a way to do display manipulation in a terminal independent manner.) Besides the normal startup file (usually .mg) terminal specific initialization files may be used. (For example, in .mg.vt100 you may want to (global-set-key "\e[A" 'previous-line) to have the up arrow key work.) Some changes made to make this version more like Gnu Emacs may break startup files. Gnu Emacs 18 has both backward-delete-char and delete-backward-char that apperently do the same thing. This version has only the latter because that is what is documented in my manual (version 17) and bound by Gnu Emacs to DEL. ---------------------------------------------------------------------- Known limitaions: Recursive bindings may cause help and key rebinding code to go into an infinite loop, aborting with a stack overflow. Overwrite mode does not work in macros. (Characters are inserted rather than overwriting.) Dired mode has some problems: Rename does not update the buffer. Doing a dired again will update the buffer (whether it needs it or not) and will lose any marks for deletion. .. and . are not recognized as special cases. On systems with 16 bit integers, the kill buffer cannot exceed 32767 bytes. New implementation oddities: insert and define-key are new commands corresponding to the mocklisp functions in Gnu Emacs. (Mg does not have non-command functions.) (Mg's insert will only insert one string.) The display wrap code does not work at all like that of GNU emacs. ------------------------------------------------------------------------ If you have a change to make that you think should be incorporated into the next version of Mg, send it the mg-support mail list. Addresses are: mg-support%ais1@ecla.usc.edu {cit-vax,sdcrdcf,trwrb}!oberon!ais1!mg-support Support for additional systems and terminals should include being available for beta testing as other changes are made. (Send a short note to mg-support.) Currently, beta test copies of Mg are made available via Internet ftp, so beta testers need access to the Internet. (UUCP sites that are customers of uunet can get it via them. Contact uunet!uunet-request for details.) If you can't reach one of us via a computer network, I suppose you could send a change to my snail mail address below on 5" os9 format disks or 9 track tape (ANSI variable label or Prime magsav format), but this effectivly rules you out as a potential beta tester. (Don't expect the disk or tape back unless you inculude a SASE with sufficent postage.) I will not be sending out copies on magnetic media, so please don't ask. If you somehow got an incomplete or non-standard copy, (i.e. missing one of the sys directories mentioned here as working) complain to who you got it from not to me. Robert Larson 309 S. Alexandria Ave. Apt. 117 Los Angeles, CA 90020 Alternatively, and under the same conditions, you can send either a 3" AmigaDOS format disk or a 9 track tape (Unix tar format) to: Mike Meyer P.O. Box 4730 Berkeley, CA 94704 ng-1.5beta1/docs/README.Ami100644 1750 1750 5673 7175332115 14005 0ustar amurausers# $Id: README.Ami,v 1.3 2000/10/24 16:09:49 amura Exp $ README.Ami -- この file には、Ng Amiga OS におけるソースの変更点につい て記述してあります。 1. Amiga 依存部分ソース sys/amiga にある機種依存ソースは、mg2b(FredFish#147) のものをベー スに、Ng で機能拡張された ReadOnlyMode とか ShellCommand の起動とか、 TABによる filename 補完などに必要なものを追加した形になっています。追 加は主に ttyio.c fileio.c に対して行なわれています。その辺りの説明は省 くとして、アルゴリズム的(?)に mg2b から大きく変更したのは、次の 2 点で す。 1) ttyio.c 内のルーチンで行なわれていた各 Shared Library の Open,Close を、sysinit.c に移動した。(この方がリーズナブルで ある) 2) RAWkeyConvert によって行なわれていた Keyboard からの入力を、 Console Device からの Read に変更した。(日本語対応のため) また、一部 AREXX への対応のための変更を加えた箇所がありますが、現在 AREXX 未対応のため無効です。当初、mg3b(FredFish#352) の AREXX 用ルーチ ンを利用すれば簡単に対応可能ではと考えたのですが、mg3b ではkeyboardマ クロ機能が強化されていて、AREXX ルーチンはこれと無関係ではなく、マクロ 関連ルーチンまでの変更となるとかなり大掛かりな改造が必要なため、今回は 見送ってあります。(もっとも、わたしが Ng のkeyboard マクロ及びAREXX に 精通してないのが見送ることになった最大の要因ではありますが)さらに、 file R/W 時の Mouse pointer を sleep pointer に変更するためpublic domain なソース、zz_pointer.c を追加しました。 2. Scratch から再実装されたソース Ng 1.4.1 で、Amiga 依存部分ソースのうち、 menustack.c は削除され、 ttymenu.c、iconify.[ch] は新たに書き直されました。これは、 1) ttymenu.c は変更不可とされており、ttymenu.c が依存している menustack.c は変更不可/商用利用不可である。 2) iconify.[ch] は変更の許可が不明で、またソースコードを付けて配布 すること、また、これを利用したソフトを(iconify.cの)作者に送る事、 が使用条件である。(しかし、作者との連絡方法は不明) となっていて、変更が許可されていないにもかかわらず Ng では変更して使用し ていたこと、また、変更前のソースコードに戻したとしても、現在の Ng の配布 条件とはあわないことが理由です。 新たに作成した ttymenu.c、iconify.[ch] は村松が無から作成し直した物で あり、趣味もしくは技術的な理由により元の物の完全なコピーではありません。 1) マクロ V2 を定義してコンパイルすると、アイコン化に workbench.library の機能を使うようになります。 2) メニューの構造がGNU Emacsに近くなりました。 3) Kg 4.x で追加されたコマンドボックスは使えなくなりました。 4) ASL を使わない BROWSER 機能は実装されていません。 3. 使用コンパイラ、コンパイル方法 現在 Ng は GeekGadgets 990501 SNAPSHOT、DICE 3.57 でのコンパイルを確 認しております。SAS C、Manx 用の Makefile も付属しますが、これは SAS C や Manx でコンパイルできるという保証ではありません。 コンパイル方法は sys/amiga から、必要な Makefile / DMakefile をカレン トディレクトリのコピーして make(or DMake) ですむと思います。 H.Ohkubo (ASCII-net pcs35757) Dec.31,1992 amura(村松 篤) <修正加筆> Oct.25,2000 ng-1.5beta1/docs/README.DOS100644 1750 1750 42125 7126003723 13731 0ustar amurausers# $Id: README.DOS,v 1.1.1.1 2000/06/27 01:48:03 amura Exp $ ============================================================================== README.DOS for Ng 1.3 MS-DOS version. 1991.01.25 吉田茂樹 (shige@iamas.ac.jp) 1.4 (修正加筆) 2000.04.20 村松 篤 (amura@ma3.seikyou.ne.jp) ============================================================================== 1. Ng MS-DOS version Ng 1.4 MS-DOS バージョンは、Ng 1.4 を MS-DOS へ移植したものです。Ng 1.4 については、README.Ng をお読み下さい。このドキュメントには、MS-DOS 版に 固有の注意事項等が書かれています。 Ng MS-DOS バージョンは、MS-DOS ver. 3.1 での動作を確認しています。また、 機種依存の部分はありませんので、どの MS-DOS マシンでも利用できるはずです。 (ただし、コンパイル時に IBMPC または PC9801 オプションを指定することによっ て、IBM PC(J-3100) バージョンおよび PC-9801 バージョンにすることもできま す。どのバージョンかを確認するには、ng -v または ng -c を実行して Ng の バージョンを表示させて下さい。ただし、この機能は Ng 1.3 以降でしか利用で きません。以下の説明では MS-DOS/IBM PC/PC-9801 版を合わせて "MS-DOS" 版 と呼びます) [註] 1.4から J-3100 版を IBM PC 版と名称を変更しました。(機能的には変わっ ていません) これは、旧版の J-3100版でも IBM PC互換機(もしくは DOS/V 互換機)で問題なく動作する上、 J-3100 シリーズよりも IBM PC 互換機の 方が一般的になったからです。 ドキュメントで一部変更されていない部分 があるかも知れませんが、J-3100 を IBM PC と読み換えて読んでください。 Ng MS-DOS バージョン用に配布されるものには次のものがあります。 a) UNIX 版と一緒に配布されるソースファイルとドキュメント一式。 b) MS-DOS 版専用のソースファイル一式。 c) MS-DOS 版の実行モジュール一式。 d) ドキュメント一式。 Ng MS-DOS バージョンを利用する場合は c) が、詳しい使い方等を知りたい場合 は d) が、改造等のためコンパイルをしたい場合は a) または b) が必要となり ます。なお、a) には b) および d) のほとんど全てが含まれています。ただし、 一部の機種依存のファイルは含まれません。このドキュメント (README.DOS) は a) から d) 全てに含まれています。 Ng MS-DOS バージョンをコンパイルするには、MS-C 5.1, MS-C 6.0, Turbo-C 1.5, Turbo-C 2.0, Turbo-C++ のいずれかのコンパイラと、MASM または TASM、 OPTASM などのアセンブラが必要です。それ以前のバージョンの MS-C, Turbo-C や MS-C, Turbo-C 以外のコンパイラでコンパイルするには、Ng のソースの手直 しが必要となるでしょう。なお、b) の MS-DOS 版専用のソースの配布には、ア センブラを必要とするソースの .obj ファイルが含まれていますので、アセンブ ラがなくてもコンパイルできます。 2. Manifest Ng MS-DOS バージョンのそれぞれの配布に含まれているファイルは以下の通りで す。 a) UNIX 版と一緒に配布されるソースファイルとドキュメント MANIFEST ファイルをごらん下さい。 b) MS-DOS 版専用のソースファイルの配布 README.DOS このドキュメント。 makefile MS-C 用の makefile。(MS-C 6.0 の nmake および UNIX like の make 用) makefile.msc MS-C 用の makefile。(MS-C 5.1 の make 用) makefile.tc Turbo-C 用の makefile。(Turbo-C 標準の make 用) linkfile link 時に参照される link 用記述ファイル (MS-C 用) linkfile.tc link 時に参照される link 用記述ファイル (Turbo-C 用) *.c C 言語のソース。 *.h ヘッダファイル。 *.asm アセンブラのソース。 *.obj アセンブラソースのオブジェクト。 rawget31.obj rawgetc.asm のオブジェクト (J-3100 用)。 rawget98.obj rawgetc.asm のオブジェクト (PC-9801 用)。 termcap 実行時に必要となる termcap (端末機能記述) ファイル。 ng.ini 初期設定ファイルのサンプル。 COPYING GNU EMACS GENERAL PUBLIC LICENSE c) MS-DOS 版の実行モジュールの配布 README.DOS このドキュメント。 ng.exe Ng の MS-DOS 汎用実行モジュール。 ng31.exe Ng の J-3100 用実行モジュール。 ng98.exe Ng の PC-9801 用実行モジュール。 termcap 実行時に必要となる termcap (端末機能記述) ファイル。 ng.ini 初期設定ファイルのサンプル。 COPYING GNU EMACS GENERAL PUBLIC LICENSE 註) 実行モジュールの配布には、MS-DOS/IBM PC/PC-9801 用のセットがそれ ぞれあり、それらには対象となる機種に合わせて ng.exe, ng31.exe, ng98.exe のいずれか 1 つだけが含まれています。 d) ドキュメントの配布 README.DOS このドキュメント。 README.Ng Ng 全体についての説明。 README Mg2a 全体についての説明。 Ng.doc Ng の日本語機能についての説明。 Ng.tut Ng の初心者用入門チュートリアル。 Ng.ref Ng のリファレンス・マニュアル。 CHANGES.dos Ng のチェンジノート。 fepctrl.doc FEP 自動制御ライブラリの説明。 mg.tex Mg2a のマニュアル。(TeX テキストファイル) mgidx.tex Mg2a マニュアルの索引。(TeX テキストファイル) mg2a.cha Mg2a チェンジノート。 mgprog.doc Mg2a のプログラム内部に関する説明。 COPYING GNU EMACS GENERAL PUBLIC LICENSE 3. Make & Install UNIX 版と同時に配布されたソースファイルを用いて、MS-DOS マシンでコンパイ ルし利用するには、以下の手順の通りに行います。なお、MS-DOS 版専用のソー スファイルの配布を用いる場合は、1) から 6) の手順は必要ありません。さら に、MS-DOS 版の実行モジュールを利用するだけの場合は、1) から 8) の手順は 必要ありません。なお、以下では UNIX マシン上の Ng のソースがあるディレク トリを $NG とします。 1) UNIX マシン上で $NG の下に MS-DOS 用の作業ディレクトリ doswork を作 ります。 cd $NG mkdir doswork 2) $NG の下のファイルを全て $NG/doswork へコピーします。 cp * doswork 3) $NG/sys/default の下のファイルを全て $NG/doswork へコピーします。 cp sys/default/* doswork 4) $NG/sys/msdos の下のファイルを全て $NG/doswork へコピーします。 cp sys/msdos/* doswork [3 と 4 は必ずこの順番で行ってください。$NG/sys/default と $NG/sys/msdos で重複するファイルがあるためです。] 5) paragraph.c を parag.c へ名前を変更して、re_search.c を research.c へ名前を変更します。 cd doswork mv paragraph.c parag.c mv re_search.c research.c 6) $NG/doswork にある全てのファイルを MS-DOS マシンへ転送します。 [必要ならば、改行コードの変更をしてください。アーカイブでは、改行コードは LF のみになっています。このままではMS-DOS 用コンパイラの一部で、問題を起 こします。(Turbo-C 2.02 IBM PC英語版 では正常にコンパイルできませんでし た) うまくコンパイルできない時は改行コードを CR LF に変更してみてくださ い。ただし、この時に漢字コードは変更してはいけません。 (なお、Turbo-C++ 1.01 PC-9801版では改行コードを変更しなくてもコンパイル できます)] 7) 必要な初期設定を行います。 Ng で日本語を扱うためには、コンパイル時に KANJI オプションをつけてコ ンパイルしないといけません。また、禁則処理を行うためには同じく KINSOKU オプションをつけてコンパイルする必要があります。デフォルトで は KANJI および、KINSOKU の両方をつけてコンパイルするようになってい ます。 KANJI, KINSOKU を含めて、コンパイル時オプションは config.h というファ イルで設定を変更できます。デフォルトでは、Ng 1.4 で利用できる機能を 全て利用するような設定になっています。利用したい機能に合わせて適宜変 更して下さい。 IBM PC バージョンまたは PC-9801 バージョンを作りたい場合は、config.h と makefile を修正して、J3100 または PC9801 オプションを define して 下さい。 漢字コードの初期値は、kinit.h で設定されています。必要に応じて変更し て下さい。より詳しくは Ng.doc を御覧下さい。 8) Ng をコンパイルします。 MS-C と MS-C 5.1 に付属している make を使う場合は makefile.msc を、 MS-C と MS-C 6.0 に付属している nmake またはフリーソフトなどで配布さ れている UNIX like の make を使う場合は makefile を、Turbo-C を使う 場合は makefile.tc を使って下さい。なお、各コンパイラがインストール されている環境によっては、makefile.* や linkfile.* のドライブ名やパ ス名を若干手直しする必要があります。 make makefile.msc (MS-C & MS-C 5.1 make) make (MS-C & MS-C 6.0 nmake or MS-C & UNIX like make) make -fmakefile.tc (Turbo-C) [コンパイルに失敗する時:コンパイラ、config.h の設定によっては、Segment Overflow (もしくは、Fixup Overflow) が起こってリンクに失敗する事がある かもしれません。そのときは、お手数ですが、sys/default/ttydef.h 内のマ クロ NROW と NCOL を減らすとリンクできるようになります。ただし、NROW は 25 以上、NCOL は 80以上にしないと問題を起こすかもしれません。] 9) できた ng を PATH 環境変数に設定されているディレクトリのいずれかにコ ピーします。 (例) copy ng.exe a:\bin 10) termcap ファイルを \etc (または、希望するディレクトリ) へコピーしま す。(すでに他のプログラム用に termcap がある場合はこの手順は不要です) (例) copy termcap a:\etc 11) 必要に応じて Ng の初期設定ファイルのサンプル ng.ini を希望するディレ クトリへコピーして、内容を希望する設定に修正します。 (例) copy ng.ini a:\usr\home 12) TERMCAP 環境変数と TERM 環境変数、NG 環境変数または HOME 環境変数を 設定します。これらは Ngを実行するために必要なので、autoexec.bat に書 いておいたほうがよいでしょう。(それぞれの環境変数については下記参照) (例) set TERMCAP=a:\etc\termcap set TERM=j3100 set NG=a:\usr\home 4. Caution & Difference MS-DOS 版 Ng の注意および、UNIX 版 Ng との違いは以下の通りです。 a) TERMCAP 環境変数には、termcap ファイルの位置を指定する。TERMCAP 環境 変数が設定されていないと、カレントドライブの \etc\termcapファイルを探 す。 b) TERM 環境変数には、使用する端末のタイプ (マシンの種類) を指定する。Ng は TERM 環境変数が存在しないと起動できないので、必ず指定する事。なお、 TERM 環境変数に指定する端末のタイプは、termcap ファイル中に存在するも のでないといけない。termcap ファイル中に、使用する端末の記述が存在し ない場合は、同じようなタイプの他の端末を指定するか、他の端末用の記述 を参考にして、追加する。 c) NG (または HOME) 環境変数には、Ng の初期設定ファイルがあるディレクト リを指定する。Ng は起動時に NG 環境変数に設定してあるディレクトリの下 の ng.ini ファイルを探し、見つかればそれを読み込んで解釈し実行する。 NG 環境変数が設定されていなければ、HOME 環境変数に設定してあるディレ クトリの下の ng.ini ファイルを探す。 d) C-@, C-SPC (NUL) に加え、C-\ でもマークの設定ができる。MS-DOS では通 常 C-@ や C-SPC で NUL を入力できないための対処である。ただし、 IBM PC, PC-9801 版では C-SPC で NUL の入力ができるようになっている。 e) bsmap-mode コマンドが使用でき、デフォルトで bsmap-mode が ON になって いる。これにより、C-h で一文字後退削除を行うようになっている。また、 ヘルプは DEL である。 f) cd コマンドで、カレントドライブと違うドライブにあるディレクトリを指定 すると、カレントドライブを切り替えたあと指定されたディレクトリに移る。 また、"ドライブ名:" を指定するとカレントドライブの切り替えだけを行う。 g) suspend-emacs (C-z) コマンドでは、SHELL 環境変数に設定されているコマ ンドの実行を行う。SHELL 環境変数が設定されていなければ、shell, COMSPEC, comspec 環境変数の順に探して、それでもなければ command.com が実行される。これらのコマンドはカレント・ディレクトリか、 PATH に設 定されているディレクトリのいずれかに存在しなければいけない。 h) dired で表示されるファイルサイズと、それを読み込んだ後 list-buffers で表示されるファイルサイズでは、その値が違っている。これは、ディスク 上にあるファイルの各行の最後が ^J^M となっているのに対して、バッファ に読み込まれたものは行の最後が ^J だけになるからである。 i) キー入力は、コンソールから直接読み込みを行っている (MS-DOS のシステム コール 06H を使用している) ので、特殊キーで入力されるコードには注意す る必要がある。例えば、IBM PC シリーズでは初期状態では DEL キーを押し ても、10 進数で 0 と 83 の 2 つのコードが続けて入ってくるだけで、DEL コード (127) は入ってこない。 j) shell-command (ESC !) で使用する一時ファイル ("ng??????") は、TMP 環 境変数に設定されているディレクトリに作成される。TMP 環境変数が設定さ れていなければ、tmp, TEMP, temp 環境変数の順に探して、それでもなけれ ばカレントディレクトリに作成される。 k) デフォルトでは make-backup-files が disable になっている。また、 make-backup-files が enable の時に作成されるバックアップファイル名は、 強制的に拡張子が ".bak" になる。そのため、例えば "foo.c" と "foo.h" という 2 つのファイルのバックアップファイルはどちらも "foo.bak" にな るので注意が必要である。 l) FEP 自動制御機能が追加されている。詳しくは 5. FEP auto control を参照 のこと。 m) Ng MS-DOS バージョンの実行モジュールの配布に含まれている ng.exe, ng31.exe, ng98.exe では、GNU emacs の正規表現ルーチンを使用しているの で、GNU emacs の copyright の制限を受ける。GNU emacs の copyright に ついては、COPYING を参照のこと。 5. FEP auto control コンパイル時に FEPCTRL オプションを指定すると、かな漢字変換フロントエン ドプロセッサを Ng から自動的に制御できるようになります。 Ng で利用できるのは、C-x 2 のように 2 文字目が通常の文字であるようなコマ ンドや、C-x C-f のようにミニバッファで文字列引き数を入力しなければいけな い時に、FEP が on になっている場合自動的に off にして、文字または文字列 の入力が終わったら再度自動的に on にする機能です。 FEP 自動制御機能を使うには、初期設定ファイル ng.ini で (set-fep-control t) と指定するか、Ng 起動後 set-fep-control コマンドで t を指定してください。 なお、これらに n を指定すると FEP 自動制御機能が off になります。 FEP 自動制御機能は、太田純氏による FEPCTRL ライブラリを一部 Ng 用に修正 したものを利用しています。制御できる FEP や使用時の注意、プログラムに関 する注意などは、fepctrl.doc をご覧ください。なお、fepctrl.doc には MS-C でコンパイルすると ATOK7, FIXER が直接制御できない、と書いてありますが、 Ng 用 FEPCTRL ライブラリでは改良を加えて、MS-C でも ATOK7, FIXER を直接 制御できるようになっています。 なお、カレントドライブがフロッピーディスクになっていて、ルートディレクト リに非常に多くのファイルが存在すると、FEP 自動制御機能の初期化のために、 数十秒時間がかかることがあります。 6. For IBM PC & PC-9801 user IBM PC 版と PC-9801 版では、DEL キー、カーソル (矢印) キーなどを Ng 用 に設定するようになっています。他のプログラム用にすでに何らかの設定がされ ていても強制的に Ng 用の設定にしてしまいますので注意をしてください。 他に IBM PC 版では、カーソルの形や動作を設定することができます。 1) IBM PC シリーズ a) IBM PC シリーズでは、以下のキーが Ng で使用できます。 Del DEL コード (127)。 左矢印 (<-) カーソルの左移動。(C-b) 右矢印 (->) カーソルの右移動。(C-f) 上矢印 カーソルの上移動。(C-p) 下矢印 カーソルの下移動。(C-n) Home バッファの先頭への移動。(ESC-<) Pg Up (Prev) 前ページの表示。(ESC-v) Pg Dn (Next) 次ページの表示。(C-v) End (Exec) バッファの最後への移動。(ESC->) Ng を終了すると、初期設定に戻ります。 b) IBM PC シリーズでは ibmpc-set-cursor というコマンドにより、Ng 内 でカーソルの形や動作を指定することができます。 [旧版の j31-set-cursor も使用できます] 初期設定ファイル ng.ini 中では以下のように指定します。 (ibmpc-set-cursor "0,15,t,n") | | | | 指定値 スタートラスター -------+ | | | 0 から 15 エンドラスター -----------+ | | 0 から 15 ブリンク設定 ----------------+ | t または n 終了時動作設定 ----------------+ t または n スタートラスター/エンドラスターでカーソルの大きさを指定します。ス タートラスターの方がエンドラスターより大きい場合はカーソルが消え ます。 ブリンク設定に t を指定するとカーソルが点滅します。n を指定すると 点滅が止まります。 終了時動作設定に t を指定すると、Ng の終了時および suspend-emacs (C-z) 時に現在のカーソル設定をそのまま残します。n を指定すると Ng 起動前または suspend-emacs 終了前のカーソル設定に戻ります。 各値は省略することができます。それぞれの値が省略された時は、その 部分の値は以前のものを使用します。 例) (ibmpc-set-cursor "0,15") 形だけ指定 (ibmpc-set-cursor ",,n") 点滅停止だけ指定 Ng 使用中に ibmpc-set-cursor コマンドを実行するときは、ミニバッ ファのプロンプトに対して一度に各値を指定します。 例) IBM PC Cursor: 0,15,t,n IBM PC Cursor: ,,n 2) PC-9801 シリーズ a) PC-9801 シリーズでは、以下のキーが Ng で使用できます。 DEL DEL コード (127)。 左矢印 (<-) カーソルの左移動。(C-b) 右矢印 (->) カーソルの右移動。(C-f) 上矢印 カーソルの上移動。(C-p) 下矢印 カーソルの下移動。(C-n) ROLL UP 次ページの表示。(C-v) ROLL DOWN 前ページの表示。(ESC-v) HOME CLR バッファの先頭への移動。(ESC-<) HELP バッファの最後への移動。(ESC->) Ng を終了すると、初期設定に戻ります。 7. Turbo-C direct console I/O Turbo-C/C++、Borland C++ の direct console I/O を使う事ができます。 コンパイル時にオプション TCCONIO を設定してください。このとき、termcap ライブラリは使わなくなります。(環境変数 TERM、TERMCAP の設定は不要です。 もちろん、direct console I/O を使うと機種依存しますので注意してください。 MS-C で TCCONIO を設定してもコンパイルエラーを起こすだけなので、設定しな いでください。 8. Author (Only MS-DOS part) 吉田茂樹 Ng MS-DOS バージョン、IBM PC(J-3100) バージョン、 下記以外の追加機能 高野和博 Ng PC-9801 バージョン、C モード、FEP 自動制御機能 白橋明弘 PC-9801 高速バージョン、Turbo-C バージョン 前田薫 ファイル名補完機能、shell-command 機能、 細かなバグ修正 太田純 termcap ライブラリ、FEP 自動制御ライブラリ、 Turbo-C 1.5/++ バージョン 澤柳喜郎 新しい版の補完機能 村松篤 Turbo-C direct console I/O 9. Bug MS-DOS 版に固有のバグは以下の通りです。 a) shell-command (ESC !) で、キーボードからの入力を必要とするような MS-DOS コマンド (例えば "date", "time" など) を実行させるとハング アップする。 ng-1.5beta1/docs/README.H68100644 1750 1750 4741 7126003723 13633 0ustar amurausers# $Id: README.H68,v 1.1.1.1 2000/06/27 01:48:03 amura Exp $ README.H68 -- このファイルには Ng Human68k についての説明が書かれて います。 1. Ng Human68k の動作環境 Ng Human68k は SHARP/X68000 用の OS である Human68k 上で動作する Ng です。Ng につきましては Ng 本体についての README を参照して下さい。 Human68k のバージョンは 2.01 以上であることが必要です。それ未満のバー ジョンでの動作は期待されておりません。 2. コンパイル 既に ng.x が存在し、コンパイルをしなくともよい場合、この章を読む 必要はありません。 コンパイルには XC Version 2 一式、そして最低限 GCC Human68k が必要 です。GCC Human68k には幾つかのバージョンが存在しますが、多分どのバー ジョンでも無修正か、あるいは僅かの修正でコンパイル出来るでしょう。 まずソース・ファイルを X68000 上に置きます。ディレクトリ構成は保存 するようにして下さい。つぎに sys\human68k\Makefile をトップ・ディレク トリにコピーします。コピーされた Makefile の、特に変数 LIBS をそれぞれ の環境にしたがって変更します。変更が済みましたら XC の make を実行しま す。最後までうまくいけば ng.x が作成されたはずです。うまくいかない場合、 様々な理由が考えられますが、どうしてもできないという場合は後記のアドレ スまでメールをお書き下さい。 3. 初期設定 Ng は termcap というファイルを使用します。termcap ファイルは端末の 様々な特性を記述したファイルです。X68000 のコンソール用の記述は sys\ human68k\termcap に用意されています。これを適当な場所に置き、環境変数 TERMCAP にその位置を set します。環境変数 TERM にはターミナルの名前と して x68k を set しておきます。 この X68000 用 termcap ファイルは先人の努力により得られたものであ ることをここにしるし、感謝したいと思います。 4. 仕様 ファイル名補完は大文字小文字を区別します。パスの区切りには '/' と '\' が同等に使えるはずです。Ng 側の標準としては '/' を用います。 5. アドバイス ワイルドカード展開ライブラリを持っていらっしゃる方は Makefile の LIBS に含めるとよいでしょう。標準以外の malloc をリンクされる方は sysinit() を修正あるいは削除したくなると思われます。 6. 謝辞 助力いただいた方の中から特に以下の方の名前を挙げ、感謝したいと思い ます。 小川 嘉徳 (GAPO) さん fepctrl その他 前田 薫 (Mad Player) さん UNIX tools その他 吉野 智興 (Mariko) さん GCC Human68k 吉沢 正敏 (Yoz.) さん hentrap 7. 連絡先 [これは旧版の物です。連絡は村松におねがいします] バグ、改善提案などは後記のアドレスまでお寄せ下さい。 willow@saru.cc.u-tokyo.ac.jp 澤 柳 喜 郎 ng-1.5beta1/docs/README.Ng100644 1750 1750 17260 7225352344 13660 0ustar amurausers# $Id: README.Ng,v 1.5 2001/01/05 14:06:28 amura Exp $ ============================================================================== README.Ng for Ng (Micro Nemacs) 1.3 1991.01.25 吉田茂樹 (shige@iamas.ac.jp) 1.5 (修正加筆) 2000.12.xx 村松 篤 (amura@ma3.seikyou.ne.jp) ============================================================================== 1. Ng Ng (Micro Nemacs) は、Mg (MicroGnuEmacs) をベースにした日本語エディタで、 Nemacs (日本語 GNU emacs) に似た操作感を実現しています。 最新の Ng のバージョンは Ng 1.5beta で、これは Mg 2a をベースにしていて、 Nemacs 3.3.2 に準拠しています。Ng 1.3 からの変更点は CHANGES.new をお読 みください。 Ng 1.5 は フルソースファイルセットで配布されています。従って、Ng 1.5 の 配布セットのみで Ng 1.5 をコンパイルし利用できます。 Ng 1.5 は BSD 系の UNIX と System V 系の UNIX および MS-DOS, SHARP X68000 上の Human68k, Microsoft Win32(Windows CE, Windowns 95/98/NT4.0), Commodore AMIGA 上の AmigaOSで利用できます。それ以外の OS では利用できま せん。 MS-DOS で利用する方は README.DOS も、Human68k で利用する方は README.H68、 AmigaOS では README.Ami、Win32 では README.W32 もお読み下さい。 Ng 1.5 の日本語機能および Ng で追加された機能に関する詳しい説明について は Ng.doc をお読み下さい。 Mg 2a に関しては README をお読み下さい。また、プログラムの内部に関しては mgprog.doc をお読み下さい。 2. Make & Install ここでは、UNIX 版のコンパイルの方法について説明します。それ以外の OS で のコンパイルの方法については、それぞれの README.* をご覧下さい。 1) まず、適当なディレクトリで配布された Ng 1.5 のソースをばらします。 2) configure を実行します。現在、Ng 1.5 の configure には標準のオプション の他に次のようなオプションがあります。 --enable-canna[=dir] Canna を使うようにコンパイルします。 --with-termcap termcap ライブラリを優先的にリンクします。デフォルトです。 --with-terminfo terminfo(curses) ライブラリを優先的にリンクします。termcap ライブラリがタコな OS で使用する時に指定してください。 3) Ng で日本語を扱うためには、コンパイル時に KANJI オプションをつけてコ ンパイルしないといけません。また、禁則処理を行うためには同じく KINSOKU オプションをつけてコンパイルする必要があります。デフォルトで は KANJI および、KINSOKU の両方をつけてコンパイルするようになっていま す。 KANJI, KINSOKU を含めて、コンパイル時オプションは config.h というファ イルで設定を変更できます。デフォルトでは、Ng 1.5 で利用できる機能を全 て利用するような設定になっています。多くの場合、変更する必要はありま せん。しかし、ディスク、メモリの制限などがきつい場合、英語版を作成し たい時は、利用する機能に合わせて適宜変更して下さい。 漢字コードの初期値は、kinit.h で設定されています。必要に応じて変更 して下さい。より詳しくは Ng.doc を御覧下さい。 4) make します。 5) できた ng を適当なディレクトリにインストールします。 make install を実行しましょう。 # autoconf を使うのは初めてなので、環境によっては 上記の手順ではうまくいかな # いかも知れません。その時は 2) の変わりに 2') # # 2')BSD 系の UNIX でコンパイルするには、 # ln sys/bsd/Makefile . # を、System V 系の UNIX でコンパイルするには、 # ln sys/sysv/Makefile . # を実行します。 # # を実行してください。また、ならべくどのように動かなかったのかを報告して欲し # いです。 # (これは移行期間のみです。将来 sys/{bsd,sysv} ディレクトリは削除されます) 3. Manual & Tutorial Ng の簡単な使い方の説明が Ng.tut に書いてあります。これをよく読んで、実 際に説明の通りに操作してみれば、おおまかな使い方は覚えられると思います。 実際に操作してみる場合には、Ng.tut のバックアップを作っておいてから、 ng Ng.tut を実行して下さい。あとは、書かれている説明に従っていろいろコマンドを実行 してみて下さい。 Ng.tut に説明してあるたいていのコマンドは、Nemacs や GNU emacs でも同じ ように操作することができます。ただし、Nemacs や GNU emacs はより多くの機 能を持っていますので、Nemacs や GNU emacs の様々な機能を使いこなすために は、それぞれのマニュアル等を御覧下さい。 Ng.ref には、Ng で使用することのできる全コマンドの一覧が示してあります。 ただし、コンパイル時オプションの設定によっては、利用できないコマンドもあ りますので注意して下さい。 日本語機能に関する説明は Ng.doc に書かれていますが、それ以外の機能につい ての説明は、mg.tex に TeX のテキストとして書かれています。これを印刷 (プ リンタ等への出力) するには、文書清書システムの TeX が必要です。 4. Copyright 現在、Ng は、正規表現ルーチン(re_search.c, regex_{j,e}.h, regex_{j,e}.c)、 Win32 版のソースの一部は GPL にて、残りの部分は BSD-style License で配布 されています。 ここでいう BSD-style License とは、簡単に書くと Ng はフリーソフトウェアであり、著作権表示削除しない事、免責表示 「当ソフトウェアを利用する事により、いかなる不利益や障害が発生して も、著者は一切の責を負わない」をソースコードもしくは付属のドキュ メントに明記する事を守れば、修正、改造の有無にかかわらず、自由に利 用、再配布できます。 というものです。詳しくは同封の LICENSE ファイルをご覧ください。 GPL で配布されているソースには GPL のライセンス表示がソースの先頭に書かれ ていますのでそれにしたがってください。 オリジナルの Mg は、ほとんどの部分には著作権がなく、Public Domain に置 かれていると宣言されています。 正規表現ルーチン (re_search.c, regex_{j,e}.h, regex_{j,e}.c) については Richard M. Stallman が著作権を保有しています。GNU emacs の copyright に よる制限を避けたい時には、この 3 つのソースを空ファイルと置き換えるよう に、という原著作者の記述が README にあります。GNU emacs の copyright は COPYING をご覧ください。 太田純氏による MS-DOS 用 FEP 自動制御ライブラリ fepctrl.c は、パブリッ クドメインに置かれたものとして扱われることを期待する旨がドキュメントに 書かれています。また、MS-DOS 用 termcap ライブラリ (termcap.c) は nearly public domain に置かれていると宣言されています。 5. Author Dave Conroy 古いバージョンの MicroEmacs, v30 Dave Brower 古いバージョンの Mg Bob Larson 現在のバージョンの Mg Mic Kaczmarczik 同上 Mike Meyer 同上 Sandra Loosemore 同上 Michael Portuesi 同上 Stephen Walton 同上 Marion Hakanson 同上 吉田茂樹 日本語化 (Ng)、下記以外の追加機能、ドキュメント、 Ng MS-DOS バージョン、J-3100 バージョン 高野和博 Ng PC-9801 バージョン、C モード、FEP 自動制御機能 白橋明弘 PC-9801 高速バージョン、Turbo-C バージョン 前田薫 ファイル名補完機能、shell-command 機能、 細かなバグ修正 太田純 termcap ライブラリ、FEP 自動制御ライブラリ、 Turbo-C 1.5/++ バージョン 澤柳喜郎 Ng X68000 バージョン、新しい版の補完機能 佐々木茂彦 半角仮名対応。 H.Ohkubo Ng AMIGA バージョン 小西宏和 Ng AMIGA バージョンの改良、Simple Kanji Generator 伊藤栄一郎 Ng WinCE 英語バージョン 今井透 Ng Win32 日本語バージョン、新しい dir 制御 遠藤康裕 CANNA による日本語入力機能 角川裕次 minibuffer での編集機能 黒木玄、別所博之、野村ゆうじ、十代田浩児、 小柳洋一、新保さん、岡本さん、若林さん、木原英人他 Patch の contribute 村松篤 現在保守をしています。 6. Bug report バグや要望などは、E-mail で以下のアドレスに送って下さい。 amura@ma3.seikyou.ne.jp なお、現在わかっているバグは以下の通りです。 a) JIS コード入力時に入力された通常の ESC は、続いて入力される文字に より、漢字選択/ASCII 選択エスケープシークエンスではない事が確定す るまで有効にはならない。 b) fill-prefix 文字列および、それを含めた英単語 1 つの長さが、 fill-column より長い場合、動作が保証されない。(core dump または hang up) d) 日本語と英単語の間に ' ' がある状態での fill-word, fill-paragraph の動作がおかしい時がある。 ng-1.5beta1/docs/README.SKG100644 1750 1750 17432 7175070052 13736 0ustar amurausers# $Id: README.SKG,v 1.2 2000/10/23 17:06:50 amura Exp $ <<< **** SKG version 4.2 **** >>> Ng 用簡易漢字変換(SKG)の解説 Emacs-lisp上の日本語入力システムSKK *1に準拠した漢字辞書を使用した漢 字変換機能です。 漢字変換は、単文節変換です。つまり、変換は頭から行い、残りをひらがな として扱う、というタイプです。口語体に対して強く パソコン通信などで書 き込みを行うのがメイン目的となる場合には妥当だと思い、採用しました。 これでも充二分に働くと思っています。 * 作成の動機 : 誰もが指摘するように、Amiga *2ではまだ日本語を安定して扱うことがで きません。ミックジャパン *3によってAmigaにバンドルされているANS *4 も不安定で、とても実用には耐えられません(A4000/040では暴走するし... ^^;)。 しかし、暴走するのは入力時で、漢字表示に関しては 全くと言っていいほ ど問題ありません。「ならば、ちゃんと意味ある漢字のコ―ドの文字列を生 成することさえできればAmigaでも日本語の入力ができる!」というわけで、 このSKGができました。 あと、三好新二さんが「SKKのような軽い漢字変換が...」*5 という言葉に インスパイアされ、SKKのフォ―マットに準拠した漢字変換を採用しました。 このSKGを組み込んだNgさえあれば、ANS環境上で、ちょっとしない書き込み を(^^;)オフラインでやることができるようになります。ANSと両立すること ができるAKシリ―ズ *6 などを用いてください。但し、私自身Amigaで通信し たことがないので、実際に試したことはありません。 また、Amigaでなくとも、漢字の表示は出来るが入力が出来ない環境(英語版 のWindowsに日本語フォントのみいれてあるとか、仮名漢字変換サーバーが動 いていないUNIXで使うとか)では役立つかも知れません。 * 使用方法: まず、適当なディレクトリに、辞書ファイルとなるSKG-JISYOと ロ―マ字変 換ファイルとなるSKG-ROMANを置いてください。 そして、Ng 初期化ファイル(.ng、ng.ini、もしくはS:Ng-Startup)に 以下の ように記述してください。(ちなみに Work:tools/KGDOC は SKG-ROMAN と SKG-JISYOを置いたディレクトリ名です。) (set-skg-roman-dictionary "Work:tools/KGDOC/SKG-ROMAN") (set-skg-kanji-dictionary "Work:tools/KGDOC/SKG-JISYO") SKGによる漢字変換モ―ドへは、 ESC C-k ( あるいは M-x skg-input ) で入ることができます。漢字変換モ―ドになると、 Skg[あ]:_ というプロンプトがミニバッファ行にでます。あとはロ―マ字で入力していけ ば、自動的にひらがなに変換してくれます。大文字で入力するとカタカナにな ります。C-\を打つと、プロンプトが、 Skg[*a]:_ にかわり、ANK文字入力モ―ドになります。(注意:"."→"。"といった記号の変 換はこのANK文字入力モ―ドでやってください) SKGを終了するときは、何も入力していない状態で RET か、C-gを押してくだ さい。入力文字列が存在する状態で C-gを押すと、入力された文字列がクリア されます。また、[←]-KeyがBackSpaceとなっています。 Skg[あ]:かんじで_ 読みが入力できたら、SPCを打ってください。そうすれば、漢字変換してくれ ます。(何も入力していない状態でSPCを打つと半角空白がテキストにInsertさ れます) RETを打つと、漢字変換せず、そのままバッファの内容を テキストに Insertします。 Skg[--]?|漢字|で ||でくくられた部分が漢字変換されたところです。あとは SPCと C-pで候補を 選択することができます。(注意:現在の仕様では候補選択方向を逆にする場合、 キ―を2度押さないといけない)。選びたい文字列が見つかったらRETを押してく ださい。SKGでは、変換長を変更することはできないので(最長探索)、変換長を 変えたいときは C-g を押して、ひらがな入力モードに戻り、入力文字列を再編 集してください *7。 * システムの説明: SKKの漢字辞書フォ―マットで書いてあれば、SKGの辞書として使用できます。 ア―カイブに入っている辞書は、SKKのミドル版漢字辞書(SKK-JISYO.M)に若干 エントリを加えたものです。自分がよく使用する単語を辞書に登録することも できます。辞書フォ―マットは、 : 読み /漢字候補1/漢字候補2/.../.../漢字候補n/ : という構造になっております。好きなようにエントリを加えてください。辞書 ファイル内の順番は、SKKの準拠してください *8。(読みのあとの空白文字を 忘れないこと) SKG-ROMANにロ―マ字仮名変換ル―ルが記述されています。これも自由に記述 することができます。自分のキ―タッチに合わせたル―ルに変更することがで きます。 辞書ファイルの漢字コ―ドはEUCを用いています(というより、EUCでないとダ メ^^;)です) あと、Amiga上で書いたテキストを他のマシンに持っていく場合は、改行コ― ドに注意してください。Amiga上で改行は0x0a(=LF)コ―ドのみです。0x0d(=CR) が必要なマシンがありますので、必要な変換をほどこしてください。 * 今後の展開: 漢字の表示はANSにまかせているのですが、このフォントが実に見にくいので す。選択した漢字を確認するのに、かなり高いパタ―ン認識力が必要です(^^;)。 とりあえず K14.fontを使用したほうがマシのようです(^^;)。いずれにしろ、 もっとクリアな日本語表示システムが登場することが待たれるでしょう。 それでは、このNgがAmigaのフィ―ルドをさらに拡げることを願っています。 --------------------------------------------------------------------- Usage: ESC C-k skg-input SKGの起動。 (入力モード) SPC 変換(辞書検索開始.候補選択モードへ) RET 無変換(入力バッファの内容をそのままテキストにインサート) C-l 現在のテキスト上でのカーソルの位置を表示。 C-g SKGの終了。(入力バッファに文字列がある場合、クリアする) BS(←) バックスペース C-\ ANK/ひらがな入力モード切替 (候補選択モード) RET 現在、表示されている候補をインサート。 SPC 次候補 C-n 次候補(SPCと同じ) C-p 前候補 C-g 入力モードへ戻る。 --------------------------------------------------------------------- ***** History (ここでの Version は Kg の物です) Version 2.x からの変更点: ・SKG-ROMANを若干手直し. 記号の入力を追加など. ・辞書検索の高速化。1文字めの内容をみて、そのエントリを読み飛ば すかどうか判断するルーティンを追加。これで15%ほど改善。また、 Kg2.xでは辞書ファイルをいちいち全部スキャンしていたのを、必要 なエントリを見つけたら、スキャンをうち切るようにした。これで、 平均辞書探索速度がかなり改善。 ・おかしなコントロール文字を入力した場合にUSAGEがでるようにした。 Version 3.2 からの変更点: ・辞書検索のスピードアップ。 130KB(SKG-JISYO.M)の辞書で最悪(体感)3秒以内で検索を終了する ようにファイルアクセス・ルーチンを改善。 ・現在のカーソルポジションの表示機能の追加。 カーソルがSkgのプロンプトに取られてしまい、日本語のテキストを 挿入する場所が分からなかったので、Ctrl-Lで現在のテキストのカー ソル・ポイントをいったん表示するコマンドを加えた。 ・候補選択の改善。 Ctrl-P, Ctrl-Nによる漢字候補選択方法を改善。 ・SKG入力モードにおけるCtrl-Gの使用を変更。 プロンプトに 文字列が存在する場合、Ctrl-Gで文字列をクリアする 使用に変更。またクリアされた状態でもう一度Ctrl-Gを押すとQuitす るようにした。 Version 4.1 からの変更点: ・SKG入力モードで、Ngの編集コマンドが使えるようした。 ____ *1 Skkは、佐藤 雅彦 (東北大学電気通信研究所)らのグループが開発した Nemacs/mule のために高速で効率的な日本語入力環境を提供するシステム で、Gnu General Public Licenseに従ったfree softwareとして配布されて います。 *2 今は亡きCommodoreの販売していたMotorola 680x0を使用したパソコンです。 Commodreが倒産した後、ESCOM->Gatewayと渡り歩き、今はAMIGA,Incが販売 しています。 *3 Commodoreの正規代理店でした。Commodoreが倒産した余波で倒産しちゃいま した。 *4 ミックジャパンが開発した、Amiga で日本語を扱えるようにするソフトで す。今は入手できません。かわりにJKFFとか大語界とかを使いましょう。 *5 どうやら、三好新二さんが話していたSKKと僕が採用したSKKとは別ものだっ たみたいです(^^;)。 *6 推奨環境は、ANSを動かし、通信ソフトはAK-Termを、Ngで書いた文章をNTV で確認といったところでしょうか。 (でも、僕(小西さん)はAmigaで通信してないので動作確認してません ^^;) *7 SKGでは、バッファサイズが許すかぎり、候補をバッファリングします。つ まり、'あいさつ'を変換すると、"挨拶","愛さつ","哀さつ","相さつ",..., "合いさつ"といった感じで、最長候補の長さに合わせ、ひらがなをつめてく れます。 *8 SKKの辞書内のエントリは、完全にソートされてなくてはいけません。 -------------- このドキュメントは 小西宏和氏の Kg 4.2.1 の Readme.doc を元に作成しま した。 ng-1.5beta1/docs/README.W32100644 1750 1750 30160 7137576066 13674 0ustar amurausers# $Id: README.W32,v 1.2 2000/07/26 14:56:54 amura Exp $ Ng for Win32 Version 0.4 June 7, 1999 1. Ng とは Ng とは著名なエディタである Emacs と同様の操作感を提供する MicroEmacs の一つである MG (Micro GNU Emacs)を吉田茂樹さんが中心となり日本語化し たバージョンで、当初は Nihongo micro GNU Emacs、後期には Micro Nemacs と呼ばれているものです。 Ng の歴史は大変古く、開発が盛んに行われていたのは 1990 年頃にさかのぼ ります。当初は UNIX 上で動作するエディタとして開発され、後に MS-DOS に 移植されています。 この Ng ですが、Windows 時代の到来とともに動きが不活発になり、1992 年 の 1.3L を最後に最近まではアップデートが行われておりませんでした。とこ ろが、1998年の 12 月頃伊藤栄一郎さんが MS-DOS 版をベースに Windows CE の英語版に Ng を移植、Tillanosoft が今回提供するものはこの伊藤栄一郎さ んの移植バージョンである 0.12 をベースに日本語版 Windows CE に移植した ものです(対応する MGのバージョンは 2a、Ng のバージョンは 1.3L になりま す)。 "Micro" Emacs ということで、たとえば GNU Emacs と比較すると機能は大変 限られたものになります。しかし、キーバインディングはかなり GNU Emacs の雰囲気を持っていいますし、「バッファ」を利用して複数のファイルを同時 に開いたり、一つのファイルを複数の「窓」で表示したりといったエッセンス はまさに Emacs であると言えましょう。 また、"Micro" Emacs ということで、GNU Emacs では Lisp ライブラリのイン ストールで数十MBのファイルのインストールが必要だったところを、Ng では たった一つの実行形式ファイル(200KB前後)のインストールだけで利用するこ とが可能です。 上記で述べたことを含め Ng for Win32 の特徴的なポイントをいくつかあげて おきます。 (1) Emacs のエッセンスを提供 キーバインディングはもちろん、バッファの概念、C-x 2 による複数のエディッ トウィンドウなど、そのまんま小型の Emacs となっています。 (2) dired 機能を提供 GNU Emacs で提供されている dired (ディレクトリエディタ)機能のうち、 中心的な機能を提供。また、Tillanosoft により、dired-do-shell-command が追加されており、dired 内からファイルを実行できるようになっています。 これにより dired を簡易ランチャーとして利用することができます。 (3) コントロールキーのマップ機能を提供 Mobile Gear (CS または II)では A キーの左横のキー(英数キーですね)を コントロールキーに割り当てる機能がシステムにより提供されていますが、 カシオペアのようにそのような機能が提供されていない H/PC も存在します。 Ng for Win32では、Tillanosoft により、英数キーをコントロールキーとし て利用する機能が提供されます。 *注意* ただし、現在の所 Windows95、WindowsNT では不具合のため実用に耐えませ ん。 (4) メールの作成等に最適な auto-fill-mode の提供 auto-fill-mode とは文章作成時に、決められたコラム位置で自動的に折り 返し処理を入れる機能です。たとえばこのドキュメントも auto-fill-mode で作成されています。段落の左右の位置がそろっていることをご確認くださ い。 Ng (や Emacs)の auto-fill-mode では、左側部分と折り返し位置を指定す ることが可能で、入力後に編集しデコボコになってしまった場合でも再度位 置ぞろえをやりなおすことができます(fill-paragraph)。 2. インストール方法 配布パッケージを解凍するといくつかの ng.exe が出てきます。それぞれの ng.exe は CPU および Windows CE のバージョンにより以下のフォルダに置い てあります。 ce1mips -- Windows CE 1.0 対応の MIPS 版。動作確認はしておりませんが、 Windows CE 2.0 でも動くと思います。 ce2sh -- Windows CE 2.0 対応の SH 版。Windows CE 1.0 では動きません。 w32intel - Windows 95/98/NT4.0 対応の Intel 版。 上記の ng.exe のうちお使いの PC に対応するものをお好みの場所に放り込ん でください。また必要に応じてng.iniをお好みの場所に置いてください。 3. アンインストール方法 ng.exe と ng.ini を削除することによりアンインストールできます。 Ng for Win32 は以下のレジストリエントリを利用しています。放置しておい ても問題はありませんが、気になる場合はレジストリエディタ等で削除してく ださい。 HKEY_CURRENT_USER\Software\mg-developers\Ng 4. 起動方法 インストールした ng.exe を実行してください。起動オプションについては、 Ng.ref および SUPDOC.N32 をご参照ください。 また、最初の起動時に Ng for Win32 にて、M-x configure RET と入力し初期 化ファイルとして用いる ng.ini をフルパスで指定してください。この設定は 次回の Ng の起動時から有効になります。 なお、M-x は Alt キーを押しながら X キーを押すことを、RET は Enter キー を押すことを意味します。 5. 終了方法 C-x C-c と続けてキー入力してください。C-x はコントロールキーを押しなが ら X キーを、C-c はコントロールキーを押しながら C キーを押すことを意味 します。 6. ドキュメントファイル 本ファイル以外にも各種ドキュメントファイルに目を通していただけますと Ng についてより詳しく知ることができます。必要に応じて目をお通しくださ い。 README.N32 本ファイル CHANGES.N32 Ng for Win32 の変更履歴 SUPDOC.N32 下記の各ドキュメントに対するNg for Win32 の補足事項 README.TXT 伊藤栄一郎氏の Ng for WinCE の README README.DOS MS-DOS 版の Ng 1.3 についての説明 README.Ng Ng 1.3 の全般的な説明 README MG 2a 全体についての説明 Ng.doc Ng の日本語機能についての説明 Ng.tut Ng の初心者用入門チュートリアル Ng.ref Ng のリファレンス・マニュアル CHANGES.dos Ng 1.3 にいたるまでの改版履歴 mg.tex MG のマニュアル (TeX ファイル) mgidx.tex MG マニュアルの索引 (TeX ファイル) mg2a.change MG 2A にいたるまでの改版履歴 mgprog.doc MG のソースコードに関する説明 COPYING re_search.c, regex.h, regex.c に適用される著作権記述 7. 著作権表示 Ng for Win32 はフリーソフトウェアであり、Tillanosoft による Ng for Win32 のための修正部分に関する権利の主張も特にいたしません。ただし、利 用に際しては Tillanosoft による修正をはじめとした、Ng for Win32 に起因 する事由により直接間接を問わずいかなる損害が出た場合においても Tillanosoft および Ng 著作者は一切の責任を問われないという条件に同意い ただくことを前提とさせていただきます。 なお、Ng for Win32 は伊藤栄一郎氏の Ng for WinCE をベースにしておりま すが、伊藤栄一郎氏は特に著作権についての記述を readme には入れておらず、 単に GNU Emacs の GPL 記述ファイルを配布物件に含め、readme ファイルに てそのファイルの内容を簡単に説明しているのみです。これは氏の改造部分の 権利を GPL にしたがうものにするとの意志のあらわれかと思われます。 また、Ng for Win32 および Ng for WinCE がベースとしている Ng 自身もフ リーソフトであることがオリジナル readme ファイルにて明記されています。 以下に Ng の著作権に関する記述を引用します。 Ng はフリーソフトウェアであり、営利を目的としない限り自由に利用、改造、 修正、再配布できます。ただし、Ng を利用する事により不利益や障害が しても、著者は一切の責を負いません。 オリジナルの Mg は、ほとんどの部分には著作権がなく、Public Domain に置 かれていると宣言されています。 正規表現ルーチン (re_search.c, regex.h, regex.c) については Richard M. Stallman が著作権を保有しています。GNU emacs の copyright による制限を 避けたい時には、この 3 つのソースを空ファイルと置き換えるように、とい う原著作者の記述が README にあります。GNU emacs の copyright は COPYING をご覧ください。 太田純氏による MS-DOS 用 FEP 自動制御ライブラリ fepctrl.c, fepcsub.asm は、パブリックドメインに置かれたものとして扱われることを期待する旨がドキュ メントに書かれています。また、MS-DOS 用 termcap ライブラリ (termcap.c) は nearly public domain に置かれていると宣言されています。 8. 著作者 著作者の記述を README.Ng から引用し、一部補足します。 Dave Conroy 古いバージョンの MicroEmacs, v30 Dave Brower 古いバージョンの Mg Bob Larson 現在のバージョンの Mg Mic Kaczmarczik 同上 Mike Meyer 同上 Sandra Loosemore 同上 Michael Portuesi 同上 Stephen Walton 同上 Marion Hakanson 同上 吉田茂樹 日本語化 (Ng)、下記以外の追加機能、ドキュメント、 Ng MS-DOS バージョン、J-3100 バージョン 高野和博 Ng PC-9801 バージョン、C モード、FEP 自動制御機能 白橋明弘 PC-9801 高速バージョン、Turbo-C バージョン 前田薫 ファイル名補完機能、shell-command 機能、 細かなバグ修正 太田純 termcap ライブラリ、FEP 自動制御ライブラリ、 Turbo-C 1.5/++ バージョン 澤柳喜郎 Ng X68000 バージョン、新しい版の補完機能 伊藤栄一郎 英語版 Windows CE バージョン Tillanosoft 日本語版 Windows CE バージョン 9. 制限事項 以下については将来の課題とします。 (1) undo がまったくない MG, Ng, Ng for Win CE, Ng for Win32 とも undo をまったくサポートして いません。 (2) mini buffer GNU Emacs とは異なりミニバッファはバッファではありません。つまり、通 常の編集操作はミニバッファでは行えませんので注意してください。 なお、ミニバッファにおけるキーマッピングに関する記述は日本語のドキュ メントには含まれません。mg.tex にキーバインディングが書いてありますが、 Ng でのミニバッファのキーバインディングに慣れてしまうと本物の Emacs を使うときに支障が出る恐れがありますのでご注意ください。 (3) ファイル名コンプリーションの制限 file completionで、パスの最中に .. が入ると completion できなくなりま す。 (4) dired dired 上で rename や copy 操作が、実際の dired の画面に反映されません。 また、些細な問題ですが、dired でのカーソル位置が GNU Emacs とは異なり ます。こちらは近いうちに直したいと思います。 (5) toroku-region がない バッファ上に存在する単語を M-x toroku-region で単語登録できるようにし たいですね。 (6) overwite-mode における制限 マクロの実行中は文字の入力が挿入モードで行われます。 (7) Windows CE 1.0 における dired-do-shell-command における制限 Windows CE 1.0 以外では、ディレクトリ(フォルダ)に対して dired-do-shell-command を行うと該当するディレクトリを対象としてエクス プローラが起動しますが、Windows CE 1.0 では起動されません。 (8) Windows 95/98/NT4.0 版における dired-do-shell-command の制限 .htm/.html に IE が割り当てられているときに、.htm/.html ファイルに対 する dired-do-shell-command が正常に動作しないようです。 (9) Windows 95/98/NT 版におけるリサイズ時/フォント変更時の制限 Windows 95/98/NT 版でウィンドウのサイズ変更を行ったり、フォントの変更 を行ったときに画面が真っ白になることがあります。その場合、画面をクリッ クする、C-l を入力するなどで画面を再描画してください。 (10) ファイル名長の制限 ファイル名の長さが 24 バイトを超えるファイルは扱えません。 10. サポートされているプラットフォーム 現在以下のプラットフォームをサポートしています。 サポート 動作確認機種 該当機種 CE1.0 SH3 × MIPS ○ MobileGear CS12 CE2.0 SH3 ○ Cassiopeia A-51up Persona MIPS × 95/98/NT4.0 Intel ○ PC-AT互換機 11. ソース環境 Ng for Win32 のビルド環境は UNIX 版の Ng の make 環境をベースに作成さ れております。基本的なディレクトリ構成は同等で、sys/ サブディレクトリ の下に Win32 特有のファイルを格納している win32/ サブディレクトリを設 けております。 したがってこのソース一式をベースに UNIX 版および MS-DOS 版の Ng も作成 できると思います。Tillanosoft では同一ソース環境をベースに Windows CE, Windows 95/98/NT および FreeBSD 2.2.5-release を対象にビルドまたは make してひと通りの動作を確認しております。 12. ビルドに必要な開発環境 Ng for Win32 をソースからビルドするには以下の開発環境が必要です。 Microsoft Windows NT 4.0 Workstation または Server Microsoft Developper Studio 97 Professional Edition Visual C++ V5.0 Microsoft Windows CE Toolkit for Visual C++ V5.0 13. ビルド方法 このファイルが存在するディレクトリと同じディレクトリに、ng.dsw が存在 しますので Developer Studio のメニューの「ファイル」→「ワークスペース を開く」にて本ファイルを指定してください。あとは、ターゲット CPU およ び Windows CE のバージョンを指定してメニューの「ビルド」→「ビルド」を 選択すれば OK です。 なお、アイコンビットマップは Windows CE 1.0 用(ce1appicon.ico)と Windows CE 2.0 用(ce2appicon.ico)の 2 つのファイルを用意しております。 適宜目的の Windows CE バージョンに応じて appicon.ico という名前のファ イルにコピーしてご利用ください。(ce2appicon.ico はモノクロマシン用に 4 値モノクロアイコンを含んでいますが、Developer Studio で CE 1.0 用のビ ルドを行うとカラーアイコンから 4 値アイコンをつくり出そうとしてしまい ます。ce1appicon.ico はこのカラーアイコンを含んでいないアイコンです。 14. 変更履歴 ※最新版は以下のURLに置かれます。 http://www.geocities.co.jp/SiliconValley-PaloAlto/5006/downloads.html 0.4 1999.6.7 β4版 95/98 版サポートなど 0.3 1999.5.20 β3版 NT 版サポートなど 0.2 1999.4.21 β2版 configure 項目の追加など 0.1 1999.4.15 β1版 日本語版 Windows CE 対応 各版の修正内容の詳細は CHANGES.W32 をご参照ください。 以上 ng-1.5beta1/docs/fepctrl.doc100644 1750 1750 133714 7126003723 14600 0ustar amurausers# $Id: fepctrl.doc,v 1.1.1.1 2000/06/27 01:48:03 amura Exp $ ============================================================================ 日本語入力 FEP 操作ライブラリー FEPCTRL ユーザーズマニュアル ============================================================================ 【名称】 FEPCTRL - 日本語入力 FEP をアプリケーションから制御する 【バージョン】 1.5 - 1992/04/08 【形式】 #include "fepctrl.h" int fep_init(void) ... 初期化および変換オフ void fep_term(void) ... 変換状態の復元および終了処理 void fep_on(void) ... fep_off() 時の変換状態に戻す void fep_off(void) ... 変換状態を保存して変換オフ void fep_force_on(void) ... 変換オン void fep_force_off(void) ... 変換状態を保存せず変換オフ int fep_raw_init(void) ... 初期化 void fep_raw_term(void) ... 終了処理 int fep_get_mode(void) ... 変換状態の取得 【説明】 FEPCTRL は C 言語で書かれたアプリケーションから MS-DOS 上の日本語入 力 FEP の変換オン・オフを制御するためのライブラリーである。このライ ブラリーを使うことにより、組み込まれている FEP の種類によらず、さま ざまな FEP をアプリケーションから統一的に制御することができる。 このライブラリーを使うアプリケーションは、最初に fep_init() を呼ばな ければならない。fep_init() は組み込まれている FEP を識別し、変換オン の状態であればオフにしてから、各 FEP に対応する定数を返す。この定数 は fepctrl.h に enum 型で定義されており、いずれの FEP の組み込みも確 認できない場合には FEP_NONE、すなわち 0 が返る。これ以後 fep_term() が呼ばれるまでのあいだ、アプリケーションはライブラリーの各関数を利用 できる。アプリケーションは、ライブラリーの使用終了時には fep_term() を呼ばなければならない。fep_term() は FEP を fep_init() が呼ばれたと きの変換状態に戻す。fep_init() と fep_term() の組はアプリケーション の実行中に何度実行されてもよく、特に子プロセスの実行など制御がプログ ラムを離れる場合には、その直前直後を fep_term() と fep_init() で囲ん でおく必要がある。ただし、2 回目以降に実行された fep_init() では FEP の識別を行わないので、この間に FEP を切り放したり組み替えたりすると 動作が正常に行われない恐れがある。なお、FEP が FEP_NONE であっても各 ライブラリー関数を呼んで差し支えなく、この場合は何の動作も行われない。 fep_off() は FEP の現在の変換状態を記憶し、変換をオフにする。fep_on() は FEP を fep_off() が呼ばれたときの変換状態に戻す。ただし fep_off() が呼ばれていない状態で fep_on() が呼ばれた場合は fep_init() が呼ばれ たときの変換状態になる。つまり、アプリケーションが一時的に FEP を通 さずに入力を行いたい場合、その前後を fep_off() と fep_on() で囲めば よい。fep_off() を呼んだときの変換モードは、それが日本語入力状態であ ろうとなかろうと、fep_on() が呼ばれた段階で回復されることになる。 fep_force_on() は無条件に変換をオンにする。このときの変換状態は FEP に依存する。fep_force_off() は現在の変換状態を記憶することなく変換を オフにする。プログラムが通常は変換オフの状態で実行されていて、一時的 に日本語入力が必要になる場合には、fep_force_on() と fep_force_off() でその前後を囲めばよい。 fep_raw_init()、fep_raw_term() は fep_init()、fep_term() と同様に初 期化と終了処理を行うが、fep_raw_init() は FEP を変換オフの状態にせず、 fep_raw_term() は FEP を fep_raw_term() が呼ばれたときの状態に戻すこ とをしない。FEP を初期化時と異なる状態にして終了するようなアプリケー ションでは、fep_init() や fep_term() の代わりにこちらの関数を使う必 要がある。なお、fep_init() や fep_term() と同時には使用できない。 fep_get_mode() は FEP の現在の変換状態を返す。この値は FEP がオフの ときには 0、オンのときには 0 以外である。 定義されている FEP の数は FEP_NONE を含め NFEPS 個であり、fep_init() が返す値は 0 以上 NFEPS-1 以下の数値である。定数 NFEPS は fepctrl.h 中で enum 型の値として定義されている。 このライブラリーは Turbo C 1.5/2.0、Turbo C++ 1.0、Borland C++ 2.0/ 3.0、Microsoft C 5.1/6.0、Quick C 2.0、Lattice C 4.1、LSI C-86 3.2/ 3.3 試食版から利用することが可能であり、以下の例外を除いて各コンパイ ラーの全メモリーモデルに対応している。Lattice C ではヒュージモデルで 利用することができず、またコンパイル時に -t を指定してネガティブスタ ックフレームを使用する必要がある(通常のポジティブスタックフレームを 使用したオブジェクトとリンクすることは可能)。また、LSI C-86 ではス モールモデルでのみ利用可能である。コンパイラーやメモリーモデルにもよ るが、このライブラリーをリンクすることにより、最低で 4.7KB ほど消費 メモリーが増加する。 fepctrl.c の先頭にはライブラリーの動作を変更するための3つのマクロ定 義が置かれている。コンパイル時に DO_MSKANJI を指定しなかった場合には、 MS-KANJI API 仕様の FEP を制御できなくなるが、消費メモリーが 500 バ イトほど少なくなる。また、DO_GENERIC を指定しなかった場合は、PC-9801 以外の機種専用の FEP を制御できなくなる。これらの2つは PC-9801 専用 のプログラムから利用するとき役に立つかも知れない。さらに、DO_USERDEV を指定しなかった場合には、後述するダミーデバイス名による組み込み判定 が行われなくなる。対応する FEP を少なくしても FEPDMY.SYS、FEPAID.SYS などの制御支援ユーティリティーを使いたくない場合には役に立つかもしれ ない。このライブラリーが参照する C ライブラリー関数は以下のものだけ である。   intdos(), intdosx(), int86(), int86x(), bdos(), strncmp()   memset() ... DO_MSKANJI を指定した場合のみ   intdoss(), int86s(), FP_SEG(), FP_OFF() ... Lattice C 4.1 のみ 現在のバージョンでサポートする FEP は次のものである。括弧内は確認さ れた対応機種を示す。   MS-KANJI API 仕様の FEP (各種 MS-DOS 機)   VJE-α/β/Σ (PC-9801)   ATOK5/ATOK6/ATOK7 (PC-9801, Panacom M, J3100, AX, PS/55, DOS/V)   松茸86/松茸V2/松茸V3 (PC-9801)   EGBridge Ver.2/Ver.3 (PC-9801)   Katana2/ACE/Katana4 (PC-9801)   FIXER3/FIXER4 (PC-9801)   WX/WXS/WXP/WX2/WXA6/WX2+ (PC-9801, J3100, DOS/V)   DFJ/DFJ2 (PC-9801)   MGR2/JJ (PC-9801)   E1 (PC-9801)   DANGO変換 (PC-9801)   おてもと (PC-9801)   OMAC (PC-9801)   αX-1 (PC-9801)   AJIP1 (PC-9801)   Joker-III (PC-9801)   NEC 逐次/連文節変換、AI かな漢字変換 (PC-9801)   風、嵐 Ver.2/Ver.3 (PC-9801)   オアシスかな漢字変換 (FM-R)   かな漢字変換機能 (Panacom M)   連文節日本語入力/日本語自動変換システム (B16、Mr.マイツール)   日本語入力システム (Mr.マイツール MAGUS)   FEPEX (IF800)   単漢字変換/連文節変換 (IBM DOS/V) なお、マクロ TEST を定義して fepctrl.c をコンパイルすると、FEP 制御 の簡易テストプログラムが得られる。ライブラリーに新たな FEP の制御を 追加したときはこのプログラムでテストすることができる。test オプショ ンを指定してテストプログラムを起動すると、組み込みが確認された FEP の名前が表示され、4行のテキスト入力が要求される。以下は WXP を組み 込んだ状態でテストプログラムを実行した場合の例である。   A> tcc -DTEST fepctrl.c   ...   A> fepctrl test   fep = WXP   enter 4 lines of text   on: うにゃにゃん   off: unyanyan    on: ふひょひょ   off: fuhyohyo   A> _ 最初の1行は fep_force_on() によって強制的に変換オンの状態になってい る。ここでテキストを入力して改行すると、fep_off() によって変換がオフ になる。次に1行入力すると、次は fep_on() によって変換がオンになる。 変換モードは fep_off() が入力されたときの状態になっているので、最初 の1行の途中で変換モードが変更されている場合には、できるだけそのモー ドが再現されるようになっている。ここで1行入力すると fep_force_off() で変換オフの状態になるので、さらに1行入力する。この入力が終了すると、 FEP はテストプログラム起動時の状態に戻り、テストプログラムが終了する。 各行の先頭には、fep_get_mode() の結果によって「on:」あるいは「off:」 が表示される。 【備考】 未確定の入力がある状態では、一般にその入力を捨てて変換をオフにするこ とができない。 fep_force_on() によって強制的に変換をオンにする場合、実際にどのよう なモードになるかは FEP に依存する。変換位置はカーソル位置ないし既定 の変換位置となる。入力モードは既定の入力モードとなるが、例えば ATOK6 では変換がオフのときに入力モードを知る手段が存在しないため、配布時の 設定では「ローマ字漢字」モードが選択される。なお、fep_force_on() で 移行するモードは fepctrl.c 中の配列 fepon[] に定義されているので、必 要に応じて変更することができる。 FEP が変換オン状態のときに fep_get_mode() が返す値は FEP に依存する。 MS-DOS 5.0 の KKCFUNC.SYS を利用して複数の FEP を組み込んでいる場合、 MS-KANJI API に対応していない FEP があると組み込み判定が正しく行われ ない可能性がある。ただし、KKCFUNC.SYS に対応していながら MS-KANJI API に対応しないことが許されるかどうかは現在のところ不明である。 MS-KANJI API 仕様と独自インターフェースの両方を備えた FEP は MS-KANJI API 仕様の FEPとして認識される。 MS-KANJI API 仕様の FEP では、ライブラリーの使用後に変換位置がカーソ ル位置に固定されてしまう場合がある。これは VJE-β 2.x や AI かな漢字 変換が持つ MS-KANJI API の不具合に対応しているためである。 VJE-α Ver.1.10 以前のバージョン、ATOK5 の初期バージョンは制御できな い。また、EGBridge Ver.2 では変換オン直後の1文字の入力が変換の対象 とならない場合がある。FIXER4 は V3 互換インターフェースのみによって 制御される(V4 インターフェースを使用しない)。松茸V3 は V2 互換イン ターフェースのみによって制御される(V3 ネイティブインターフェースを 使用しない)。 EGBridge、MGR2/JJ、おてもと、Joker-III については原作者が独自に調査 した方法で制御しているため、ライブラリーの使用によって何らかの障害が 発生する可能性がある。ただし、これまで使用した限りでは特に問題は発見 されていない。 J3100 の MIJ(独自 API) については対応しているはずであるが、動作を 確認していない。 Microsoft C 5.1、Lattice C 4.1 では、データ領域にコードを置いてそこ に飛び込むというトリッキーな方法を用いて ATOK7 および FIXER3/FIXER4 の関数呼び出しによる制御を実現している。このため、データ領域に置いた コードを実行できないようなメモリー管理が行われている環境では利用でき ないことが考えられる。 Lattice C 4.1 でコンパイルした場合、松茸86 を制御する際にハングアッ プすることがある。この現象は Lattice C でコンパイルした直後に制御し たときには必ず発生するが、いったん計算機をリブートした後では発生しな いようである。現在のところ原因は不明。 ソフトウエア割り込みベクター上に置かれた識別文字列で組み込みを判定し ている FEP では、PC-9801 と異なる割り込みベクターを利用している場合 には制御できない。またデバイス名で組み込みを判定してソフトウエア割り 込み経由で制御している FEP は、PC-9801 以外の機種では誤動作を起こす 可能性がある。なお、現実にこの問題が発生したために、識別文字列による 判定をデバイス名による判定より優先させることにした。 組み込み判定の手段が用意されていない一部の FEP、サードパーティーの組 み込みユーティリティーで組み込んだ FEP、PC-286/386 シリーズ上の FEP などについては、FEPCTRL 単独では制御できない場合がある。このような場 合でもライブラリーに付属する FEPDMY.SYS、FEPAID.SYS などの制御支援ユ ーティリティーを同時に組み込めば制御できることがある。これについては 次節以降の FEPDMY.SYS、FEPAID.SYS の説明および付表「FEPCTRL Ver.1.2 〜 1.5 による FEP 制御テスト結果」を参照されたい。 PC-9801 上の FEP には、オン・オフの際にテキスト VRAM を分割・結合し た結果が CRT BIOS の作業領域に残るためにオン・オフを検出できるものが ある。さらに、KBD BIOS のバッファーに直接 CTRL-XFER のコードを書き込 むことによってオン・オフが可能ならば、独自インターフェースの有無によ らず FEPCTRL からこれらの FEP を制御することが可能である。FEPCTRL で は、いくつかの FEP をこのような方法で制御している。 ただし、この方法で制御する場合にはいくつかの理由で動作が不安定になる ことがある。CRT BIOS の作業領域は FEP 以外のプログラムからも使用され るため、このライブラリーの使用前あるいは使用中に他のプログラムから変 更されてオン・オフの判定をあやまる場合がある。例えばカーソルタイプを 変更する BIOS 呼び出しはこの作業領域をクリアする。また KBD BIOS のバ ッファーに書き込まれた CTRL-XFER のコードがどの時点で FEP に読まれる かは FEP によって異なり、次にキーボード割り込みが発生したとき(INT 09h)、次にキー入力を読もうとしたとき(INT 18h)、次にコンソール出力 を行ったとき(INT 29h)、MS-DOS がアイドル状態になったとき(INT 28h) などさまざまである。このため、オン・オフの制御が続けて行われた場合、 制御の間にキー入力あるいはコンソール出力が行われなかった場合などには 正しく制御できないことがある。 このライブラリーではこれらの問題に対応するため、BIOS 経由での制御を 3種類用意して FEP によって使い分けている。詳細についてはソースを参 照されたい。 【関連文献】 太田純「特集: 汎用 FEP 制御ライブラリ FEPCTRL」『C マガジン』1991 年 3 月号, ソフトバンク FEPCTRL Ver.1.2 で制御可能な各種 FEP の API および FEPCTRL Ver.1.2 の内部構造を解説している。 太田純「特集: 続・汎用 FEP 制御ライブラリ構築」『C マガジン』1991 年 9 月号, ソフトバンク 上記記事へのフォローアップ。FEPCTRL Ver.1.4 対応。 【利用条件】 このライブラリー(FEPDMY.SYS、FEPAID.SYS を含む)の利用、改変、再配 布にはいかなる制限もない。原作者はこのライブラリーに関するすべての著 作権を放棄すること、またいかなる場合でも著作者人格権を主張しないこと を表明する。言い換えれば、原作者はこのライブラリーがパブリックドメイ ンに置かれたものとして扱われることを期待する。オリジナル版、改変版の 商業的利用あるいは各種 BBS への転載などについても、原作者への連絡は 一切不要である。 ただし、原作者はこのライブラリーに関していかなる保証も行わない。原作 者はこのライブラリーが期待された動作をすること、特定の目的に対して有 用であることを保証せず、またこのライブラリーを利用したことによって生 起したいかなる損害に対する責任も負わないものとする。 このライブラリーを改変して再配布する場合、各自による改変部分を何らか の形で保護したい場合には、改変部分と制限条項を何らかの形で明示してお かなければならない。明示のない場合には、改変者は自己の改変部分につい て原作者による部分と同じ扱いを受けることに同意したものとみなす。 【原作者】 太田純 ohta@src.ricoh.co.jp (junet) msa02563 (MSA-NET) 【謝辞】 Katana2/ACE/Katana4 に関してはサムシンググッドから、FIXER3/FIXER4 に 関しては日本マイコン販売から技術資料を提供していただいた。また、制御 情報の入手およびテストについては、以下の各氏に多大な援助をいただいた (敬称略)。   太田昌宏、景山昭博、笠井康伸、金子 裕、兼宗 進、久保田英行、   坂野恒之、澤口昌規、滝川雅巳、千葉 滋、冨岡 晶、成澤一浩、   樋口貴章、藤崎清孝、村井 淳、Oh!No! 上記各社および各氏に対して深く感謝の意を表したい。また MSA-NET の TP コーナーほか、日経 MIX の fp 会議、aisoft 会議、k3 会議、v.c. 会議の 議論を参考にさせていただいた。 【履歴】 1990/1 - jstevie1.1 の一部として初版をリリース * 対応 FEP は MS-KANJI API、ATOK5/ATOK6/ATOK7、VJE-α/β/Σ、松茸V2、 FIXER3/FIXER4、Katana2/ACE、EGBridge Ver.2/Ver.3、WXP、E1 * VJE-β Ver.2 の MS-KANJI API は使用していない * ATOK7 は 7TO6.COM を組み込んで ATOK6 互換 API を実現した場合のみ * FIXER3/FIXER4 はソフトウエア割り込み API のみ * E1 については未テスト 1990/2 - jstevie1.2 の一部としてリリース * 対応 FEP に NEC AI 変換、DFJ、MGR2 を追加 * VJE-β Ver.2 を MS-KANJI API で制御するよう変更 * PC-9801 の BIOS 作業領域を利用した制御を実装 1990/06/06 - jstevie1.3 から切り出し、バージョン 1.0 とする * 対応 FEP に松茸86 を追加 * MELWARE Ver.4 の FPLD.SYS に対応 * FEPDMY.SYS を追加し、組み込みが判定できない FEP に対応 * ATOK7、FIXER3/FIXER4 を関数経由の独自 API で制御するよう変更 * WXP の制御方法を CTRL-XFER を使う方式に変更 * PC-9801 の BIOS 作業領域を利用した制御を改善 1990/08/20 - バージョン 1.1 * 対応 FEP に NEC 逐次変換、J3100 の ATOK7R、FM-R の OAK を追加 * IOS-10/II の BNKDRV.SYS に対応 * 引数でデバイス名を指定できるように FEPDMY.SYS を変更 * ATOK5/ATOK6 の組み込み判定方法を変更し、AtokID Ver.1.02 に対応 * 松茸用 G-RAM 転送ドライバ、裏しまっ太郎使用時の動作を確認 * BNKDRV.SYS で組み込んだ ATOK7 を制御する BDATOK7 を別途リリース 1990/11/25 - バージョン 1.2 * 対応 FEP に OAK Ver.4.20、J3100 の WXP、J3100 の ATOK5T、 MS-DOS3.3C の NEC AI 変換、風、嵐、日立純正 FEP を追加 * BNKDRV.SYS で組み込んだ松茸V2/XMS対応版に対応 * FEPAID.SYS を追加し、PC-286/386 における BIOS 経由での制御に対応 * MS-KANJI API の制御方法を一部変更 * NEC 純正 FEP の制御方法を拡張機能呼び出しを使う方式に変更 * PC-9801 の VRAM を利用した状態検出を実装 * MEMORY-PRO386 の LU.DRV 使用時の動作を確認 * MSATOK 使用時の不具合を確認 1991/05/18 - バージョン 1.3 * コードを ANSI スタイルに書き直し、全面的にクリーンアップ * 対応コンパイラーに Turbo C++ 1.0、Borland C++ 2.0、 Microsoft C 6.00、Quick C 2.0、Lattice C 4.1、 LSI C-86 3.2 試食版を追加 * 対応 FEP に JJ、WX2、リコー純正 FEP、Katana4(未テスト)、 AX の ATOK6、IBM PS/55 シリーズの ATOK6/ATOK7、 IBM DOS/V の ATOK7、IBM 単漢字/連文節、 IF800 シリーズの FEPEX、J3100 の MIJ(未テスト)を追加 * PC-9801 の WXS、AX の VJE-β、IBM DOS/V の VJE-βの動作を確認 * MS-KANJI API の制御方法を一部変更して安全性を向上 * 組み込み判定の順序を(やむなく)割り込みベクター優先に変更 * FIXER4 を FIXER3 互換 API のみによって制御するよう変更 * Microsoft C 5.1、Lattice C 4.1 での ATOK7/7R、FIXER3/FIXER4 の 関数呼び出しによる直接制御を実現 1991/06/29 - バージョン 1.4 * 対応 FEP に Panacom M シリーズのかな漢字変換機能を追加 * PC-9801 の松茸V3、Katana4、WX2+、 Panacom M シリーズの ATOK6 での動作を確認 * ATOK6+MSKN、ATOK7+MSKN での動作を確認 1992/04/08 - バージョン 1.5 * ライブラリー関数に fep_raw_init()、fep_raw_term()、 fep_get_mode() を追加 * テストプログラムを拡張してバッチユーティリティーを作成 * 対応コンパイラーに Borland C++ 3.0、LSI C-86 3.3 試食版を追加 * 対応 FEP に PC-9801 の DANGO 変換、おてもと、OMAC、AJIP1、 Joker-III、嵐V3 を追加 * PC-9801 の DFJ2、VJE-β3.0、E1、WX、WXA6、αX-1、 IBM DOS/V の WX2+/WX2I/WX2A7、J3100 の WX2+/WX2A5/WX2A7、 FM-R シリーズの VJE-β2.5 での動作を確認 * PC-9801 の BIOS 作業領域を利用した制御を改善 * NEC および日本 IBM の MS-DOS 5.0 での動作を確認 * デバイスのオープンの際にドライブ名「@:」を付加するよう変更して デバイスアクセスの安全性を向上 * FEPAID.SYS のバグを修正 ============================================================================ 【名称】 FEPCTRL.COM/EXE - バッチファイルのための FEP 制御ユーティリティー 【バージョン】 FEPCTRL ライブラリーと同じ 【形式】 fepctrl [コマンド] コマンド: help - ヘルプメッセージを表示する test - 従来と同様の FEP テストを行う name - 組み込まれた FEP 名を表示する on - FEP を変換オンにする off - FEP を変換オフにする flip - FEP の変換状態を反転する status - FEP の変換状態を返す check [FEP名 ...] - 指定された FEP が存在するかどうか調べる FEP名: PC9801A, PC9801B, PC9801C, MSKANJI, VJE, ATOK6, ATOK7, MTTK86, MTTK2, KATANA, FIXER, EGB2, EGB3, WXP, WX2, MGR2, JJ, NEC, DFJ, DANGO, OTEMOTO, OMAC, AJIP1, JOKER3, KAZE, OAK, MKK, B16, RICOH, WXPJ, MIJ, FEPEX, AT6AX, AT6IBM, AT7IBM, AT7DOSV, IBMIAS 【使用例】 rem - FEP が存在して変換オンなら変換オフにする rem - (実際には fepctrl off だけでも弊害はない) fepctrl check if not errorlevel 1 goto done fepctrl status if not errorlevel 1 goto done fepctrl off :done 【説明】 このユーティリティーは、バッチファイルの内部で FEP の状態を取得した り制御したりするためのものである。機能としては、特定あるいは不特定の FEP の組み込みをチェックする機能、FEP の変換状態を取得する機能、変換 状態を変更する機能などがある。 取得された組み込み状態や変換状態はユーティリティーの終了コードとして 呼び出し側プロセスに返されるため、バッチファイル中で errorlevel を判 定することによって結果を利用することができる。 特定の FEP がどのような名称で組み込みを識別されるかは状況に依存する。 例えば、VJE-βは VJE でなく MSKANJI と識別される可能性が高い。このた め、内部動作に対する十分な知識を持たないかぎり、このユーティリティー を特定の FEP の組み込みチェックのために利用することは避けた方が賢明 である。 なお、マクロ TEST を定義して fepctrl.c をコンパイルすればこのユーテ ィリティーが作られる。 ============================================================================ 【名称】 FEPDMY.SYS - 任意の名称を持つダミーデバイスを登録する 【バージョン】 1.0 - 1990/06/05 初期バージョン 1.1 - 1990/06/10 パラメーターによるデバイス名設定機能の追加 【形式】 DEVICE=FEPDMY.SYS <デバイス名> 【使用例】 DEVICE=FPLD.SYS DFJ.SYS DEVICE=FEPDMY.SYS FP$DFJ (MELWARE Ver.4 に付属の FPLD.SYS で DFJ を組み込む場合) 【説明】 FEPDMY.SYS は何もしないダミーデバイスであり、組み込みの際にパラメー ターとして指定された名前をデバイス名として持つ。FEPDMY.SYS は、各種 MS-DOS 機で利用可能である。 FEPCTRL ライブラリーで FEP を制御する場合、どの FEP が組み込まれてい るかを判定する必要があるが、FEP そのものが組み込み判定の手段を用意し ていない場合や、ある種の組み込みユーティリティーを用いて組み込んだ場 合には判定が行えないことがある。FEPDMY.SYS は、適当なデバイス名を登 録することによって組み込み判定不能な FEP を FEPCTRL から認識させるた めの支援ユーティリティーである。 FEPDMY.SYS を用いれば、どんな FEP でも FEPCTRL から組み込みを判定で きるようになるが、どのデバイス名がどの FEP に対応するかについてはあ らかじめ FEPCTRL と合意を取っておく必要がある。現在 FEPCTRL が認識す るダミーデバイス名は次のものである。どの状況でどのデバイス名を利用す べきかについては、付表「FEPCTRL Ver.1.2 〜 1.5 による FEP 制御テスト 結果」を参照されたい。   FP$PC98A(PC-9801 の BIOS 領域操作による制御 (1))、   FP$PC98B(PC-9801 の BIOS 領域操作による制御 (2))、   FP$PC98C(PC-9801 の BIOS 領域操作による制御 (3))、   FP$VJE(VJE-α/β/Σ)、FP$ATOK6(ATOK5/ATOK6、DANGO 変換)、   FP$MTTK(松茸86; FP$PC98A と同義)、FP$KTN(Katana2/ACE)、   FP$EGB2(EGBridge Ver.2)、FP$EGB3(EGBridge Ver.3)、   FP$WXP(WX、WXS、WXP Ver.1.03a)、FP$WX2(WXP Ver.1.04c、WX2)、   FP$MGR2(MGR2/JJ)、FP$NEC(NEC 逐次/AI 変換)、   FP$DFJ(DFJ; FP$PC98A と同義)、FP$KAZE(風、嵐V2/V3)、   FP$AJIP1(AJIP1; FP$PC98B と同義)、FP$JOKER(Joker-III)、   FP$OMAC(OMAC; FP$PC98C と同義)、FP$OAK(FM-R の OAK) ============================================================================ 【名称】 FEPAID.SYS - PC-9801/PC-286 の BIOS 領域による FEP 制御を支援する 【バージョン】 1.0 - 1990/10/19 初期バージョン 1.1 - 1991/03/18 CRT BIOS 作業領域を保存するよう変更 1.2 - 1992/03/23 バグ修正(saveworkの参照にcs:を忘れていた^_^;) 【形式】 DEVICE=FEPAID.SYS [<デバイス名>] 【使用例】 DEVICE=DFJ.SYS DEVICE=FEPAID.SYS FP$DFJ (PC-286/386 シリーズ上で DFJ の制御を行う場合) 【説明】 FEPAID.SYS は、PC-9801/PC-286 での BIOS 領域操作による FEP 制御を支 援するためのダミーデバイスである。FEPDMY.SYS と同様に、組み込みの際 にパラメーターとしてデバイス名を指定できる。FEPAID.SYS は PC-9801 お よび PC-286/386 シリーズで利用可能である。 FEPCTRL の節で述べたように、PC-9801 では CRT BIOS の作業領域から FEP の状態を検出できる場合がある。FEP が制御インターフェースを用意してい ない場合、組み込み方法によっては本来の状態検出方法が有効でない場合な どが存在するため、FEPCTRL では CRT BIOS 作業領域からの状態検出を積極 的に活用している。しかし、互換機である PC-286/386 では BIOS の互換性 が不足しているためこの方法が利用できない。また、FEP によってはこの作 業領域を使用しない CRT BIOS 呼び出しを用いるものもある。 FEPAID.SYS は CRT BIOS 呼び出しを監視し、必要に応じて CRT BIOS 作業領域を書き換 えることによってこの領域からの状態検出を可能にするためのユーティリテ ィーである。これは FEPCTRL だけでなく、CRT BIOS 作業領域から状態検出 を行うようなアプリケーション(EZKEY など)すべてから利用できる。 FEPAID.SYS は int 18h をフックし、「1つの表示領域の設定」が行われた ときには作業領域に 0 を設定し、「複数の表示領域の設定」が行われたと きには作業領域に dl レジスターの値を設定する。それ以外の int 18h 呼 び出しが行われたときには作業領域の値を保存する。具体的には以下のよう な操作を行っている。   ah ← 0eh; int 18h のとき、0000:053dh に 0 を書き込む   ah ← 0fh; int 18h のとき、0000:053dh に dl の値を書き込む   それ以外の int 18h のとき、0000:053dh の値を保存する 「表示領域の設定」以外の int 18h 呼び出しに際して作業領域の値を保存 するようにしたのは、「カーソルタイプの設定(ah ← 10h)」が行われる と作業領域の値が 0 に変更されることが判明したためである(Ver.1.1)。 FEPAID.SYS は標準で $FEPAID というデバイス名を持つが、FEPDMY.SYS と 同様にパラメーターとして指定することによって任意のデバイス名に変更す ることができる。FEPCTRL から利用する場合には状況に応じて以下のいずれ かのデバイス名を指定する必要がある。どのようなデバイス名を組み込むべ きか、また FEP の前後いずれに組み込むべきかについては、付表「FEPCTRL Ver.1.2 〜 1.5 による FEP 制御テスト結果」を参照されたい。   FP$PC98A、FP$PC98B、FP$PC98C、FP$NEC ============================================================================ 付表: FEPCTRL Ver.1.2 〜 1.5 による FEP 制御テスト結果 1. NEC PC-9801 シリーズ (1) CONFIG.SYS、ADDDRV でメインメモリーに組み込んだ場合 ======================================================================== 日本語入力 FEP 制御 FEPDMY*1 制御形態 常駐判定 ------------------------------------------------------------------------ ATOK5 Ver.1.1 ○ INT DEV ATOK6 Ver.1.2 ○ INT DEV, VECT ATOK7 Ver.1.10 ○ FARCALL, INT*2 DEV, VECT VJE-Σ Ver.1.05 ○ INT DEV, VECT VJE-β Ver.1.20R ○ INT DEV, VECT VJE-β Ver.2.00 L24 ○ MSKANJIV, INT DEV, VECT VJE-β Ver.2.11 L02 ○ MSKANJIV, INT DEV, VECT VJE-β Ver.2.50 L19 ○ MSKANJIV, INT DEV, VECT VJE-β Ver.3.00 L00 ○ MSKANJIV, INT DEV, VECT 松茸86 Ver.1.0 △ BIOS VECT 松茸V2 Ver.2.11 ○ INT VECT 松茸V2 Ver.2.13β版B19 ○ INT VECT 松茸V3 Ver.3.00開発B14 ○ INT VECT EGBridge Ver.2.01 ○ INT VECT EGBridge Ver.3.10 ○ INT, MSKANJI*3 VECT WX Ver.1.00 ○ INT+BIOS VECT WXS Ver.1.01 ○ INT+BIOS VECT WXP Ver.1.03a ○ INT+BIOS VECT WX2 Ver.1.50a ○ MSKANJIV, INT*4 VECT WXA6 Ver.1.50a ○ MSKANJIV, INT*4 VECT WXA6 Ver.1.53 ○ MSKANJI, INT*4 VECT WX2+ Ver.2.00 ○ MSKANJIV, INT*4 VECT WX2A6 Ver.2.00 ○ MSKANJIV, INT VECT WX2A7 Ver.2.00 ○ MSKANJIV, FARCALL VECT WX2VJ Ver.2.00 ○ MSKANJIV, INT VECT WX2MT Ver.2.00 ○ MSKANJIV, INT VECT WX2+ Ver.2.00F ○ MSKANJI, INT*4 VECT WX2A6 Ver.2.00F ○ MSKANJI, INT VECT WX2A7 Ver.2.00F ○ MSKANJI, FARCALL VECT WX2VJ Ver.2.00F ○ MSKANJIV, INT VECT WX2MT Ver.2.00F ○ MSKANJI, INT VECT ACE Ver.2.15 ○ INT CON Katana2 Ver.1.25 ○ INT CON Katana4 Ver.4.01 ○ MSKANJI, INT VECT FIXER Ver.3.10 Rel.2.1 ○ FARCALL, INT*5 IOCTL FIXER Ver.4.13 ○ FARCALL, INT*5 IOCTL DFJ Ver.1.0 △ BIOS VECT DFJ2 Ver.1.00 ○ MSKANJI DEV MGR2 Ver.1.00 ○ INT DEV, VECT JJ Ver.1.00 ○ INT DEV, VECT E1 Ver.1.05 ○ MSKANJI DEV DANGO Ver.1.00 ○ INT VECT おてもと Ver.1.01 ○ FARCALL DEV OMAC Ver.1.00 △ BIOS VECT αX-1 Ver.1.04 ○ MSKANJI DEV AJIP1 Ver.1.05 △ BIOS DEV, VECT Joker-III Ver.1.00 ○ INT VECT NEC AI (DOS3.3C以降) ○ MSKANJIV DEV, VECT NEC AI (DOS3.3Bまで) △ BIOS+INT DEV, VECT NEC 逐次/連文節変換 △ BIOS+INT DEV, VECT NEC 連文節変換 × 状態検出不能 DEV, VECT NEC 文節変換 × 状態検出不能 DEV, VECT NEC 熟語変換 × 状態検出不能 組み込み判定不能 風 Ver.1.21 ○ FP$KAZE VRAM DEV 嵐 Ver.2 ○ FP$KAZE VRAM DEV 嵐 Ver.3 ○ FP$KAZE VRAM DEV ------------------------------------------------------------------------ △ PC-286 では FEPAID.SYS を同時に組み込んだ場合のみ(詳細は(6)を参照) *1 FEPDMY.SYS を組み込む必要がある場合、引数として指定すべきデバイス名 *2 ATOK7 に付属の 7TO6.COM を同時に組み込んだ場合のみ *3 EGBridge に付属の EGB98IF.SYS を同時に組み込んだ場合のみ *4 組み込み時に /VZ パラメーターで WXP 互換 API を有効にした場合のみ *5 組み込み時に /I パラメーターで V3 割り込みベクターを指示した場合のみ ======================================================================== 制御形態 意味 ------------------------------------------------------------------------ INT ソフトウエア割り込み FARCALL 制御関数への far call MSKANJI MS-KANJI アプリケーションインターフェース(正式) MSKANJIV MS-KANJI アプリケーションインターフェース(VJE 方言) BIOS PC-9801 CRT/KBD BIOS 経由での検出・制御(PC-286 では利用不可) VRAM PC-9801 VRAM の特定位置が空白かどうかで検出、BIOS 経由で制御 ======================================================================== 常駐判定 意味 ------------------------------------------------------------------------ DEV 特定デバイスの存在 VECT ソフトウエア割り込み先メモリー上の識別 ID IOCTL デバイスへの IOCTL CON コンソールステータスレポートまたはフックされたベクター ======================================================================== (2) MEMORY-PRO386 V1.5 付属の LU.DRV V1.50 で仮想 UMB に組み込んだ場合 ======================================================================== 日本語入力 FEP 制御 FEPDMY*1 備考 ------------------------------------------------------------------------ ATOK5 Ver.1.1 − 変換時に異常動作 ATOK6 Ver.1.2 ○ ATOK7 Ver.1.10 ○ VJE-Σ Ver.1.05 ○ VJE-β Ver.1.20R − 組み込み時にハングアップ VJE-β Ver.2.00 L24 ○ VJE-β Ver.2.11 L02 − 組み込み時にハングアップ VJE-β Ver.2.50 L19 − 組み込み時にハングアップ 松茸86 Ver.1.0 △ 松茸V2 Ver.2.11 ○ 松茸V2 Ver.2.13β版B19 ○ 松茸V3 Ver.3.00開発B14 ○ EGBridge Ver.2.01 ○ EGBridge Ver.3.10 ○ MS-KANJI API は利用不可 WXP Ver.1.03a ○ WX2 Ver.1.50a ○ WX2+ Ver.2.00 ○ ACE Ver.2.15 ○ Katana2 Ver.1.25 ○ FIXER Ver.3.10 Rel.2.1 ○ DFJ Ver.1.0 △ MGR2 Ver.1.00 ○ NEC AI (DOS3.3C以降) ○ NEC AI (DOS3.3Bまで) △ NEC 逐次/連文節変換 △ 風 Ver.1.21 − 大きすぎて組み込めない 嵐 Ver.2 ○ FP$KAZE ------------------------------------------------------------------------ △ PC-286 では FEPAID.SYS を同時に組み込む必要がある(詳細は(6)を参照) *1 FEPDMY.SYS を組み込む必要がある場合、引数として指定すべきデバイス名 ======================================================================== (3) MELWARE V4 付属の FPLD V1.0C でバンクメモリーに組み込んだ場合*1 ======================================================================== 日本語入力 FEP 制御 FEPDMY*2 備考 ------------------------------------------------------------------------ ATOK5 Ver.1.1 ○ ATOK6 Ver.1.2 ○ ATOK7 Ver.1.10 − 起動時にハングアップ VJE-Σ Ver.1.05 ○ VJE-β Ver.1.20R − 組み込み時に暴走 VJE-β Ver.2.00 L24 ○ MS-KANJI API は無効 VJE-β Ver.2.11 L02 ○ MS-KANJI API は無効 VJE-β Ver.2.50 L19 ○ MS-KANJI API は無効 松茸86 Ver.1.0 △ 松茸V2 Ver.2.11 △ BIOS 経由で制御(松茸86 相当) 松茸V2 Ver.2.13β版B19 − 組み込み時に暴走 EGBridge Ver.2.01 − 組み込み時に暴走 EGBridge Ver.3.10 − 起動できない WXP Ver.1.03a − 組み込み時に暴走 WX2 Ver.1.50a − 組み込み時に暴走 ACE Ver.2.15 ○ Katana2 Ver.1.25 ○ FIXER Ver.3.10 Rel.2.1 ○ FARCALL は無効、INT/BIOS で制御*3 FIXER Ver.4.13 − 組み込み時に暴走 DFJ Ver.1.0 △ FP$DFJ MGR2 Ver.1.00 − 起動できない NEC AI (DOS3.3C以降) △ NEC AI (DOS3.3Bまで) △ NEC 逐次/連文節変換 △ 風 Ver.1.21 − 大きすぎて組み込めない 嵐 Ver.2 − 組み込み時に暴走 ------------------------------------------------------------------------ △ PC-286 では FEPAID.SYS を同時に組み込む必要がある(詳細は(6)を参照) *1 元のデバイス名も組み込まれるため、デバイス経由で常駐判定が可能 *2 FEPDMY.SYS を組み込む必要がある場合、引数として指定すべきデバイス名 *3 PC-286 で /I を指定せずに組み込んだ場合は FEPAID.SYS が必要 ======================================================================== (4) IOS-10 V2.2 付属の BNKDRV V1.01 でバンクメモリーに組み込んだ場合*1 ======================================================================== 日本語入力 FEP 制御 FEPDMY*2 備考 ------------------------------------------------------------------------ ATOK5 Ver.1.1 ○ FP$ATOK6 ATOK6 Ver.1.2 ○ FP$ATOK6 ATOK7 Ver.1.10 − 組み込み時にハングアップ VJE-Σ Ver.1.00-05 ○ BNKDRV が AS$VJE を設定 VJE-Σ Ver.1.10 ○ BNKDRV が AS$VJE を設定 VJE-β Ver.1.20R − 組み込み時にハングアップ 松茸V2 Ver.2.04 △ FP$MTTK BIOS 経由で制御(松茸86 相当) EGBridge Ver.3.10 ○ FP$EGB3 MS-KANJI API は利用不可 WXP Ver.1.03a ○ FP$WXP wxcolor、wxegg などは無効 ACE Ver.2.15 − 起動時に暴走 DFJ Ver.1.0 △ FP$DFJ ------------------------------------------------------------------------ △ PC-286 では FEPAID.SYS を同時に組み込む必要がある(詳細は(6)を参照) *1 一部を除き元のデバイス名が組み込まれないため、FEPDMY 経由で常駐判定 *2 FEPDMY.SYS を組み込む必要がある場合、引数として指定すべきデバイス名 ======================================================================== (5) IOS-10II V3 付属の BNKDRV V1.13 でバンクメモリーに組み込んだ場合*1 ======================================================================== 日本語入力 FEP 制御 FEPDMY*2 備考 ------------------------------------------------------------------------ ATOK5 Ver.1.1 ○ FP$ATOK6 ATOK6 Ver.1.2 ○ FP$ATOK6 ATOK7 Ver.1.10 × FARCALL は無効、状態検出不能 VJE-Σ Ver.1.05 ○ BNKDRV が AS$VJE を設定 VJE-β Ver.1.20R ○ BNKDRV が AS$VJE を設定 VJE-β Ver.2.00 L24 ○ BNKDRV が MS$KANJI、AS$VJE を設定 VJE-β Ver.2.11 L02 ○ BNKDRV が MS$KANJI、AS$VJE を設定 VJE-β Ver.2.50 L19 ○ BNKDRV が MS$KANJI、AS$VJE を設定 松茸86 Ver.1.0 △ 割り込みベクター上の識別 ID が有効 松茸V2 Ver.2.11 △ FP$MTTK BIOS 経由で制御(松茸86 相当) 松茸V2 Ver.2.13β版B19 × 状態検出不能 松茸V2 Ver.3.00開発B14 × 状態検出不能 EGBridge Ver.2.01 ○ FP$EGB2 EGBridge Ver.3.10 ○ FP$EGB3 MS-KANJI API は利用不可 WXP Ver.1.03a ○ FP$WXP wxcolor、wxegg などは無効 WX2 Ver.1.50a − 組み込み時に暴走*3 WX2+ Ver.2.00 − 組み込み時に暴走*3 ACE Ver.2.15 − 起動時に暴走*3 Katana2 Ver.1.25 ○ FP$KTN FIXER Ver.3.10 Rel.2.1 ○ FARCALL は無効、INT/BIOS で制御*4 FIXER Ver.4.13 − 組み込み時に暴走 DFJ Ver.1.0 ○ FP$DFJ MGR2 Ver.1.00 ○ FP$MGR2 NEC AI (DOS3.3C以降) △ FP$NEC NEC AI (DOS3.3Bまで) △ FP$NEC NEC 逐次/連文節変換 △ FP$NEC 風 Ver.1.21 − 大きすぎて組み込めない 嵐 Ver.2 ○ FP$KAZE ------------------------------------------------------------------------ △ PC-286 では FEPAID.SYS を同時に組み込む必要がある(詳細は(6)を参照) *1 一部を除き元のデバイス名が組み込まれないため、FEPDMY 経由で常駐判定 *2 FEPDMY.SYS を組み込む必要がある場合、引数として指定すべきデバイス名 *3 BNKDRV V1.14 では組み込み可能、かつ MS-KANJI API で制御可能 *4 PC-286 で /I を指定せずに組み込んだ場合は FEPAID.SYS が必要 ======================================================================== (6) BNKDRV V1.13 で組み込み、同時に「FEPAID V1.0」*1 を組み込んだ場合*2 ======================================================================== 日本語入力 FEP 制御 FEPAID*3 組込順序*4 備考 ------------------------------------------------------------------------ ATOK5 Ver.1.1 × 状態検出不能 ATOK6 Ver.1.2 × 状態検出不能 ATOK7 Ver.1.10 × 状態検出不能 VJE-Σ Ver.1.05 ○ FP$PC98B FEPより後 VJE-β Ver.1.20R ○ FP$PC98B any VJE-β Ver.2.00 L24 ○ any  any VJE-β Ver.2.11 L02 ○ any  any VJE-β Ver.2.50 L19 ○ any  any 松茸86 Ver.1.0 ○ any  any 松茸V2 Ver.2.11 ○ any  any 松茸V2 Ver.2.13β版B19 ○ FP$PC98A any 松茸V3 Ver.3.00開発B14 × 起動時に暴走 EGBridge Ver.2.01 × 制御できない EGBridge Ver.3.10 ○ FP$PC98B FEPより後 WXP Ver.1.03a ○ any  any WX2 Ver.1.50a ○ FP$PC98B FEPより前 (BNKDRV V1.14 の場合) WX2+ Ver.2.00 ○ FP$PC98B FEPより前 (BNKDRV V1.14 の場合) ACE Ver.2.15 ○ any  FEPより前 (BNKDRV V1.14 の場合) Katana2 Ver.1.25 ○ any  FEPより前 FIXER Ver.3.10 Rel.2.1 ○ FP$PC98B any FIXER Ver.4.13 × 状態検出不能 DFJ Ver.1.0 ○ any  any MGR2 Ver.1.00 × 状態検出不能 NEC AI (DOS3.3C以降) ○ FP$NEC any 制御のみ INT 経由で行う NEC AI (DOS3.3Bまで) ○ FP$NEC  any 制御のみ INT 経由で行う NEC 逐次/連文節変換 ○ FP$NEC any 制御のみ INT 経由で行う 嵐 Ver.2 × 状態検出不能 ------------------------------------------------------------------------ *1 太田純作成の PC-9801/286 CRT BIOS 作業領域強制更新デバイスドライバー *2 PC-9801 CRT/KBD BIOS 経由で検出・制御を行う(PC-286 でも利用可能) *3 FEPAID.SYS の引数に指定すべきデバイス名(any: FP$PC98A/B のいずれか) *4 FEP に対する FEPAID.SYS の組み込み順序(any: 前後いずれも可) ======================================================================== (7) BNKDRV V1.13 で組み込み、「BDSETID V1.0」*1 で認識させた場合*2 ======================================================================== 日本語入力 FEP 制御 BDSETID*3 備考 ------------------------------------------------------------------------ ATOK5 Ver.1.1 ○ ATOK6 ATOK6 Ver.1.2 ○ ATOK6 *4 EGBridge Ver.2.01 ○ EGB2 EGBridge Ver.3.10 ○ EGB3 *4 WXP Ver.1.03a ○ WXP *4、wxcolor、wxatok などは無効*5 MGR2 Ver.1.00 ○ MGR2 NEC AI (DOS3.3C以降) × NEC AI (DOS3.3Bまで) ○ NECAIK NEC 逐次/連文節変換 ○ NECAIK ------------------------------------------------------------------------ *1 金子裕氏作成の BNKDRV 用デバイス/識別 ID 書き込みプログラム(junet) *2 BNKDRV V1.01 では利用できない *3 BDSETID コマンドに指定する引数 *4 BNKDRV V1.12 でも動作確認済み *5 ID 書き込みを「WX 01.00」にすれば wxcolor は利用可能と思われる ======================================================================== (8) BNKDRV V1.13 で組み込み、「AtokID V1.03」*1 で認識させた場合 ======================================================================== 日本語入力 FEP 制御 AtokID*2 備考 ------------------------------------------------------------------------ ATOK5 Ver.1.1 ○ ATOKID5 メモリー上の識別ID でのみ常駐判定可 ATOK6 Ver.1.2 ○ ATOKID6 メモリー上の識別ID でのみ常駐判定可 ATOK7 Ver.1.10 × ATOKID7 AtokID の不備により暴走の可能性あり ------------------------------------------------------------------------ *1 NCC-1701A 氏作成、ASCII-NET PCS などで配布 *2 常駐させるコマンドのバージョン ======================================================================== (9) BNKDRV V1.13 で組み込み、「BDATOK7 V0.91」*1 で API を再設定した場合 ======================================================================== 日本語入力 FEP 制御 備考 ------------------------------------------------------------------------ ATOK7 Ver.1.10 ○ bdatok7 -6 では ATOK6 API で制御 ------------------------------------------------------------------------ *1 太田純作成の BNKDRV 対応 ATOK7 API 再設定プログラム(junet、MSA-NET) ======================================================================== (10) 「裏しまっ太郎 V1.2a」*1 で裏 G-VRAM に組み込んだ場合 ======================================================================== 日本語入力 FEP 制御 備考 ------------------------------------------------------------------------ ATOK6 Ver.1.2 ○ デバイス名でのみ常駐判定可 ------------------------------------------------------------------------ *1 サザンパシフィックの QUICKSILVER、dBXL に付属 ======================================================================== (11) 「松茸用 G-RAM 転送ドライバ V1.00」*1 で G-VRAM に組み込んだ場合 ======================================================================== 日本語入力 FEP 制御 備考 ------------------------------------------------------------------------ 松茸86 Ver.1.0 ○ 松茸V2 Ver.2.11 ○ 松茸V2 Ver.2.13β版B19 ○ 松茸V3 Ver.3.00開発B14 ○ ------------------------------------------------------------------------ *1 日経 MIX の k3/pds 会議で配布 ======================================================================== 2. 東芝 J3100 (1) システム標準の方法でメインメモリーに組み込んだ場合 ======================================================================== 日本語入力 FEP 制御 制御形態 常駐判定 ------------------------------------------------------------------------ ATOK5T Ver.1.2 ○ INT DEV, VECT ATOK7R Ver.1.00 ○ FARCALL, INT*1 DEV, VECT WXP Ver.1.03 ○ INT VECT WX2+ Ver.2.00A ○ MSKANJI DEV WX2A5 Ver.2.00A ○ MSKANJI, INT DEV, VECT WX2A7 Ver.2.00A ○ MSKANJI, INT*1 DEV, VECT ------------------------------------------------------------------------ *1 7TO5.COM を同時に組み込んだ場合のみ ======================================================================== 3. 富士通 FM-R シリーズ (1) CONFIG.SYS でメインメモリーに組み込んだ場合 ======================================================================== 日本語入力 FEP 制御 FEPDMY*1 制御形態 常駐判定 ------------------------------------------------------------------------ OAK Ver.1.10 ○ INT VECT OAK Ver.1.30 ○ INT VECT OAK Ver.4.20 ○ FP$OAK INT VECT VJE-β Ver.2.50 L10 ○ MSKANJI DEV ------------------------------------------------------------------------ *1 FEPDMY.SYS を組み込む必要がある場合、引数として指定すべきデバイス名 ======================================================================== 4. 松下 Panacom M シリーズ (1) CONFIG.SYS でメインメモリーに組み込んだ場合 ======================================================================== 日本語入力 FEP 制御 制御形態 常駐判定 ------------------------------------------------------------------------ かな漢字 Ver.2.00 L13 ○ INT VECT ATOK6 Ver.1.2 ○ INT DEV, VECT ======================================================================== 5. 日立 B16 シリーズ、リコー Mr.マイツール (1) CONFIG.SYS でメインメモリーに組み込んだ場合 ======================================================================== 日本語入力 FEP 制御 制御形態 常駐判定 ------------------------------------------------------------------------ 連文節 Ver.2.05A ○ INT VECT 自動変換 Ver.1.04A ○ INT VECT 自動変換 Ver.2.04A ○ INT VECT ======================================================================== 6. リコー Mr.マイツール MAGUS (1) CONFIG.SYS でメインメモリーに組み込んだ場合 ======================================================================== 日本語入力 FEP 制御 制御形態 常駐判定 ------------------------------------------------------------------------ 日本語入力 Ver.1.00 ○ INT DEV ======================================================================== 7. 沖 IF800 シリーズ (1) CONFIG.SYS でメインメモリーに組み込んだ場合 ======================================================================== 日本語入力 FEP 制御 制御形態 常駐判定 ------------------------------------------------------------------------ FEPEX Ver.2.5 ○ INT DEV ======================================================================== 8. AX 協議会機 (1) CONFIG.SYS でメインメモリーに組み込んだ場合 ======================================================================== 日本語入力 FEP 制御 制御形態 常駐判定 ------------------------------------------------------------------------ ATOK6AX Ver.1.2 ○ INT VECT VJE-β Ver.2.11 ○ MSKANJI DEV ======================================================================== 9. IBM PS/55 シリーズ (1) CONFIG.SYS でメインメモリーに組み込んだ場合 ======================================================================== 日本語入力 FEP 制御 制御形態 常駐判定 ------------------------------------------------------------------------ ATOK6 Ver.1.2 ○ INT VECT ATOK7 Ver.1.10 ○ FARCALL, INT*1 VECT ------------------------------------------------------------------------ *1 ATOK7 に付属の 7TO6.COM を同時に組み込んだ場合のみ ======================================================================== 10. IBM DOS J4.0x/V, J5.0x/V (1) CONFIG.SYS でメインメモリーに組み込んだ場合 ======================================================================== 日本語入力 FEP 制御 制御形態 常駐判定 ------------------------------------------------------------------------ IBM SKK Ver.1.00 ○ IAS*1 DEV IBM 連文節 Ver.3.01 ○ IAS*1 DEV ATOK7 Ver.1.10 ○ IAS*1, INT*2 VECT VJE-β Ver.2.50 ○ MSKANJI DEV WX2+ Ver.2.00 ○ MSKANJI DEV WX2I Ver.2.00 ○ MSKANJI, IAS*1 DEV WX2A7 Ver.2.00 ○ MSKANJI DEV ------------------------------------------------------------------------ *1 DOS/V 日本語入力サブシステム($IAS.SYS)経由での制御 *2 ATOK7 に付属の 7TO6.COM を同時に組み込んだ場合のみ ======================================================================== ng-1.5beta1/docs/mg.tex100644 1750 1750 143544 7126003724 13602 0ustar amurausers\batchmode %be nice to fellow VAXers \hoffset=0in \voffset=0in %correct dvi2ln3 bug \documentstyle[11pt,titlepage]{report} %\pagestyle{headings} %not sure on this one yet %\parindent=0in \textwidth=6in \oddsidemargin=0.25in % definitions for DEFINE environment \newlength{\lblwide} \newcommand{\resetmarg}{\settowidth{\leftmargin}{\makebox[\lblwide]{}\makebox[\labelsep]{}}} \newcommand{\resetlbl}{\setlength{\labelwidth}{\lblwide}} \newenvironment{define}[1]{\begin{list}{}{\settowidth{\lblwide}{\bf #1}\resetmarg \resetlbl}}{\end{list}} % definitions for fn environment \newcommand{\fname}[3]{\hspace{1em}\\{\tt #1}\index{#1} {\it #2}\hfill{\tt #3}} \newcommand{\fmore}[3]{\\{\tt #1}\index{#1} {\it #2}\hfill{\tt #3}} \newcommand{\fbody}{\\[0.5em]} % definitions for making the index \newcommand{\indexentry}[2]{\item {\tt #1} \dotfill\ #2} \setcounter{secnumdepth}{5} %personal preference \setcounter{tocdepth}{5} %personal preference \author{Sandra J. Loosemore} \title{The MG Reference Manual \\ Release MG2A} \date{\vspace{1.5in} Copyright \copyright 1987, Sandra J. Loosemore \\[0.5em] \parbox{5 in}{This document, or sections of this document, may be freely redistributed provided that the copyright notice and the following disclaimer remain intact: The author bears no responsibilities for errors in this document or the software it describes; and shall not be held liable for any indirect, incidental, or consequential damages.}} \makeindex %usually not \begin{document} \maketitle \tableofcontents \chapter{Introduction} MG is a small, fast, and portable Emacs-style text editor intended to be used by people who can't run a real Emacs for one reason or another --- as their main editor on smaller machines with limited memory or file space, or as a ``quick-start'' editor on larger systems, useful for composing short mail messages and the like. We've made MG compatible with GNU Emacs because that is the ``big'', full-featured editor that many of us use regularly and are most familiar with. GNU Emacs is the creation of Richard M. Stallman, who was also the author of the original Emacs editor. However, MG is not associated in any way with the GNU project, and the MG authors individually may or may not agree with the opinions expressed by Richard Stallman and the GNU project. MG is largely public domain. You can use, modify, and redistribute MG as you like. A few modules, however, are copyrighted; specifically, the regular expression code, the VMS termcap routines, and the Amiga support code. Look at the source code for the exact copyright restrictions. There are several other editors in existence which call themselves MicroEmacs. The original public domain version was written by Dave Conroy and circulated as version 1.6. Derived from this, there is another PD version by Dave Conroy numbered v30; a significantly larger PD version by Daniel Lawrence which is now up to version 3.9; at least one proprietary implementation; an implementation for the Atari ST with an integrated command shell, by Prabhaker Mateti; and probably others that we don't know about. MG is derived from the v30 MicroEmacs, with key bindings, command names, and general functionality made more compatible with GNU Emacs. Like v30, MG is fairly small and quite robust. We have generally resisted the temptation to overfeaturize. Some features which are large and complex are flagged for conditional compilation. Many people have contributed their time to developing, improving, and porting MG. Mike Meyer, Mic Kaczmarczik, and Bob Larson deserve particular mention for their efforts. Questions, suggestions, and offers of help should be addressed to: \begin{verbatim} mg-developers@ucbvax.berkeley.edu (ARPA) ucbvax!mg-developers (UUCP) \end{verbatim} \section{Implementations of MG} MG runs on many different kinds of hardware under many different operating systems. Currently, these include: \begin{itemize} \item 4.2 and 4.3 BSD Unix (including Ultrix-32) \item System V Unix \item VAX/VMS \item Primos \item OS9/68k \item Amiga \item Atari ST \item MS-DOS \end{itemize} This document describes release MG2A. When we talk of different versions of MG in this manual, the term {\em version\/} is used to refer to the different support MG provides for the various machines and operating systems it runs under, not to different releases of MG itself. For example, we might speak of how the VMS version of MG differs from the Unix version. As mentioned above, some MG commands may not be implemented in all versions; these are noted in the documentation. Some versions of MG also support features (such as mouse handling) that are not described here. \section{A Note on Character Sets} MG uses the 128-character ASCII character set, and provides support for 8-bit characters. Whether the particular version of MG that you are running knows about extended character sets depends on whether your terminal and the host operating system know about them. Moreover, since there is no standard 8-bit character set, the same character codes will probably give different glyphs on different systems. Most versions of MG use the DEC multinational character set. \section{Notation and Conventions} In this manual, commands and other things that must be typed in literally are indicated in a typewriter font, like {\tt next-line}. Placeholders such as command argument names use an italic font. The terms {\em command\/} and {\em function\/} are synonymous. We often speak of a command being bound to a particular {\em key\/}, although you may actually have to type more than one character to form a single key. Most commands are bound to keys with {\em control\/} and {\em meta\/} modifiers. To type a control character, use the control key on your keyboard like a shift key: hold down the control key while typing the character. In this manual, we will indicate control characters like \verb"C-x" --- here, typing the character ``x'' while holding down the control key. Some keyboards also have a meta key that works like the control key. (It may be labelled something else; on the Atari ST, for example, the key marked ``Alternate'' is the meta key.) If your keyboard doesn't have a meta key, don't panic. You can also use the escape key as a meta prefix; first type the escape, and {\em then\/} the character. Meta characters will be indicated as \verb"M-x". Besides the meta prefix, two other characters are used as prefixes: \verb"C-x" and \verb"C-h". A few keys have special notation: {\tt SPC} is the space character, {\tt DEL} is the delete or rubout character, {\tt RET} is carriage return, and {\tt ESC} is the escape character. {\tt NUL} is the null character (ASCII 0), which is usually equivalent to either \verb"C-SPC" or \verb"C-@". Uppercase and lowercase characters are generally equivalent in command keystrokes. When you run MG from a shell, command line arguments are interpreted as the names of files you want to {\em visit\/}, or edit. Each file is read into a {\em buffer\/} in memory. No changes are actually made to the file until you ask it to be written out to disk. Within MG, the large top part of the screen serves as a {\em window\/} into the buffer being edited. Below this is the {\em mode line\/}, which displays the name of the buffer. Finally, at the very bottom of the screen, there is a one-line {\em minibuffer\/} which is used for displaying messages and answering questions. MG keeps track of two pointers into each window, the {\em point\/} and the {\em mark\/}. The {\em cursor\/} appears at the point in the current window, and we often speak of moving the cursor rather than of moving the point. The text between the point and the mark is referred to as the {\em region\/}. Some commands deal with {\em words\/} and {\em paragraphs\/}. Generally, whitespace and punctuation separate words. Lines that are empty or that contain only spaces or tabs separate paragraphs without being part of a paragraph. A non-empty line that starts with a space or tab also begins a new paragraph. A number of commands are defined as {\em toggles\/}. If no prefix argument is supplied, these commands toggle an action. The action is turned on if a negative or zero argument is supplied, and turned on if a positive argument is supplied. \section{Getting Started} This document is intended primarily as a reference manual. If you have never used any Emacs-like text editor before, it is strongly suggested that you run the on-line tutorial supplied with the MG distribution, instead of reading this manual. Do not be put off by the large number of commands described in this manual! It is possible to get by with only a handful of basic commands. Here are the ones that are probably used most frequently: \begin{define}{\hspace{1in}} \item[{\tt C-p}\hfill] Move the cursor to the previous line \item[{\tt C-n}\hfill] Move the cursor to the next line \item[{\tt C-b}\hfill] Move the cursor backwards \item[{\tt C-f}\hfill] Move the cursor forwards \item[{\tt C-v}\hfill] Scroll forwards one screenful \item[{\tt M-v}\hfill] Scroll backwards one screenful \item[{\tt M-<}\hfill] Go to the beginning of the buffer \item[{\tt M->}\hfill] Go to the end of the buffer \item[{\tt C-a}\hfill] Go to the beginning of the line \item[{\tt C-e}\hfill] Go to the end of the line \item[{\tt DEL}\hfill] Delete the previous character \item[{\tt C-k}\hfill] Kill (delete) to the end of line \item[{\tt C-y}\hfill] Reinsert killed text. \item[{\tt C-x C-c}\hfill] Exit MG \item[{\tt C-x C-s}\hfill] Save the current buffer \end{define} \chapter{Using Commands} \section{Command Arguments} Some commands require arguments. For example, if you want to read a file into a buffer, you must type in the name of the file. In the descriptions of commands in this manual, if arguments are required, they are listed following the command name. MG prompts for command arguments in the minibuffer. Within the minibuffer, the following characters can be used for editing: \begin{define}{\hspace{1in}} \item[{\tt DEL, C-h}\hfill] Erase the last character. \item[{\tt C-x, C-u}\hfill] Erase the entire input line. \item[{\tt C-w}\hfill] Erase to the beginning of the previous word. \item[{\tt C-q, $\backslash$}\hfill] Quote the next character typed. \item[{\tt RET}\hfill] Signifies that you have completed typing in the argument. \item[{\tt C-g}\hfill] Abort the command in progress. \end{define} \section{Prefix Arguments} All commands accept an optional numeric prefix argument. This is often interpreted as a repetition count. For example, the function {\tt next-line}, if given a prefix argument, will move the cursor forward that many lines; without an argument, it will move the cursor forward one line. A few commands behave differently if given a prefix argument than they do without one, and others ignore the prefix argument entirely. \fname{digit-argument}{}{M-0, M-1, M-2, M-3, M-4, M-5, M-6, M-7, M-8, M-9} \fmore{negative-argument}{}{M--} \fbody One way to specify a command argument is to use the escape key as a meta prefix, and then type one or more digits. A dash may be used for a negative argument. \fname{universal-argument}{}{C-u} \fbody Another way to specify a command prefix is to type {\tt C-u}. Typing one {\tt C-u} is equivalent to a prefix argument of 4, typing two gives a value of 16, and so on. In addition, you can type digits following {\tt C-u} to form a numeric prefix argument. \section{Aborting} \fname{keyboard-quit}{}{C-g} \fbody Typing {\tt C-g} cancels any command. It is particularly useful for cancelling a command when MG is prompting for input in the minibuffer. \section{Extended Commands} \fname{execute-extended-command}{command}{M-x} \fbody Commands that are not bound to keys can be executed through {\tt execute extended-command}. If a prefix argument is supplied, it is passed to the command being executed. \chapter{Moving the Cursor} The commands described in this chapter move the cursor (sometimes called the point or dot) within the current window. Commands which set the mark are included here as well. \fname{backward-char}{}{C-b} \fbody Moves the cursor backward (left) one character. If the cursor is at the left margin, it will be moved to the end of the previous line. \fname{backward-paragraph}{}{M-[} \fbody Moves the cursor backwards to the beginning of the current paragraph, or to the beginning of the previous paragraph if the cursor is already at the beginning of a paragraph. \fname{backward-word}{}{M-b} \fbody Moves the cursor backwards to the beginning of the current word, or to the beginning of the previous word if the cursor is already at the beginning of a word. \fname{beginning-of-buffer}{}{M-<} \fbody Moves the cursor backwards to the beginning of the buffer. \fname{beginning-of-line}{}{C-a} \fbody Moves the cursor backwards to the beginning of the current line. This command has no effect if the cursor is already at the beginning of the line. \fname{end-of-buffer}{}{M->} \fbody Moves the cursor forwards to the end of the buffer. \fname{end-of-line}{}{C-e} \fbody Moves the cursor forwards to the end of the current line. This command has no effect if the cursor is already at the end of the line. \fname{exchange-point-and-mark}{}{C-x C-x} \fbody Set the mark at the current cursor position, and move the cursor to the old location of the mark. \fname{forward-char}{}{C-f} \fbody Moves the cursor forwards one character. If the cursor is at the end of a line, it will be moved to the first character on the next line. \fname{forward-paragraph}{}{M-]} \fbody Moves the cursor forwards to the next paragraph delimiter. \fname{forward-word}{}{M-f} \fbody Moves the cursor forwards to the end of the current word, or to the end of the next word if the cursor is already at the end of a word. \fname{goto-line}{line-number}{} \fbody Moves the cursor to the beginning of line {\em line-number\/} in the buffer. \fname{next-line}{}{C-n} \fbody Moves the cursor down one line. The cursor remains in the same column unless it would be past the end of the line, in which case it is moved to the end of the line. At the end of the buffer, {\tt C-n} will create new lines. \fname{previous-line}{}{C-p} \fbody Moves the cursor up one line. The cursor remains in the same column unless it would be past the end of the line, in which case it is moved to the end of the line. \fname{recenter}{}{C-l} \fbody Redraws the entire screen, scrolling the current window if necessary so that the cursor is near the center. With a positive prefix argument {\em n\/}, the window is scrolled so that the cursor is {\em n\/} lines from the top. A negative prefix argument puts the cursor that many lines from the bottom of the window. \fname{redraw-display}{}{} \fbody Redraws the entire screen, but never scrolls. \fname{scroll-down}{}{M-v} \fbody Scrolls the display down (moving backward through the buffer). Without an argument, it scrolls slightly less than one windowful. A prefix argument scrolls that many lines. \fname{scroll-one-line-down}{}{} \fmore{scroll-one-line-up}{}{} \fbody These functions are similar to {\tt scroll-down} and {\tt scroll-up} (respectively), but when invoked without an argument, cause the display to scroll by one line only. These functions are enabled by defining the compile-time option GOSMACS. \fname{scroll-other-window}{}{M-C-v} \fbody Scrolls the ``other'' window forward as for {\tt scroll-up}. \fname{scroll-up}{}{C-v} \fbody Scrolls the display up (moving forward through the buffer). Without an an argument, it scrolls slightly less than one windowful. A prefix argument scrolls that many lines. \fname{set-mark-command}{}{NUL} \fbody Set the mark at the current cursor position. \fname{what-cursor-position}{}{C-x =} \fbody Prints some information in the minibuffer about where the cursor is. \chapter{Text Insertion Commands} The usual way to insert text into a buffer is simply to type the characters. The default binding for all of the printing characters ({\tt self-insert-command}) causes them to be inserted literally at the cursor position. \fname{insert}{string}{} \fbody Insert {\em string\/} into the current buffer at the cursor position. \fname{newline}{}{RET} \fbody Insert a line break into the current buffer at the cursor position, moving the cursor forward to the beginning of the new line. \fname{newline-and-indent}{}{C-j} \fbody Insert a line break into the current buffer at the cursor position, then add extra whitespace so that the cursor is aligned in the same column as the first non-whitespace character in the previous line. \fname{open-line}{}{C-o} \fbody Inserts a line break into the current buffer at the current position, but does not move the cursor forward. \fname{quoted-insert}{}{C-q} \fbody This command acts as a prefix to cancel the normal interpretation of the next keystroke. If {\tt C-q} is followed by one to three octal digits, it is interpreted as the code of the character to insert. Otherwise a single key is read and the character typed is inserted into the buffer instead of interpreted as a command. This is used for inserting literal control characters into a buffer. \fname{self-insert-command}{}{} \fbody This is the default binding for keys representing printable characters. The character is inserted into the buffer at the cursor position, and the cursor moved forward. \chapter{Killing, Deleting, and Moving Text} When text is deleted, it is erased completely. Killing text, on the other hand, moves it into a temporary storage area called the kill buffer. The saved text in the kill buffer is erased when another block of text is killed. Until then, however, you can retrieve text from the kill buffer. This can be used to move or copy blocks of text, as well as to restore accidentally killed text. \fname{backward-kill-word}{}{M-DEL} \fbody Kill the text backwards from the cursor position to the beginning of the current word. Typing {\tt M-DEL} several times in succession prepends each killed word to the kill buffer. \fname{copy-region-as-kill}{}{M-w} \fbody Copies the text in the region into the kill buffer, without removing it from the current buffer. \fname{delete-backward-char}{}{DEL} \fbody Deletes the character to the left of the cursor. \fname{delete-blank-lines}{}{C-x C-o} \fbody Deletes all blank lines after the current line, and if the current line is blank, deletes it and all blank lines preceeding it as well. \fname{delete-char}{}{C-d} \fbody Deletes the character underneath the cursor. \fname{delete-horizontal-space}{}{M-$\backslash$} \fbody Deletes all spaces and tabs on either side of the cursor. \fname{just-one-space}{}{M-SPC} \fbody This is like {\tt delete-horizontal-space}, except it leaves a single space at the cursor position. \fname{kill-line}{}{C-k} \fbody If no prefix argument is specified, this function kills text up to the next newline; or if the cursor is at the end of a line, the newline is killed. A prefix argument specifies how many lines to kill. Typing {\tt C-k} several times in succession appends each line to the kill buffer. \fname{kill-paragraph}{}{} \fbody This command kills the entire paragraph containing the cursor. If the cursor is positioned between paragraphs, the next paragraph is killed. \fname{kill-region}{}{C-w} \fbody The region (all text between point and mark) is killed. \fname{kill-word}{}{M-d} \fbody Text is killed forward from the cursor position to the next end of word. If the cursor is at the end of the word, then the next word is killed. Typing {\tt M-d} several times appends the killed text to the kill buffer. \fname{yank}{}{C-y} \fbody Text is copied from the kill buffer into the current buffer at the cursor position. The cursor is moved to the end of the inserted text. \chapter{Searching and Replacing} \section{Searching} The ordinary search command in MG differs from that in many other editors in that it is incremental: it begins searching as soon as you begin typing the search string, instead of waiting for you to type the entire string. All of the search commands described in this section are case-insensitive. \fname{isearch-backward}{pattern}{C-r} \fmore{isearch-forward}{pattern}{C-s} \fbody These commands perform an incremental search backward and forward (respectively) for {\em pattern\/}. MG will move the cursor to the place in the buffer that matches as much of the pattern as you have typed so far, as each character is entered. Within the incremental search, the following characters are interpreted specially: \begin{define}{\hspace{1in}} \item[{\tt DEL}\hfill] Erase the last character in the search string. \item[{\tt ESC}\hfill] Stop searching; exit from incremental search mode, leaving the cursor where the search brought it. \item[{\tt C-g}\hfill] If a match has been found, exits from incremental search but leaves the cursor in its original position. If the search has failed, this will just erase the characters which have not been found from the end of the search pattern. In this case, you must type \verb"C-g" again to abort the search. \item[{\tt C-s}\hfill] Search forward for the next occurrence of the same pattern. \item[{\tt C-r}\hfill] Search backward for the previous occurrence of the same pattern. \item[{\tt C-q}\hfill] ``Quotes'' the next character typed, forcing it to be interpreted as a literal character in the search pattern. \end{define} In addition, normal commands such as \verb"C-a" that do not have special meanings within incremental search cause the search to be terminated, and then are executed in the ordinary way. \fname{search-again}{}{} \fmore{search-backward}{pattern}{M-r} \fmore{search-forward}{pattern}{M-s} \fbody These commands perform ordinary, non-incremental searches. {\tt Search-again} uses the same pattern and direction as the previous search. \section{Replacing} \fname{query-replace}{pattern replacement}{M-\%} \fbody The primary replace command in MG is an interactive query replace. MG searches forward for occurrences of {\em pattern\/}, and asks you what to do about each one. The choices are: \begin{define}{\hspace{1in}} \item[{\tt SPC}\hfill] Replace this match with {\em replacement\/}, and go on to the next. \item[{\tt DEL}\hfill] Skip to the next match without replacing this one. \item[{\tt .}\hfill] Replace this match, and then quit. \item[{\tt !}\hfill] Replace all remaining occurrences without asking again. \item[{\tt ESC}\hfill] Quit. \end{define} By default, {\tt query-replace} adjusts the case of lower-case letters in the replacement string to match that of the particular occurrence of the pattern; for example, replacing ``Foo'' with ``bar'' results in ``Bar''. Upper case letters in the replacement string are always left uppercase. In addition, supplying a prefix argument will also tell {\tt query-replace} to leave the case of the replacement string as-is. Note that {\tt query-replace} always performs a case-insensitive search. \section{Regular Expressions} Regular expressions provide a means for specifying complex search patterns, instead of just a literal string. The commands in this section are available only if MG is compiled with the REGEX option defined. Regular expression syntax uses the following rules. Most characters in a regular expression are considered to be {\em ordinary\/} characters, and will match themselves and nothing else. The exceptions are the special characters listed below. \begin{define}{\hspace{1in}} \item[{\tt .}\hfill] Matches any single character except a newline. \item[{\tt *}\hfill] A suffix operator that matches zero or more repetitions of the (smallest) preceding regular expression. \item[{\tt +}\hfill] A suffix operator that matches one or more repetitions of the (smallest) preceding regular expression. \item[{\tt ?}\hfill] A suffix operator that matches either zero or one occurence of the (smallest) preceding regular expression. \item[{\tt [\ldots]}\hfill] Matches any one character listed in the character set between the square brackets. See examples below. \item[{\tt \^{ }}\hfill] Matches at the beginning of a line. \item[{\tt \$}\hfill] Matches at the end of a line. \item[{\tt $\backslash$}\hfill] Except for the situations listed below, acts as a prefix operator which causes the character following to be treated as an ordinary character. \item[{\tt $\backslash$|}\hfill] An infix binary {\em or\/} operator. It applies to the two largest surrounding expressions. \item[{\tt $\backslash$(\ldots$\backslash$)}\hfill] A grouping construct, usually used to specify a larger expression for postfix operators such as \verb"*" or to limit the scope of operands to \verb"\|". \item[{\tt $\backslash${\em digit\/}}\hfill] Matches the same text matched by the {\em digit\/}th \verb"\(...\)" construct. These are numbered from 1 to 9 in the order that the open-parentheses appear. \item[{\tt $\backslash$`}\hfill] Matches at the beginning of the buffer. \item[{\tt $\backslash$'}\hfill] Matches at the end of the buffer. \item[{\tt $\backslash$b}\hfill] Matches at the beginning or end of a word. \item[{\tt $\backslash$B}\hfill] Matches anyplace {\em except\/} at the beginning or end of a word. \item[{\tt $\backslash$<}\hfill] Matches at the beginning of a word. \item[{\tt $\backslash$>}\hfill] Matches at the end of a word. \item[{\tt $\backslash$w}\hfill] Matches any word-constituent character. \item[{\tt $\backslash$W}\hfill] Matches any character which is {\em not\/} a word-constituent. \end{define} Some examples may help clarify the rules. \begin{define}{\hspace{1in}} \item[{\tt foo}\hfill] Matches the literal string {\tt foo}. \item[{\tt ;.*}\hfill] Matches all strings which begin with a semicolon and continue to the end of a line. \item[{\tt c[ad]+r}\hfill] Matches strings of the form {\tt car}, {\tt cdr}, {\tt caar}, {\tt cadr}, and so on. \item[{\tt [a-z]}\hfill] Matches any lowercase letter. \item[{\tt [\^{ }a-z]}\hfill] Matches any character {\em except\/} lowercase letters. \item[{\tt [0-9+---]}\hfill] Matches a digit or sign. \item[{\tt $\backslash$(foo$\backslash$|bar$\backslash$)}\hfill] Matches either the string {\tt foo} or the string {\tt bar}. \end{define} \fname{count-matches}{pattern}{} \fmore{count-non-matches}{pattern}{} \fbody These commands count the number of lines which do or do not (respectively) match the specified pattern. \fname{delete-matching-lines}{pattern}{} \fmore{delete-non-matching-lines}{pattern}{} \fbody These commands delete all lines which do or do not (respectively) match the specified pattern. \fname{query-replace-regexp}{pattern replacement}{} \fbody This is the regular expression version of {\tt query-replace}. The {\em replacement\/} string may be a constant, or it can refer to all or part of the string matched by the {\em pattern\/}. \verb"\&" in the replacement string expands into the entire text being replaced, while \verb"\"{\em n\/} (where {\em n\/} is a number) replaces the {\em n\/}th parenthesized expression in {\em pattern\/}. \fname{re-search-again}{}{} \fmore{re-search-backward}{pattern}{} \fmore{re-search-forward}{pattern}{} \fbody These are the regular expression equivalents of the ordinary non-incremental search commands. \fname{set-case-fold-search}{}{} \fbody This command toggles an internal variable that controls whether the regular expression search and replace commands pay attention to case. By default, regular expression searches are case-insensitive. Ordinary searches are always case-insensitive and are not affected by the setting of this variable. \chapter{Windows} MG initially has only one text window displayed. However, you can have as many windows as will fit on the screen. Each window has its own mode line and must display at least two lines of text. (Note that a MG's ``windows'' are distinct from the ``windows'' handled by screen managers such as the X Window System.) Multiple windows may be used to display different buffers. You can also have the same buffer displayed in more than one window, which is useful if you want to see one part of a file at the same time as you are editing another part. Although many windows can be displayed at once, only one window is active at any given time. This is the window where the cursor appears. Some commands refer to the ``other'' window. This is the window directly below the current window, or the top window if you are in the bottom window. \fname{delete-other-windows}{}{C-x 1} \fbody Makes the current window the only window. \fname{delete-window}{}{C-x 0} \fbody Deletes the current window, making the ``other'' window the current window. This command doesn't do anything useful if there is only one window being displayed. \fname{enlarge-window}{}{C-\^{ }} \fbody Makes the current window larger. Without a prefix argument, the window grows one line; otherwise, the prefix argument specifies how many lines to grow. \fname{other-window}{}{C-x o} \fbody Makes the ``other'' window the current window. \fname{previous-window}{}{} \fbody This is like {\tt other-window}, except that it cycles through the windows in reverse order. This command is available only if MG was compiled with the GOSMACS option defined. \fname{shrink-window}{}{} \fbody Makes the current window smaller. Without a prefix argument, the window loses one line; otherwise, the prefix argument specifies how many lines go away. \fname{split-window-vertically}{}{C-x 2} \fbody Split the current window into two windows, both using the same buffer. \chapter{Files and Buffers} Most buffers are used to contain a file being edited. It is also possible to have buffers that are not associated with any file; MG uses these for purposes such as displaying help text, for example. However, since most commands for dealing with files also deal with buffers, we have grouped all of these commands together into one chapter. \section{Buffer Manipulation} \fname{insert-buffer}{buffer-name}{} \fbody Inserts the contents of the named buffer into the current buffer at the cursor location. The cursor moves to the end of the inserted text. \fname{kill-buffer}{buffer-name}{C-x k} \fbody The named buffer and its contents are deleted. If the buffer has been marked as modified, MG will ask you if you really want to delete it. Note that, contrary to its name, this command {\em does not\/} save the buffer contents in the kill buffer. If a buffer is being displayed in a window when it is deleted, MG will find some other buffer to display in the same window. \fname{list-buffers}{}{C-x C-b} \fbody This command writes information about the buffers currently in use to a buffer named {\tt *Buffer List*}. This buffer is then displayed in the ``other'' window; if there is only one window, this command will split the screen into two windows. \fname{not-modified}{}{M-\~{ }} \fbody This command makes MG think that the current buffer has not been modified, even if it really has been changed. This affects the behavior of the {\tt kill-buffer} and the buffer-saving commands described below. MG indicates modified buffers with two stars at the left end of the mode line. \fname{switch-to-buffer}{buffer-name}{C-x b} \fbody The current window is mapped onto the named buffer. If there isn't already a buffer with that name around, MG will create one. \fname{switch-to-buffer-other-window}{buffer-name}{C-x 4 b} \fbody This command works like {\tt switch-to-buffer}, except that the ``other'' window is used. If there is only one window, this command splits the screen into two windows and maps the named buffer onto one of them. \section{Reading and Writing Files} \fname{find-file}{file-name}{C-x f} \fmore{find-file-other-window}{file-name}{C-x 4 C-f} \fbody These commands are analagous to {\tt switch-to-buffer} and {\tt switch-to-buffer-other-window}, respectively. The difference is that these commands look for a buffer associated with the named file. If no matching buffer is found, MG will create a new buffer with a name derived from the filename, and attempt to read the file into the buffer. If the named file cannot be opened, the buffer remains empty. \fname{insert-file}{file-name}{C-x i} \fbody This command reads in the contents of the named file into the current buffer at the cursor position. The cursor remains in the same place. \fname{save-buffer}{}{C-x C-s} \fbody If the current buffer has been modified, it is saved. Buffers that are not associated with files cannot be written out with this command. \fname{save-buffers-kill-emacs}{}{C-x C-c} \fbody This command is used to leave MG and return control to the shell or other program that was used to start MG. If there are modified buffers, MG will ask you if you want to save them before exiting. \fname{save-some-buffers}{}{C-x s} \fbody MG will ask you if you want to save modified buffers that are associated with files. \fname{write-file}{file-name}{C-x C-w} \fbody The current buffer is written out using the file name supplied. This is useful for saving buffers that are not associated with files, or for writing out a file with a different name than what was used to read it in. \section{Backup Files} MG provides a way to save a copy of the original version of files which have been modified and then written out again. The backup copy reflects the state of the file as it existed the first time it was read into MG. The name used for the backup file varies, depending on the operating system. This feature is disabled if MG is compiled with NO\_BACKUP defined. \fname{make-backup-files}{}{} \fbody This command is a toggle which controls the state of an internal variable that determines whether MG creates backup files. \section{Changing the Directory} The commands in this section are disabled by defining NO\_DIR. \fname{cd}{directory-name}{} \fbody This command changes MG's notion of the ``current'' directory or pathname. This is used to supply defaults for functions that read or write files. The syntax for {\em directory-name\/} is obviously specific to the particular operating system MG is running on. \fname{pwd}{}{} \fbody Display what MG thinks is the current directory. \chapter{Modes} Modes are used to locally alter the bindings of keys on a buffer-by-buffer basis. MG is normally in fundamental mode, and these are the bindings that are listed with the command descriptions in this manual. Modes define additional keymaps that are searched for bindings before the fundamental mode bindings are examined; see the section on key binding below for more details on how this works. \fname{set-default-mode}{mode-name}{} \fbody Normally, when MG visits a file, it puts the associated buffer into fundamental mode. Using the {\tt set-default-mode} command, you can specify that MG should default to use some other mode on all subsequent buffers that are created. This command is a toggle. With no prefix argument, if the named mode is not already on the list of default modes, then it will be added to the list; otherwise, it is removed from the list. \section{No Tab Mode} In notab mode, tabs are expanded into spaces instead of inserted literally into the buffer. Literal tab characters are displayed as \verb"^I" (much like other control characters). These commands are available if MG is compiled with the symbol NOTAB defined. (This mode is mainly for use on systems such as PRIMOS that do not treat tab as a series of spaces.) \fname{no-tab-mode}{}{} \fbody This command is a toggle to control whether notab mode is in effect. \fname{space-to-tabstop}{}{} \fbody Insert enough spaces to move the cursor to the next tab stop. In notab mode, this function is bound to {\tt C-i}. \section{Overwrite Mode} Normally, when characters are inserted into the buffer, they are spliced into the existing text. In overwrite mode, inserting a character causes the character already at the cursor position to be replaced. This is useful for editing pictures, tables, and the like. \fname{overwrite-mode}{}{} \fbody This command is a toggle which controls whether overwrite mode is in effect. \section{Auto Fill} Fill mode causes newlines to be added automatically at word breaks when text is added at the end of a line, extending past the right margin. Auto fill is useful for editing text and documentation files. \fname{auto-fill-mode}{}{} \fbody This command is a toggle which controls whether fill mode is in effect. \fname{insert-with-wrap}{}{} \fbody This command works like {\tt self-insert}, except that it checks to see if the cursor has passed the right margin. If so, it fills the line by inserting a line break between words. This command is bound to {\tt SPC} in fill mode. \fname{fill-paragraph}{}{M-q} \fbody Fill the paragraph containing the cursor. \fname{set-fill-column}{}{C-x f} \fbody Without a prefix argument, this command sets the right margin at the current cursor column. If a prefix argument is supplied, it is used instead as the line width. \section{Auto Indent} Indent mode binds {\tt RET} to {\tt newline-and-indent}, so that each new line is indented to the same level as the preceeding line. This mode is useful for editing code. \fname{auto-indent-mode}{}{} \fbody This command is a toggle which controls whether auto-indent mode is in effect. \section{Blink} Blink mode makes it easier to match parentheses, brackets, and other paired delimiters. When the closing delimiter is typed, the cursor moves momentarily to the matching opening delimiter (if it is on the screen), or displays the line containing the matching delimiter on the echo line. This is useful for editing Lisp or C code, or for preparing input files for text processors such as LaTeX that use paired delimiters. \fname{blink-matching-paren}{}{} \fbody This command is a toggle which controls whether blink mode is in effect. \fname{blink-matching-paren-hack}{}{} \fbody This function behaves like {\tt self-insert}, except that it finds the matching delimiter as described above. In blink mode, this function is bound to \verb")", which flashes the matching \verb"(". This function also knows about the pairs \verb"{}", \verb"[]", and \verb"<>". All other characters match with themselves. \section{Dired Mode} ``Dired'' is an abbreviation for ``directory editor'', and it provides a way to browse through the contents of a directory from with MG. Dired puts a directory listing into a buffer; you can use normal editing commands to move around the buffer, and a special group of commands to manipulate the files. For example, there are commands to delete and rename files, and to read a file into an MG buffer. Since dired mode rebinds many keys, a table may be helpful: \begin{verbatim} C-d dired-flag-file-deleted SPC next-line c dired-copy-file d dired-flag-file-deleted e dired-find-file f dired-find-file n next-line o dired-find-file-other-window p previous-line r dired-renamefile u dired-unflag x dired-do-deletions DEL dired-backup-unflag \end{verbatim} The commands in this section are disabled by defining NO\_DIRED. \fname{dired}{directory-name}{C-x d} \fbody Creates a dired buffer for the given directory name, and displays it in the current window. The files in the directory are listed, usually along with information about the file such as its size and timestamp. The exact format of the information is system-specific. \fname{dired-backup-unflag}{}{} \fbody This function removes the deletion flag from the file listed on the previous line of the dired buffer. \fname{dired-copy-file}{new-name}{} \fbody Copy the file listed on the current line of the dired buffer. \fname{dired-do-deletions}{}{} \fbody Deletes the files that have been flagged for deletion. \fname{dired-find-file}{}{} \fmore{dired-find-file-other-window}{}{} \fbody These function works like {\tt find-file} and {\tt find-file-other-window}, except that the filename is taken from the current line in the dired buffer. \fname{dired-flag-file-deleted}{}{} \fbody Flag the file listed on the current line for deletion. This is indicated in the buffer by putting a ``D'' at the left margin. No files are not actually deleted until the function {\tt dired-do-deletions} is executed. \fname{dired-other-window}{directory-name}{} \fbody This function works just like {\tt dired}, except that it puts the dired buffer in the ``other'' window. \fname{dired-rename-file}{new-name}{} \fbody Renames the file listed on the current line of the dired buffer. Note that the dired buffer is not updated to reflect the change. \fname{dired-unflag}{}{} \fbody Remove the deletion flag for the file on the current line. \chapter{Miscellaneous} \section{Help} Most of the commands in this section write useful information to the {\tt *help*} buffer, which is then displayed in the ``other'' window. These commands can be disabled at compile-time by defining NO\_HELP. \fname{apropos}{topic}{C-h a} \fbody This command lists all functions whose names contain a string matching {\em topic\/} in the {\tt *help*} buffer. \fname{describe-bindings}{}{C-h b} \fbody Information about the key bindings in effect in the current buffer is listed in the {\tt *help*} buffer. \fname{describe-key-briefly}{key}{C-h c} \fbody Information about the binding of {\em key\/} is printed in the minibuffer. \fname{help-help}{option}{C-h C-h} \fbody This command lists all of the help options available and prompts for which one to run. Currently, these include only {\tt a} to run {\tt apropos}, {\tt b} to run {\tt describe-bindings}, and {\tt c} to run {\tt describe-key-briefly}. \section{Keyboard Macros} A keyboard macro is a saved set of commands from the keyboard that can be reexecuted later on. There can only be one keyboard macro defined at any one time. The commands in this section are available unless they have been disabled by defining NO\_MACRO. \fname{call-last-kbd-macro}{}{C-x e} \fbody Execute the saved keyboard macro. A prefix argument can be used to specify a repetition count. \fname{end-kbd-macro}{}{C-x )} \fmore{start-kbd-macro}{}{C-x (} \fbody These functions are used to define a keyboard macro. All keys entered after {\tt start-kbd-macro} is executed, up to a {\tt end-kbd-macro}, are remembered as they are executed. You can then reexecute the same sequence of operations using {\tt call-last-kbd-macro}. \section{Changing Case} MG provides a number of functions for changing the case of text. \fname{capitalize-word}{}{M-c} \fmore{downcase-region}{}{C-x C-l} \fmore{downcase-word}{}{M-l} \fmore{upcase-region}{}{C-x C-u} \fmore{upcase-word}{}{M-u} \fbody All of these commands do the obvious. \section{Odds and Ends} This section describes miscellaneous commands that don't fit into any particular category. \fname{emacs-version}{}{} \fbody Prints information about the version of MG you are running in the minibuffer. \fname{meta-key-mode}{}{} \fbody If the particular version of MG you are running supports a meta key, this function can be used to determine whether MG actually pays attention to it or not. If no prefix argument is supplied, the internal variable that controls the use of the meta key is toggled; a positive value enables the meta key, while a negative value disables it. \fname{prefix-region}{}{} \fmore{set-prefix-string}{string}{} \fbody {\tt Prefix-region} is used to prefix each line of the region with a string. This is useful for indenting quoted text, making block comments, and the like. The function {\tt set-prefix-string} can be used to set the string used as the prefix. \fname{suspend-emacs}{}{C-z} \fbody This command temporarily suspends MG so that you can run other programs, and later resume editing. The exact behavior depends on which operating system you are running MG under. Typically, MG will either spawn a new shell as a subprocess, or return you to the parent process. \fname{transpose-chars}{}{C-t} \fbody This command transposes the previous two characters. \chapter{Customization} MG provides a limited support for customization. However, unlike ``real'' Emacs, there is no extension language for interpretively defining new functions. \section{Key Bindings} MG allows keys to be rebound locally or globally. To understand the difference between the two, some discussion on how modes are implemented is necessary. An internal data structure called a keymap is used to look up the function that is bound to a particular key. The keymap for fundamental mode contains all of the default bindings which are listed with the command descriptions in this manual. Modes define additional keymaps that are searched for a binding before the fundamental mode keymap is examined. Keymaps have the same name as the mode they are associated with. MG does not provide commands for defining new modes, but you can alter the keymaps for existing modes. \fname{define-key}{keymap-name key command}{} \fbody This command can be used to modify the keymap for the named mode. \fname{global-set-key}{key command}{} \fmore{global-unset-key}{key}{} \fbody These commands modify the keymap for fundamental mode. Bindings established by {\tt global-set-key} will be inherited by all other modes, as long as they do not establish local rebindings of the same key. \fname{local-set-key}{key command}{} \fmore{local-unset-key}{key}{} \fbody These commands modify the keymap currently in effect. \section{Startup Files} Although MG does not include a general-purpose extension language, it does provide a way to read and evaluate commands using a somewhat different syntax than that used for executing extended commands. This is typically used in a startup file to modify key bindings. A startup file consists of one or more expressions. Each expression must appear on a separate line in the file; there may not be more than one expression per line, nor may expressions span across line breaks. Whitespace (spaces and tabs) separate the tokens in an expression. For historical reasons, parentheses are also considered to be whitespace in this context. A semicolon acts as a comment character, causing the rest of the line to be discarded. An expression consists of a function name, an optional prefix argument (given as an integer constant), and arguments to be passed to the function. If an argument includes literal whitespace or nonprintable characters (for example, as in a keystroke argument to one of the key binding functions described in the previous section), it must be supplied as a string constant enclosed in double quotes. Within string constants, the following backslash escapes are available to specify nonprintable characters: \begin{define}{\hspace{1in}} \item[{\tt $\backslash$t, $\backslash$T}\hfill] Tab \item[{\tt $\backslash$n, $\backslash$N}\hfill] Newline \item[{\tt $\backslash$r, $\backslash$R}\hfill] Carriage return \item[{\tt $\backslash$e, $\backslash$E}\hfill] Escape (Meta prefix) \item[{\tt $\backslash$\^{ }}\hfill] Control prefix \item[{\tt $\backslash${\em n\/}}\hfill] Specifies a character by its ASCII code, where {\em n\/} may consist of from one to three octal digits \item[{\tt $\backslash$f{\em n\/}, $\backslash$F{\em n\/}}\hfill] Specifies the keycode for the {\em n\/}th function key. {\em N\/} may consist of one or two decimal digits. \end{define} The following commands which deal with evaluation of expressions are disabled by defining the compile-time option NO\_STARTUP. See the implementation notes for your particular version of MG for information on how it handles startup files. \fname{eval-current-buffer}{}{} \fbody Evaluate the expressions in the current buffer. \fname{eval-expression}{expression}{} \fbody Evaluate the expression supplied. \fname{load}{file-name}{} \fbody Read in the specified file and evaluate its contents. \twocolumn[\Huge{\vspace{2em}{\bf Fundamental Mode Key Bindings}\vspace{1.5em}}] \addcontentsline{toc}{chapter}{Fundamental Mode Key Bindings} \begin{verbatim} NUL set-mark-command C-a beginning-of-line C-b backward-char C-d delete-char C-e end-of-line C-f forward-char C-g keyboard-quit C-h help TAB self-insert-command C-j newline-and-indent C-k kill-line C-l recenter RET newline C-n next-line C-o open-line C-p previous-line C-q quoted-insert C-r isearch-backward C-s isearch-forward C-t transpose-chars C-u universal-argument C-v scroll-up C-w kill-region C-x c-x prefix C-y yank C-z suspend-emacs ESC meta prefix SPC .. ~ self-insert-command DEL delete-backward-char C-h C-g keyboard-quit C-h C-h help-help C-h a apropos C-h b describe-bindings C-h c describe-key-briefly C-x C-b list-buffers C-x C-c save-buffers-kill-emacs C-x C-f find-file C-x C-g keyboard-quit C-x C-l downcase-region C-x C-o delete-blank-lines C-x C-s save-buffer C-x C-u upcase-region C-x C-w write-file C-x C-x exchange-point-and-mark C-x ( start-kbd-macro C-x ) end-kbd-macro C-x 0 delete-window C-x 1 delete-other-windows C-x 2 split-window-vertically C-x 4 c-x 4 prefix C-x = what-cursor-position C-x ^ enlarge-window C-x b switch-to-buffer C-x d dired C-x e call-last-kbd-macro C-x f set-fill-column C-x i insert-file C-x k kill-buffer C-x o other-window C-x s save-some-buffers C-x 4 C-f find-file-other-window C-x 4 C-g keyboard-quit C-x 4 b switch-to-buffer-other-window C-x 4 f find-file-other-window M-C-g keyboard-quit M-C-v scroll-other-window M-SPC just-one-space M-% query-replace M-- negative-argument M-0 digit-argument M-1 digit-argument M-2 digit-argument M-3 digit-argument M-4 digit-argument M-5 digit-argument M-6 digit-argument M-7 digit-argument M-8 digit-argument M-9 digit-argument M-< beginning-of-buffer M-> end-of-buffer M-[ backward-paragraph M-\ delete-horizontal-space M-] forward-paragraph M-b backward-word M-c capitalize-word M-d kill-word M-f forward-word M-l downcase-word M-q fill-paragraph M-r search-backward M-s search-forward M-u upcase-word M-v scroll-down M-w copy-region-as-kill M-x execute-extended-command M-~ not-modified M-DEL backward-kill-word \end{verbatim} \begin{theindex} \addcontentsline{toc}{chapter}{Index} \input{mgidx.tex} \end{theindex} \end{document} ng-1.5beta1/docs/mg2a.change100644 1750 1750 12441 7126003724 14421 0ustar amurausersHere is a list of some of the changes from Mg version 1b to 2a, in reverse semi-cronological order. Much is only of interest if you are modifying Mg. Some things may only apply relitive to beta versions. (I tried to edit these out.) The kill buffer should now avoid growing bigger than possible. (malloc takes an unsigned arg, which may only be 16 bits.) This is a temporary hack until the kill buffer code is rewriten. Bcopy is NOT used properly, the third argument should be declared unsigned but isn't. 16 bit int systems need to treat the third agument as unsigned. Added functions set-default-mode, global-unset-key, and local-unset-key. dired_ functions in system dependent code now need to set bp->b_nmodes to 0. Function key binding should finally work properly. #define FKEYS if you have function keys that don't fit into a char. Termcap XKEYS code completly rewritten. It does not use the FKEYS code. Terminal-dependant initialization files may now be present. System dependent routine startupfile now takes a single char * arguement. It is NULL for the normal startup file, the terminal type name for the terminal dependent file. The BSD version no longer tries to use .emacs if .mg isn't found. BSD, SYS V, and OSK versions can look for a system-wide startup file if STARTUPFILE is #defined to the directory to look in. Extend.c now has a dependancy on key.h. Insert-file now uses adjustname. Optional SYSCLEANUP macro. Various changes to make mg smaller and faster. Portability issuses: Identifiers should now be unique in first 7 chars. (Change dired_makename to d_makename in fileio.c.) Lint found various bugs. Character set dependent portion of def.h moved to sys/default/chrdef.h. Cinfo.c moved there. tty/termcap/* moved there. Bug fixes: insert-file, fill-paragraph, startup code, "make lint" in bsd makefile. "varargs.h" in sys/default is for systems that worked with the non-varargs code on mg1. It does not work on systems that don't happen to pass arguments that way. fncmp is now also used to compare buffer names. Buffer names are now case sensitive iff file names are. The #ifndef ... in some files moved after the #include "def.h". This should be better for systems that define various things in sysdef.h. Let me know what I missed. Minibuffer and search commands modified so ^H does the same as ^?, ^\ as ^Q, and ^] as ^S. bsmap-mode may be done by key bindings, flow-mode still needs to toggle system-dependent capture of ^S/^Q. re_search.c probably needs to change also. dired mode. (requires a significant amount of system dependent code.) Two case, non-case sensitive systems are now fully supported. The routine fncmp is used to compare file names. (strcmp may be used on monocase or case sensitive systems.) If NO_DIR is not defined, adjustname (the replacement for adjustcase) must append the directory name to the filename if it doesn't have one already. Cleanup and rearangement. symbol.c has been renamed to keymap.c. The key name function has been moved to cinfo.c to reduce the number of files dependent on character set. The terminal type determining code has been moved out of sys/default/tty.c. For unix systems, just "#define gettermtype() getenv("TERM")". For VMS and Primos, it's a bit more compicated. I made some changes to the regular expression code to get it to compile under os9/68k. It now compiles, but requires a number of routines not present in the library that would be difficult to implement. lalloc has be rewriten and split into lallocx (for lines not expected to grow) and lalloc. The OFFSET macro may have to be defined in the system dependent file if the normal definition supplied will not work with your compiler. (I considered alternatives, but could not think of one that used as little storage. Use the offsetof macro if your compiler conforms to the ANSI C draft standard.) The MALLOCROUND macro should be defined if you can predict the behavior of your libraries malloc. It takes a single lvalue arguement, and rounds it up to the amount of memory that realy would be allocated by a malloc of that size. (This is most important on memory tight systems.) Apropos is new. It has a few minor problems: slow, displays only global key bindings, dosn't like lots of keys bound to the same function. (Digit-argument is closest to causing problems.) Its output should probably be the basis of future functions files. The file reading and writing code has changed to fix a couple of long-standing bugs. Files no longer get an extra newline at the end of the last line if it doesn't have one. Line length is now only limited by memory and how big a number will fit in a short int. See description below on what needs to change. Umpteen minor bugs fixed. If anyone is doing serious development based on 1b, some should be merged back in. (Kill-buffer had several bugs, help didn't redisplay properly if the *help* buffer was already present, etc.) The display wrap code is better that what was done before, but not at all what GNU emacs does in the same situation. Compile options have been changed to make those things present in GNU emacs the default. Compile-time options to turn on features not in GNU emacs and to turn of features that are in GNU emacs are documented below. ng-1.5beta1/docs/mgidx.tex100644 1750 1750 10304 7126003724 14252 0ustar amurausers\indexentry{apropos}{31} \indexentry{auto-fill-mode}{27} \indexentry{auto-indent-mode}{28} \indexentry{backward-char}{9} \indexentry{backward-kill-word}{14} \indexentry{backward-paragraph}{9} \indexentry{backward-word}{9} \indexentry{beginning-of-buffer}{9} \indexentry{beginning-of-line}{9} \indexentry{blink-matching-paren}{28} \indexentry{blink-matching-paren-hack}{28} \indexentry{call-last-kbd-macro}{32} \indexentry{capitalize-word}{32} \indexentry{cd}{25} \indexentry{copy-region-as-kill}{14} \indexentry{count-matches}{19} \indexentry{count-non-matches}{19} \indexentry{define-key}{34} \indexentry{delete-backward-char}{14} \indexentry{delete-blank-lines}{14} \indexentry{delete-char}{14} \indexentry{delete-horizontal-space}{15} \indexentry{delete-matching-lines}{19} \indexentry{delete-non-matching-lines}{19} \indexentry{delete-other-windows}{21} \indexentry{delete-window}{21} \indexentry{describe-bindings}{31} \indexentry{describe-key-briefly}{31} \indexentry{digit-argument}{8} \indexentry{dired}{29} \indexentry{dired-backup-unflag}{29} \indexentry{dired-copy-file}{29} \indexentry{dired-do-deletions}{29} \indexentry{dired-find-file}{29} \indexentry{dired-find-file-other-window}{29} \indexentry{dired-flag-file-deleted}{29} \indexentry{dired-other-window}{30} \indexentry{dired-rename-file}{30} \indexentry{dired-unflag}{30} \indexentry{downcase-region}{32} \indexentry{downcase-word}{32} \indexentry{emacs-version}{32} \indexentry{end-kbd-macro}{32} \indexentry{end-of-buffer}{9} \indexentry{end-of-line}{10} \indexentry{enlarge-window}{21} \indexentry{eval-current-buffer}{36} \indexentry{eval-expression}{36} \indexentry{exchange-point-and-mark}{10} \indexentry{execute-extended-command}{8} \indexentry{fill-paragraph}{27} \indexentry{find-file}{24} \indexentry{find-file-other-window}{24} \indexentry{forward-char}{10} \indexentry{forward-paragraph}{10} \indexentry{forward-word}{10} \indexentry{global-set-key}{34} \indexentry{global-unset-key}{34} \indexentry{goto-line}{10} \indexentry{help-help}{31} \indexentry{insert}{12} \indexentry{insert-buffer}{23} \indexentry{insert-file}{24} \indexentry{insert-with-wrap}{27} \indexentry{isearch-backward}{16} \indexentry{isearch-forward}{16} \indexentry{just-one-space}{15} \indexentry{keyboard-quit}{8} \indexentry{kill-buffer}{23} \indexentry{kill-line}{15} \indexentry{kill-paragraph}{15} \indexentry{kill-region}{15} \indexentry{kill-word}{15} \indexentry{list-buffers}{23} \indexentry{load}{36} \indexentry{local-set-key}{34} \indexentry{local-unset-key}{35} \indexentry{make-backup-files}{25} \indexentry{meta-key-mode}{32} \indexentry{negative-argument}{8} \indexentry{newline}{12} \indexentry{newline-and-indent}{12} \indexentry{next-line}{10} \indexentry{no-tab-mode}{26} \indexentry{not-modified}{24} \indexentry{open-line}{12} \indexentry{other-window}{21} \indexentry{overwrite-mode}{27} \indexentry{prefix-region}{33} \indexentry{previous-line}{10} \indexentry{previous-window}{22} \indexentry{pwd}{25} \indexentry{query-replace}{17} \indexentry{query-replace-regexp}{19} \indexentry{quoted-insert}{12} \indexentry{re-search-again}{20} \indexentry{re-search-backward}{20} \indexentry{re-search-forward}{20} \indexentry{recenter}{10} \indexentry{redraw-display}{11} \indexentry{save-buffer}{24} \indexentry{save-buffers-kill-emacs}{24} \indexentry{save-some-buffers}{25} \indexentry{scroll-down}{11} \indexentry{scroll-one-line-down}{11} \indexentry{scroll-one-line-up}{11} \indexentry{scroll-other-window}{11} \indexentry{scroll-up}{11} \indexentry{search-again}{17} \indexentry{search-backward}{17} \indexentry{search-forward}{17} \indexentry{self-insert-command}{13} \indexentry{set-case-fold-search}{20} \indexentry{set-default-mode}{26} \indexentry{set-fill-column}{27} \indexentry{set-mark-command}{11} \indexentry{set-prefix-string}{33} \indexentry{shrink-window}{22} \indexentry{space-to-tabstop}{26} \indexentry{split-window-vertically}{22} \indexentry{start-kbd-macro}{32} \indexentry{suspend-emacs}{33} \indexentry{switch-to-buffer}{24} \indexentry{switch-to-buffer-other-window}{24} \indexentry{transpose-chars}{33} \indexentry{universal-argument}{8} \indexentry{upcase-region}{32} \indexentry{upcase-word}{32} \indexentry{what-cursor-position}{11} \indexentry{write-file}{25} \indexentry{yank}{15} ng-1.5beta1/docs/mgprog.doc100644 1750 1750 25231 7126003724 14407 0ustar amurausersThis documentation covers mg 2a. I do want feedback from other mg developers on what they think of my changes, documentation, and what needs to be done to make mg better. This document is not complete, it mainly covers the areas I have recently changed. Possible future changes: Rearange file contents along more rational lines. Further split the monolithic def.h file. Changing the echo line stuff to use a minibuffer keymap. Making the kill buffer a linked list of lines. Variables. Allow for backspace, ^s, etc. to be changed in some reasonable manner. (Probably using variables or a simulation thereof.) I do not think an input keymap is the correct solution, even if it is frequently used in Gnu emacs. (Besides the extra overhead, keynames come out wrong.) Make long lines wrap like they do in GNU emacs. Fix known (and unknown :-) bugs. Have the keymaps and associated tables generated by a program. Known bugs/limitations: Binding a key in a named keymap may or may not change the binding of other keys pointing to the same keymap. (i.e. if ^H and ^_ are bound to help, rebinding ^Hb may not (or may) change ^_b. This can be cured by rebinding ^_ to help.) Overwrite mode does not work in macros. (Characters are inserted rather than overwriting.) Dired mode has some problems: Rename does not update the buffer. Doing a dired again will update the buffer (whether it needs it or not) and will lose any marks for deletion. .. and . are not recognized as special cases. New implementation oddities: insert and define-key are new commands corresponding to the mocklisp functions in Gnu Emacs. (Mg does not have non-command functions.) (Mg's insert will only insert one string.) The display wrap code does not work at all like that of GNU emacs. Adding command functions to mg: Command functions take two integer aguments and return an integer. The first argument, f, is a set of flags. (f&FFARG) is non-zero if a numeric arguement was passed to the function. (There are bits indicating how the agument was specified, but they are not fully impleminted.) (f&FFRAND) is non-zero if the function is being called by another function and that possibly slightly different action should be taken. (No error checking, supress output, etc.) The second argument, n, is the numeric agument passed or one if there was no numeric arugment. The fuction should return TRUE if it executes correctly, FALSE if it could not, and ABORT if the user typed the keyboard quit character at a prompt. The function must be added to the functnames table in keymap.c. This table must be kept in assending ascii sequence. Key maps: Key maps are structures containing information on what action should be taken corresponding to an individual keypress. That action could be an indication that this is a prefix key and the next kepress should be looked up in another keymap. Example keymap: static struct KEYMAPE(6+IMAPEXT) cXmap = { 6, 6+IMAPEXT, rescan, { {CCHR('B'),CCHR('G'), cXcB, (KEYMAP *)NULL}, {CCHR('L'),CCHR('X'), cXcL, (KEYMAP *)NULL}, {'(', ')', cXlp, (KEYMAP *)NULL}, {'0', '4', cX0, (KEYMAP *)&cX4map}, {'=', '=', cXeq, (KEYMAP *)NULL}, {'^', 's', cXcar, (KEYMAP *)NULL}, } }; (Note: this example is a simplified example of a real keymap in keymap.c.) Since C does not directly support structures containing undementioned arrays, the macro KEYMAPE is used to create a structure with an array of the proper size. 6 is the current size of the array, and IMAPEXT is the number of extra elements left for future groth (by rebinding keys) before the map must be reallocated. rescan is the function to be executed if a specific entry for the key is not found. (rescan is a special function that searches for something else to do -- first by trying lowercasing the last character in the keymap, then by trying the other modes in effect.) The array elements must be in order by the keys they define. Each covers a range of characters. Numeric values should not be used for characters, they make porting mg to some other systems harder. The CCHR macro may be used to specify control characters, including DEL (CCHR('?')). cXcB, cXcL, etc. are arrays of pointers to functions returning int. One of these fuction pointers per element may be to the pseuto-function prefix. cX4map is the keymap coresponding to the prefix function bound to '4' in this keymap. Having several keys in an element bound to the default function is better than increasing the number of elements. Modes: Modes are named key maps that are scanned for key bindings before the global keymap is. There are functions in modes.c to toggle modes on or off for individual buffers. Note that the "major"/"minor" mode distiction is different than in Gnu Emacs. Dired is currently the only major mode available, buffers are put into dired mode on creation by the dired code. (The distiction in mg is the major mode replaces the default keymap instead of being an overlay.) Some modes (overwrite and no-tab) also trigger per-buffer flags that should be convered to per-buffer variables when we add variables. Keymaps for the modes are kept in keymap.c with the other keymaps. System dependent files: Fileio.c: Contains file i/o routines: ffputbuf(BUFFER *): Write all lines of buffer to the file. The last line of the buffer does NOT have the normally implied newline. (One may be added if nessisary, but don't write out the last line if it is zero characters long.) ffgetline(char *buf, int nbuf, int *nbytes): Read a line from the file up to the length specified by the second argument in to the buffer pointed to by the first. If a newline is not found after reading nbuf characters, return FIOLONG and on the next call to ffgetline return the remaining portion (or nbuf more characters and return FIOLONG). If a newline is found, set *nbytes to the number of characters read and return FIOSUC. If the end of file is descovered, set *nbytes and return FIOEOF. (If the file ends in a newline, the call returning FIOEOF will set *nbytes to 0.) If any other error occurs, return FIOERR. char *adjustname(char *fname) Standardize filename. On mono-case systems, lowercase the file name. If NO_DIR is not defined, make fully qualified. (not relitive to the current directory, which may change.) fncmp(char *fna, char *fnb) Return 0 if both arguments refer to the same file or buffer. #define it to be strcmp on mono-case or case sensitive systems, use a non-case sensitive compareison otherwise. (Borrow it from the osk fileio.c) Both arguments have been through adjustname already. routines needed for dired: rename(char *fromname, char *toname) rename file. BSD systems have this as a system call. return -1 on error. copy(char *fromname, char *toname) copy file. return -1 on error. unlinkdir(char *name) Delete directory. return -1 on error. (possibly including non-empty directory.) BUFFER *dired_(char *name) Create dired buffer for named directory. See example from osk or bsd. d_makename(LINE *l, char *fname) Concatinate directory name associated with the current dired BUFFER with file name in line. Return ABORT if no file name on line, FALSE if it is an ordinary file, or TRUE if there is a directory. Name made should be the same as if it were run through adjustname. Converting system & terminal dependent files from mg1b: All command functions will have to be rewritten to use the new two argument calling sequence. (Some compilers will let you get away without doing this for testing purposes. Problems, if any, will show up at run-time.) Key binding is completly different. See extend.c if your code needs to do rebinding. I have attempted make mg less dependant on ascii character values. Keymap.c depends on ascii sorting order. Cinfo.c depends on character values and contains a function to convert from a character value to a key name. Several modules assume 3 octal digits are enough for any character value. Names of most compile time options have changed. Whatever is most GNU-emacs like is now the default. sysdef.h: The type KEY should not be defined. The type KCHAR should be defined. All posible key inputs must be positive in type KCHAR. short is recomended. spawn.c: Update to the new function calling conventions. Makefile: Needs complete rewrite. You can probably figure out the dependencies from the bsd or osk one. Compile time options have changed. Fileio.c: Remove function ffputline. Add function ffputbuf (described above). Rewrite ffgetline to conform to the new way of doing things. (see above.) These routines can probably be borrowed intact from the OSK system dependant fileio.c for unix systems. Replace adjustcase with adjustname. Add fncmp either here or as a #define in sysdef.h. Add functions needed by dired. Compile time options: extentions not directly in gnu emacs BSMAP input mapping exchanging ^H and DEL. 1 for defaulting to this, 0 for normal default. NOTAB for systems that don't like tabs CVMVAS arguments to ^V in screens not lines PREFIXREGION prefix region PREVWIND previous window GOSREC Gossling style recenter STARTUPFILE (unix & OSK) system-wide startup file XKEYS (Termcap) Put kepad in alternate mode, use terminal-dependent startup file. Features removeable to save space NO_HELP help, descibe-bindings, describe-key-briefly, apropos NO_MACRO keyboard macros. If defined, NO_STARTUP must be also. NO_STARTUP startup files, load, etc. NO_BACKUP backup files when writing NO_DPROMPT Delayed prompt on multi-key sequences NO_DIR Dir change functions. If defined, NO_DIRED must be also. NO_DIRED Dired mode REGEX Regular expressions. Not default, since the code is rather unportable and has the GNU copywrite on it. System dependant garbage (avoid where practical) VMS VMS AMIGA AMIGA Things that may be defined in system dependant code: XCHAR XCHAR and XSHORT (char and short for space savings) BDC2 more special characters for filenames BDC3 dito. METABIT Bit of KCHAR set on meta keys OFFSET macro to calculate offset of member from start of structure NBLOCK line growth amount KBLOCK kill buffer growth amount MALLOCROUND macro to predict malloc allocations stratagy SYSINIT system dependant initialization NO_VOID_TYPE compiler dosen't have type void ZEROARRAY zero length arrays are allowed BINDKEY include bindkey routine for use by system & terminal dependent code. Terminal dependant DO_METAKEY meta key METABIT Which bit in a KCHAR is used by the meta key (default 0x80) STANDOUT_GLITCH standout (may) take character position(s) GOSLING optimize redisplay MEMMAP memory mapped display MOVE_STANDOUT cursor addressing may be done in standout mode FKEYS function keys do not fit in type char. Not for use where function keys send multiple characters. ng-1.5beta1/docs/supdoc.w32100644 1750 1750 10760 7126003724 14260 0ustar amurausers# $Id: supdoc.w32,v 1.1.1.1 2000/06/27 01:48:04 amura Exp $ Ng for Win32 各種ドキュメントに対する補足事項 (v0.4.1) (original)Tillanosoft 1999.6.7 本ドキュメントは下記の各ドキュメントに対する Ng for Win32 での補足説明 を記述します。 Ng.doc Ng の日本語機能についての説明 Ng.ref Ng のリファレンス・マニュアル mg.tex MG のマニュアル (TeX ファイル) 1. Ng.doc に対する補足事項 以下では Ng.doc に記述されている内容について補足説明します。 1.1 吉田茂樹さんの電子メールアドレス Ng.doc には、吉田茂樹さんの電子メールアドレスとして shige@csk.CO.JP と 記されておりますが吉田さんの現在のアドレスは以下になります。 shige@iamas.ac.jp 2. mg.tex に対する補足事項 以下では mg.tex に記述されている内容について補足説明します。 2.1 電子メールアドレス 残念ながら MG 開発者宛の連絡先アドレスとされている mg-developers@ucbvax.berkeley.edu は、現在では無効なアドレスのようです。 2.2 サポートプラットフォーム mg.tex の「1.1 Implementations of MG」に、サポートプラットフォームの記 述がありますが、Ng for Win32 では Windows CE, Windows 95/98/NT4.0 をサ ポートしています。 2.3 コマンドラインオプション mg.tex の「1.3 Notation and Conventions」にコマンドラインオプションの 記述が若干ありますが、Ng for Win32 ではコマンドラインオプションとして 以下のオプションが追加されております。 (1) -f コマンド名 Ng for Win32 起動直後に「コマンド名」で指定したコマンドを実行します。 たとえば -f yank を指定することにより Ng 起動後、カットバッファに存 在するテキストを Ng に貼り付けます。 2.4 ファイル関連操作 mg.tex の「8.2 Reading and Writing Files」を中心にファイル関連操作の記 述がありますが、Ng for Win32 では Tillanosoft により find-file 等のファ イル関連操作時の動作がより GNU Emacs ライクになっております。 すなわち、ファイルのパスをミニバッファから入力するような操作においては カレントディレクトリをミニバッファに表示するようになっております。これ に該当するコマンドとしては以下のものがあります。 cd, find-file, find-file-other-window, find-file-readonly, write-file, insert-file, dired, dired-other-window, dired-copy-file, dired-rename-file, find-alternate-file 2.5 カレントディレクトリ mg.tex の「8.4 Changing the Directory」を中心にカレントディレクトリ関 連操作の記述がありますが、Ng for Win32 では Tillanosoft によりカレント ディレクトリの取り扱いがより GNU Emacs ライクになっております。 すなわち、今までは Ng 全体で一つのカレントディレクトリを利用していたの に対し、Ng for Win32 ではバッファごとにカレントディレクトリを管理する ようにしております。したがって、cd や pwd などのコマンドは有効範囲がバッ ファ内のみとなります。 2.6 追加されているコマンド 以下のモードやコマンドが吉田茂樹さんあるいは、Tillanosoft により追加さ れております。 C モード C 言語ファイル編集モード Buffer Menu モード バッファ一覧表示モード ng-version Ng バージョンの詳細の表示 configure Windows 関連の設定 copy-buffer-as-kill KILLバッファへの保存 dired-do-shell-command ファイルの実行 dired-view-file ファイルの参照 dired-flag-backup-files バックアップに削除マーク find-alternate-file 別ファイルの読み込み Buffer-menu-this-window f バッファの選択 Buffer-menu-delete d 削除マークの付与 Buffer-menu-unmark u 削除マークの取り消し Buffer-menu-execute x マークされたバッファを削除 c-mode C モード c-indent-command TAB インデントの自動調整 c-newline-and-indent LFD 改行とインデントの自動調整 electric-c-brace }, { 括弧の挿入とインデントの自 動調整 electric-c-semi : ':' の挿入とインデントの自 動調整 electric-c-terminator ; ';' の挿入とインデントの自 動調整 list-c-mode-variables C モード変数の値の表示 set-c-argdecl-indent c-argdecl-indent の値の設定 set-c-auto-newline c-auto-newline モードの設定 set-c-brace-imaginary-offset c-brace-imaginary-offset の 値の設定 set-c-brace-offset c-brace-offset の値の設定 set-c-continued-brace-offset c-continued-brace-offset の 値の設定 set-c-continued-statement-offset c-continued-statement-offset の値の設定 set-c-indent-level c-indent-level の値の設定 set-c-label-offset c-label-offset の値の設定 set-c-tab-always-indent c-tab-always-indent モード 以上