Sponsored Content
Full Discussion: Need help with FSMs...
Top Forums Programming Need help with FSMs... Post 302095316 by sharsin2001 on Monday 6th of November 2006 07:32:32 AM
Old 11-06-2006
Need help with FSMs...

hii..
I need to implement a pure virtual FSM program design which copies stdin to stdout, converting any C trigraphs found to their single character form (e.g. converting trigraph ??= to #) including those in the comments.
implement a pure virtual FSM program design. See the class notes for more information regarding FSM design.
i dint understand how do i give the states..that is how to check for two continous '?' symbpls and the the other special characters...

My program..(itz not complete one..):


#include <stdio.h>
#define START '?' /* states */
#define SAW_1 '?'
#define SAW_2 '('
#define SAW_3 ')'
int main( void)
{
int state, next, c, out;
setbuf( stdout, 0); /* make stdout unbuffered */
next = START; /* set initial state */
while( 1)
{
/* get next input */
c = getchar(); if( c < 0) break; if( c == '\n') putchar(c);
if( c != '?' && c != '('&& c != ')') continue; /* skip bad inputs */
state = next; /* get next state */
out = '0'; /* set default output */
switch( state)
{
case START:
if( c == '?') next = SAW_1;
else next = START;
break;
case SAW_1:
if( c == '?') next = SAW_2;
else next = START;
break;
case SAW_2:
if( c == '(')
{
out='[';
printf( "%c", out);
next =START;
}
else
next=SAW_3;
break;
case SAW_3:
if( c == ')')
{
out = ']';
printf( "%c", out);
next = START;
}
else
next = START;
break;
}
}
return 0;
}
 
START 
TRANSACTION(7) SQL Commands START TRANSACTION(7) NAME
START TRANSACTION - start a transaction block SYNOPSIS
START TRANSACTION [ transaction_mode [, ...] ] where transaction_mode is one of: ISOLATION LEVEL { SERIALIZABLE | REPEATABLE READ | READ COMMITTED | READ UNCOMMITTED } READ WRITE | READ ONLY DESCRIPTION
This command begins a new transaction block. If the isolation level or read/write mode is specified, the new transaction has those charac- teristics, as if SET TRANSACTION [set_transaction(7)] was executed. This is the same as the BEGIN [begin(7)] command. PARAMETERS
Refer to SET TRANSACTION [set_transaction(7)] for information on the meaning of the parameters to this statement. COMPATIBILITY
In the standard, it is not necessary to issue START TRANSACTION to start a transaction block: any SQL command implicitly begins a block. PostgreSQL's behavior can be seen as implicitly issuing a COMMIT after each command that does not follow START TRANSACTION (or BEGIN), and it is therefore often called ``autocommit''. Other relational database systems might offer an autocommit feature as a convenience. The SQL standard requires commas between successive transaction_modes, but for historical reasons PostgreSQL allows the commas to be omit- ted. See also the compatibility section of SET TRANSACTION [set_transaction(7)]. SEE ALSO
BEGIN [begin(7)], COMMIT [commit(7)], ROLLBACK [rollback(7)], SAVEPOINT [savepoint(7)], SET TRANSACTION [set_transaction(7)] SQL - Language Statements 2010-05-14 START TRANSACTION(7)
All times are GMT -4. The time now is 09:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy