添付ファイルの情報



[添付ファイル一覧] [全ページの添付ファイル一覧]

fileguardgen_with_guid.js
格納ファイル名:attach/4D6163726F2FC5EAB9C62F313834_677561726467656E5F776974685F677569642E6A73
ページ:Macro/投稿/184
格納ファイル名:attach/4D6163726F2FC5EAB9C62F313834_677561726467656E5F776974685F677569642E6A73
MD5ハッシュ値:b763b2382b9c9ac6bdb5719484624976
サイズ:2.3KB (2392 bytes)
Content-type:application/octet-stream
登録日時:2007/11/28 19:25:59
アクセス数:205
MD5ハッシュ値:b763b2382b9c9ac6bdb5719484624976
fileguardgen_with_guid.js
  0
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
//
//  Include Guard Generator
//
//  Copyright (C) 2007, genta
//
// GUIDGen : http://p2p.wrox.com/topic.asp?TOPIC_ID=20339
//
 
// ------------------------
// Options
var header_prefix = "SAKURA_"
var header_postfix = "_H_"
var license = zlib_license
 
var EOL = ["\r\n", "\r", "\n" ][Editor.GetLineCode()]
 
// ------------------------
 
var filepart = Editor.ExpandParameter("$g").toUpperCase()
var guidpart = GUIDGen().toUpperCase()
 
var guardkey = header_prefix + filepart + "_" + guidpart + header_postfix
 
//------------------------
 
Editor.GoFileTop()
if( license ){
    Editor.InsText( license() )
}
Editor.InsText("#ifndef " + guardkey + EOL )
Editor.InsText("#define " + guardkey + EOL )
Editor.GoFileEnd()
Editor.InsText( EOL + "#endif /* " + guardkey + " */" + EOL + "/*[EOF]*/" + EOL )
 
//------------------------
function GUIDGen() 
{
    try
    {
        var x = new ActiveXObject("Scriptlet.TypeLib");
        // Note: GUID contains \0 !!
        return x.GUID.replace(/[{}\0]/g, "" ).replace(/-/g,"_");
    }
    catch (e)
    {
        // set default string if GUID is not available
        return ("_GUARD_");
    }
}
 
function zlib_license (){
    return "/*" + EOL +
    "	Copyright (C) **YEAR**, **AUTHOR**" + EOL +
    "" + EOL +
    "	This software is provided 'as-is', without any express or implied" + EOL +
    "	warranty. In no event will the authors be held liable for any damages" + EOL +
    "	arising from the use of this software." + EOL +
    "" + EOL +
    "	Permission is granted to anyone to use this software for any purpose," + EOL +
    "	including commercial applications, and to alter it and redistribute it" + EOL +
    "	freely, subject to the following restrictions:" + EOL +
    "" + EOL +
    "		1. The origin of this software must not be misrepresented;" + EOL +
    "		   you must not claim that you wrote the original software." + EOL +
    "		   If you use this software in a product, an acknowledgment" + EOL +
    "		   in the product documentation would be appreciated but is" + EOL +
    "		   not required." + EOL +
    "" + EOL +
    "		2. Altered source versions must be plainly marked as such," + EOL +
    "		   and must not be misrepresented as being the original software." + EOL +
    "" + EOL +
    "		3. This notice may not be removed or altered from any source" + EOL +
    "		   distribution." + EOL +
    "*/" + EOL
    ;
}




    


    ホーム 一覧 単語検索 最終更新 バックアップ リンク元   ヘルプ   最終更新のRSS