PCB论坛网

 找回密码
 注册
楼主: justwin

genesis 運行perl scripts?

[复制链接]
 楼主| 发表于 2004-7-19 09:58:38 | 显示全部楼层

版主: 我的genesis V8.0a scr_start.csh內容為:

#!/bin/csh # File Name: script_start.csh # File Purpose: This file is a c-shell script which is sourced by the system # everytime any c-shell script is run. The function of this # hook is to hold all the standard script variables and aliases # that may be called / used by c-shell scripts. # Written by: Ian Ticehurst (Autom8 Ltd.) # Version 1A.: Date: 14.08.00 - Initial design and development. # Version 1B.: Date: 04.09.00 - Addition of awk, sort and find aliases for NT (ref. CB-Orbotech). # Version 1C.: Date: 26.10.00 - Addition of $TMP defintion and useage. # Version 1D.: Date: 05.12.00 - Removal of "gui" alias and "gui" data and response settings (set locally). # Version 1E.: Date: 06.12.00 - Added TCSHSUBSTHB definition to allow calling tcl scripts on NT from tcsh 5.44 ############################# Start of notes ############################### # This file is called automatically everytime a c-shell script is run. Thus, # by adding aliases, path definitions, and global variable statements etc. # every c-shell script that is called within the Genesis environment can use # these values. So, instead of adding these definitions to each individual # script, the definitions appear only in one place. ############################# End of notes ###############################

# Define correct temp. dir. depending on env. vars. if ($?GENESIS_TMP) then set TMP = $GENESIS_TMP else if ($?GENESIS_DIR) then set TMP = $GENESIS_DIR/tmp else set TMP = /genesis/tmp endif

# Detect current operating system. set CURR_OS = `uname -s`

# Set the INFO alias and the tmp INFO file. set IFILE = $TMP/do_info.$$ alias DO_INFO 'COM info,out_file=$IFILE,write_mode=replace,args= \!:* ; source $IFILE; rm $IFILE'

# If working on NT machine, set awk, sort and find aliases. if ($CURR_OS == "WINDOWS_NT") then alias awk 'c:/bin/awk95' alias sort 'c:/usr/local/bin/sort' alias find 'c:/usr/local/bin/find' # Modify if tclsh80.exe is found elsewhere or if wish_start.tcl has been modified setenv TCSHSUBSTHB "/usr/local/bin/wish c:/progra~1/tcl/bin/tclsh80.exe;" endif

# Set up alias for using bc in numeric calculations (this MATH alias can be used in the same way as "set" and "@" are used). # (for more information, check the man pages for "bc"). alias MATH 'set \!:1 = `echo "\!:3-$" | bc -l`'

exit

是否和你的一樣,上面說明中,好像没有支援perl耶???? 若不一樣,可否給我新版的scr_start.csh,和配屬的程式呢!讓再試試.......

[em06]
回复 支持 反对

使用道具 举报

发表于 2004-7-19 12:23:35 | 显示全部楼层

試試這個..........................

#!/bin/csh # # Date : 12 Jan 1994 # Version : 1 MK # if($?GENESIS_DIR)then set _genesis_root=$GENESIS_DIR else set _genesis_root=/genesis endif

if($?GENESIS_EDIR)then set _genesis_edir=$GENESIS_EDIR else set _genesis_edir=e$GENESIS_VER endif

if($_genesis_edir =~ /* || $_genesis_edir =~ ?:*)then set path=($_genesis_edir/all $path) else set path=($_genesis_root/$_genesis_edir/all $path) endif

set STATUS=0 set PROG=$1 if(! -e $PROG)then set PROG_STATUS=1 goto end endif

# define aliases set DIR_PREFIX='@%#%@'

alias VON 'echo "${DIR_PREFIX}VON";' alias VOF 'echo "${DIR_PREFIX}VOF";'

alias SU_ON 'echo "${DIR_PREFIX}SU_ON";' alias SU_OFF 'echo "${DIR_PREFIX}SU_OFF";'

alias PAUSE 'echo "${DIR_PREFIX}PAUSE \!:*"; \ set STATUS=$<; set READANS=$<; set PAUSANS=$<; \ if ($PAUSANS != "OK") exit' alias MOUSE 'echo "${DIR_PREFIX}MOUSE \!:*"; \ set STATUS=$<; set READANS=$<; set MOUSEANS="$<"' alias COM 'echo "${DIR_PREFIX}COM \!:*"; \ set STATUS=$<; set READANS="$<"; set COMANS=($READANS)' alias AUX 'echo "${DIR_PREFIX}AUX \!:*"; \ set STATUS=$<; set READANS="$<"; set COMANS=($READANS)'

set argv = ($2)

#executing hook script if(-e $_genesis_root/sys/hooks/script_start.csh)then source $_genesis_root/sys/hooks/script_start.csh endif

# check first line of program set _HEAD=`head -1 $PROG`

if("$_HEAD" =~ *perl*)then echo "Executing Perl Program $PROG $argv" perl $PROG $argv set PROG_STATUS=$status else if("$_HEAD" =~ *wish*)then setenv TCSHONLYSTARTEXES 1 echo "Executing TCL Program $PROG $argv" $_genesis_root/sys/hooks/wish_start.tcl $PROG $argv set PROG_STATUS=$status else echo "Executing C Shell Program $PROG" source $PROG set PROG_STATUS=$status endif

end: exit($PROG_STATUS)

回复 支持 反对

使用道具 举报

 楼主| 发表于 2004-7-19 16:14:54 | 显示全部楼层

Script ended with error:

if: Missing file name. ----產生此一訊息

[em06][em06][em06]
回复 支持 反对

使用道具 举报

 楼主| 发表于 2004-7-19 16:30:43 | 显示全部楼层

gen_csh-10004-Script exited Script C:/valor/e80/all/perl/example.pl ended with error:

Badly placed ()'s.

更改用版主給的scr_start.csh 去執行 example.pl ,產生了上述情形...............

好像是錯誤放置了檔案耶....還是找不到perl主程式....?????

要讓perl 執行,好像很難....[em06][em06][em06][em06][em06]

我一定要把perl在genesis中 執行.....請版主支持 小弟...謝謝版主[em17]

回复 支持 反对

使用道具 举报

 楼主| 发表于 2004-7-19 20:35:08 | 显示全部楼层

版主: 我現在覺的問題好像是出在.....h2ph.bat程式未執行完成.因為在我的C槽下,找不到任何的 *.PH的檔.而找到很多 *.H 的檔.

所以好像是H2PH.BAT程式未完成導致. 之前版主所說的 p2ph.bat方法,我都試過,就是無法順利完成..... 請版主能詳細的說明h2ph.bat的作法.... 謝謝

回复 支持 反对

使用道具 举报

发表于 2004-7-19 21:37:01 | 显示全部楼层
以下是引用justwin在2004-7-19 20:35:08的发言:

版主: 我現在覺的問題好像是出在.....h2ph.bat程式未執行完成.因為在我的C槽下,找不到任何的 *.PH的檔.而找到很多 *.H 的檔.

所以好像是H2PH.BAT程式未完成導致. 之前版主所說的 p2ph.bat方法,我都試過,就是無法順利完成..... 請版主能詳細的說明h2ph.bat的作法.... 謝謝

*.h為C語言或C++語言所用的標準程式庫.....

例如在C++中,程式開頭都要宣告類似#include <iostream.h>或#include <stdlib.h>等等.....

其中#include是讓前置處理器識別的假指令.....執行時會將*.h的東西被宣告於程式表頭.....

其實在perl中的原理也一樣.......C++的標準函式庫可以與perl共用, 但須轉為perl認得的格式,其副檔名為*.ph,所以才需用h2ph.bat轉換格式!

但是在perl的許多優點中的一個就是程式表頭不用宣告一堆有的沒的......

<想當初學了5年的C++.....到最後還是用perl最快樂..........因為C可能要寫5000行....但是perl可能只需要寫700行.........至於速度.....C++ > perl > java > unix shell.......>

回复 支持 反对

使用道具 举报

 楼主| 发表于 2004-7-19 22:03:03 | 显示全部楼层

謝謝....可是我的genesis的perl,還是無法執行........[em39]

版主....救救我........

[em49]
回复 支持 反对

使用道具 举报

发表于 2004-7-19 22:10:15 | 显示全部楼层
1. csh.exe
2. cd c:\perl\lib\core
3. h2ph.bat * sys/*
4. 會在c:\perl\site\lib\下產生*.ph
回复 支持 反对

使用道具 举报

 楼主| 发表于 2004-7-19 22:41:39 | 显示全部楼层

require '_h2ph_pre.ph';

no warnings 'redefine';

回复 支持 反对

使用道具 举报

 楼主| 发表于 2004-7-19 22:44:00 | 显示全部楼层

% h2ph.bat * sys/* require '_h2ph_pre.ph';

no warnings 'redefine';

Terminating on signal SIGBREAK(21)

% 要終止批次作業嗎 (Y/N)? y

%

回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|小黑屋|手机版|PCB设计论坛|EDA论坛|PCB论坛网 ( 沪ICP备05006956号-1 )

GMT+8, 2024-5-14 22:22 , Processed in 0.127821 second(s), 14 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表