·¢²©ÎÄ
jiaxiyingying

http://blog.chinaunix.net/space.php?uid=403164

¼ÓϲӢӢµÄ¼Ò ×¢£ºÎÄÕ¶àÎª×ªÔØ£¬×÷ΪѧϰËùÓà QQ:122827420   
¸öÈË×ÊÁÏ
  • ²©¿Í·ÃÎÊ£º371724
  • ²©ÎÄÊýÁ¿£º238
  • ²©¿Í»ý·Ö£º5010
  • ²©¿ÍµÈ¼¶£º´óУ
  • ×¢²áʱ¼ä£º2007-01-23 15:14:15
¶©ÔÄÎҵIJ©¿Í
  • ¶©ÔÄ
  • ¶©Ôĵ½Ïʹû
  • ¶©Ôĵ½×¥Ïº
  • ¶©Ôĵ½Google
×ÖÌå´óС£º´ó ÖРС²©ÎÄ
Source InsightʹÓÃ½Ì³Ì (2007-11-18 22:06)
·ÖÀࣺ Source Insight


×÷Ϊһ¸ö¿ª·ÅÔ´´úÂëµÄ²Ù×÷ϵͳ£¬Linux¸½´øµÄÔ´´úÂë¿âʹµÃ¹ã´ó°®ºÃÕßÓÐÁËÒ»¸ö¹ã·ºÑ§Ï°¡¢ÉîÈë×êÑеĻú»á£¬ÌرðÊÇLinuxÄں˵Ä×éÖ¯¼«Îª¸´ÔÓ£¬Í¬Ê±£¬ÓÖ²»ÄÜÏñwindowsƽ̨µÄ³ÌÐòÒ»Ñù£¬¿ÉÒÔʹÓü¯³É¿ª·¢»·¾³Í¨¹ý²ì¿´±äÁ¿ºÍº¯Êý£¬ÉõÖÁÉèÖöϵ㡢µ¥²½ÔËÐС¢µ÷ÊÔµÈÊÖ¶ÎÀ´ÅªÇå³þÕû¸ö³ÌÐòµÄ×éÖ¯½á¹¹£¬Ê¹µÃLinuxÄÚºËÔ´´úÂëµÄÔĶÁ±äµÃÓÈΪÀ§ÄÑ¡£

µ±È»LinuxϵÄvimºÍemacs±à¼­³ÌÐò²¢²»ÊÇûÓÐÌṩ±äÁ¿¡¢º¯ÊýËÑË÷£¬²ÊÉ«ÏÔʾ³ÌÐòÓï¾äµÈ¹¦ÄÜ¡£ËüÃǵŦÄÜÊǷdz£Ç¿´óµÄ¡£±ÈÈ磬vimºÍemacs¾Í¸÷×ÔÄÚǶÁËÒ»¸ö±ê¼Ç³ÌÐò£¬·Ö±ð½Ð×öctagºÍetag£¬Í¨¹ýÅäÖÃÕâÁ½¸ö³ÌÐò£¬Ò²¿ÉÒÔʵÏÖ¹¦ÄÜÇ¿´óµÄº¯Êý±äÁ¿ËÑË÷¹¦ÄÜ£¬µ«ÊÇÓÉÓÚÆäÅäÖø´ÔÓ£¬linux¸½´øµÄÓйØ×ÊÁÏÒ²²»ÊǺÜÏêϸ£¬¶øÇÒ£¬¼´Ê¹½¨Á¢ºÃ±ê¼Ç¿â£¬ÒªÊµÏÖ´úÂë²ÊÉ«ÏÔʾ¹¦ÄÜ£¬ÈÔÈ»ÐèÒª½øÒ»²½µÄÅäÖã¨ÔÚÁíһƬÎÄÕ£¬ÎÒ½«»á½²ÊöÈçºÎÅäÖÃÕâЩ¹¦ÄÜ£©£¬Í¬Ê±£¬¶ÔÓÚ´ó¶àÊý°®ºÃÕßÀ´Ëµ£¬¿ÉÄÜ»¹²»ÄÜÊìÁ·Ê¹ÓÃvimºÍemacsÄÇЩ¹¦ÄܱȽÏÇ¿´óµÄÃüÁîºÍ¿ì½Ý¼ü¡£

ΪÁË·½±ãµÄѧϰLinuxÔ´³ÌÐò£¬ÎÒÃDz»·Á»Øµ½ÎÒÃÇÊìϤµÄwindow»·¾³Ï£¬Ò²ËãÊÇ¡°Ê¦ÒÔ³¤ÒÄÒÔÖÆÒÄ¡±°É¡£µ«ÊÇÔÚWindowƽ̨ÉÏ£¬Ê¹ÓÃһЩ³£¼ûµÄ¼¯³É¿ª·¢»·¾³£¬Ð§¹ûÒ²²»ÊǺÜÀíÏ룬±ÈÈçÄÑÒÔ½«ËùÓеÄÎļþ¼Ó½øÈ¥£¬²éÕÒËÙ¶È»ºÂý£¬¶ÔÓÚ·ÇWindowsƽ̨µÄº¯Êý²»ÄܲÊÉ«ÏÔʾ¡£ÓÚÊDZÊÕßͨ¹ýÔÚ»¥ÁªÍøÉÏËÑË÷£¬ÖÕÓÚÕÒµ½ÁËÒ»¸öÇ¿´óµÄÔ´´úÂë±à¼­Æ÷£¬ËüµÄ׿ԽÐÔÄÜʹµÃѧϰLinuxÄÚºËÔ´´úÂëµÄÄѶȴó´ó½µµÍ£¬Õâ±ãÊÇSource Insight3.0£¬ËüÊÇÒ»¸öWindowsƽ̨ÏµĹ²ÏíÈí¼þ£¬¿ÉÒÔ´Ó http://www.sourceinsight.com/ÉϱßÏÂÔØ30ÌìÊÔÓð汾¡£ÓÉÓÚSource InsightÊÇÒ»¸öWindowsƽ̨µÄÓ¦ÓÃÈí¼þ£¬ËùÒÔÊ×ÏÈҪͨ¹ýÏàÓ¦ÊֶΰÑLinuxϵͳÉϵijÌÐòÔ´´úÂëŪµ½Windowsƽ̨Ï£¬ÕâÒ»µã¿ÉÒÔͨ¹ýÔÚlinuxƽ̨ÉϽ«/usr/srcĿ¼ÏµÄÎļþ¿½±´µ½Windowsƽ̨µÄ·ÖÇøÉÏ£¬»òÕß´ÓÍøÉϹâÅÌÖ±½Ó¿½±´Îļþµ½Windowsƽ̨µÄ·ÖÇøÀ´ÊµÏÖ¡£

ÏÂÃæÖ÷Òª½²½âÈçºÎʹÓÃSource Insight£¬¿¼Âǵ½ÔĶÁÔ´³ÌÐòµÄ°®ºÃÕß¶¼ÓÐÏ൱µÄÈí¼þʹÓÃˮƽ£¬±¾ÎĶÔÓÚһЩËöËé¡¢ÈËËù¹²ÖªµÄϸ½ÚÂÔ¹ý²»Ìᣬ½ö½éÉÜһЩÖ÷ÒªÄÚÈÝ£¬ÒÔ±ã´ó¼ÒÄܹ»ºÜ¿ìÊìÁ·Ê¹Óñ¾Èí¼þ£¬¼õÉÙÃþË÷µÄ¹ý³Ì¡£

°²×°Source Insight²¢Æô¶¯³ÌÐò£¬¿ÉÒÔ½øÈëͼ1½çÃæ¡£ÔÚ¹¤¾ßÌõÉÏÓм¸¸öÖµµÃ×¢ÒâµÄµØ·½£¬ÈçͼËùʾ£¬Í¼ÖÐÄÚ°¼×ó±ßµÄÊǹ¤³Ì°´Å¥£¬ÓÃÓÚÏÔʾ¹¤³Ì´°¿ÚµÄÇé¿ö£»ÓұߵÄÄǸö°´Å¥°´ÏÂÈ¥½«»áÏÔʾһ¸ö´°¿Ú£¬Àï±ßÌṩ¹â±êËùÔڵĺ¯ÊýÌåÄÚ¶ÔÆäËûº¯ÊýµÄµ÷ÓÃͼ£¬Í¨¹ýµã»÷¸Ã´°ÌåÀïÄÇЩº¯Êý¾Í¿ÉÒÔ½øÈë¸Ãº¯ÊýËùÔڵĵط½¡£


ͼ1 Source Insight½çÃæÍ¼
ͼ1 Source Insight½çÃæÍ¼

ÓÉÓÚSource InsightʵÖÊÉÏÊÇÒ»¸öÖ§³Ö¶àÖÖ¿ª·¢ÓïÑÔ£¨java,c ,c++µÈµÈ£©µÄ±à¼­Æ÷£¬Ö»²»¹ýÓÉÓÚÆä²éÕÒ¡¢¶¨Î»¡¢²ÊÉ«ÏÔʾµÈ¹¦ÄܵÄÇ¿´ó£¬¶ø±»ÎÒÃǵ±³ÉÔ´´úÂëÔĶÁ¹¤¾ßʹÓá£ËùÒÔ£¬ÎªÁËÓÐЧµÄÔĶÁÔ´³ÌÐò£¬Ê×ÏȱØÐëÑ¡Ôñ¹¦Äܲ˵¥É쵀 ¡°Project¡±Ñ¡ÏîµÄ×Ӳ˵¥¡°New Project¡±Ð½¨Ò»¸öÏîÄ¿£¬ÏîÄ¿Ãû³Æ¿ÉÒÔ×ÔÓÉÑ¡¶¨£¬µ±È»Ò²¿ÉÒÔÑ¡Ôñɾ³ý£¨Remove£©Ò»¸öÏîÄ¿¡£µ±É¾³ýÒ»¸öÏîÄ¿µÄʱºò£¬²¢²»É¾³ýÔ­ÓеÄÔ´´úÂëÎļþ,Ö»Êǽ«¸ÃÈí¼þÉú³ÉµÄÄÇЩ¹¤³Ì¸¨ÖúÎļþɾ³ý¡£É趨֮ºó£¬½«»áµ¯³öÒ»¸ö¶Ô»°¿òÈçͼ2£¬½ÓÊÜĬÈÏÑ¡Ôñ£¬Èç¹û£¬Ó²Å̿ռä×ã¹»£¬¿ÉÒÔ½«µÚÒ»¸ö¸´Ñ¡¿òÑ¡ÉÏ£¬¸ÃÑ¡Ï»áÐèÒªÓëÔ´´úÂë´óÖÂͬµÈµÄ¿Õ¼äÀ´½¨Á¢Ò»¸ö±¾µØÊý¾Ý¿âÒÔ¼Ó¿ì²éÕÒµÄËÙ¶È¡£


ͼ2 ¹¤³ÌÉèÖÃ
ͼ2 ¹¤³ÌÉèÖÃ

µã»÷¡°OK¡±°´Å¥£¬½ÓÊÜÑ¡Ôñºó£¬½«»áÓÐÒ»¸öеĶԻ°¿òµ¯³ö£¬ÔÚÕâ¸ö¶Ô»°¿òÀ¿ÉÒÔÑ¡Ôñ½«ÒªÔĶÁµÄÎļþ¼ÓÈ빤³Ì£¬Ò»ÖÖ·½Ê½ÊÇͨ¹ýÔÚFile NameÖÐÊäÈëÒªÔĶÁÔ´´úÂëÎļþµÄÃû³Æ£¬µã»÷¡°Add¡±°´Å¥½«Æä¼ÓÈ룬Ҳ¿ÉÒÔͨ¹ýÆäÖС°Add All¡±ºÍ¡°Add Tree¡±Á½¸ö°´Å¥¿ÉÒÔ½«Ñ¡ÖÐĿ¼µÄËùÓÐÎļþ¼ÓÈëµ½¹¤³ÌÖУ¬ÆäÖС°Add All¡±Ñ¡Ïî»áÌáʾ¼ÓÈë¶¥²ãÎļþºÍµÝ¹é¼ÓÈëËùÓÐÎļþÁ½ÖÖ·½Ê½£¬¶ø¡°Add Tree¡±Ï൱ÓÚ¡°Add All¡±Ñ¡ÏîµÄµÝ¹é¼ÓÈëËùÓÐÎļþ£¬¿ÉÒÔ¸ù¾ÝÐèҪʹÓ㬾ÍÎÒÀ´Ëµ£¬¸üϲ»¶¡°Add Tree¡±Ò»Ð©¡£ÓÉÓڸóÌÐò²ÉÓÃÁ˲¿·Ö´ò¿ªÎļþµÄ·½Ê½£¬Ã»ÓÐÓõ½µÄÎļþ²»»á´ò¿ª£¬ËùÒÔ£¬¼ÓÈëÊýǧ¸öÎļþÒ²²»Óõ£ÐļÓÈëµÄÎļþ³¬³ö³ÌÐòµÄËùÄÜÈÝÈ̵Ä×î´óÖµ£¬ÎÒ¾ÍÊDzÉÓá°Add Tree¡±µÄ·½Ê½½«Linux2.4Äں˵ÄËÄǧÎå°Ù¾Åʮһ¸öÎļþ¼ÓÈëµÄ¡£


ͼ3 Ìí¼ÓÎļþ
ͼ3 Ìí¼ÓÎļþ

¼ÓÈëÎļþºó£¬µã»÷Ò»¸öÎļþ£¬¿ÉÒÔ³öÏÖʹÓýçÃæ£¬Èçͼ4Ëùʾ£¬ÆäÖУ¬ÓұߵÄÄǸö´°¿Ú£¨Linux Project£¬¼´¹¤³Ì´°¿Ú£©È±Ê¡°´ÕÕ×Öĸ˳ÐòÁгöµ±Ç°¹¤³ÌÖÐËùÓеÄÎļþ¡£


ͼ4 ¹¤×÷´°¿Ú
ͼ4 ¹¤×÷´°¿Ú

µã»÷Ò»¸öÎļþ¾Í¿ÉÒÔ´ò¿ª¸ÃÎļþ£¬ÏÔʾÈçͼ5Ëùʾ£¬½øÈëµ½ÓұߵÄÄǸö´°¿Ú·Ö±ð¿ÉÒÔÒÔÎļþÁбíµÄ·½Ê½£¬ÁгöËùÓеÄÎļþ£¬Ã¿¸ö´°ÌåϱßÓÐÒ»ÅŰ´Å¥£¬×ó±ßµÄ´°¿Ú£¨21142.c£©´Ó×óÖÁÓÒ·Ö±ðΪ£º°´×Öĸ˳ÐòÅÅÁÐËùÓбê¼Ç¡¢°´ÕÕÎļþÖÐÐÐÊý˳ÐòÅÅÁбê¼Ç¡¢°´ÕÕÀàÐÍÅÅÁбê¼Ç¡¢ä¯ÀÀ±¾µØÎļþ±ê¼Ç¡¢±ê¼Ç´°¿ÚÊôÐÔ¡£ÓұߵĴ°¿Ú£¨Linux Project£©´Ó×óÖÁÓÒ·Ö±ðΪ£º°´×Öĸ˳ÐòÎļþÁÐ±í¡¢ÏÔʾÎļþ¼Ð¡¢°´ÕÕÎļþÀàÐ͹éÀàÎļþ¡¢È«²¿ÎļþµÄËùÓбê¼ÇÁÐ±í¡¢°´ÕÕ±ê¼ÇÀàÐ͹éÀà±ê¼Ç¡¢Ìø×ªµ½¶¨Òå´¦¡¢ÏÔʾ±ê¼ÇÐÅÏ¢¡¢ä¯ÀÀ¹¤³Ì±ê¼Ç¡¢²éÕÒº¯Êýµ÷Óᢹ¤³ÌÊôÐÔ£¬ÆäÖÐÈ«²¿ÎļþµÄËùÓбê¼ÇÁбíÑ¡Ïî¿ÉÄÜÒªÒ»¶Îʱ¼ä³éÈ¡±ê¼Ç£¬Í¬²½µ½Êý¾Ý¿âÈ¥£¬Èç¹û¿ªÊ¼Ñ¡ÔñÁ˽¨Á¢±ê¼ÇÊý¾Ý¿â£¬½«»áÔÚ½ñºó½Úʡͬ²½Ê±¼ä£¬×îÓÐÓõÄιýÓÚä¯ÀÀ±ê¼ÇÐÅÏ¢ºÍ²éÕÒº¯Êýµ÷Óã¬Ç°Õß¿ÉÒÔͨ¹ý¡°Jump¡±°´Å¥ÔÚ²»Í¬µÄµØ·½²éÕÒͬÑùµÄ±êÖ¾£¬»¹¿ÉÒÔͨ¹ý¡°Reference¡±°´Å¥½áºÏºóÕß½øÐÐÈ«¾ÖµÄ±ê¼Ç²éÕÒ¡£


ͼÎå

Reference¹¦ÄÜÊÇSource InsightµÄÌØÉ«Ö®Ò»£¬Ëü¿ÉÒÔÔÚËٶȼ«¿ìµÄÔÚÕû¸ö¹¤³ÌÖÐÕÒµ½ËùÓеıê¼Ç£¬²¢ÇÒÔÚ¸ÃÐгÌÐòµÄǰ±ß¼ÓÉϺìÉ«¼ýÍ·µÄС°´Å¥Á´½ÓÉÏ¡£Í¼6ÊÇÒ»¸öReferenceËÑË÷ºóµÄ½á¹û£¬Ëü¿ÉÒÔÓÐÁ½ÖÖģʽ£¬Ò»ÖÖ¼¯ÖÐÏÔʾ½á¹û£¬Í¼6ÏÔʾµÄ¾ÍÊÇÕâÖÖģʽ£¬ÔÚÕâÖÖģʽÏ£¬¿ÉÒÔͨ¹ýǰ±ßµÄºìÉ«¼ýͷС°´Å¥½øÈëÁíÍâÒ»ÖÖģʽ£¬¸Ã±ê¼ÇµÄ¾ßÌåµÄËùÔÚ´¦£¬Ò²¿ÉÒÔͨ¹ý±ê¼ÇµÄ¾ßÌåËùÔÚ´¦µã»÷ºìÉ«¼ýͷС°´Å¥½øÈ뾯ÖÖģʽ£¬»¹¿ÉÒÔͨ¹ý¹¤¾ßÌõÉϵÄÁ½¸öºìɫС¼ýÍ·Ö±½ÓÔÚµÚ¶þÖÖģʽÏÂǰºóÒÆ¶¯£¬²ì¿´ÏàÓ¦ÐÅÏ¢¡£ËüµÄÕâ¸öÇ¿´óµÄ¹¦ÄÜʹµÃÔĶÁLinuxÔ´³ÌÐòÓÐÈçÉñÖú¡£µ«ÊÇҪעÒâµÄÊÇ£¬µ±½øÐÐÁ˵ڶþ´Î¡°Reference¡±Ê±£¬Ëü»áÌáʾÄ㽫½á¹û¼¯¸½¼ÓÔÚµÚÒ»¸ö½á¹û¼¯µÄºó±ß»¹ÊÇÈ¡´úµÚÒ»¸ö½á¹û¼¯¡£Èç¹ûÑ¡ÔñǰÕߣ¬²»ÄܶԽá¹û¼¯¸ù¾ÝǰºóÁ½´ÎËÑË÷½á¹û½øÐзÖÀ࣬ȻºóÔÚÆä×ÓÀàÀï½øÐÐÒÆ¶¯£¬Ö»ÄÜÔÚÕû¸ö½á¹û¼¯ÀïÒÆ¶¯£»Èç¹û£¬Ñ¡ÔñºóÕߣ¬½á¹û¼¯½«»á±»Ì滻ΪµÚ¶þ´ÎËÑË÷µÄ½á¹û£¬ÂÔ΢ÓÐЩ²»·½±ã¡£


ͼ6 ReferenceµÄËÑË÷½á¹û
ͼ6 ReferenceµÄËÑË÷½á¹û

µ±È»£¬Source Insight »¹ÌṩÁËһЩÆäËû³£¼ûµÄ±ãÀû¡£±ÈÈç:ÓÒ¼ü²Ëµ¥¼¸ºõ°üº¬Á˳ÌÐòµÄËùÓй¦ÄÜ£¬¿ÉÒÔÔڱ༭´°¿ÚΪ³ÌÐò¼ÓÉÏÐкţ¬»¹¿ÉÒÔͳ¼ÆÕû¸ö¹¤³ÌµÄ³ÌÐòÐÐÊý,µ±È»»¹Óй¦ÄÜÇ¿´óÈ´Óò»ÉÏ×Ô¶¯Íê³É¹¦ÄÜ£¬ËƺõÁ¬ËüµÄ30ÌìÊÔÓÃÆÚÒ²ÊDZðÓÐÓÃÐĨD¨D¿ÉÒÔÆÈʹÄ㾡¿ÉÄÜ¿ìËÙµÄÔĶÁÔ´³ÌÐò£¬ÆäËûһЩ¼¼ÇÉ´ó¼Ò¿ÉÒÔÔÚʹÓùý³ÌÖÐÂýÂýÃþË÷¡£ÔõôÑù£¿°®ºÃ¶ÁÔ´´úÂëµÄÅóÓÑ£¬²»·ÁÂíÉÏÈ¥ÏÂÔØÒ»¸ö£¬È¥¿ªÊ¼ÎÒÃǵÄLinuxÄÚºË̽ÏÕÖ®ÂðÉ


Èç¹ûÒ»¸öÈí¼þµÄÎļþÊý´ïµ½1000ÒÔÉÏ£¬ÄÇô¶Ô´úÂëµÄ¹ÜÀíºÍÔĶÁ½«ÊÇÒ»¼þ±È½ÏÀ§ÄѵÄÊÂÇé¡£ÔÚVCÏ£¬²»µÃ²»°²×°Visual AssistÈí¼þ£¬ÒÔÌáÉýÔĶÁºÍ±àд´úÂëµÄЧÂÊ¡£

Source InsightÊÇÒ»¿î·Ç³£ÓÅÐãµÄÉÌÒµ´úÂëÔĶÁºÍ±àдÈí¼þ¡£ÔÚ¹ÜÀí´óÐÍÔ´Âë·½Ãæ¾ßÓзdz£¶Àµ½µÄÓÅÊÆ¡£Æä×îа汾£¬Ó¦¸ÃÊÇ3.5¡£ÒòΪÊÇÉÌÒµÈí¼þ£¬Ò»Ð©Õý¹æµÄ ´ó¹«Ë¾Èç¹ûûÓйºÂò£¬ÊǽûֹʹÓõġ£ÒÔǰÔÚ»ªÎªÓÐÈË˽×ÔʹÓÃSource Insight£¬»¹±»´¦·£¡£×îºó¹«Ë¾ÂòÁËÕý°æ¡£

µ«Source InsightµÄȱʡÑùʽÓÐʱºò¾õµÃ¹ýÓÚÁèÂÒ¡£¿´´úÂë¾ÃÁ˾ÍÀÛ¡£¶øVCÔÚ×°ÓÐVisual AssistµÄÇé¿öÏ£¬½çÃæÉÏÃæÔòºÃºÜ¶à£¬Êæ·þºÜ¶à£¬µ«¹¦ÄÜÉÏ»¹ÊǸϲ»ÉÏSource Insight¡£ÒÔǰ´«ÑÔ΢ÈíÒªÊÕ¹ºSource Insight¡£Èç¹ûÕæÊÇÕâÑù£¬ÄÇVisual studio½«ÊÇÊ·ÉÏ×îÅ£µÄ¼¯³É¿ª·¢»·¾³¡£¿Éϧ±È¶ûһֱûÓÐÐж¯¡£ËäÈ»ÍÚÁËDelphiµÄ´´Ê¼ÈË£¬Ê¹VS2003ÒԺ󣬱à³ÌÐòÇáËÉÁ˲»ÉÙ¡£

¼ÈÈ»±È¶û²»Ðж¯£¬ÄÇÎÒ×Ô¼º¶¯ÊÖºÃÁË£¬°ÑSource InsightÅäµÄºÍVC²î²»¶à£¬³ýÁ˲»ÄܱàÒëÖ®Íâ¡£ Source InsightµÄÏÔʾЧ¹ûµÄÈ·²»Ì«ºÃ¡£¶ÔÖÐÎÄÖ§³ÖÒ²²»ºÃ£¬ËùÒÔ¾­¹ýÎÒ¶à´ÎÊÔÑ飬²ÅÕÒµ½Õâ±È½ÏºÃµÄ·½·¨¡£

1. ÅäÖÃȱʡ×ÖÌå¡£²Ëµ¥Options->Document Options, ÅäÖÃScreen FontsΪArial 10 Bold¡£µãAuto Indent°´Å¥£¬Auto Indent TypeѡΪSmart£¬½«Indent Open Brace ºÍ Indent Close Brace¸´Ñ¡¿òÈ¥µô£¬È·ÈÏ¡£Õâ¸öʱºò×ÖÌå¾ßÓÐÁËVCÀïÃæÈ±Ê¡µÄSystem×ÖÌåµÄºÚÌåЧ¹û¡£¶øÇÒÕâÖÖ×ÖÌåÔÚSource InsightÀïÃæ×îÃÀ»¯£¬±ðµÄ×ÖÌåÔò±È½ÏÄÑ¿´¡£°üÀ¨Æäȱʡ×ÖÌå¡£Arial 10 Bold»¹ÄÜÕý³£Ö§³ÖÖÐÎÄ£¬ÕâÒ²ÊDZØÐëµÄ¡£

2.ÅäÖÃ¹Ø ¼ü×ÖÑÕÉ«¡£µãÑ¡²Ëµ¥Options->Style Properties£¬ÉèÖÃÑùʽ¡£ÔÚDefault TextÑùʽ£¬Foreground colorÑ¡Pick£¬RGBÌîΪ0£¬0£¬128¡£ÕâÖÖ²ØÇàÉ«±ÈºÚÉ«Êæ·þÒ»µã¡£Í¬Ñù£¬½«Ref to local, Ref to parameter,Ref to member,Standard Object,Standard PropertyÉèΪ128,128,128µÄ»ÒÉ«¡£½«Null value£¬Keyword,Ref to Class,Ref to struct,Ref to typedef,string¶¼ÉèΪ0,0,255¡£½«Ref to macro,Ref to Const,Ref to Enum,Ref to EnumConstÉèΪ160,0,160;½«Ref to Method, Ref to Method Proto,Ref to Proto,Ref to Func,Standard FunctionµÄÑÕÉ«ÉèΪ136£¬0£¬0µÄÉîºìÉ«£¬½«CommentÉèΪ33,133,33µÄÂÌÉ«¡£

3.΢µ÷ÑÕÉ«¡£Èç¹û¿´µ½¹Ø¼ü×ÖÑÕÉ«²»·ûºÏ×Ô¼ºÒªÇó£¬Ôڸùؼü×ÖÉϵãÓÒ¼ü£¬ÔÚµ¯³ö²Ëµ¥ÉÏÓÐÒ»¸öStyle Properties£¬½øÈ¥ºó¾ÍÊǶÔÓ¦µÄÌõÄ¿£¬¿ÉÒÔÉèÖÃÆäÑùʽ£¬Í¨³£ÊÇÑÕÉ«¡£

4.±£´æ¡£×Ô¼ºÂúÒâºó£¬½øÈëStyle PropertiesºóµãSave °´Å¥£¬½«Æä±£´æÆðÀ´£¬ÉõÖÁ¿ÉÒÔ´æµ½ÍøÉÏ£¬ÒÔ±ãÏ´ÎʹÓúÍÓëÅóÓѹ²Ïí¡£

1 sourceinsight¡¡screen font¡¡µÄĬÈÏ×ÖÌåÊÇVerdanaµÄ£¬ËüÊÇÒ»Ö±±ä¿í×ÖÌå¡£ÔÚDocument styleÖпÉÒÔ½«×ÖÌå¸ÄΪ¶¨¿íµÄCourier 

2  ¹´µôindent Open BraceºÍIndent Close BraceµÄЧ¹û: ¼ÌÉÏÒ»¶Î£¬ÔÚÏà¶ÔËõ½øÐÐÀï, Èç¹ûÊäÈë"{"»ò"}", Ôò×Ô¶¯ºÍÉÏÒ»ÐÐÁÐ¶ÔÆë 

3 ½ñÌì°ÑÒ»¸öÓÃsourceinsightÅŰæÕûÆëµÄCÎļþ£¬Å¼È»ÓÃVC´ò¿ªÒ»¿´£¬È«ÂÒÁË¡£Ñо¿Á˰ëÌ죬·¢ÏÖSI¶Ôÿ¸ö×Ö·ûµÄ¿í¶È²»Ì«Ò»Ö¡£

   ·¢ÏÖÑ¡ÉÏ"view --> draft view"£¬ ¾Í¿ÉÒÔÈÃÿ¸ö×Ö·ûµÄ¿í¶ÈÒ»ÖÂÁË¡£¿ì½Ý¼üÊÇ "Alt + F12"
 
4Ñ¡Öм¸ÐдúÂë°´tab¼ü»òÕßshift+tab¿ÉÒÔ×óÓÒÒÆ¶¯´úÂ룬µ÷Õû´úÂëʱºÜÓÐÓá£
 
5ʹÓÃ×îÇ¿´óµÄºê¹¦ÄÜ£¬ÕæµÄ´ïµ½µÄÍêÃÀ¾³½ç

˵Ã÷:
    ¸ÃºêÎļþʵÏÖһЩ±àÂë³ÌÖÐÄܻᵽµÄ¹¦ÄÜ, ÈçÌí¼ÓÎļþÍ·¡¢º¯Êý˵Ã÷ºÍºê¶¨ÒåµÈ, ʹÓÃʱÄÜ×Ô¶¯Ìí¼ÓÎļþÃû¡¢º¯ÊýÃûºÍµ±Ç°ÈÕÆÚ.

ʹÓÃ˵Ã÷:
    1. Project->Open Project... ´ò¿ªBase¹¤³Ì(¸Ã¹¤³ÌÒ»°ãÔÚ"ÎÒµÄÎĵµ\Source Insight\Projects\Base"ÖÐ);
    2. Project->Add and Remove Project Files... ¼ÓÈëºêÎļþ(¼´mymacro.em);
    3. Options->Menu Assignments ´ò¿ªMenu Assignments´°¿Ú, ÔÚCommandÖÐÊäÈëMacro, Ñ¡ÖÐҪʹÓõĺê, Ìí¼Óµ½ºÏÊʵIJ˵¥ÖÐ.
ÔÚhttp://www.sourceinsight.com/public/macros/¿ÉÒÔÕÒµ½ºÜ¶àºê¶¨ÒåÎļþ£¬µ«´ó¶àÊýûʲôÓá£
/*¸½ÉϺ궨ÒåÎļþ£¨Ò»ÏÂÊÇÎÒ¾«ÐÄÌôÑ¡µÄÊ®·ÖºÃÓõĺ궨Ò壬²»ÊÔ²»ÖªµÀ£¬Ò»ÊÔÕæÓÐÓã©*/
/* mymacro.em - a small collection of useful editing macros */


/******************************************************************************
 * InsFunHeader -- insert function's information
 *
 * modification history
 * --------------------
 * 01a, 23mar2003, added DESCRIPTION by t357
 * 01a, 05mar2003, t357 written
 * --------------------
 ******************************************************************************/
macro InsFunHeader()
{
 // Get the owner's name from the environment variable: szMyName.
 // If the variable doesn't exist, then the owner field is skipped.

/*#########################################################
  #########################################################
  #######  Set szMyName variable to your name    ########
  #######  for example    szMyName = "t357"     ########
  #########################################################   
  #########################################################*/
 szMyName = "LW"

 // Get a handle to the current file buffer and the name
 // and location of the current symbol where the cursor is.
 hbuf = GetCurrentBuf()
 szFunc = GetCurSymbol()
 ln = GetSymbolLine(szFunc)

 // Get current time
 szTime = GetSysTime(1)
 Day = szTime.Day
 Month = szTime.Month
 Year = szTime.Year
 if (Day < 10)
  szDay = "0@Day@"
 else
  szDay = Day
 szMonth = NumToName(Month)
 szInf = Ask("Enter the information of function:")
 szDescription = Ask("Enter the description of function:")

 // begin assembling the title string
 sz = "/******************************************************************************"
 InsBufLine(hbuf, ln, sz)
 InsBufLine(hbuf, ln + 1, " * @szFunc@ - @szInf@")
 InsBufLine(hbuf, ln + 2, " * DESCRIPTION: - ")
    InsBufLine(hbuf, ln + 3, " *    @szDescription@ ")
// remove by t357.    CutWord(szDescription)
 InsBufLine(hbuf, ln + 4, " * Input: ")
 InsBufLine(hbuf, ln + 5, " * Output: ")
 InsBufLine(hbuf, ln + 6, " * Returns: ")
 InsBufLine(hbuf, ln + 7, " * ")
 InsBufLine(hbuf, ln + 8, " * modification history")
 InsBufLine(hbuf, ln + 9, " * --------------------")
 InsBufLine(hbuf, ln + 10, " * 01a, @szDay@@szMonth@@Year@, @szMyName@ written")
 InsBufLine(hbuf, ln + 11, " * --------------------")
 InsBufLine(hbuf, ln + 12, " ******************************************************************************/")

 // put the insertion point inside the header comment
 SetBufIns(hbuf, ln + 1, strlen(szFunc) + strlen(szInf) + 8)
}


/******************************************************************************
 * NumToName -- change the month number to name
 *
 * modification history
 * --------------------
 * 01a, 05mar2003, t357 written
 * --------------------
 ******************************************************************************/
macro NumToName(Month)
{
 if (Month == 1)
  return "jan"
 if (Month == 2)
  return "feb"
 if (Month == 3)
  return "mar"
 if (Month == 4)
  return "apr"
 if (Month == 5)
  return "may"
 if (Month == 6)
  return "jun"
 if (Month == 7)
  return "jul"
 if (Month == 8)
  return "aug"
 if (Month == 9)
  return "sep"
 if (Month == 10)
  return "oct"
 if (Month == 11)
  return "nov"
 if (Month == 12)
  return "dec"
}

/******************************************************************************
 * CutWord -- auto newline
 *
 * modification history
 * --------------------
 * 01a, 24mar2003, t357 fix some bug
 * 01a, 05mar2003, t357 written
 * --------------------
 ******************************************************************************/
macro CutWord(ncurLine, szInf)
{
 LENGTH = 63
 nlength = StrLen(szInf)
 i = 0 /* loop control */
 begin = 0 /* first character's index of current line */
 pre = 0 /* preceding word's index */
 hbuf = GetCurrentBuf()
// nline = GetBufLnCur()
 while (i < nlength)
 {
/* remove by t357
  nrow = 0
  sz = ""
  while (nrow < 80)
  {
   if (nlength < 0)
    break
   sz = Cat(sz, szInf[nrow])
   nrow = nrow + 1
   nlength = nlength - 1
  }
  InsBufLine(hbuf, nline, sz)
  szInf = szInf[nrow]
 }
*/
        c = szInf[i]
        if (" " == @c@ && (i - b < LENGTH))
        {
            pre = i
        }
        else if (" " == @c@)
        {
            szOutput = ""
            k = begin /* loop control */
            while (k < pre)
            {
                szOutput = Cat(szOutput, szInf[k])
                k = k + 1
            }
            InsBufLine(hbuf, ncurLine, sz)
            ncurLine = ncurLine + 1
            begin = pre
        }
        i = i + 1
    }
    if (h != i - 1)
    {
        szOutput = ""
        k = begin /* loop control */
        while (k < pre)
        {
            szOutput = Cat(szOutput, szInf[k])
            k = k + 1
        }
        InsBufLine(hbuf, ncurLine, sz)
        ncurLine = ncurLine + 1
    }
}

 

// Wrap ifdeinef <sz> .. endif around the current selection
macro IfdefineSz(sz)
{
 hwnd = GetCurrentWnd()
 lnFirst = GetWndSelLnFirst(hwnd)
 lnLast = GetWndSelLnLast(hwnd)

 hbuf = GetCurrentBuf()
 InsBufLine(hbuf, lnFirst, "#ifndef @sz@")
 InsBufLine(hbuf, lnFirst + 1, "#define @sz@")
 InsBufLine(hbuf, lnLast + 3,  "#endif  /* @sz@ */")
 SetBufIns(hbuf, lnFirst + 2, 0)
}

 


/*   A U T O   E X P A N D   */
/*-------------------------------------------------------------------------
    Automatically expands C statements like if, for, while, switch, etc..

    To use this macro,
     1. Add this file to your project or your Base project.

  2. Run the Options->Key Assignments command and assign a
  convenient keystroke to the "AutoExpand" command.

  3. After typing a keyword, press the AutoExpand keystroke to have the
  statement expanded.  The expanded statement will contain a ### string
  which represents a field where you are supposed to type more.

  The ### string is also loaded in to the search pattern so you can
  use "Search Forward" to select the next ### field.

 For example:
  1. you type "for" + AutoExpand key
  2. this is inserted:
   for (###; ###; ###)
   {
    ###
   }
  3. and the first ### field is selected.
-------------------------------------------------------------------------*/
/******************************************************************************
 * AutoExpand - Automatically expands C statements
 *
 * DESCRIPTION: - Automatically expands C statements like if, for, while,
 *    switch, etc..
 *
 * Input:
 * Output:
 * Returns:
 *
 * modification history
 * --------------------
 * 01a, 27mar2003, t357 modified
 * --------------------
 ******************************************************************************/
macro AutoExpand()
{
 // get window, sel, and buffer handles
 hwnd = GetCurrentWnd()
 if (hwnd == 0)
  stop
 sel = GetWndSel(hwnd)
 if (sel.ichFirst == 0)
  stop
 hbuf = GetWndBuf(hwnd)

 // get line the selection (insertion point) is on
 szLine = GetBufLine(hbuf, sel.lnFirst);

 // parse word just to the left of the insertion point
 wordinfo = GetWordLeftOfIch(sel.ichFirst, szLine)
 ln = sel.lnFirst;

 chTab = CharFromAscii(9)

 // prepare a new indented blank line to be inserted.
 // keep white space on left and add a tab to indent.
 // this preserves the indentation level.
 ich = 0
 while (szLine[ich] == ' ' || szLine[ich] == chTab)
  {
  ich = ich + 1
  }

 szLine = strmid(szLine, 0, ich)
 sel.lnFirst = sel.lnLast
 sel.ichFirst = wordinfo.ich
 sel.ichLim = wordinfo.ich

 // expand szWord keyword...


 if (wordinfo.szWord == "if" ||
  wordinfo.szWord == "while" ||
  wordinfo.szWord == "elseif")
  {
  SetBufSelText(hbuf, " (###)")
  InsBufLine(hbuf, ln + 1, "@szLine@" # "{");
  InsBufLine(hbuf, ln + 2, "@szLine@" # chTab);
  InsBufLine(hbuf, ln + 3, "@szLine@" # "}");
  }
 else if (wordinfo.szWord == "for")
  {
  SetBufSelText(hbuf, " (###; ###; ###)")
  InsBufLine(hbuf, ln + 1, "@szLine@" # "{");
  InsBufLine(hbuf, ln + 2, "@szLine@" # chTab);
  InsBufLine(hbuf, ln + 3, "@szLine@" # "}");
  }
 else if (wordinfo.szWord == "switch")
  {
  SetBufSelText(hbuf, " (###)")
  InsBufLine(hbuf, ln + 1, "@szLine@" # "{")
  InsBufLine(hbuf, ln + 2, "@szLine@" # "case ")
  InsBufLine(hbuf, ln + 3, "@szLine@" # chTab)
  InsBufLine(hbuf, ln + 4, "@szLine@" # chTab # "break;")
  InsBufLine(hbuf, ln + 5, "@szLine@" # "default:")
  InsBufLine(hbuf, ln + 6, "@szLine@" # chTab)
  InsBufLine(hbuf, ln + 7, "@szLine@" # "}")
  }
 else if (wordinfo.szWord == "do")
  {
  InsBufLine(hbuf, ln + 1, "@szLine@" # "{")
  InsBufLine(hbuf, ln + 2, "@szLine@" # chTab);
  InsBufLine(hbuf, ln + 3, "@szLine@" # "} while ();")
  }
 else if (wordinfo.szWord == "case")
  {
  SetBufSelText(hbuf, " ###")
  InsBufLine(hbuf, ln + 1, "@szLine@" # chTab)
  InsBufLine(hbuf, ln + 2, "@szLine@" # chTab # "break;")
  }
 else
  stop

 SetWndSel(hwnd, sel)
 LoadSearchPattern("###", true, false, false);
 Search_Forward
}


/*   G E T   W O R D   L E F T   O F   I C H   */
/*-------------------------------------------------------------------------
    Given an index to a character (ich) and a string (sz),
    return a "wordinfo" record variable that describes the
    text word just to the left of the ich.

    Output:
     wordinfo.szWord = the word string
     wordinfo.ich = the first ich of the word
     wordinfo.ichLim = the limit ich of the word
-------------------------------------------------------------------------*/
macro GetWordLeftOfIch(ich, sz)
{
 wordinfo = "" // create a "wordinfo" structure

 chTab = CharFromAscii(9)

 // scan backwords over white space, if any
 ich = ich - 1;
 if (ich >= 0)
  while (sz[ich] == " " || sz[ich] == chTab)
   {
   ich = ich - 1;
   if (ich < 0)
    break;
   }

 // scan backwords to start of word
 ichLim = ich + 1;
 asciiA = AsciiFromChar("A")
 asciiZ = AsciiFromChar("Z")
 while (ich >= 0)
  {
  ch = toupper(sz[ich])
  asciiCh = AsciiFromChar(ch)
  if ((asciiCh < asciiA || asciiCh > asciiZ) && !IsNumber(ch))
   break // stop at first non-identifier character
  ich = ich - 1;
  }

 ich = ich + 1
 wordinfo.szWord = strmid(sz, ich, ichLim)
 wordinfo.ich = ich
 wordinfo.ichLim = ichLim;

 return wordinfo
}

//
// Comment the selected block of text using single line comments and indent it
//
macro CommentBlock()
{
 hbuf = GetCurrentBuf();
 hwnd = GetCurrentWnd();

 sel = GetWndSel(hwnd);

 iLine = sel.lnFirst;
 
 while (iLine <= sel.lnLast)
 {
  szLine = GetBufLine(hbuf, iLine);
  szLine = cat("// ", szLine);
  PutBufLine(hbuf, iLine, szLine);
  iLine = iLine + 1;
 }

 if (sel.lnFirst == sel.lnLast)
 {
  tabSize = _tsGetTabSize() - 1;
  sel.ichFirst = sel.ichFirst + tabSize;
  sel.ichLim = sel.ichLim + tabSize;
 }
 SetWndSel(hwnd, sel);
}


//
// Undo the CommentBlock for the selected text.
//
macro UnCommentBlock()
{
 hbuf = GetCurrentBuf();
 hwnd = GetCurrentWnd();

 sel = GetWndSel(hwnd);

 iLine = sel.lnFirst;


 tabSize = 0;
 while (iLine <= sel.lnLast)
 {
  szLine = GetBufLine(hbuf, iLine);
  len = strlen(szLine);
  szNewLine = "";
  if (len > 1)
  {
   if (szLine[0] == "/" && szLine[1] == "/")
   {
    if (len > 2)
    {
     if (AsciiFromChar(szLine[2]) == 9)
     {
      tabSize = _tsGetTabSize() - 1;
      szNewLine = strmid(szLine, 3, strlen(szLine));
     }
    }

    if (szNewLine == "")
    {
     szNewLine = strmid(szLine, 2, strlen(szLine));
     tabSize = 2;
    }
    
    PutBufLine(hbuf, iLine, szNewLine);
   }
  }
  iLine = iLine + 1;
 }

 if (sel.lnFirst == sel.lnLast)
 {
  sel.ichFirst = sel.ichFirst - tabSize;
  sel.ichLim = sel.ichLim - tabSize;
 }

 SetWndSel(hwnd, sel);
}

 

macro _tsGetTabSize()
{
 szTabSize = GetReg("TabSize");

 if (szTabSize != "")
 {
  tabSize = AsciiFromChar(szTabSize[0]) - AsciiFromChar("0");
 }
 else
 {
  tabSize = 4;
 }

 return tabSize;
}

 


//
// Reformat a selected comment block to wrap text at 80 columns.
// The start of the selection (upper left most character of the selection) is
// handled specially, in that it specifies the left most column at which all
// lines will begin.  For example, if the following block was selected starting
// at the @ symbol, through the last line of the block...
//------------------------------------------------------------------------------
// preamble: @ This is a line that will be wrapped keeping the "at" symbol in its current column.
// All lines following it that are selected will use that as their starting column.  See below to see how the wrapping
// works for this block of text.
//------------------------------------------------------------------------------
// preamble: @ This is a line that will be wrapped keeping the "at" symbol in
//    its current column. All lines following it that are selected
//    will use that as their starting column.  See below to see how
//    the wrapping works for this block of text.
//
macro tsReformatCommentBlock()
{
 hbuf = GetCurrentBuf();
 hwnd = GetCurrentWnd();

 sel = GetWndSel(hwnd);

 tabSize = _tsGetTabSize();
 leftTextCol = 0 - 1;
 colWrap = 80;

 // Find the starting column, and create a Margin string
 ichFirst = sel.ichFirst;
 
 // Single line comment reformat?
 if (sel.ichFirst == sel.ichLim && sel.lnFirst == sel.lnLast)
 {
  ichFirst = 0;
 }

 rec = _tsGetStartColumn(hbuf, ichFirst, sel.lnFirst);

 if (rec == "")
  stop;

 colLeftMargin = rec.colMargin;
 szMargin = "";

 colComment = 0;
 if (rec.colComment >= 0)
 {
  colComment = rec.colComment + 2
  szMargin = _tsAddWhiteToColumn(szMargin, 0, rec.colComment, tabSize);
  szMargin = cat(szMargin, "//");
 }

 szMargin = _tsAddWhiteToColumn(szMargin, colComment, rec.colMargin, tabSize);

 rec = "";

 szCurMargin = "";
 if (ichFirst != 0)
 {
  szLine = GetBufLine(hbuf, sel.lnFirst);
  szCurMargin = strmid(szLine, 0, ichFirst);
 }
 else
 {
  szCurMargin = szMargin;
  szMargin = "";
 }

 insertLine = sel.lnFirst;
 iLine = sel.lnFirst;
 szRemainder = "";
 while (1)
 {
//  msg("$0-" # iLine # ":" # szRemainder);
  rec = _tsGetNextCommentString(hbuf, ichFirst, szRemainder, iLine, sel.lnLast, colWrap);
  ichFirst = 0;

  if (rec == "")
   break;

//  msg("$1-" # rec.ln # ":" # rec.szComment);
  szLine = rec.szComment;
 
  ich = 0;
  col = colLeftMargin;
  len = strlen(szLine);
  
  ichPrevCharToWhite = 0-1;
  ichPrevWhiteToChar = 0-1;
//  msg("Leftovers @szRemainder@");

  while (ich < len)
  {
   if (AsciiFromChar(szLine[ich]) == 9)
   {
    col = (((col + tabSize) / tabSize) * tabSize);
   }
   else
   {
    col = col + 1;
   }

   if (col > colWrap)
    break;

   fIsWhitespace = _tsIsWhitespaceChar(szLine[ich]);
   fIsWhitespace1 = 1;

   if (ich + 1 < len)
   {
    fIsWhitespace1 = _tsIsWhitespaceChar(szLine[ich + 1]);
   }

   if (!fIsWhitespace && fIsWhitespace1)
    ichPrevCharToWhite = ich;
   
   ich = ich + 1;
  }

  if (ichPrevCharToWhite > 0)
  {
//   msg("$2:" # strmid(szLine, 0, ichPrevCharToWhite + 1));
   ich = ichPrevCharToWhite + 1;

   while (ich < len)
   {
    if (!_tsIsWhitespaceChar(szLine[ich]))
    {
     ichPrevWhiteToChar = ich - 1;
//     msg("$3:" # strmid(szLine, ichPrevWhiteToChar + 1, len));
     break;
    }
    ich = ich + 1;
   }
  }

  if (ichPrevCharToWhite > 0 && col > colWrap)
  {
   szNewLine = cat(szCurMargin, strmid(szLine, 0, ichPrevCharToWhite + 1));
   szRemainder = "";
   if (ichPrevWhiteToChar > 0)
    szRemainder = strmid(szLine, ichPrevWhiteToChar + 1, len);
    
   if (ichPrevCharToWhite > ichPrevWhiteToChar)
    msg("!!!Wrap, duplicating word " # ichPrevWhiteToChar # " " # ichPrevCharToWhite # " " # szNewLine # " >>> " # szRemainder);
//    msg(szLine);
//    msg(col # " " # ichPrevWhiteToChar # " " # ichPrevCharToWhite # " " # szNewLine # " >>> " # szRemainder);
  }
  else if (szLine != "")
  {
   szNewLine = cat(szCurMargin, szLine );
   szRemainder = "";
//   sel.lnLast = sel.lnLast + 1;
  }

  iLine = rec.ln;
  if (insertLine == iLine)
  {
   iLine = iLine + 1;
   sel.lnLast = sel.lnLast + 1;
   
//   msg("$5-" # insertLine # ":" # szNewLine);
   InsBufLine(hbuf, insertLine, szNewLine);
  }
  else
  {
   szLine = GetBufLine(hbuf, insertLine);
   if (szLine != szNewLine)
   {
//    msg("$6-" # insertLine # ":" # szNewLine);
    PutBufLine(hbuf, insertLine, szNewLine);
   }
  }
  insertLine = insertLine + 1;

  if (szMargin != "")
  {
   szCurMargin = szMargin;
   szMargin = "";
  }
 }

 while (insertLine <= sel.lnLast)
 {
  DelBufLine(hbuf, insertLine);
  sel.lnLast = sel.lnLast - 1;
 }

 len = GetBufLineLength(hbuf, insertLine-1);

 sel.ichFirst = len;
 sel.ichLim = len;
 sel.lnFirst = sel.lnLast;
 SetWndSel(hwnd, sel);
}


macro _tsAddWhiteToColumn(sz, col0, col, tabSize)
{
 szTabs = "                              ";
 szSpaces = "                ";

 tabs0 = col0 / tabSize;
 tabs = (col / tabSize) - tabs0;

 if (tabs == 0)
  foo = col0;
 else
  foo = (tabs + tabs0) * tabSize;
 spaces = col - foo;
// msg(col0 # " " # col # " " # tabs # " " # spaces # " " # tabs0);

 if (tabs)
  sz = cat(sz, strmid(szTabs, 0, tabs));

 if (spaces)
  sz = cat(sz, strmid(szSpaces, 0, spaces));

 return sz;
}

macro _tsGetStartColumn(hbuf, ichBegin, ln)
{
 szLine = GetBufLine(hbuf, ln);
 len = strlen(szLine);
 tabSize = _tsGetTabSize();
 ich = 0;

 colMargin = 0;
 colComment = 0-1;

 rec = "";
 rec.colMargin = colMargin;
 rec.colComment = colComment;
 
 while (ich < len)
 {
  if (AsciiFromChar(szLine[ich]) == 9)
  {
   colMargin = (((colMargin + tabSize) / tabSize) * tabSize);
  }
  else
  {
   colMargin = colMargin + 1;
  }

  if (colComment < 0)
  {
   if (ich + 1 < len)
   {
    if (szLine[ich] == "/" && szLine[ich+1] == "/")
    {
     colComment = colMargin - 1;
     ich = ich + 2;
     colMargin = colMargin + 1;
     continue;
    }
   }
  }

  if (ich >= ichBegin)
  {
   if (!_tsIsWhitespaceChar(szLine[ich]))
   {
    rec.colMargin = colMargin - 1;
    rec.colComment = colComment;
//    msg(szLine[ich]);
    return rec;
   }
  }

  ich = ich + 1;
 }
 
 return rec;
}

macro _tsGetNextCommentString(hbuf, ichSkip, szRemainder, ln, lnLast, colWrap)
{
 rec = "";

 // Go until we get a string that is at least long enough to fill a line
 // or, we run out of lines.
 if (szRemainder == "" && ln > lnLast)
  return "";
  
 ichFirst = ichSkip;
// msg(ichSkip);
 while (1)
 {
  if (ln > lnLast)
  {
   rec.szComment = szRemainder;
   rec.ln = ln;
   return rec;
  }

  cchRemainder = strlen(szRemainder);

  if (cchRemainder > colWrap)
  {
   rec.szComment = szRemainder;
   rec.ln = ln;
   return rec;
  }

  szLine = GetBufLine(hbuf, ln);
  len = strlen(szLine);

  if (ichSkip == 0)
   ichFirst = _tsSkipPastCommentAndWhitespace(szLine, len);
  ichSkip = 0;
   
  ichLast = len - 1;

  // Now, strip out all whitespace at the end of the line
  while (ichLast >= ichFirst)
  {
   if (!_tsIsWhitespaceChar(szLine[ichLast]))
   {
    break;
   }
   ichLast = ichLast - 1;
  }

  // Entire line is whitespace?
  if (ichLast < ichFirst)
  {
   if (szRemainder == "")
    ln = ln + 1;
   rec.szComment = szRemainder;
   rec.ln = ln;
   return rec;

  }
  // length of the non whitespaced comment + 1 space + cchRemainder
  if ((ichLast + 1) - ichFirst + cchRemainder + 1 > 255)
  {
   // It may not format the current line quite right, but
   // but at least we won't throw away some of the comment.
   rec.szComment = szRemainder;
   rec.ln = ln;
   return rec;
  }

  if (szRemainder != "")
   szRemainder = cat(szRemainder, " ");
  szRemainder = cat(szRemainder, strmid(szLine, ichFirst, ichLast + 1));
  ln = ln + 1;
 }
}

 

macro _tsSkipPastCommentAndWhitespace(szLine, len)
{
 ichFirst = 0;
 // Skip past the comment initiator "//" if there is one.
 while (ichFirst < len)
 {
  if (ichFirst + 1 < len)
  {
   if (szLine[ichFirst] == "/" && szLine[ichFirst+1] == "/")
   {
    ichFirst = ichFirst + 2;
    break;
   }
  }
  ichFirst = ichFirst + 1;
 }

 // If no comment found in line, then start from the beginning
 if (ichFirst >= len)
  ichFirst = 0;

 ichFirst = ichFirst;
 // Now, strip out all whitespace after the comment start.
 while (ichFirst < len)
 {
  if (!_tsIsWhitespaceChar(szLine[ichFirst]))
  {
   break;
  }
  ichFirst = ichFirst + 1;
 }

 return ichFirst;
}

[·¢ÆÀÂÛ] ÆÀÂÛ ÖØÒªÌáʾ£º¾¯ÌèÐé¼ÙÖн±ÐÅÏ¢!
  • chinaunixÍøÓÑ 2009-02-26 17:00
    ºÃ¶«Î÷ ¿ÉϧÎÒ»¹ÊÇ¿´²»¶® ÎÒÊdzõѧÁËһЩCÓïÑÔ ¿ÉÊÇÔõôҲ¿´²»¶® ²»»áÓÃÕâ¸öÈí¼þ ÎÒÓ¦¸ÃÔõôÑù×ö »¹ÒªÑ§Ï°Ò»Ð©Ê²Ã´¶«Î÷ÄØ ¹òÇó Çë½Ì Èç¹ûÄãÓпÕÄÜ´Í½Ì ´óлÁË m.kolp@163.COM
Ç×£¬Äú»¹Ã»ÓеǼ,Çë[µÇ¼]»ò[×¢²á]ºóÔÙ½øÐÐÆÀÂÛ