/*** * Arquivo ...... ALGORITM.CH * Proposito .... Definir comandos para o estudo de algoritmos * Autor ........ Fernando Paim * Data ......... 10 de marco de 1996 * Observacao ... Utilizar com o programa Transbin.exe * #STDOUT => Transbin * #STDOUT => Fapp (R) Gerenciador de Algoritmos versao 1.0 * #STDOUT => Copyright (C) Fapp Sistemas 1996. Todos os direitos reservados *****/ #include "STD.CH" #xcommand ALGORITMO => SetPos (0,0) #xcommand ALGORITMO() => SetPos (0,0) #xcommand FIM ALGORITMO => Return #xcommand FIM_ALGORITMO => Return #xcommand FIMALGORITMO => Return #xtranslate VERDADE => .T. #xtranslate FALSO => .F. #xtranslate E => .AND. #xtranslate OU => .OR. #xtranslate NAO => .NOT. #xcommand DECLARE REAL [, ] => ; := 0.00 [; := 0.00 ] #xcommand DECLARE INTEIRO [, ] => ; := Int ( 0 ) [; := Int ( 0 ) ] #xcommand DECLARE CARACTER [, ] => ; := Space ( 10 ) [; := Space ( 10 ) ] #xcommand DECLARE ALFA [, ] => ; := Space ( 10 ) [; := Space ( 10 ) ] #xcommand DECLARE LOGICO [, ] => ; := .F. [; := .F. ] #xcommand PROC AFILL => ; PROC _AFILL ; #error AFILL #xcommand DECLARE VETOR REAL ( ) => ; := Array ( ) ; AFill ( , 0.00 ) #xcommand DECLARE VETOR INTEIRO ( ) => ; := Array ( ) ; AFill ( , 0 ) #xcommand DECLARE VETOR CARACTER ( ) => ; := Array ( ) ; AFill ( , Space ( 10 ) ) #xcommand DECLARE VETOR LOGICO ( ) => ; := Array ( ) ; AFill ( , .F. ) #xcommand DECLARE MATRIZ REAL ( , ) => ; := Array ( , ) #xcommand DECLARE MATRIZ INTEIRO ( , ) => ; := Array ( , ) #xcommand DECLARE MATRIZ CARACTER ( , ) => ; := Array ( , ) #xcommand DECLARE MATRIZ LOGICO ( , ) => ; := Array ( , ) #xcommand DECLARE MATRIZ REAL ( , , ) => ; := Array ( , , ) #xcommand DECLARE MATRIZ INTEIRO ( , , ) => ; := Array ( , , ) #xcommand DECLARE MATRIZ CARACTER ( , , ) => ; := Array ( , , ) #xcommand DECLARE MATRIZ LOGICO ( , , ) => ; := Array ( , , ) /* SEM DECLARE */ #xcommand REAL [, ] => ; := 0.00 [; := 0.00 ] #xcommand INTEIRO [, ] => ; := Int ( 0 ) [; := Int ( 0 ) ] #xcommand CARACTER [, ] => ; := Space ( 10 ) [; := Space ( 10 ) ] #xcommand ALFA [, ] => ; := Space ( 10 ) [; := Space ( 10 ) ] #xcommand LOGICO [, ] => ; := .F. [; := .F. ] #xcommand VETOR REAL ( ) => ; := Array ( ) ; AFill ( , 0.00 ) #xcommand VETOR INTEIRO ( ) => ; := Array ( ) ; AFill ( , 0 ) #xcommand VETOR CARACTER ( ) => ; := Array ( ) ; AFill ( , Space ( 10 ) ) #xcommand VETOR LOGICO ( ) => ; := Array ( ) ; AFill ( , .F. ) #xcommand MATRIZ REAL ( , ) => ; := Array ( , ) #xcommand MATRIZ INTEIRO ( , ) => ; := Array ( , ) #xcommand MATRIZ CARACTER ( , ) => ; := Array ( , ) #xcommand MATRIZ LOGICO ( , ) => ; := Array ( , ) #xcommand MATRIZ REAL ( , , ) => ; := Array ( , , ) #xcommand MATRIZ INTEIRO ( , , ) => ; := Array ( , , ) #xcommand MATRIZ CARACTER ( , , ) => ; := Array ( , , ) #xcommand MATRIZ LOGICO ( , , ) => ; := Array ( , , ) // update ... #xtranslate MOLDURA ( , , , ) => ; @ , to , #xcommand LIMPA_TELA () => Scroll (); SetPos (0,0) #xcommand LIMPATELA () => Scroll (); SetPos (0,0) #xcommand POSICIONE ( , ) => DevPos ( , ) #xcommand POSICAO ( , ) => DevPos ( , ) #xcommand AGUARDE ( ) => Inkey ( ) #xcommand PAUSA ( ) => Inkey ( 0 ) #xcommand ENQUANTO => Do While ( ) #xcommand FIM_ENQUANTO => End #xcommand FIMENQUANTO => End #xcommand REPITA => Do While .T. #xcommand ATE_QUE => if ( ); Exit; End; End #xcommand ATEQUE => if ( ); Exit; End; End #xcommand PARA => For #xcommand PARA [ ATE ] [ PASSO ] => For [ TO ] [ Step ] #xcommand FIM_PARA => Next #xcommand FIMPARA => Next #xcommand INTERROMPA => Exit #xcommand CONTINUE => Loop #xcommand SE => if ( ) #xcommand SENAO => else #xcommand FIM_SE => End #xcommand FIMSE => End #xcommand SELECIONE => Do Case #xcommand CASO => Case #xcommand CASO CONTRARIO => Otherwise #xcommand FIM_SELECAO => Endcase #xcommand FIMSELECAO => Endcase #xcommand ESCREVA ( ) => QOut ( ) #xcommand ESCREVA ( , , ) => SetPos ( , ); QOut ( ) #xcommand MOSTRE ( ) => QQOut ( ) #xcommand MOSTRE ( , , ) => SetPos ( , ); QQOut ( ) #xcommand LEIACAR ( ) => ; := StrTran( FReadStr(0, 256), Chr(13)+Chr(10) ) #xcommand LEIANUM ( ) => ; := Val( StrTran( FReadStr(0, 256), Chr(13)+Chr(10) ) ) #xtranslate MODULO => FUNCTION #xtranslate FUNCAO => FUNCTION #xtranslate PROCEDIMENTO => PROCEDURE #xtranslate FIM_MODULO => #xtranslate FIMMODULO => #xtranslate FIM_FUNCAO => #xtranslate FIMFUNCAO => #xtranslate FIM_PROCEDIMENTO => #xtranslate FIMPROCEDIMENTO => #xcommand RETORNE => RETURN /* #xcommand LEIA ( ) => @ Row(), Col() GET #xcommand LEIA ( , , , ) => @ , Say Get #xcommand RECEBA ( ) => @ Row(), Col() GET #xcommand RECEBA ( , , , ) => @ , Say Get #xcommand PROCESSE LEITURA => READ #xtranslate LEIA ( ) => ; if ( val ( := __Accept () ) != 0 ) ; ; := & ( __acceptstr () ) ; ; end #xtranslate LEIA ( ) => ; if ( val ( := StrTran ( FReadStr( 0, 256 ), Chr(13)+Chr(10) ) ) != 0 ) ; ; := val ( ) ; ; end */ #xtranslate LEIA ( ) => ; if val ( := FReadStr ( 0, 256 ) ) != 0 ; ; := val ( ) ; ; end #xtranslate QUOCIENTE ( , ) => / #xtranslate RESTO ( , ) => MOD ( , ) #xtranslate TRUNCA ( ) => INT ( ) #xtranslate ARREDONDA ( , ) => ROUND ( , ) #command ABS ( ) => ABS ( ) #xtranslate SINAL ( ) => INT ( ABS ( ) / ) #xtranslate RAIZ ( ) => SQRT ( ) #xtranslate POT ( , ) => ** #command EXP ( ) => EXP ( ) #xtranslate LOG10 ( ) => ( LOG ( ) / LOG ( 10 ) ) #xtranslate LN ( ) => LOG ( ) #xtranslate MULTIPLO ( , ) => IIF( == 0, .f., (( % ) == 0)) #xtranslate PAR ( ) => Empty ( % 2 ) #xtranslate IMPAR ( ) => !Empty ( % 2 ) #xtranslate PERCENTUAL ( , ) => ( ( * 100 ) / ) #xtranslate NUM_CAR ( ) => AllTrim ( Str ( ) ) #xtranslate MOVE to => := #xtranslate ADD TO => += #xtranslate SUBTRACT FROM => -= #xtranslate MULTIPLY BY => *= #xtranslate DIVIDE BY => /= #xtranslate DIVIDE INTO => /= #xtranslate RAISE TO THE POWER OF => ^= #xtranslate ADD TO INTO => ( := +) #xtranslate SUBTRACT FROM INTO => ( := -) #xtranslate MULTIPLY BY INTO => ( := *) #xtranslate DIVIDE BY INTO => ( := /)